From 6700dbb2fa21cb80112573765b623c2a03035960 Mon Sep 17 00:00:00 2001 From: scalarbot Date: Tue, 15 Sep 2026 22:43:26 +0000 Subject: [PATCH 1/6] chore(api): update generated SDK content 5 generated files changed with no detected API surface change (documentation, examples, or file content). Build: JUDc5kuA4PS1JVhLLH3PS --- .github/workflows/release-please.yml | 65 +++++++++++ .github/workflows/release-title-edit.yml | 143 +++++++++++++++++++++++ .github/workflows/sdk-ci.yml | 51 ++++++++ .release-please-manifest.json | 3 + VERSIONING.md | 86 ++++++++++++++ release-please-config.json | 46 ++++++++ 6 files changed, 394 insertions(+) create mode 100644 .github/workflows/release-please.yml create mode 100644 .github/workflows/release-title-edit.yml create mode 100644 .github/workflows/sdk-ci.yml create mode 100644 .release-please-manifest.json create mode 100644 VERSIONING.md create mode 100644 release-please-config.json diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 0000000..3b1e858 --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,65 @@ +name: Release Please + +on: + # A release is cut when a human merges the platform-managed release PR into + # main (the PR's base, so its diff shows the full pending release). + # Every other push here runs release-please as well — commits written straight to + # this branch included — and cuts nothing, there being no release commit at the tip. + push: + branches: + - main + # The Scalar platform pushes these workflow files straight to main to keep them + # current between releases; that is bookkeeping, never a release. Running anyway is worse + # than pointless on a branch that has not been handed a .release-please-manifest.json yet — + # release-please fails the run outright when it cannot read one. A release commit always + # rewrites the manifest and the changelog, so this filter can never swallow one. + paths-ignore: + - '.github/workflows/**' + # Manual fallback only; nothing in the automated chain depends on dispatch. + workflow_dispatch: + +permissions: + contents: write + # Required to update the merged release PR's autorelease labels after tagging. + pull-requests: write + +jobs: + release-please: + runs-on: ubuntu-latest + outputs: + release_created: ${{ steps.release.outputs.release_created }} + # Consumed by the publish job's checkout: without this mapping the checkout ref would be + # empty and the publish would build the triggering branch head instead of the released + # tag's exact commit. + tag_name: ${{ steps.release.outputs.tag_name }} + steps: + - uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0 + id: release + with: + target-branch: main + config-file: release-please-config.json + manifest-file: .release-please-manifest.json + # Release PRs are opened and updated by the Scalar platform with its own + # credential (so their CI runs without manual approval); this workflow only + # cuts the tag + GitHub Release once a release PR is merged. + skip-github-pull-request: true + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + if: ${{ steps.release.outputs.release_created == 'true' }} + with: + fetch-depth: 0 + # Merging the release PR into main is itself the promotion, but the + # version bump and changelog must also land back on scalar-next, or the next + # release PR would propose this release again. A real merge (never a plain + # commit push) so a squash- or rebase-merged release PR syncs just as well; the + # non-conventional message keeps the sync commit out of future changelogs. Plain + # (non-force) push on purpose: losing a race against a concurrent regeneration + # push fails loudly here, and the platform's next sync re-converges. + - name: Sync release back to scalar-next + if: ${{ steps.release.outputs.release_created == 'true' }} + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git fetch origin scalar-next + git checkout -B scalar-next origin/scalar-next + git merge --no-edit -m "Sync release ${{ steps.release.outputs.tag_name }} back to scalar-next" "${{ steps.release.outputs.sha }}" + git push origin scalar-next diff --git a/.github/workflows/release-title-edit.yml b/.github/workflows/release-title-edit.yml new file mode 100644 index 0000000..d1827b1 --- /dev/null +++ b/.github/workflows/release-title-edit.yml @@ -0,0 +1,143 @@ +name: Release PR Version + +on: + # `edited` is not one of the default pull_request types, but it is the point of this + # workflow: retitling the release PR is how a maintainer picks an exact version. The + # other types keep the consistency check attached to the PR as it evolves. + pull_request: + types: [opened, reopened, edited, synchronize] + +# Read-only by default; only the job that pushes the Release-As commit widens this. +permissions: + contents: read + +jobs: + version-consistency: + # Also the check name the release PR's footer tells maintainers to wait for. + name: Release PR version + # A release-shaped title against the release branch is the whole test here, with no clause + # on who opened the pull request or what branch it is rendered onto. This job only reads, + # and a pull request claiming to be a release is worth checking against the committed + # version whoever opened it. Every other pull request skips this job, which GitHub reports + # as neutral. + # + # Loose on purpose: the prefix, not the full semver pattern the script matches. A version + # typo'd into the title still reaches the script and fails there, rather than falling out + # of the guard and leaving no check at all — a missing check is not a failing one, and this + # is the check the release PR's footer tells maintainers to wait for before merging. + # + # It is also what keeps the workflow from failing silently if the platform ever opens + # release PRs from a different account: the bridge below stops firing, but this check still + # runs, the retitled version and the committed one disagree, and it turns red. The merge is + # blocked loudly instead of releasing the old version. + if: >- + ${{ github.event.pull_request.base.ref == 'main' + && startsWith(github.event.pull_request.title, 'release: ') }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + with: + # The version committed on the PR head is what merging would actually release. + ref: ${{ github.event.pull_request.head.sha }} + # Fails while the title version and the committed version disagree — the window between + # a maintainer's retitle and the platform re-rendering the PR from it. Without this a + # merge in that window would tag a release whose own files self-report the old version, + # and a title release-please cannot parse would silently cut no release at all. + - name: Compare the title version with the committed version + env: + # The title is human input, so it is bound through the environment (never + # interpolated into the script) and matched against a strict semver pattern + # before it is read. + PR_TITLE: ${{ github.event.pull_request.title }} + run: | + pattern='^release: ((0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?)$' + if [[ ! "$PR_TITLE" =~ $pattern ]]; then + echo "::error::Release PR title must be \"release: X.Y.Z\" with a full semver version, got: $PR_TITLE" + exit 1 + fi + title_version="${BASH_REMATCH[1]}" + manifest_version="$(jq -r '.["."]' .release-please-manifest.json)" + if [[ "$title_version" != "$manifest_version" ]]; then + echo "::error::Release PR title says $title_version but the pull request is versioned $manifest_version. Wait for the release PR to be re-rendered at $title_version before merging." + exit 1 + fi + echo "Release PR title and committed version agree on $title_version." + + apply-title-version: + name: Apply edited release version + # A human retitle of the open release PR is bridged into the canonical explicit-version + # mechanism (a Release-As commit on scalar-next, which the platform re-renders the + # release PR from). `changes.title` is only set when the title itself changed, and bot + # senders are ignored so the platform's own retitles cannot bounce back into another + # commit. + # + # Both signals are required here, unlike the read-only check above, and each covers what the + # other cannot. The author, because this job pushes with `contents: write` and a title is + # free text — anyone able to open a pull request against main could otherwise + # name a version and have it committed to scalar-next. `user.login` is set by GitHub when + # the pull request is opened and cannot be forged by whoever edits the title afterwards. + # The title, because those accounts open pull requests other than release PRs, and retitling + # one of those must not push a release. + # + # One login per platform deployment, since a repo generated by staging carries staging's + # app. Parenthesised because the group is ANDed with the title clause below: without the + # parens that `&&` would bind to the last login alone, letting the other accounts push a + # release off any title. Listed rather than matched on the shared `scalar-docs` stem — a + # prefix test would also admit any future `scalar-docs-*[bot]`, including someone else's. + if: >- + ${{ github.event.action == 'edited' + && github.event.changes.title != null + && github.event.sender.type != 'Bot' + && github.event.pull_request.state == 'open' + && github.event.pull_request.base.ref == 'main' + && (github.event.pull_request.user.login == 'scalar-docs[bot]' + || github.event.pull_request.user.login == 'scalar-docs-staging[bot]' + || github.event.pull_request.user.login == 'scalar-docs-development[bot]') + && startsWith(github.event.pull_request.title, 'release: ') }} + # One bridge run at a time per pull request, newest retitle wins. Two retitles in quick + # succession (a version typo corrected seconds later) would otherwise start two runs that + # both read the version committed on the PR head, both get past the no-op guard, and both + # push — and since each fetches scalar-next immediately before committing, the second + # push fast-forwards instead of failing. release-please honours the newest Release-As + # footer, so the release would land on whichever run happened to push last, not on the + # title the maintainer actually left behind. + concurrency: + group: release-title-edit-${{ github.event.pull_request.number }} + cancel-in-progress: true + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + with: + # The PR head, so the version the pull request currently carries can be read before + # deciding whether anything needs to change. + ref: ${{ github.event.pull_request.head.sha }} + - name: Push a Release-As commit for the edited version + env: + PR_TITLE: ${{ github.event.pull_request.title }} + run: | + set -euo pipefail + pattern='^release: ((0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?)$' + if [[ ! "$PR_TITLE" =~ $pattern ]]; then + echo "::error::Release PR title must be \"release: X.Y.Z\" with a full semver version, got: $PR_TITLE" + exit 1 + fi + # Only ever a validated semver from here on, so it is safe in a commit message. + version="${BASH_REMATCH[1]}" + manifest_version="$(jq -r '.["."]' .release-please-manifest.json)" + # The re-rendered PR is retitled to the version it now carries; stopping here keeps + # that from producing an endless chain of Release-As commits. + if [[ "$version" == "$manifest_version" ]]; then + echo "This release PR already carries $version; nothing to do." + exit 0 + fi + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git fetch origin scalar-next + git checkout -B scalar-next origin/scalar-next + git commit --allow-empty -m "chore: release $version" -m "Release-As: $version" + # Plain (non-force) push: losing a race against a regeneration push fails loudly + # rather than discarding it, and the retitle can simply be repeated. + git push origin scalar-next + echo "Pushed Release-As: $version to scalar-next. The release PR will be re-rendered at that version." diff --git a/.github/workflows/sdk-ci.yml b/.github/workflows/sdk-ci.yml new file mode 100644 index 0000000..652459a --- /dev/null +++ b/.github/workflows/sdk-ci.yml @@ -0,0 +1,51 @@ +name: JVM SDK CI + +on: + push: + pull_request: + +# Least privilege for a verification-only workflow: every job below only reads the checked-out +# tree, so the run's GITHUB_TOKEN is narrowed to that regardless of the repository's default +# grants. Declared at the workflow level so a job added later inherits the floor. +permissions: + contents: read + +jobs: + # Verification only, never auto-fix: the SDK is generated formatter-clean, so a reported file + # means either hand-edited custom code or a regenerate that was not committed. Both tools are + # pinned to the release that produced these bytes, since a formatter minor can change them, and + # both run from their published jars so this job needs no Gradle plugin in the generated build. + format: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + - uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4.8.0 + with: + distribution: temurin + java-version: "21" + - name: ktfmt + run: | + curl -fsSL -o /tmp/ktfmt.jar \ + "https://repo1.maven.org/maven2/com/facebook/ktfmt/0.64/ktfmt-0.64-with-dependencies.jar" + find . -type f \( -name '*.kt' -o -name '*.kts' \) -print0 \ + | xargs -0 -r java -jar /tmp/ktfmt.jar --kotlinlang-style --dry-run --set-exit-if-changed + # No style flag: the generator formats with google-java-format's own Google style, which is + # what the tool does when none is passed. `-r` because a Kotlin-target SDK has no `.java` + # files at all, and the formatter exits non-zero when handed no arguments. + - name: google-java-format + run: | + curl -fsSL -o /tmp/google-java-format.jar \ + "https://repo1.maven.org/maven2/com/google/googlejavaformat/google-java-format/1.36.1/google-java-format-1.36.1-all-deps.jar" + find . -type f -name '*.java' -print0 \ + | xargs -0 -r java -jar /tmp/google-java-format.jar --dry-run --set-exit-if-changed + + verify: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + - uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4.8.0 + with: + distribution: temurin + java-version: "21" + - uses: gradle/actions/setup-gradle@ed408507eac070d1f99cc633dbcf757c94c7933a # v4.4.3 + - run: ./gradlew build 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/VERSIONING.md b/VERSIONING.md new file mode 100644 index 0000000..662f2b6 --- /dev/null +++ b/VERSIONING.md @@ -0,0 +1,86 @@ +# Versioning + +This SDK is configured with the `manual` versioning policy. + +- `manual`: package versions are set explicitly before release. +- `semver`: releases should follow semantic versioning based on API and SDK surface changes. +- `calendar`: releases should use a calendar-derived version chosen by the release workflow or maintainer. + +## Branches and releases + +This repository follows a three-branch flow, managed by the Scalar platform together +with the generated workflows (which need only the default `GITHUB_TOKEN` — no extra +token required): + +- **`scalar-generated`** — pristine generator output. Pushed by the Scalar platform; do + not commit here. +- **`scalar-next`** — generated output merged with this repository's custom code. Commit + your customizations here (directly or via PRs). The Scalar platform merges each + regeneration into this branch and keeps the release PR up to date; merge conflicts + arrive as a PR from `scalar-merge-conflict` for you to resolve. +- **Default branch** — seeded from the first generated snapshot, then only ever receives + released states, each one the merge of a release PR. + +Release PRs are opened by the Scalar platform from `scalar-next` against the default +branch — so the PR diff shows the full pending release — and are versioned from +[Conventional Commits](https://www.conventionalcommits.org). Merging a release PR tags the +release, publishes it, and syncs the version bump and changelog back to `scalar-next`. +Pre-1.0, breaking changes bump the minor version. + +### Choosing an exact version + +To release a specific version — `1.0.0`, a hotfix number, anything the commit history would +not have picked — **edit the release PR title** to the version you want: + +```text +release: 1.0.0 +``` + +The `Release PR version` check turns red as soon as you save, because the version in the +title no longer matches the version committed in the PR. The Scalar platform then re-renders +the release PR at your version (changelog, manifest, and every version-bearing file), the +title comes back as `release: 1.0.0`, and the check turns green. **Wait for it to be green +before merging** — merging in between would tag a release whose own files still carry the +old version. + +The git-native equivalent, if you would rather not touch the PR: push an empty commit with a +`Release-As` footer to `scalar-next`. This is exactly what the title edit does for you. + +```sh +git commit --allow-empty -m "chore: release 1.0.0" -m "Release-As: 1.0.0" +``` + +### When a release PR does not merge cleanly + +Nothing is ever force-pushed automatically: a release PR that conflicts with the default +branch simply cannot be merged, and GitHub disables its merge button. The two causes have +different fixes: + +- **The default branch received direct commits** (for example a hotfix) that are not in + `scalar-next`. Land those commits on `scalar-next` (merge the default branch into it, or + cherry-pick), and the refreshed release PR merges cleanly again. Do not force-push — + that would discard the direct commits. +- **The repository was adopted with pre-existing content**, so the default branch shares + no history with `scalar-next`. The Scalar platform adds a checkbox to the release PR + description offering to replace the default branch with this release; checking it + authorizes the platform to force-push the released state over the old content. This is + destructive for anything on the default branch that never reached `scalar-next`, which + is why it requires that explicit opt-in. + +### Repository prerequisites + +- Branch protection on `scalar-next` and the default branch must allow the Scalar + platform and the `github-actions` bot to push (or be left unprotected); the default + branch only ever advances by merging release PRs, and `scalar-next` receives each + released state back from the release workflow. +- No Actions settings changes are required: the generated workflows declare their own + permissions and never create pull requests. +- If this package publishes through OIDC trusted publishing (for example PyPI or npm), + register the trusted publisher on the registry against the **`release-please.yml`** + workflow filename. Merging a release PR publishes from the `publish` job inside that + same workflow run (checked out at the released tag), so the automated path's OIDC + claims name that file — and, because nothing is dispatched, releasing works from any + release branch, not only the repository default branch. `sdk-release.yml` exists for + manual re-publishes at an existing tag; register it as an additional trusted publisher + only if you use it. If the publish job is configured with a deployment environment, + include that environment in the registration too. diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..3711560 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,46 @@ +{ + "packages": { + ".": { + "release-type": "simple", + "extra-files": [ + "build.gradle.kts" + ] + } + }, + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": false, + "include-component-in-tag": false, + "pull-request-title-pattern": "release: ${version}", + "pull-request-header": "Automated Release PR", + "pull-request-footer": "The semver version number is based on included commit messages. To release a specific version,\nedit this pull request title to `release: 1.2.3` — Scalar re-creates this pull request at that\nversion, so wait for the `Release PR version` check to pass before merging.\n\nBrought to you by [Scalar](https://scalar.com)", + "changelog-sections": [ + { + "type": "feat", + "section": "Features" + }, + { + "type": "fix", + "section": "Bug Fixes" + }, + { + "type": "perf", + "section": "Performance Improvements" + }, + { + "type": "revert", + "section": "Reverts" + }, + { + "type": "chore", + "section": "Chores" + }, + { + "type": "docs", + "section": "Documentation" + }, + { + "type": "refactor", + "section": "Refactors" + } + ] +} From 582f867e84e41d0046e9b23a6fa8fa38d6d32e62 Mon Sep 17 00:00:00 2001 From: scalarbot Date: Wed, 30 Sep 2026 19:59:12 +0000 Subject: [PATCH 2/6] feat(api)!: update SDK surface (15 changes) - Regenerated with generator `0.36.0` (previously `0.32.14`). - Added `oauth2` auth scheme `OAuth2`. - Removed body field `lastKnownVersionSha` from `registry.updateApiDocumentVersion`. - Removed body field `lastKnownVersionSha` from `registry.createApiDocumentVersion`. - Added optional body field `force` to `schemas.version.create`. - Response of `schemas.version.create` changed from `uid` to `none`. - Schema `slug` shape changed. - Schema `namespace` shape changed. - Added required property `managed_doc_version.endpointCount`. - Removed optional property `managed_doc_version.versionSha`. - Schema `method` shape changed. - Added optional property `managed_schema_version.yamlSha`. - Added optional property `managed_schema_version.jsonSha`. - Added required property `github_project.userInfoHookUrl`. - Added required property `github_project.analyticsEnabled`. BREAKING CHANGE: 10 breaking changes to the SDK surface. - Removed body field `lastKnownVersionSha` from `registry.updateApiDocumentVersion`. - Removed body field `lastKnownVersionSha` from `registry.createApiDocumentVersion`. - Response of `schemas.version.create` changed from `uid` to `none`. - Schema `slug` shape changed. - Schema `namespace` shape changed. - Added required property `managed_doc_version.endpointCount`. - Removed optional property `managed_doc_version.versionSha`. - Schema `method` shape changed. - Added required property `github_project.userInfoHookUrl`. - Added required property `github_project.analyticsEnabled`. Build: DSSyanrPJAu7bGPDEx7Kw --- .claude/skills/scalar-java-sdk/SKILL.md | 1 + .github/workflows/release-please.yml | 2 +- .github/workflows/release-title-edit.yml | 4 +- .github/workflows/sdk-ci.yml | 15 +- README.md | 3 + SKILL.md | 1 + VERSIONING.md | 14 ++ api.md | 16 +- .../client/okhttp/ScalarOkHttpClient.kt | 14 +- .../client/okhttp/ScalarOkHttpClientAsync.kt | 14 +- .../kotlin/com/scalar/core/ClientOptions.kt | 44 ++++- .../com/scalar/models/ManagedDocVersion.kt | 98 ++++++---- .../RegistryCreateApiDocumentResponse.kt | 44 +---- .../RegistryCreateApiDocumentVersionParams.kt | 79 +------- .../RegistryUpdateApiDocumentVersionParams.kt | 92 +-------- ...egistryUpdateApiDocumentVersionResponse.kt | 47 +---- .../scalarDocs/ScalarDocListGuidesResponse.kt | 89 ++++++++- .../models/schemas/SchemaListResponse.kt | 81 +++++++- .../schemas/version/VersionCreateParams.kt | 66 ++++++- .../schemas/version/VersionCreateResponse.kt | 175 ++++++++++++++++++ .../async/schemas/VersionServiceAsync.kt | 26 ++- .../async/schemas/VersionServiceAsyncImpl.kt | 9 +- .../blocking/schemas/VersionService.kt | 24 ++- .../blocking/schemas/VersionServiceImpl.kt | 12 +- .../proguard/ProGuardCompatibilityTest.kt | 3 +- scalar-sdk.manifest.json | 169 ++++++++++++----- tests/smoke-test.java | 111 ++++++----- 27 files changed, 802 insertions(+), 451 deletions(-) create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/schemas/version/VersionCreateResponse.kt diff --git a/.claude/skills/scalar-java-sdk/SKILL.md b/.claude/skills/scalar-java-sdk/SKILL.md index 5520294..798ef8b 100644 --- a/.claude/skills/scalar-java-sdk/SKILL.md +++ b/.claude/skills/scalar-java-sdk/SKILL.md @@ -26,6 +26,7 @@ ScalarClient client = Provide credentials using the options below. Environment variables are read automatically when the target runtime supports them: - `bearerAuth` (env: `BEARER_AUTH`) — Credential for the BearerAuth client option. +- `oAuth2` (env: `SCALAR_O_AUTH2`) — Authorization code with PKCE (S256), for apps acting on behalf of a Scalar user. Each scope implies the weaker ones. ## Calling operations diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 3b1e858..a4483a9 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -43,7 +43,7 @@ jobs: # credential (so their CI runs without manual approval); this workflow only # cuts the tag + GitHub Release once a release PR is merged. skip-github-pull-request: true - - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 if: ${{ steps.release.outputs.release_created == 'true' }} with: fetch-depth: 0 diff --git a/.github/workflows/release-title-edit.yml b/.github/workflows/release-title-edit.yml index d1827b1..c836f65 100644 --- a/.github/workflows/release-title-edit.yml +++ b/.github/workflows/release-title-edit.yml @@ -35,7 +35,7 @@ jobs: && startsWith(github.event.pull_request.title, 'release: ') }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: # The version committed on the PR head is what merging would actually release. ref: ${{ github.event.pull_request.head.sha }} @@ -108,7 +108,7 @@ jobs: permissions: contents: write steps: - - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: # The PR head, so the version the pull request currently carries can be read before # deciding whether anything needs to change. diff --git a/.github/workflows/sdk-ci.yml b/.github/workflows/sdk-ci.yml index 652459a..d28a89b 100644 --- a/.github/workflows/sdk-ci.yml +++ b/.github/workflows/sdk-ci.yml @@ -18,8 +18,8 @@ jobs: format: runs-on: ubuntu-latest steps: - - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 - - uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4.8.0 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1 with: distribution: temurin java-version: "21" @@ -42,10 +42,15 @@ jobs: verify: runs-on: ubuntu-latest steps: - - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 - - uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4.8.0 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1 with: distribution: temurin java-version: "21" - - uses: gradle/actions/setup-gradle@ed408507eac070d1f99cc633dbcf757c94c7933a # v4.4.3 + # `enhanced` (the default) is proprietary — free for public repos, a free preview for + # private. `basic` is MIT `actions/cache` but keeps no restore keys: a dependency change + # rebuilds the cache cold. + - uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0 + with: + cache-provider: basic - run: ./gradlew build diff --git a/README.md b/README.md index ebd2489..d25418f 100644 --- a/README.md +++ b/README.md @@ -202,10 +202,12 @@ Pass credentials to the generated client constructor. Environment variables are | Option | Type | Default | Description | | --- | --- | --- | --- | | `bearerAuth` | `string \| provider` | - | Credential for the BearerAuth client option. Defaults to BEARER_AUTH. | +| `oAuth2` | `string \| provider` | - | Authorization code with PKCE (S256), for apps acting on behalf of a Scalar user. Each scope implies the weaker ones. Defaults to SCALAR_O_AUTH2. | Declared schemes: - `BearerAuth` bearer token +- `OAuth2` OAuth2/OpenID Connect
@@ -248,6 +250,7 @@ ScalarClient client = | Option | Type | Default | Description | | --- | --- | --- | --- | | `bearerAuth` | `String` | `System.getenv("BEARER_AUTH")` | Credential for the BearerAuth client option. | +| `oAuth2` | `String` | `System.getenv("SCALAR_O_AUTH2")` | Authorization code with PKCE (S256), for apps acting on behalf of a Scalar user. Each scope implies the weaker ones. | | `baseUrl` | `String` | - | Override the default API base URL. | | `putHeader` | `(String, String) -> Builder` | - | Set a header sent with every request. | | `putQueryParam` | `(String, String) -> Builder` | - | Set a query parameter sent with every request. | diff --git a/SKILL.md b/SKILL.md index 6a74d55..85a5904 100644 --- a/SKILL.md +++ b/SKILL.md @@ -26,6 +26,7 @@ ScalarClient client = Provide credentials using the options below. Environment variables are read automatically when the target runtime supports them: - `bearerAuth` (env: `BEARER_AUTH`) — Credential for the BearerAuth client option. +- `oAuth2` (env: `SCALAR_O_AUTH2`) — Authorization code with PKCE (S256), for apps acting on behalf of a Scalar user. Each scope implies the weaker ones. ## Calling operations diff --git a/VERSIONING.md b/VERSIONING.md index 662f2b6..f9cf7dd 100644 --- a/VERSIONING.md +++ b/VERSIONING.md @@ -73,6 +73,10 @@ different fixes: platform and the `github-actions` bot to push (or be left unprotected); the default branch only ever advances by merging release PRs, and `scalar-next` receives each released state back from the release workflow. +- **`scalar-next` must not enable "Require linear history."** The Scalar platform merges each + regeneration into it, and merges a resolved conflict back the same way; the release sync + adds another merge whenever a release PR is squash- or rebase-merged. That setting rejects + all of them. - No Actions settings changes are required: the generated workflows declare their own permissions and never create pull requests. - If this package publishes through OIDC trusted publishing (for example PyPI or npm), @@ -84,3 +88,13 @@ different fixes: manual re-publishes at an existing tag; register it as an additional trusted publisher only if you use it. If the publish job is configured with a deployment environment, include that environment in the registration too. + +### Recommended, not required + +Releases work without this; it closes a window where one can go out at the wrong version. + +- **If this repository uses auto-merge, make the `Release PR version` check a required status + check.** Auto-merge merges as soon as the checks that are *required* go green, with no + human present — so a check that is not required but still red at that moment stops + nothing, which is exactly the window between retitling a release PR and the platform + re-rendering it. diff --git a/api.md b/api.md index 2f50af3..a9d5d76 100644 --- a/api.md +++ b/api.md @@ -358,7 +358,7 @@ RegistryCreateApiDocumentAccessGroupParams params = RegistryCreateApiDocumentAccessGroupParams.builder() .namespace("namespace") .slug("slug") - .accessGroup(AccessGroup.builder().accessGroupSlug("xxx").build()) + .accessGroup(AccessGroup.builder().accessGroupSlug("x").build()) .build(); var registry = client.registry().createApiDocumentAccessGroup(params); @@ -386,7 +386,7 @@ RegistryDeleteApiDocumentAccessGroupParams params = RegistryDeleteApiDocumentAccessGroupParams.builder() .namespace("namespace") .slug("slug") - .accessGroup(AccessGroup.builder().accessGroupSlug("xxx").build()) + .accessGroup(AccessGroup.builder().accessGroupSlug("x").build()) .build(); var registry = client.registry().deleteApiDocumentAccessGroup(params); @@ -557,7 +557,7 @@ Create a schema version. | Direction | Type | | --- | --- | | Request | [`VersionCreateParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/schemas/version/VersionCreateParams.kt) | -| Response | [`Uid`](./scalar-java-core/src/main/kotlin/com/scalar/models/Uid.kt) | +| Response | [`VersionCreateResponse`](./scalar-java-core/src/main/kotlin/com/scalar/models/schemas/version/VersionCreateResponse.kt) | ```java import com.scalar.client.ScalarClient; @@ -604,7 +604,7 @@ AccessGroupCreateParams params = AccessGroupCreateParams.builder() .namespace("namespace") .slug("slug") - .accessGroup(AccessGroup.builder().accessGroupSlug("xxx").build()) + .accessGroup(AccessGroup.builder().accessGroupSlug("x").build()) .build(); var accessGroup = client.schemas().accessGroup().create(params); @@ -632,7 +632,7 @@ AccessGroupDeleteParams params = AccessGroupDeleteParams.builder() .namespace("namespace") .slug("slug") - .accessGroup(AccessGroup.builder().accessGroupSlug("xxx").build()) + .accessGroup(AccessGroup.builder().accessGroupSlug("x").build()) .build(); var accessGroup = client.schemas().accessGroup().delete(params); @@ -742,7 +742,7 @@ LoginPortalCreateParams params = .title("Private Docs") .mainColor("#2a2f45") .mainBackground("#f6f6f6") - .cardColor("2a2f45") + .cardColor("#2a2f45") .cardBackground("#fff") .buttonColor("#fff") .buttonBackground("#0f0f0f") @@ -940,7 +940,7 @@ RuleCreateRulesetAccessGroupParams params = RuleCreateRulesetAccessGroupParams.builder() .namespace("namespace") .slug("slug") - .accessGroup(AccessGroup.builder().accessGroupSlug("xxx").build()) + .accessGroup(AccessGroup.builder().accessGroupSlug("x").build()) .build(); var rule = client.rules().createRulesetAccessGroup(params); @@ -968,7 +968,7 @@ RuleDeleteRulesetAccessGroupParams params = RuleDeleteRulesetAccessGroupParams.builder() .namespace("namespace") .slug("slug") - .accessGroup(AccessGroup.builder().accessGroupSlug("xxx").build()) + .accessGroup(AccessGroup.builder().accessGroupSlug("x").build()) .build(); var rule = client.rules().deleteRulesetAccessGroup(params); diff --git a/scalar-java-client-okhttp/src/main/kotlin/com/scalar/client/okhttp/ScalarOkHttpClient.kt b/scalar-java-client-okhttp/src/main/kotlin/com/scalar/client/okhttp/ScalarOkHttpClient.kt index 589bff4..06a7eae 100644 --- a/scalar-java-client-okhttp/src/main/kotlin/com/scalar/client/okhttp/ScalarOkHttpClient.kt +++ b/scalar-java-client-okhttp/src/main/kotlin/com/scalar/client/okhttp/ScalarOkHttpClient.kt @@ -294,7 +294,19 @@ class ScalarOkHttpClient private constructor() { */ fun logLevel(logLevel: LogLevel) = apply { clientOptions.logLevel(logLevel) } - fun bearerAuth(bearerAuth: String) = apply { clientOptions.bearerAuth(bearerAuth) } + fun bearerAuth(bearerAuth: String?) = apply { clientOptions.bearerAuth(bearerAuth) } + + /** Alias for calling [Builder.bearerAuth] with `bearerAuth.orElse(null)`. */ + fun bearerAuth(bearerAuth: Optional) = bearerAuth(bearerAuth.getOrNull()) + + /** + * Authorization code with PKCE (S256), for apps acting on behalf of a Scalar user. Each + * scope implies the weaker ones. + */ + fun oAuth2(oAuth2: String?) = apply { clientOptions.oAuth2(oAuth2) } + + /** Alias for calling [Builder.oAuth2] with `oAuth2.orElse(null)`. */ + fun oAuth2(oAuth2: Optional) = oAuth2(oAuth2.getOrNull()) fun headers(headers: Headers) = apply { clientOptions.headers(headers) } diff --git a/scalar-java-client-okhttp/src/main/kotlin/com/scalar/client/okhttp/ScalarOkHttpClientAsync.kt b/scalar-java-client-okhttp/src/main/kotlin/com/scalar/client/okhttp/ScalarOkHttpClientAsync.kt index 1cd1002..de911cc 100644 --- a/scalar-java-client-okhttp/src/main/kotlin/com/scalar/client/okhttp/ScalarOkHttpClientAsync.kt +++ b/scalar-java-client-okhttp/src/main/kotlin/com/scalar/client/okhttp/ScalarOkHttpClientAsync.kt @@ -294,7 +294,19 @@ class ScalarOkHttpClientAsync private constructor() { */ fun logLevel(logLevel: LogLevel) = apply { clientOptions.logLevel(logLevel) } - fun bearerAuth(bearerAuth: String) = apply { clientOptions.bearerAuth(bearerAuth) } + fun bearerAuth(bearerAuth: String?) = apply { clientOptions.bearerAuth(bearerAuth) } + + /** Alias for calling [Builder.bearerAuth] with `bearerAuth.orElse(null)`. */ + fun bearerAuth(bearerAuth: Optional) = bearerAuth(bearerAuth.getOrNull()) + + /** + * Authorization code with PKCE (S256), for apps acting on behalf of a Scalar user. Each + * scope implies the weaker ones. + */ + fun oAuth2(oAuth2: String?) = apply { clientOptions.oAuth2(oAuth2) } + + /** Alias for calling [Builder.oAuth2] with `oAuth2.orElse(null)`. */ + fun oAuth2(oAuth2: Optional) = oAuth2(oAuth2.getOrNull()) fun headers(headers: Headers) = apply { clientOptions.headers(headers) } diff --git a/scalar-java-core/src/main/kotlin/com/scalar/core/ClientOptions.kt b/scalar-java-core/src/main/kotlin/com/scalar/core/ClientOptions.kt index 1058847..76d0ea7 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/core/ClientOptions.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/core/ClientOptions.kt @@ -119,7 +119,8 @@ private constructor( * Defaults to [LogLevel.fromEnv]. */ @get:JvmName("logLevel") val logLevel: LogLevel, - @get:JvmName("bearerAuth") val bearerAuth: String, + private val bearerAuth: String?, + private val oAuth2: String?, ) { init { @@ -135,6 +136,14 @@ private constructor( */ fun baseUrl(): String = baseUrl ?: PRODUCTION_URL + fun bearerAuth(): Optional = Optional.ofNullable(bearerAuth) + + /** + * Authorization code with PKCE (S256), for apps acting on behalf of a Scalar user. Each scope + * implies the weaker ones. + */ + fun oAuth2(): Optional = Optional.ofNullable(oAuth2) + fun toBuilder() = Builder().from(this) companion object { @@ -147,7 +156,6 @@ private constructor( * The following fields are required: * ```java * .httpClient() - * .bearerAuth() * ``` */ @JvmStatic fun builder() = Builder() @@ -177,6 +185,7 @@ private constructor( private var maxRetries: Int = 2 private var logLevel: LogLevel = LogLevel.fromEnv() private var bearerAuth: String? = null + private var oAuth2: String? = null @JvmSynthetic internal fun from(clientOptions: ClientOptions) = apply { @@ -194,6 +203,7 @@ private constructor( maxRetries = clientOptions.maxRetries logLevel = clientOptions.logLevel bearerAuth = clientOptions.bearerAuth + oAuth2 = clientOptions.oAuth2 } /** @@ -326,7 +336,19 @@ private constructor( */ fun logLevel(logLevel: LogLevel) = apply { this.logLevel = logLevel } - fun bearerAuth(bearerAuth: String) = apply { this.bearerAuth = bearerAuth } + fun bearerAuth(bearerAuth: String?) = apply { this.bearerAuth = bearerAuth } + + /** Alias for calling [Builder.bearerAuth] with `bearerAuth.orElse(null)`. */ + fun bearerAuth(bearerAuth: Optional) = bearerAuth(bearerAuth.getOrNull()) + + /** + * Authorization code with PKCE (S256), for apps acting on behalf of a Scalar user. Each + * scope implies the weaker ones. + */ + fun oAuth2(oAuth2: String?) = apply { this.oAuth2 = oAuth2 } + + /** Alias for calling [Builder.oAuth2] with `oAuth2.orElse(null)`. */ + fun oAuth2(oAuth2: Optional) = oAuth2(oAuth2.getOrNull()) fun headers(headers: Headers) = apply { this.headers.clear() @@ -417,7 +439,8 @@ private constructor( * * |Setter |System property |Environment variable|Required|Default value | * |------------|-------------------|--------------------|--------|-----------------------------| - * |`bearerAuth`|`scalar.bearerAuth`|`BEARER_AUTH` |true |- | + * |`bearerAuth`|`scalar.bearerAuth`|`BEARER_AUTH` |false |- | + * |`oAuth2` |`scalar.oAuth2` |`SCALAR_O_AUTH2` |false |- | * |`baseUrl` |`scalar.baseUrl` |`SCALAR_BASE_URL` |true |`"https://access.scalar.com"`| * * System properties take precedence over environment variables. @@ -430,6 +453,9 @@ private constructor( (System.getProperty("scalar.bearerAuth") ?: System.getenv("BEARER_AUTH"))?.let { bearerAuth(it) } + (System.getProperty("scalar.oAuth2") ?: System.getenv("SCALAR_O_AUTH2"))?.let { + oAuth2(it) + } System.getenv("SCALAR_CUSTOM_HEADERS")?.let { customHeadersEnv -> for (line in customHeadersEnv.split("\n")) { val colon = line.indexOf(':') @@ -448,7 +474,6 @@ private constructor( * The following fields are required: * ```java * .httpClient() - * .bearerAuth() * ``` * * @throws IllegalStateException if any required field is unset. @@ -474,7 +499,6 @@ private constructor( ) ) val sleeper = sleeper ?: PhantomReachableSleeper(DefaultSleeper()) - val bearerAuth = checkRequired("bearerAuth", bearerAuth) val headers = Headers.builder() val queryParams = QueryParams.builder() @@ -489,7 +513,12 @@ private constructor( // We replace after all the default headers to allow end-users to overwrite them. headers.replaceAll(this.headers.build()) queryParams.replaceAll(this.queryParams.build()) - bearerAuth.let { + bearerAuth?.let { + if (!it.isEmpty()) { + headers.replace("Authorization", "Bearer $it") + } + } + oAuth2?.let { if (!it.isEmpty()) { headers.replace("Authorization", "Bearer $it") } @@ -522,6 +551,7 @@ private constructor( maxRetries, logLevel, bearerAuth, + oAuth2, ) } } diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/ManagedDocVersion.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/ManagedDocVersion.kt index c92a042..cc17557 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/models/ManagedDocVersion.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/ManagedDocVersion.kt @@ -27,12 +27,12 @@ private constructor( private val createdAt: JsonField, private val version: JsonField, private val upgraded: JsonField, + private val endpointCount: JsonField, private val embedStatus: JsonField, private val tags: JsonField>, private val tools: JsonField>, private val yamlSha: JsonField, private val jsonSha: JsonField, - private val versionSha: JsonField, private val additionalProperties: MutableMap, ) { @@ -42,6 +42,9 @@ private constructor( @JsonProperty("createdAt") @ExcludeMissing createdAt: JsonField = JsonMissing.of(), @JsonProperty("version") @ExcludeMissing version: JsonField = JsonMissing.of(), @JsonProperty("upgraded") @ExcludeMissing upgraded: JsonField = JsonMissing.of(), + @JsonProperty("endpointCount") + @ExcludeMissing + endpointCount: JsonField = JsonMissing.of(), @JsonProperty("embedStatus") @ExcludeMissing embedStatus: JsonField = JsonMissing.of(), @@ -49,20 +52,17 @@ private constructor( @JsonProperty("tools") @ExcludeMissing tools: JsonField> = JsonMissing.of(), @JsonProperty("yamlSha") @ExcludeMissing yamlSha: JsonField = JsonMissing.of(), @JsonProperty("jsonSha") @ExcludeMissing jsonSha: JsonField = JsonMissing.of(), - @JsonProperty("versionSha") - @ExcludeMissing - versionSha: JsonField = JsonMissing.of(), ) : this( uid, createdAt, version, upgraded, + endpointCount, embedStatus, tags, tools, yamlSha, jsonSha, - versionSha, mutableMapOf(), ) @@ -90,6 +90,12 @@ private constructor( */ fun upgraded(): Boolean = upgraded.getRequired("upgraded") + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun endpointCount(): Optional = endpointCount.getOptional("endpointCount") + /** * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -120,12 +126,6 @@ private constructor( */ fun jsonSha(): Optional = jsonSha.getOptional("jsonSha") - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun versionSha(): Optional = versionSha.getOptional("versionSha") - /** * Returns the raw JSON value of [uid]. * @@ -154,6 +154,15 @@ private constructor( */ @JsonProperty("upgraded") @ExcludeMissing fun _upgraded(): JsonField = upgraded + /** + * Returns the raw JSON value of [endpointCount]. + * + * Unlike [endpointCount], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("endpointCount") + @ExcludeMissing + fun _endpointCount(): JsonField = endpointCount + /** * Returns the raw JSON value of [embedStatus]. * @@ -191,13 +200,6 @@ private constructor( */ @JsonProperty("jsonSha") @ExcludeMissing fun _jsonSha(): JsonField = jsonSha - /** - * Returns the raw JSON value of [versionSha]. - * - * Unlike [versionSha], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("versionSha") @ExcludeMissing fun _versionSha(): JsonField = versionSha - @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -221,6 +223,7 @@ private constructor( * .createdAt() * .version() * .upgraded() + * .endpointCount() * .embedStatus() * .tags() * ``` @@ -235,12 +238,12 @@ private constructor( private var createdAt: JsonField? = null private var version: JsonField? = null private var upgraded: JsonField? = null + private var endpointCount: JsonField? = null private var embedStatus: JsonField? = null private var tags: JsonField>? = null private var tools: JsonField>? = null private var yamlSha: JsonField = JsonMissing.of() private var jsonSha: JsonField = JsonMissing.of() - private var versionSha: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -249,12 +252,12 @@ private constructor( createdAt = managedDocVersion.createdAt version = managedDocVersion.version upgraded = managedDocVersion.upgraded + endpointCount = managedDocVersion.endpointCount embedStatus = managedDocVersion.embedStatus tags = managedDocVersion.tags.map { it.toMutableList() } tools = managedDocVersion.tools.map { it.toMutableList() } yamlSha = managedDocVersion.yamlSha jsonSha = managedDocVersion.jsonSha - versionSha = managedDocVersion.versionSha additionalProperties = managedDocVersion.additionalProperties.toMutableMap() } @@ -300,6 +303,29 @@ private constructor( */ fun upgraded(upgraded: JsonField) = apply { this.upgraded = upgraded } + fun endpointCount(endpointCount: Long?) = endpointCount(JsonField.ofNullable(endpointCount)) + + /** + * Alias for [Builder.endpointCount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun endpointCount(endpointCount: Long) = endpointCount(endpointCount as Long?) + + /** Alias for calling [Builder.endpointCount] with `endpointCount.orElse(null)`. */ + fun endpointCount(endpointCount: Optional) = endpointCount(endpointCount.getOrNull()) + + /** + * Sets [Builder.endpointCount] to an arbitrary JSON value. + * + * You should usually call [Builder.endpointCount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun endpointCount(endpointCount: JsonField) = apply { + this.endpointCount = endpointCount + } + fun embedStatus(embedStatus: EmbedStatus?) = embedStatus(JsonField.ofNullable(embedStatus)) /** Alias for calling [Builder.embedStatus] with `embedStatus.orElse(null)`. */ @@ -381,17 +407,6 @@ private constructor( */ fun jsonSha(jsonSha: JsonField) = apply { this.jsonSha = jsonSha } - fun versionSha(versionSha: String) = versionSha(JsonField.of(versionSha)) - - /** - * Sets [Builder.versionSha] to an arbitrary JSON value. - * - * You should usually call [Builder.versionSha] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun versionSha(versionSha: JsonField) = apply { this.versionSha = versionSha } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -422,6 +437,7 @@ private constructor( * .createdAt() * .version() * .upgraded() + * .endpointCount() * .embedStatus() * .tags() * ``` @@ -434,12 +450,12 @@ private constructor( checkRequired("createdAt", createdAt), checkRequired("version", version), checkRequired("upgraded", upgraded), + checkRequired("endpointCount", endpointCount), checkRequired("embedStatus", embedStatus), checkRequired("tags", tags).map { it.toImmutable() }, (tools ?: JsonMissing.of()).map { it.toImmutable() }, yamlSha, jsonSha, - versionSha, additionalProperties.toMutableMap(), ) } @@ -463,12 +479,12 @@ private constructor( createdAt() version() upgraded() + endpointCount() embedStatus().ifPresent { it.validate() } tags() tools().ifPresent { it.forEach { it.validate() } } yamlSha() jsonSha() - versionSha() validated = true } @@ -491,12 +507,12 @@ private constructor( (if (createdAt.asKnown().isPresent) 1 else 0) + (if (version.asKnown().isPresent) 1 else 0) + (if (upgraded.asKnown().isPresent) 1 else 0) + + (if (endpointCount.asKnown().isPresent) 1 else 0) + (embedStatus.asKnown().getOrNull()?.validity() ?: 0) + (tags.asKnown().getOrNull()?.size ?: 0) + (tools.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (yamlSha.asKnown().isPresent) 1 else 0) + - (if (jsonSha.asKnown().isPresent) 1 else 0) + - (if (versionSha.asKnown().isPresent) 1 else 0) + (if (jsonSha.asKnown().isPresent) 1 else 0) class EmbedStatus @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -898,6 +914,8 @@ private constructor( @JvmField val PUT = of("put") + @JvmField val QUERY = of("query") + @JvmField val TRACE = of("trace") @JvmStatic fun of(value: String) = Method(JsonField.of(value)) @@ -912,6 +930,7 @@ private constructor( PATCH, POST, PUT, + QUERY, TRACE, } @@ -932,6 +951,7 @@ private constructor( PATCH, POST, PUT, + QUERY, TRACE, /** * An enum member indicating that [Method] was instantiated with an unknown value. @@ -955,6 +975,7 @@ private constructor( PATCH -> Value.PATCH POST -> Value.POST PUT -> Value.PUT + QUERY -> Value.QUERY TRACE -> Value.TRACE else -> Value._UNKNOWN } @@ -977,6 +998,7 @@ private constructor( PATCH -> Known.PATCH POST -> Known.POST PUT -> Known.PUT + QUERY -> Known.QUERY TRACE -> Known.TRACE else -> throw ScalarInvalidDataException("Unknown Method: $value") } @@ -1218,12 +1240,12 @@ private constructor( createdAt == other.createdAt && version == other.version && upgraded == other.upgraded && + endpointCount == other.endpointCount && embedStatus == other.embedStatus && tags == other.tags && tools == other.tools && yamlSha == other.yamlSha && jsonSha == other.jsonSha && - versionSha == other.versionSha && additionalProperties == other.additionalProperties } @@ -1233,12 +1255,12 @@ private constructor( createdAt, version, upgraded, + endpointCount, embedStatus, tags, tools, yamlSha, jsonSha, - versionSha, additionalProperties, ) } @@ -1246,5 +1268,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "ManagedDocVersion{uid=$uid, createdAt=$createdAt, version=$version, upgraded=$upgraded, embedStatus=$embedStatus, tags=$tags, tools=$tools, yamlSha=$yamlSha, jsonSha=$jsonSha, versionSha=$versionSha, additionalProperties=$additionalProperties}" + "ManagedDocVersion{uid=$uid, createdAt=$createdAt, version=$version, upgraded=$upgraded, endpointCount=$endpointCount, embedStatus=$embedStatus, tags=$tags, tools=$tools, yamlSha=$yamlSha, jsonSha=$jsonSha, additionalProperties=$additionalProperties}" } diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/registry/RegistryCreateApiDocumentResponse.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/registry/RegistryCreateApiDocumentResponse.kt index 1c12c45..a9c93ef 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/models/registry/RegistryCreateApiDocumentResponse.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/registry/RegistryCreateApiDocumentResponse.kt @@ -23,7 +23,6 @@ private constructor( private val title: JsonField, private val jsonSha: JsonField, private val yamlSha: JsonField, - private val versionSha: JsonField, private val additionalProperties: MutableMap, ) { @@ -36,10 +35,7 @@ private constructor( @JsonProperty("title") @ExcludeMissing title: JsonField = JsonMissing.of(), @JsonProperty("jsonSha") @ExcludeMissing jsonSha: JsonField = JsonMissing.of(), @JsonProperty("yamlSha") @ExcludeMissing yamlSha: JsonField = JsonMissing.of(), - @JsonProperty("versionSha") - @ExcludeMissing - versionSha: JsonField = JsonMissing.of(), - ) : this(uid, versionUid, title, jsonSha, yamlSha, versionSha, mutableMapOf()) + ) : this(uid, versionUid, title, jsonSha, yamlSha, mutableMapOf()) /** * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is @@ -71,12 +67,6 @@ private constructor( */ fun yamlSha(): String = yamlSha.getRequired("yamlSha") - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun versionSha(): String = versionSha.getRequired("versionSha") - /** * Returns the raw JSON value of [uid]. * @@ -112,13 +102,6 @@ private constructor( */ @JsonProperty("yamlSha") @ExcludeMissing fun _yamlSha(): JsonField = yamlSha - /** - * Returns the raw JSON value of [versionSha]. - * - * Unlike [versionSha], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("versionSha") @ExcludeMissing fun _versionSha(): JsonField = versionSha - @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -144,7 +127,6 @@ private constructor( * .title() * .jsonSha() * .yamlSha() - * .versionSha() * ``` */ @JvmStatic fun builder() = Builder() @@ -158,7 +140,6 @@ private constructor( private var title: JsonField? = null private var jsonSha: JsonField? = null private var yamlSha: JsonField? = null - private var versionSha: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -169,7 +150,6 @@ private constructor( title = registryCreateApiDocumentResponse.title jsonSha = registryCreateApiDocumentResponse.jsonSha yamlSha = registryCreateApiDocumentResponse.yamlSha - versionSha = registryCreateApiDocumentResponse.versionSha additionalProperties = registryCreateApiDocumentResponse.additionalProperties.toMutableMap() } @@ -225,17 +205,6 @@ private constructor( */ fun yamlSha(yamlSha: JsonField) = apply { this.yamlSha = yamlSha } - fun versionSha(versionSha: String) = versionSha(JsonField.of(versionSha)) - - /** - * Sets [Builder.versionSha] to an arbitrary JSON value. - * - * You should usually call [Builder.versionSha] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun versionSha(versionSha: JsonField) = apply { this.versionSha = versionSha } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -267,7 +236,6 @@ private constructor( * .title() * .jsonSha() * .yamlSha() - * .versionSha() * ``` * * @throws IllegalStateException if any required field is unset. @@ -279,7 +247,6 @@ private constructor( checkRequired("title", title), checkRequired("jsonSha", jsonSha), checkRequired("yamlSha", yamlSha), - checkRequired("versionSha", versionSha), additionalProperties.toMutableMap(), ) } @@ -304,7 +271,6 @@ private constructor( title() jsonSha() yamlSha() - versionSha() validated = true } @@ -327,8 +293,7 @@ private constructor( (if (versionUid.asKnown().isPresent) 1 else 0) + (if (title.asKnown().isPresent) 1 else 0) + (if (jsonSha.asKnown().isPresent) 1 else 0) + - (if (yamlSha.asKnown().isPresent) 1 else 0) + - (if (versionSha.asKnown().isPresent) 1 else 0) + (if (yamlSha.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -341,16 +306,15 @@ private constructor( title == other.title && jsonSha == other.jsonSha && yamlSha == other.yamlSha && - versionSha == other.versionSha && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(uid, versionUid, title, jsonSha, yamlSha, versionSha, additionalProperties) + Objects.hash(uid, versionUid, title, jsonSha, yamlSha, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "RegistryCreateApiDocumentResponse{uid=$uid, versionUid=$versionUid, title=$title, jsonSha=$jsonSha, yamlSha=$yamlSha, versionSha=$versionSha, additionalProperties=$additionalProperties}" + "RegistryCreateApiDocumentResponse{uid=$uid, versionUid=$versionUid, title=$title, jsonSha=$jsonSha, yamlSha=$yamlSha, additionalProperties=$additionalProperties}" } diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/registry/RegistryCreateApiDocumentVersionParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/registry/RegistryCreateApiDocumentVersionParams.kt index f7033a9..785ee1b 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/models/registry/RegistryCreateApiDocumentVersionParams.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/registry/RegistryCreateApiDocumentVersionParams.kt @@ -48,12 +48,6 @@ private constructor( */ fun force(): Optional = body.force() - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun lastKnownVersionSha(): Optional = body.lastKnownVersionSha() - fun namespace(): String = namespace fun slug(): Optional = Optional.ofNullable(slug) @@ -79,14 +73,6 @@ private constructor( */ fun _force(): JsonField = body._force() - /** - * Returns the raw JSON value of [lastKnownVersionSha]. - * - * Unlike [lastKnownVersionSha], this method doesn't throw if the JSON field has an unexpected - * type. - */ - fun _lastKnownVersionSha(): JsonField = body._lastKnownVersionSha() - fun _additionalBodyProperties(): Map = body._additionalProperties() /** Additional headers to send with the request. */ @@ -149,7 +135,6 @@ private constructor( * - [version] * - [document] * - [force] - * - [lastKnownVersionSha] */ fun body(body: Body) = apply { this.body = body.toBuilder() } @@ -183,21 +168,6 @@ private constructor( */ fun force(force: JsonField) = apply { body.force(force) } - fun lastKnownVersionSha(lastKnownVersionSha: String) = apply { - body.lastKnownVersionSha(lastKnownVersionSha) - } - - /** - * Sets [Builder.lastKnownVersionSha] to an arbitrary JSON value. - * - * You should usually call [Builder.lastKnownVersionSha] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun lastKnownVersionSha(lastKnownVersionSha: JsonField) = apply { - body.lastKnownVersionSha(lastKnownVersionSha) - } - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { body.additionalProperties(additionalBodyProperties) } @@ -358,7 +328,6 @@ private constructor( private val version: JsonField, private val document: JsonField, private val force: JsonField, - private val lastKnownVersionSha: JsonField, private val additionalProperties: MutableMap, ) { @@ -369,10 +338,7 @@ private constructor( @ExcludeMissing document: JsonField = JsonMissing.of(), @JsonProperty("force") @ExcludeMissing force: JsonField = JsonMissing.of(), - @JsonProperty("lastKnownVersionSha") - @ExcludeMissing - lastKnownVersionSha: JsonField = JsonMissing.of(), - ) : this(version, document, force, lastKnownVersionSha, mutableMapOf()) + ) : this(version, document, force, mutableMapOf()) /** * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is @@ -392,13 +358,6 @@ private constructor( */ fun force(): Optional = force.getOptional("force") - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun lastKnownVersionSha(): Optional = - lastKnownVersionSha.getOptional("lastKnownVersionSha") - /** * Returns the raw JSON value of [version]. * @@ -420,16 +379,6 @@ private constructor( */ @JsonProperty("force") @ExcludeMissing fun _force(): JsonField = force - /** - * Returns the raw JSON value of [lastKnownVersionSha]. - * - * Unlike [lastKnownVersionSha], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("lastKnownVersionSha") - @ExcludeMissing - fun _lastKnownVersionSha(): JsonField = lastKnownVersionSha - @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -462,7 +411,6 @@ private constructor( private var version: JsonField? = null private var document: JsonField? = null private var force: JsonField = JsonMissing.of() - private var lastKnownVersionSha: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -470,7 +418,6 @@ private constructor( version = body.version document = body.document force = body.force - lastKnownVersionSha = body.lastKnownVersionSha additionalProperties = body.additionalProperties.toMutableMap() } @@ -507,20 +454,6 @@ private constructor( */ fun force(force: JsonField) = apply { this.force = force } - fun lastKnownVersionSha(lastKnownVersionSha: String) = - lastKnownVersionSha(JsonField.of(lastKnownVersionSha)) - - /** - * Sets [Builder.lastKnownVersionSha] to an arbitrary JSON value. - * - * You should usually call [Builder.lastKnownVersionSha] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun lastKnownVersionSha(lastKnownVersionSha: JsonField) = apply { - this.lastKnownVersionSha = lastKnownVersionSha - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -558,7 +491,6 @@ private constructor( checkRequired("version", version), checkRequired("document", document), force, - lastKnownVersionSha, additionalProperties.toMutableMap(), ) } @@ -582,7 +514,6 @@ private constructor( version() document() force() - lastKnownVersionSha() validated = true } @@ -604,8 +535,7 @@ private constructor( internal fun validity(): Int = (if (version.asKnown().isPresent) 1 else 0) + (if (document.asKnown().isPresent) 1 else 0) + - (if (force.asKnown().isPresent) 1 else 0) + - (if (lastKnownVersionSha.asKnown().isPresent) 1 else 0) + (if (force.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -616,18 +546,17 @@ private constructor( version == other.version && document == other.document && force == other.force && - lastKnownVersionSha == other.lastKnownVersionSha && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(version, document, force, lastKnownVersionSha, additionalProperties) + Objects.hash(version, document, force, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "Body{version=$version, document=$document, force=$force, lastKnownVersionSha=$lastKnownVersionSha, additionalProperties=$additionalProperties}" + "Body{version=$version, document=$document, force=$force, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/registry/RegistryUpdateApiDocumentVersionParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/registry/RegistryUpdateApiDocumentVersionParams.kt index ee1739c..3a57a76 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/models/registry/RegistryUpdateApiDocumentVersionParams.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/registry/RegistryUpdateApiDocumentVersionParams.kt @@ -37,12 +37,6 @@ private constructor( */ fun document(): String = body.document() - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun lastKnownVersionSha(): Optional = body.lastKnownVersionSha() - fun namespace(): String = namespace fun slug(): String = slug @@ -56,14 +50,6 @@ private constructor( */ fun _document(): JsonField = body._document() - /** - * Returns the raw JSON value of [lastKnownVersionSha]. - * - * Unlike [lastKnownVersionSha], this method doesn't throw if the JSON field has an unexpected - * type. - */ - fun _lastKnownVersionSha(): JsonField = body._lastKnownVersionSha() - fun _additionalBodyProperties(): Map = body._additionalProperties() /** Additional headers to send with the request. */ @@ -128,7 +114,6 @@ private constructor( * This is generally only useful if you are already constructing the body separately. * Otherwise, it's more convenient to use the top-level setters instead: * - [document] - * - [lastKnownVersionSha] */ fun body(body: Body) = apply { this.body = body.toBuilder() } @@ -142,21 +127,6 @@ private constructor( */ fun document(document: JsonField) = apply { body.document(document) } - fun lastKnownVersionSha(lastKnownVersionSha: String) = apply { - body.lastKnownVersionSha(lastKnownVersionSha) - } - - /** - * Sets [Builder.lastKnownVersionSha] to an arbitrary JSON value. - * - * You should usually call [Builder.lastKnownVersionSha] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun lastKnownVersionSha(lastKnownVersionSha: JsonField) = apply { - body.lastKnownVersionSha(lastKnownVersionSha) - } - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { body.additionalProperties(additionalBodyProperties) } @@ -317,19 +287,13 @@ private constructor( @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val document: JsonField, - private val lastKnownVersionSha: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("document") - @ExcludeMissing - document: JsonField = JsonMissing.of(), - @JsonProperty("lastKnownVersionSha") - @ExcludeMissing - lastKnownVersionSha: JsonField = JsonMissing.of(), - ) : this(document, lastKnownVersionSha, mutableMapOf()) + @JsonProperty("document") @ExcludeMissing document: JsonField = JsonMissing.of() + ) : this(document, mutableMapOf()) /** * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is @@ -337,13 +301,6 @@ private constructor( */ fun document(): String = document.getRequired("document") - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun lastKnownVersionSha(): Optional = - lastKnownVersionSha.getOptional("lastKnownVersionSha") - /** * Returns the raw JSON value of [document]. * @@ -351,16 +308,6 @@ private constructor( */ @JsonProperty("document") @ExcludeMissing fun _document(): JsonField = document - /** - * Returns the raw JSON value of [lastKnownVersionSha]. - * - * Unlike [lastKnownVersionSha], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("lastKnownVersionSha") - @ExcludeMissing - fun _lastKnownVersionSha(): JsonField = lastKnownVersionSha - @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -390,13 +337,11 @@ private constructor( class Builder internal constructor() { private var document: JsonField? = null - private var lastKnownVersionSha: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(body: Body) = apply { document = body.document - lastKnownVersionSha = body.lastKnownVersionSha additionalProperties = body.additionalProperties.toMutableMap() } @@ -411,20 +356,6 @@ private constructor( */ fun document(document: JsonField) = apply { this.document = document } - fun lastKnownVersionSha(lastKnownVersionSha: String) = - lastKnownVersionSha(JsonField.of(lastKnownVersionSha)) - - /** - * Sets [Builder.lastKnownVersionSha] to an arbitrary JSON value. - * - * You should usually call [Builder.lastKnownVersionSha] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun lastKnownVersionSha(lastKnownVersionSha: JsonField) = apply { - this.lastKnownVersionSha = lastKnownVersionSha - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -457,11 +388,7 @@ private constructor( * @throws IllegalStateException if any required field is unset. */ fun build(): Body = - Body( - checkRequired("document", document), - lastKnownVersionSha, - additionalProperties.toMutableMap(), - ) + Body(checkRequired("document", document), additionalProperties.toMutableMap()) } private var validated: Boolean = false @@ -481,7 +408,6 @@ private constructor( } document() - lastKnownVersionSha() validated = true } @@ -499,10 +425,7 @@ private constructor( * * Used for best match union deserialization. */ - @JvmSynthetic - internal fun validity(): Int = - (if (document.asKnown().isPresent) 1 else 0) + - (if (lastKnownVersionSha.asKnown().isPresent) 1 else 0) + @JvmSynthetic internal fun validity(): Int = (if (document.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -511,18 +434,15 @@ private constructor( return other is Body && document == other.document && - lastKnownVersionSha == other.lastKnownVersionSha && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { - Objects.hash(document, lastKnownVersionSha, additionalProperties) - } + private val hashCode: Int by lazy { Objects.hash(document, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "Body{document=$document, lastKnownVersionSha=$lastKnownVersionSha, additionalProperties=$additionalProperties}" + "Body{document=$document, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/registry/RegistryUpdateApiDocumentVersionResponse.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/registry/RegistryUpdateApiDocumentVersionResponse.kt index 0ff089b..a0db3fe 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/models/registry/RegistryUpdateApiDocumentVersionResponse.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/registry/RegistryUpdateApiDocumentVersionResponse.kt @@ -20,7 +20,6 @@ class RegistryUpdateApiDocumentVersionResponse private constructor( private val jsonSha: JsonField, private val yamlSha: JsonField, - private val versionSha: JsonField, private val additionalProperties: MutableMap, ) { @@ -28,10 +27,7 @@ private constructor( private constructor( @JsonProperty("jsonSha") @ExcludeMissing jsonSha: JsonField = JsonMissing.of(), @JsonProperty("yamlSha") @ExcludeMissing yamlSha: JsonField = JsonMissing.of(), - @JsonProperty("versionSha") - @ExcludeMissing - versionSha: JsonField = JsonMissing.of(), - ) : this(jsonSha, yamlSha, versionSha, mutableMapOf()) + ) : this(jsonSha, yamlSha, mutableMapOf()) /** * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is @@ -45,12 +41,6 @@ private constructor( */ fun yamlSha(): String = yamlSha.getRequired("yamlSha") - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun versionSha(): String = versionSha.getRequired("versionSha") - /** * Returns the raw JSON value of [jsonSha]. * @@ -65,13 +55,6 @@ private constructor( */ @JsonProperty("yamlSha") @ExcludeMissing fun _yamlSha(): JsonField = yamlSha - /** - * Returns the raw JSON value of [versionSha]. - * - * Unlike [versionSha], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("versionSha") @ExcludeMissing fun _versionSha(): JsonField = versionSha - @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -94,7 +77,6 @@ private constructor( * ```kotlin * .jsonSha() * .yamlSha() - * .versionSha() * ``` */ @JvmStatic fun builder() = Builder() @@ -105,7 +87,6 @@ private constructor( private var jsonSha: JsonField? = null private var yamlSha: JsonField? = null - private var versionSha: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -114,7 +95,6 @@ private constructor( ) = apply { jsonSha = registryUpdateApiDocumentVersionResponse.jsonSha yamlSha = registryUpdateApiDocumentVersionResponse.yamlSha - versionSha = registryUpdateApiDocumentVersionResponse.versionSha additionalProperties = registryUpdateApiDocumentVersionResponse.additionalProperties.toMutableMap() } @@ -139,17 +119,6 @@ private constructor( */ fun yamlSha(yamlSha: JsonField) = apply { this.yamlSha = yamlSha } - fun versionSha(versionSha: String) = versionSha(JsonField.of(versionSha)) - - /** - * Sets [Builder.versionSha] to an arbitrary JSON value. - * - * You should usually call [Builder.versionSha] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun versionSha(versionSha: JsonField) = apply { this.versionSha = versionSha } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -178,7 +147,6 @@ private constructor( * ```kotlin * .jsonSha() * .yamlSha() - * .versionSha() * ``` * * @throws IllegalStateException if any required field is unset. @@ -187,7 +155,6 @@ private constructor( RegistryUpdateApiDocumentVersionResponse( checkRequired("jsonSha", jsonSha), checkRequired("yamlSha", yamlSha), - checkRequired("versionSha", versionSha), additionalProperties.toMutableMap(), ) } @@ -209,7 +176,6 @@ private constructor( jsonSha() yamlSha() - versionSha() validated = true } @@ -228,9 +194,7 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (jsonSha.asKnown().isPresent) 1 else 0) + - (if (yamlSha.asKnown().isPresent) 1 else 0) + - (if (versionSha.asKnown().isPresent) 1 else 0) + (if (jsonSha.asKnown().isPresent) 1 else 0) + (if (yamlSha.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -240,16 +204,13 @@ private constructor( return other is RegistryUpdateApiDocumentVersionResponse && jsonSha == other.jsonSha && yamlSha == other.yamlSha && - versionSha == other.versionSha && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { - Objects.hash(jsonSha, yamlSha, versionSha, additionalProperties) - } + private val hashCode: Int by lazy { Objects.hash(jsonSha, yamlSha, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "RegistryUpdateApiDocumentVersionResponse{jsonSha=$jsonSha, yamlSha=$yamlSha, versionSha=$versionSha, additionalProperties=$additionalProperties}" + "RegistryUpdateApiDocumentVersionResponse{jsonSha=$jsonSha, yamlSha=$yamlSha, additionalProperties=$additionalProperties}" } diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListGuidesResponse.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListGuidesResponse.kt index 5980107..45ec53d 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListGuidesResponse.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListGuidesResponse.kt @@ -28,10 +28,12 @@ private constructor( private val lastPublished: JsonField, private val lastPublishedUid: JsonField, private val loginPortalUid: JsonField, + private val userInfoHookUrl: JsonField, private val activeThemeId: JsonField, private val typesenseId: JsonField, private val isPrivate: JsonField, private val agentEnabled: JsonField, + private val analyticsEnabled: JsonField, private val accessGroups: JsonField, private val slug: JsonField, private val publishStatus: JsonField, @@ -58,6 +60,9 @@ private constructor( @JsonProperty("loginPortalUid") @ExcludeMissing loginPortalUid: JsonField = JsonMissing.of(), + @JsonProperty("userInfoHookUrl") + @ExcludeMissing + userInfoHookUrl: JsonField = JsonMissing.of(), @JsonProperty("activeThemeId") @ExcludeMissing activeThemeId: JsonField = JsonMissing.of(), @@ -68,6 +73,9 @@ private constructor( @JsonProperty("agentEnabled") @ExcludeMissing agentEnabled: JsonField = JsonMissing.of(), + @JsonProperty("analyticsEnabled") + @ExcludeMissing + analyticsEnabled: JsonField = JsonMissing.of(), @JsonProperty("accessGroups") @ExcludeMissing accessGroups: JsonField = JsonMissing.of(), @@ -90,10 +98,12 @@ private constructor( lastPublished, lastPublishedUid, loginPortalUid, + userInfoHookUrl, activeThemeId, typesenseId, isPrivate, agentEnabled, + analyticsEnabled, accessGroups, slug, publishStatus, @@ -151,6 +161,12 @@ private constructor( */ fun loginPortalUid(): String = loginPortalUid.getRequired("loginPortalUid") + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun userInfoHookUrl(): String = userInfoHookUrl.getRequired("userInfoHookUrl") + /** * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -175,6 +191,12 @@ private constructor( */ fun agentEnabled(): Boolean = agentEnabled.getRequired("agentEnabled") + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun analyticsEnabled(): Boolean = analyticsEnabled.getRequired("analyticsEnabled") + /** * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -271,6 +293,15 @@ private constructor( @ExcludeMissing fun _loginPortalUid(): JsonField = loginPortalUid + /** + * Returns the raw JSON value of [userInfoHookUrl]. + * + * Unlike [userInfoHookUrl], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("userInfoHookUrl") + @ExcludeMissing + fun _userInfoHookUrl(): JsonField = userInfoHookUrl + /** * Returns the raw JSON value of [activeThemeId]. * @@ -303,6 +334,16 @@ private constructor( @ExcludeMissing fun _agentEnabled(): JsonField = agentEnabled + /** + * Returns the raw JSON value of [analyticsEnabled]. + * + * Unlike [analyticsEnabled], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("analyticsEnabled") + @ExcludeMissing + fun _analyticsEnabled(): JsonField = analyticsEnabled + /** * Returns the raw JSON value of [accessGroups]. * @@ -371,9 +412,11 @@ private constructor( * .lastPublished() * .lastPublishedUid() * .loginPortalUid() + * .userInfoHookUrl() * .activeThemeId() * .isPrivate() * .agentEnabled() + * .analyticsEnabled() * .accessGroups() * .slug() * .publishStatus() @@ -394,10 +437,12 @@ private constructor( private var lastPublished: JsonField? = null private var lastPublishedUid: JsonField? = null private var loginPortalUid: JsonField? = null + private var userInfoHookUrl: JsonField? = null private var activeThemeId: JsonField? = null private var typesenseId: JsonField = JsonMissing.of() private var isPrivate: JsonField? = null private var agentEnabled: JsonField? = null + private var analyticsEnabled: JsonField? = null private var accessGroups: JsonField? = null private var slug: JsonField? = null private var publishStatus: JsonField? = null @@ -415,10 +460,12 @@ private constructor( lastPublished = scalarDocListGuidesResponse.lastPublished lastPublishedUid = scalarDocListGuidesResponse.lastPublishedUid loginPortalUid = scalarDocListGuidesResponse.loginPortalUid + userInfoHookUrl = scalarDocListGuidesResponse.userInfoHookUrl activeThemeId = scalarDocListGuidesResponse.activeThemeId typesenseId = scalarDocListGuidesResponse.typesenseId isPrivate = scalarDocListGuidesResponse.isPrivate agentEnabled = scalarDocListGuidesResponse.agentEnabled + analyticsEnabled = scalarDocListGuidesResponse.analyticsEnabled accessGroups = scalarDocListGuidesResponse.accessGroups slug = scalarDocListGuidesResponse.slug publishStatus = scalarDocListGuidesResponse.publishStatus @@ -539,6 +586,20 @@ private constructor( this.loginPortalUid = loginPortalUid } + fun userInfoHookUrl(userInfoHookUrl: String) = + userInfoHookUrl(JsonField.of(userInfoHookUrl)) + + /** + * Sets [Builder.userInfoHookUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.userInfoHookUrl] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun userInfoHookUrl(userInfoHookUrl: JsonField) = apply { + this.userInfoHookUrl = userInfoHookUrl + } + fun activeThemeId(activeThemeId: String) = activeThemeId(JsonField.of(activeThemeId)) /** @@ -587,6 +648,20 @@ private constructor( this.agentEnabled = agentEnabled } + fun analyticsEnabled(analyticsEnabled: Boolean) = + analyticsEnabled(JsonField.of(analyticsEnabled)) + + /** + * Sets [Builder.analyticsEnabled] to an arbitrary JSON value. + * + * You should usually call [Builder.analyticsEnabled] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun analyticsEnabled(analyticsEnabled: JsonField) = apply { + this.analyticsEnabled = analyticsEnabled + } + fun accessGroups(accessGroups: Any?) = accessGroups(JsonField.ofNullable(accessGroups)) /** Alias for calling [Builder.accessGroups] with `accessGroups.orElse(null)`. */ @@ -685,9 +760,11 @@ private constructor( * .lastPublished() * .lastPublishedUid() * .loginPortalUid() + * .userInfoHookUrl() * .activeThemeId() * .isPrivate() * .agentEnabled() + * .analyticsEnabled() * .accessGroups() * .slug() * .publishStatus() @@ -706,10 +783,12 @@ private constructor( checkRequired("lastPublished", lastPublished), checkRequired("lastPublishedUid", lastPublishedUid), checkRequired("loginPortalUid", loginPortalUid), + checkRequired("userInfoHookUrl", userInfoHookUrl), checkRequired("activeThemeId", activeThemeId), typesenseId, checkRequired("isPrivate", isPrivate), checkRequired("agentEnabled", agentEnabled), + checkRequired("analyticsEnabled", analyticsEnabled), checkRequired("accessGroups", accessGroups), checkRequired("slug", slug), checkRequired("publishStatus", publishStatus), @@ -742,10 +821,12 @@ private constructor( lastPublished() lastPublishedUid() loginPortalUid() + userInfoHookUrl() activeThemeId() typesenseId() isPrivate() agentEnabled() + analyticsEnabled() accessGroups() slug() publishStatus() @@ -777,10 +858,12 @@ private constructor( (if (lastPublished.asKnown().isPresent) 1 else 0) + (if (lastPublishedUid.asKnown().isPresent) 1 else 0) + (if (loginPortalUid.asKnown().isPresent) 1 else 0) + + (if (userInfoHookUrl.asKnown().isPresent) 1 else 0) + (if (activeThemeId.asKnown().isPresent) 1 else 0) + (if (typesenseId.asKnown().isPresent) 1 else 0) + (if (isPrivate.asKnown().isPresent) 1 else 0) + (if (agentEnabled.asKnown().isPresent) 1 else 0) + + (if (analyticsEnabled.asKnown().isPresent) 1 else 0) + (if (accessGroups.asKnown().isPresent) 1 else 0) + (if (slug.asKnown().isPresent) 1 else 0) + (if (publishStatus.asKnown().isPresent) 1 else 0) + @@ -1531,10 +1614,12 @@ private constructor( lastPublished == other.lastPublished && lastPublishedUid == other.lastPublishedUid && loginPortalUid == other.loginPortalUid && + userInfoHookUrl == other.userInfoHookUrl && activeThemeId == other.activeThemeId && typesenseId == other.typesenseId && isPrivate == other.isPrivate && agentEnabled == other.agentEnabled && + analyticsEnabled == other.analyticsEnabled && accessGroups == other.accessGroups && slug == other.slug && publishStatus == other.publishStatus && @@ -1553,10 +1638,12 @@ private constructor( lastPublished, lastPublishedUid, loginPortalUid, + userInfoHookUrl, activeThemeId, typesenseId, isPrivate, agentEnabled, + analyticsEnabled, accessGroups, slug, publishStatus, @@ -1569,5 +1656,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "ScalarDocListGuidesResponse{uid=$uid, createdAt=$createdAt, updatedAt=$updatedAt, name=$name, activeDeployment=$activeDeployment, lastPublished=$lastPublished, lastPublishedUid=$lastPublishedUid, loginPortalUid=$loginPortalUid, activeThemeId=$activeThemeId, typesenseId=$typesenseId, isPrivate=$isPrivate, agentEnabled=$agentEnabled, accessGroups=$accessGroups, slug=$slug, publishStatus=$publishStatus, publishMessage=$publishMessage, repository=$repository, additionalProperties=$additionalProperties}" + "ScalarDocListGuidesResponse{uid=$uid, createdAt=$createdAt, updatedAt=$updatedAt, name=$name, activeDeployment=$activeDeployment, lastPublished=$lastPublished, lastPublishedUid=$lastPublishedUid, loginPortalUid=$loginPortalUid, userInfoHookUrl=$userInfoHookUrl, activeThemeId=$activeThemeId, typesenseId=$typesenseId, isPrivate=$isPrivate, agentEnabled=$agentEnabled, analyticsEnabled=$analyticsEnabled, accessGroups=$accessGroups, slug=$slug, publishStatus=$publishStatus, publishMessage=$publishMessage, repository=$repository, additionalProperties=$additionalProperties}" } diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/schemas/SchemaListResponse.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/schemas/SchemaListResponse.kt index 3e79965..273f44e 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/models/schemas/SchemaListResponse.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/schemas/SchemaListResponse.kt @@ -16,6 +16,7 @@ import com.scalar.core.toImmutable import com.scalar.errors.ScalarInvalidDataException import java.util.Collections import java.util.Objects +import java.util.Optional import kotlin.jvm.optionals.getOrNull class SchemaListResponse @@ -385,6 +386,8 @@ private constructor( private val createdAt: JsonField, private val updatedAt: JsonField, private val version: JsonField, + private val yamlSha: JsonField, + private val jsonSha: JsonField, private val additionalProperties: MutableMap, ) { @@ -398,7 +401,9 @@ private constructor( @ExcludeMissing updatedAt: JsonField = JsonMissing.of(), @JsonProperty("version") @ExcludeMissing version: JsonField = JsonMissing.of(), - ) : this(uid, createdAt, updatedAt, version, mutableMapOf()) + @JsonProperty("yamlSha") @ExcludeMissing yamlSha: JsonField = JsonMissing.of(), + @JsonProperty("jsonSha") @ExcludeMissing jsonSha: JsonField = JsonMissing.of(), + ) : this(uid, createdAt, updatedAt, version, yamlSha, jsonSha, mutableMapOf()) /** * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is @@ -424,6 +429,18 @@ private constructor( */ fun version(): String = version.getRequired("version") + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun yamlSha(): Optional = yamlSha.getOptional("yamlSha") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun jsonSha(): Optional = jsonSha.getOptional("jsonSha") + /** * Returns the raw JSON value of [uid]. * @@ -452,6 +469,20 @@ private constructor( */ @JsonProperty("version") @ExcludeMissing fun _version(): JsonField = version + /** + * Returns the raw JSON value of [yamlSha]. + * + * Unlike [yamlSha], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("yamlSha") @ExcludeMissing fun _yamlSha(): JsonField = yamlSha + + /** + * Returns the raw JSON value of [jsonSha]. + * + * Unlike [jsonSha], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("jsonSha") @ExcludeMissing fun _jsonSha(): JsonField = jsonSha + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -487,6 +518,8 @@ private constructor( private var createdAt: JsonField? = null private var updatedAt: JsonField? = null private var version: JsonField? = null + private var yamlSha: JsonField = JsonMissing.of() + private var jsonSha: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -495,6 +528,8 @@ private constructor( createdAt = version.createdAt updatedAt = version.updatedAt this.version = version.version + yamlSha = version.yamlSha + jsonSha = version.jsonSha additionalProperties = version.additionalProperties.toMutableMap() } @@ -542,6 +577,28 @@ private constructor( */ fun version(version: JsonField) = apply { this.version = version } + fun yamlSha(yamlSha: String) = yamlSha(JsonField.of(yamlSha)) + + /** + * Sets [Builder.yamlSha] to an arbitrary JSON value. + * + * You should usually call [Builder.yamlSha] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun yamlSha(yamlSha: JsonField) = apply { this.yamlSha = yamlSha } + + fun jsonSha(jsonSha: String) = jsonSha(JsonField.of(jsonSha)) + + /** + * Sets [Builder.jsonSha] to an arbitrary JSON value. + * + * You should usually call [Builder.jsonSha] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun jsonSha(jsonSha: JsonField) = apply { this.jsonSha = jsonSha } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -582,6 +639,8 @@ private constructor( checkRequired("createdAt", createdAt), checkRequired("updatedAt", updatedAt), checkRequired("version", version), + yamlSha, + jsonSha, additionalProperties.toMutableMap(), ) } @@ -606,6 +665,8 @@ private constructor( createdAt() updatedAt() version() + yamlSha() + jsonSha() validated = true } @@ -628,7 +689,9 @@ private constructor( (if (uid.asKnown().isPresent) 1 else 0) + (if (createdAt.asKnown().isPresent) 1 else 0) + (if (updatedAt.asKnown().isPresent) 1 else 0) + - (if (version.asKnown().isPresent) 1 else 0) + (if (version.asKnown().isPresent) 1 else 0) + + (if (yamlSha.asKnown().isPresent) 1 else 0) + + (if (jsonSha.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -640,17 +703,27 @@ private constructor( createdAt == other.createdAt && updatedAt == other.updatedAt && version == other.version && + yamlSha == other.yamlSha && + jsonSha == other.jsonSha && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(uid, createdAt, updatedAt, version, additionalProperties) + Objects.hash( + uid, + createdAt, + updatedAt, + version, + yamlSha, + jsonSha, + additionalProperties, + ) } override fun hashCode(): Int = hashCode override fun toString() = - "Version{uid=$uid, createdAt=$createdAt, updatedAt=$updatedAt, version=$version, additionalProperties=$additionalProperties}" + "Version{uid=$uid, createdAt=$createdAt, updatedAt=$updatedAt, version=$version, yamlSha=$yamlSha, jsonSha=$jsonSha, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/schemas/version/VersionCreateParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/schemas/version/VersionCreateParams.kt index 318683e..3ed2e6d 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/models/schemas/version/VersionCreateParams.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/schemas/version/VersionCreateParams.kt @@ -42,6 +42,12 @@ private constructor( */ fun document(): String = body.document() + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun force(): Optional = body.force() + fun namespace(): String = namespace fun slug(): Optional = Optional.ofNullable(slug) @@ -60,6 +66,13 @@ private constructor( */ fun _document(): JsonField = body._document() + /** + * Returns the raw JSON value of [force]. + * + * Unlike [force], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _force(): JsonField = body._force() + fun _additionalBodyProperties(): Map = body._additionalProperties() /** Additional headers to send with the request. */ @@ -117,6 +130,7 @@ private constructor( * Otherwise, it's more convenient to use the top-level setters instead: * - [version] * - [document] + * - [force] */ fun body(body: Body) = apply { this.body = body.toBuilder() } @@ -140,6 +154,16 @@ private constructor( */ fun document(document: JsonField) = apply { body.document(document) } + fun force(force: Boolean) = apply { body.force(force) } + + /** + * Sets [Builder.force] to an arbitrary JSON value. + * + * You should usually call [Builder.force] with a well-typed [Boolean] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun force(force: JsonField) = apply { body.force(force) } + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { body.additionalProperties(additionalBodyProperties) } @@ -299,6 +323,7 @@ private constructor( private constructor( private val version: JsonField, private val document: JsonField, + private val force: JsonField, private val additionalProperties: MutableMap, ) { @@ -308,7 +333,8 @@ private constructor( @JsonProperty("document") @ExcludeMissing document: JsonField = JsonMissing.of(), - ) : this(version, document, mutableMapOf()) + @JsonProperty("force") @ExcludeMissing force: JsonField = JsonMissing.of(), + ) : this(version, document, force, mutableMapOf()) /** * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is @@ -322,6 +348,12 @@ private constructor( */ fun document(): String = document.getRequired("document") + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun force(): Optional = force.getOptional("force") + /** * Returns the raw JSON value of [version]. * @@ -336,6 +368,13 @@ private constructor( */ @JsonProperty("document") @ExcludeMissing fun _document(): JsonField = document + /** + * Returns the raw JSON value of [force]. + * + * Unlike [force], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("force") @ExcludeMissing fun _force(): JsonField = force + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -367,12 +406,14 @@ private constructor( private var version: JsonField? = null private var document: JsonField? = null + private var force: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(body: Body) = apply { version = body.version document = body.document + force = body.force additionalProperties = body.additionalProperties.toMutableMap() } @@ -398,6 +439,17 @@ private constructor( */ fun document(document: JsonField) = apply { this.document = document } + fun force(force: Boolean) = force(JsonField.of(force)) + + /** + * Sets [Builder.force] to an arbitrary JSON value. + * + * You should usually call [Builder.force] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun force(force: JsonField) = apply { this.force = force } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -434,6 +486,7 @@ private constructor( Body( checkRequired("version", version), checkRequired("document", document), + force, additionalProperties.toMutableMap(), ) } @@ -456,6 +509,7 @@ private constructor( version() document() + force() validated = true } @@ -476,7 +530,8 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (version.asKnown().isPresent) 1 else 0) + - (if (document.asKnown().isPresent) 1 else 0) + (if (document.asKnown().isPresent) 1 else 0) + + (if (force.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -486,15 +541,18 @@ private constructor( return other is Body && version == other.version && document == other.document && + force == other.force && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(version, document, additionalProperties) } + private val hashCode: Int by lazy { + Objects.hash(version, document, force, additionalProperties) + } override fun hashCode(): Int = hashCode override fun toString() = - "Body{version=$version, document=$document, additionalProperties=$additionalProperties}" + "Body{version=$version, document=$document, force=$force, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/schemas/version/VersionCreateResponse.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/schemas/version/VersionCreateResponse.kt new file mode 100644 index 0000000..2730393 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/schemas/version/VersionCreateResponse.kt @@ -0,0 +1,175 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.schemas.version + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.checkRequired +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects + +class VersionCreateResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val uid: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("uid") @ExcludeMissing uid: JsonField = JsonMissing.of() + ) : this(uid, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun uid(): String = uid.getRequired("uid") + + /** + * Returns the raw JSON value of [uid]. + * + * Unlike [uid], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("uid") @ExcludeMissing fun _uid(): JsonField = uid + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [VersionCreateResponse]. + * + * The following fields are required: + * ```kotlin + * .uid() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [VersionCreateResponse]. */ + class Builder internal constructor() { + + private var uid: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(versionCreateResponse: VersionCreateResponse) = apply { + uid = versionCreateResponse.uid + additionalProperties = versionCreateResponse.additionalProperties.toMutableMap() + } + + fun uid(uid: String) = uid(JsonField.of(uid)) + + /** + * Sets [Builder.uid] to an arbitrary JSON value. + * + * You should usually call [Builder.uid] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun uid(uid: JsonField) = apply { this.uid = uid } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [VersionCreateResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .uid() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): VersionCreateResponse = + VersionCreateResponse(checkRequired("uid", uid), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): VersionCreateResponse = apply { + if (validated) { + return@apply + } + + uid() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (if (uid.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is VersionCreateResponse && + uid == other.uid && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(uid, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "VersionCreateResponse{uid=$uid, additionalProperties=$additionalProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/schemas/VersionServiceAsync.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/schemas/VersionServiceAsync.kt index 1ccd2c3..1c4db86 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/async/schemas/VersionServiceAsync.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/schemas/VersionServiceAsync.kt @@ -5,8 +5,8 @@ package com.scalar.services.async.schemas import com.scalar.core.ClientOptions import com.scalar.core.RequestOptions import com.scalar.core.http.HttpResponseFor -import com.scalar.models.Uid import com.scalar.models.schemas.version.VersionCreateParams +import com.scalar.models.schemas.version.VersionCreateResponse import com.scalar.models.schemas.version.VersionDeleteParams import com.scalar.models.schemas.version.VersionRetrieveParams import java.util.concurrent.CompletableFuture @@ -28,24 +28,27 @@ interface VersionServiceAsync { fun withOptions(modifier: Consumer): VersionServiceAsync /** Create a schema version. */ - fun create(slug: String, params: VersionCreateParams): CompletableFuture = - create(slug, params, RequestOptions.none()) + fun create( + slug: String, + params: VersionCreateParams, + ): CompletableFuture = create(slug, params, RequestOptions.none()) /** @see create */ fun create( slug: String, params: VersionCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = create(params.toBuilder().slug(slug).build(), requestOptions) + ): CompletableFuture = + create(params.toBuilder().slug(slug).build(), requestOptions) /** @see create */ fun create( params: VersionCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture + ): CompletableFuture /** @see create */ - fun create(params: VersionCreateParams): CompletableFuture = + fun create(params: VersionCreateParams): CompletableFuture = create(params, RequestOptions.none()) /** Get a specific schema version document. */ @@ -112,24 +115,27 @@ interface VersionServiceAsync { fun create( slug: String, params: VersionCreateParams, - ): CompletableFuture> = create(slug, params, RequestOptions.none()) + ): CompletableFuture> = + create(slug, params, RequestOptions.none()) /** @see create */ fun create( slug: String, params: VersionCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = + ): CompletableFuture> = create(params.toBuilder().slug(slug).build(), requestOptions) /** @see create */ fun create( params: VersionCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> + ): CompletableFuture> /** @see create */ - fun create(params: VersionCreateParams): CompletableFuture> = + fun create( + params: VersionCreateParams + ): CompletableFuture> = create(params, RequestOptions.none()) /** diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/schemas/VersionServiceAsyncImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/schemas/VersionServiceAsyncImpl.kt index f46adb4..acb40f9 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/async/schemas/VersionServiceAsyncImpl.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/schemas/VersionServiceAsyncImpl.kt @@ -17,8 +17,8 @@ import com.scalar.core.http.HttpResponseFor import com.scalar.core.http.json import com.scalar.core.http.parseable import com.scalar.core.prepareAsync -import com.scalar.models.Uid import com.scalar.models.schemas.version.VersionCreateParams +import com.scalar.models.schemas.version.VersionCreateResponse import com.scalar.models.schemas.version.VersionDeleteParams import com.scalar.models.schemas.version.VersionRetrieveParams import java.util.concurrent.CompletableFuture @@ -41,7 +41,7 @@ class VersionServiceAsyncImpl internal constructor(private val clientOptions: Cl override fun create( params: VersionCreateParams, requestOptions: RequestOptions, - ): CompletableFuture = + ): CompletableFuture = // post /v1/schemas/{namespace}/{slug}/version withRawResponse().create(params, requestOptions).thenApply { it.parse() } @@ -72,12 +72,13 @@ class VersionServiceAsyncImpl internal constructor(private val clientOptions: Cl clientOptions.toBuilder().apply(modifier::accept).build() ) - private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) override fun create( params: VersionCreateParams, requestOptions: RequestOptions, - ): CompletableFuture> { + ): CompletableFuture> { // We check here instead of in the params builder because this can be specified // positionally or in the params class. checkRequired("slug", params.slug().getOrNull()) diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/schemas/VersionService.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/schemas/VersionService.kt index 8752c7c..b540caa 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/schemas/VersionService.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/schemas/VersionService.kt @@ -6,8 +6,8 @@ import com.google.errorprone.annotations.MustBeClosed import com.scalar.core.ClientOptions import com.scalar.core.RequestOptions import com.scalar.core.http.HttpResponseFor -import com.scalar.models.Uid import com.scalar.models.schemas.version.VersionCreateParams +import com.scalar.models.schemas.version.VersionCreateResponse import com.scalar.models.schemas.version.VersionDeleteParams import com.scalar.models.schemas.version.VersionRetrieveParams import java.util.function.Consumer @@ -28,7 +28,7 @@ interface VersionService { fun withOptions(modifier: Consumer): VersionService /** Create a schema version. */ - fun create(slug: String, params: VersionCreateParams): Uid = + fun create(slug: String, params: VersionCreateParams): VersionCreateResponse = create(slug, params, RequestOptions.none()) /** @see create */ @@ -36,16 +36,17 @@ interface VersionService { slug: String, params: VersionCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): Uid = create(params.toBuilder().slug(slug).build(), requestOptions) + ): VersionCreateResponse = create(params.toBuilder().slug(slug).build(), requestOptions) /** @see create */ fun create( params: VersionCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): Uid + ): VersionCreateResponse /** @see create */ - fun create(params: VersionCreateParams): Uid = create(params, RequestOptions.none()) + fun create(params: VersionCreateParams): VersionCreateResponse = + create(params, RequestOptions.none()) /** Get a specific schema version document. */ fun retrieve(semver: String, params: VersionRetrieveParams): String = @@ -102,8 +103,10 @@ interface VersionService { * otherwise the same as [VersionService.create]. */ @MustBeClosed - fun create(slug: String, params: VersionCreateParams): HttpResponseFor = - create(slug, params, RequestOptions.none()) + fun create( + slug: String, + params: VersionCreateParams, + ): HttpResponseFor = create(slug, params, RequestOptions.none()) /** @see create */ @MustBeClosed @@ -111,18 +114,19 @@ interface VersionService { slug: String, params: VersionCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = create(params.toBuilder().slug(slug).build(), requestOptions) + ): HttpResponseFor = + create(params.toBuilder().slug(slug).build(), requestOptions) /** @see create */ @MustBeClosed fun create( params: VersionCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor + ): HttpResponseFor /** @see create */ @MustBeClosed - fun create(params: VersionCreateParams): HttpResponseFor = + fun create(params: VersionCreateParams): HttpResponseFor = create(params, RequestOptions.none()) /** diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/schemas/VersionServiceImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/schemas/VersionServiceImpl.kt index ab70f67..cc91fe6 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/schemas/VersionServiceImpl.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/schemas/VersionServiceImpl.kt @@ -17,8 +17,8 @@ import com.scalar.core.http.HttpResponseFor import com.scalar.core.http.json import com.scalar.core.http.parseable import com.scalar.core.prepare -import com.scalar.models.Uid import com.scalar.models.schemas.version.VersionCreateParams +import com.scalar.models.schemas.version.VersionCreateResponse import com.scalar.models.schemas.version.VersionDeleteParams import com.scalar.models.schemas.version.VersionRetrieveParams import java.util.function.Consumer @@ -37,7 +37,10 @@ class VersionServiceImpl internal constructor(private val clientOptions: ClientO override fun withOptions(modifier: Consumer): VersionService = VersionServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - override fun create(params: VersionCreateParams, requestOptions: RequestOptions): Uid = + override fun create( + params: VersionCreateParams, + requestOptions: RequestOptions, + ): VersionCreateResponse = // post /v1/schemas/{namespace}/{slug}/version withRawResponse().create(params, requestOptions).parse() @@ -62,12 +65,13 @@ class VersionServiceImpl internal constructor(private val clientOptions: ClientO clientOptions.toBuilder().apply(modifier::accept).build() ) - private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) override fun create( params: VersionCreateParams, requestOptions: RequestOptions, - ): HttpResponseFor { + ): HttpResponseFor { // We check here instead of in the params builder because this can be specified // positionally or in the params class. checkRequired("slug", params.slug().getOrNull()) diff --git a/scalar-java-proguard-test/src/test/kotlin/com/scalar/proguard/ProGuardCompatibilityTest.kt b/scalar-java-proguard-test/src/test/kotlin/com/scalar/proguard/ProGuardCompatibilityTest.kt index 2b5cf62..ef7f441 100644 --- a/scalar-java-proguard-test/src/test/kotlin/com/scalar/proguard/ProGuardCompatibilityTest.kt +++ b/scalar-java-proguard-test/src/test/kotlin/com/scalar/proguard/ProGuardCompatibilityTest.kt @@ -45,7 +45,8 @@ internal class ProGuardCompatibilityTest { @Test fun clientResolvesEveryService() { - val client = ScalarOkHttpClient.builder().bearerAuth("My Bearer Auth").build() + val client = + ScalarOkHttpClient.builder().bearerAuth("My Bearer Auth").oAuth2("My O Auth2").build() assertNotNull(client.registry()) assertNotNull(client.schemas()) diff --git a/scalar-sdk.manifest.json b/scalar-sdk.manifest.json index 7a423b0..be91ffa 100644 --- a/scalar-sdk.manifest.json +++ b/scalar-sdk.manifest.json @@ -1,7 +1,7 @@ { "name": "Scalar", "slug": "scalar", - "generatorVersion": "0.32.14", + "generatorVersion": "0.36.0", "servers": [ "https://access.scalar.com" ], @@ -12,13 +12,31 @@ "production" ], "auth": [ - "bearer" + "bearer", + "oauth2" ], "authDetails": [ { "kind": "bearer", "id": "BearerAuth", "bearerFormat": "JWT" + }, + { + "kind": "oauth2", + "id": "OAuth2", + "flows": [ + { + "kind": "authorizationCode", + "authorizationUrl": "https://access.scalar.com/v1/oauth/authorize", + "tokenUrl": "https://access.scalar.com/v1/oauth/token", + "refreshUrl": "https://access.scalar.com/v1/oauth/token", + "scopes": [ + "read", + "write", + "admin" + ] + } + ] } ], "clientHeaderParams": [], @@ -358,7 +376,7 @@ "type": "string", "validation": { "pattern": "^[a-z](?:[a-z0-9-]*[a-z0-9])?$", - "minLength": 3, + "minLength": 1, "maxLength": 60 } } @@ -373,7 +391,7 @@ "type": "string", "validation": { "pattern": "^[a-zA-Z0-9-_]+$", - "minLength": 3, + "minLength": 2, "maxLength": 50 } } @@ -426,6 +444,28 @@ "type": "boolean" } }, + { + "name": "endpointCount", + "publicName": "endpointCount", + "required": true, + "deprecated": false, + "type": { + "kind": "union", + "variants": [ + { + "kind": "primitive", + "type": "integer", + "validation": { + "minimum": -9007199254740991, + "maximum": 9007199254740991 + } + }, + { + "kind": "null" + } + ] + } + }, { "name": "embedStatus", "publicName": "embedStatus", @@ -546,16 +586,6 @@ "kind": "primitive", "type": "string" } - }, - { - "name": "versionSha", - "publicName": "versionSha", - "required": false, - "deprecated": false, - "type": { - "kind": "primitive", - "type": "string" - } } ], "additionalProperties": false @@ -576,6 +606,7 @@ "patch", "post", "put", + "query", "trace" ], "names": [ @@ -586,6 +617,7 @@ "Patch", "Post", "Put", + "Query", "Trace" ], "deprecations": [ @@ -596,6 +628,7 @@ false, false, false, + false, false ] } @@ -757,6 +790,32 @@ "kind": "ref", "name": "version" } + }, + { + "name": "yamlSha", + "publicName": "yamlSha", + "required": false, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "pattern": "^[a-f0-9]{64}$" + } + } + }, + { + "name": "jsonSha", + "publicName": "jsonSha", + "required": false, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "pattern": "^[a-f0-9]{64}$" + } + } } ], "additionalProperties": false @@ -1368,6 +1427,20 @@ "type": "string" } }, + { + "name": "email", + "source": "email", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "format": "email", + "validation": { + "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" + } + } + }, { "name": "github_project", "source": "github_project", @@ -1480,6 +1553,16 @@ "type": "string" } }, + { + "name": "userInfoHookUrl", + "publicName": "userInfoHookUrl", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, { "name": "activeThemeId", "publicName": "activeThemeId", @@ -1520,6 +1603,16 @@ "type": "boolean" } }, + { + "name": "analyticsEnabled", + "publicName": "analyticsEnabled", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "boolean" + } + }, { "name": "accessGroups", "publicName": "accessGroups", @@ -1728,20 +1821,6 @@ "additionalProperties": false } }, - { - "name": "email", - "source": "email", - "publicAliases": [], - "deprecated": false, - "type": { - "kind": "primitive", - "type": "string", - "format": "email", - "validation": { - "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" - } - } - }, { "name": "team_summary", "source": "team_summary", @@ -2978,21 +3057,15 @@ "headerParams": [], "publicHeaderParams": [], "bodyParams": [ - "document", - "lastKnownVersionSha" + "document" ], "publicBodyParams": [ - "document", - "lastKnownVersionSha" + "document" ], "bodyParamDetails": [ { "name": "document", "required": true - }, - { - "name": "lastKnownVersionSha", - "required": false } ], "pathParamDetails": [ @@ -3520,14 +3593,12 @@ "bodyParams": [ "version", "document", - "force", - "lastKnownVersionSha" + "force" ], "publicBodyParams": [ "version", "document", - "force", - "lastKnownVersionSha" + "force" ], "bodyParamDetails": [ { @@ -3541,10 +3612,6 @@ { "name": "force", "required": false - }, - { - "name": "lastKnownVersionSha", - "required": false } ], "pathParamDetails": [ @@ -5155,11 +5222,13 @@ "publicHeaderParams": [], "bodyParams": [ "version", - "document" + "document", + "force" ], "publicBodyParams": [ "version", - "document" + "document", + "force" ], "bodyParamDetails": [ { @@ -5169,6 +5238,10 @@ { "name": "document", "required": true + }, + { + "name": "force", + "required": false } ], "pathParamDetails": [ @@ -5217,10 +5290,6 @@ } ] }, - "responseModel": { - "name": "uid", - "publicAliases": [] - }, "result": { "successStatus": "200", "errorStatuses": [ diff --git a/tests/smoke-test.java b/tests/smoke-test.java index 6000efa..f3f9d7a 100644 --- a/tests/smoke-test.java +++ b/tests/smoke-test.java @@ -56,7 +56,7 @@ final class SmokeTest { private static final ScalarClient client = - ScalarOkHttpClient.builder().fromEnv().maxRetries(0).timeout(Duration.ofSeconds(30)).build(); + ScalarOkHttpClient.builder().fromEnv().maxRetries(2).timeout(Duration.ofSeconds(10)).build(); private record SmokeResult( String operation, @@ -161,18 +161,6 @@ private static void _smokeCase8() throws Exception { } private static void _smokeCase9() throws Exception { - RegistryUpdateApiDocumentVersionParams params = - RegistryUpdateApiDocumentVersionParams.builder() - .namespace("namespace") - .slug("slug") - .semver("semver") - .document("") - .lastKnownVersionSha("") - .build(); - var registry = client.registry().updateApiDocumentVersion(params); - } - - private static void _smokeCase10() throws Exception { RegistryDeleteApiDocumentVersionParams params = RegistryDeleteApiDocumentVersionParams.builder() .namespace("namespace") @@ -182,7 +170,7 @@ private static void _smokeCase10() throws Exception { var registry = client.registry().deleteApiDocumentVersion(params); } - private static void _smokeCase11() throws Exception { + private static void _smokeCase10() throws Exception { RegistryListApiDocumentVersionMetadataParams params = RegistryListApiDocumentVersionMetadataParams.builder() .namespace("namespace") @@ -192,7 +180,7 @@ private static void _smokeCase11() throws Exception { var registry = client.registry().listApiDocumentVersionMetadata(params); } - private static void _smokeCase12() throws Exception { + private static void _smokeCase11() throws Exception { RegistryCreateApiDocumentVersionParams params = RegistryCreateApiDocumentVersionParams.builder() .namespace("namespace") @@ -203,7 +191,7 @@ private static void _smokeCase12() throws Exception { var registry = client.registry().createApiDocumentVersion(params); } - private static void _smokeCase13() throws Exception { + private static void _smokeCase12() throws Exception { RegistryCreateApiDocumentVersionParams params = RegistryCreateApiDocumentVersionParams.builder() .namespace("namespace") @@ -211,37 +199,36 @@ private static void _smokeCase13() throws Exception { .version("x") .document("") .force(false) - .lastKnownVersionSha("") .build(); var registry = client.registry().createApiDocumentVersion(params); } - private static void _smokeCase14() throws Exception { + private static void _smokeCase13() throws Exception { RegistryCreateApiDocumentAccessGroupParams params = RegistryCreateApiDocumentAccessGroupParams.builder() .namespace("namespace") .slug("slug") - .accessGroup(AccessGroup.builder().accessGroupSlug("xxx").build()) + .accessGroup(AccessGroup.builder().accessGroupSlug("x").build()) .build(); var registry = client.registry().createApiDocumentAccessGroup(params); } - private static void _smokeCase15() throws Exception { + private static void _smokeCase14() throws Exception { RegistryDeleteApiDocumentAccessGroupParams params = RegistryDeleteApiDocumentAccessGroupParams.builder() .namespace("namespace") .slug("slug") - .accessGroup(AccessGroup.builder().accessGroupSlug("xxx").build()) + .accessGroup(AccessGroup.builder().accessGroupSlug("x").build()) .build(); var registry = client.registry().deleteApiDocumentAccessGroup(params); } - private static void _smokeCase16() throws Exception { + private static void _smokeCase15() throws Exception { SchemaListParams params = SchemaListParams.builder().namespace("namespace").build(); var schema = client.schemas().list(params); } - private static void _smokeCase17() throws Exception { + private static void _smokeCase16() throws Exception { SchemaCreateParams params = SchemaCreateParams.builder() .namespace("namespace") @@ -253,7 +240,7 @@ private static void _smokeCase17() throws Exception { var schema = client.schemas().create(params); } - private static void _smokeCase18() throws Exception { + private static void _smokeCase17() throws Exception { SchemaCreateParams params = SchemaCreateParams.builder() .namespace("namespace") @@ -267,13 +254,13 @@ private static void _smokeCase18() throws Exception { var schema = client.schemas().create(params); } - private static void _smokeCase19() throws Exception { + private static void _smokeCase18() throws Exception { SchemaUpdateParams params = SchemaUpdateParams.builder().namespace("namespace").slug("slug").build(); var schema = client.schemas().update(params); } - private static void _smokeCase20() throws Exception { + private static void _smokeCase19() throws Exception { SchemaUpdateParams params = SchemaUpdateParams.builder() .namespace("namespace") @@ -285,13 +272,13 @@ private static void _smokeCase20() throws Exception { var schema = client.schemas().update(params); } - private static void _smokeCase21() throws Exception { + private static void _smokeCase20() throws Exception { SchemaDeleteParams params = SchemaDeleteParams.builder().namespace("namespace").slug("slug").build(); var schema = client.schemas().delete(params); } - private static void _smokeCase22() throws Exception { + private static void _smokeCase21() throws Exception { VersionRetrieveParams params = VersionRetrieveParams.builder() .namespace("namespace") @@ -301,12 +288,23 @@ private static void _smokeCase22() throws Exception { var version = client.schemas().version().retrieve(params); } - private static void _smokeCase23() throws Exception { + private static void _smokeCase22() throws Exception { VersionDeleteParams params = VersionDeleteParams.builder().namespace("namespace").slug("slug").semver("semver").build(); var version = client.schemas().version().delete(params); } + private static void _smokeCase23() throws Exception { + VersionCreateParams params = + VersionCreateParams.builder() + .namespace("namespace") + .slug("slug") + .version("x") + .document("") + .build(); + var version = client.schemas().version().create(params); + } + private static void _smokeCase24() throws Exception { VersionCreateParams params = VersionCreateParams.builder() @@ -314,6 +312,7 @@ private static void _smokeCase24() throws Exception { .slug("slug") .version("x") .document("") + .force(false) .build(); var version = client.schemas().version().create(params); } @@ -323,7 +322,7 @@ private static void _smokeCase25() throws Exception { AccessGroupCreateParams.builder() .namespace("namespace") .slug("slug") - .accessGroup(AccessGroup.builder().accessGroupSlug("xxx").build()) + .accessGroup(AccessGroup.builder().accessGroupSlug("x").build()) .build(); var accessGroup = client.schemas().accessGroup().create(params); } @@ -333,7 +332,7 @@ private static void _smokeCase26() throws Exception { AccessGroupDeleteParams.builder() .namespace("namespace") .slug("slug") - .accessGroup(AccessGroup.builder().accessGroupSlug("xxx").build()) + .accessGroup(AccessGroup.builder().accessGroupSlug("x").build()) .build(); var accessGroup = client.schemas().accessGroup().delete(params); } @@ -373,7 +372,7 @@ private static void _smokeCase31() throws Exception { .title("Private Docs") .mainColor("#2a2f45") .mainBackground("#f6f6f6") - .cardColor("2a2f45") + .cardColor("#2a2f45") .cardBackground("#fff") .buttonColor("#fff") .buttonBackground("#0f0f0f") @@ -472,7 +471,7 @@ private static void _smokeCase40() throws Exception { RuleCreateRulesetAccessGroupParams.builder() .namespace("namespace") .slug("slug") - .accessGroup(AccessGroup.builder().accessGroupSlug("xxx").build()) + .accessGroup(AccessGroup.builder().accessGroupSlug("x").build()) .build(); var rule = client.rules().createRulesetAccessGroup(params); } @@ -482,7 +481,7 @@ private static void _smokeCase41() throws Exception { RuleDeleteRulesetAccessGroupParams.builder() .namespace("namespace") .slug("slug") - .accessGroup(AccessGroup.builder().accessGroupSlug("xxx").build()) + .accessGroup(AccessGroup.builder().accessGroupSlug("x").build()) .build(); var rule = client.rules().deleteRulesetAccessGroup(params); } @@ -552,7 +551,7 @@ private static void _smokeCase53() throws Exception { ScalarDocCreateGuideParams params = ScalarDocCreateGuideParams.builder() .name("") - .slug("xxx") + .slug("x") .isPrivate(false) .allowedUsers(java.util.List.of()) .allowedDomains(java.util.List.of()) @@ -624,90 +623,90 @@ private static void _smokeCase57() throws Exception { "updateApiDocumentVersion", "PATCH", "/v1/apis/{namespace}/{slug}/version/{semver}", - "required params", + "", SmokeTest::_smokeCase8), - new SmokeCase( - "updateApiDocumentVersion", - "PATCH", - "/v1/apis/{namespace}/{slug}/version/{semver}", - "all params", - SmokeTest::_smokeCase9), new SmokeCase( "deleteApiDocumentVersion", "DELETE", "/v1/apis/{namespace}/{slug}/version/{semver}", "", - SmokeTest::_smokeCase10), + SmokeTest::_smokeCase9), new SmokeCase( "listApiDocumentVersionMetadata", "GET", "/v1/apis/{namespace}/{slug}/version/{semver}/metadata", "", - SmokeTest::_smokeCase11), + SmokeTest::_smokeCase10), new SmokeCase( "createApiDocumentVersion", "POST", "/v1/apis/{namespace}/{slug}/version", "required params", - SmokeTest::_smokeCase12), + SmokeTest::_smokeCase11), new SmokeCase( "createApiDocumentVersion", "POST", "/v1/apis/{namespace}/{slug}/version", "all params", - SmokeTest::_smokeCase13), + SmokeTest::_smokeCase12), new SmokeCase( "createApiDocumentAccessGroup", "POST", "/v1/apis/{namespace}/{slug}/access-group", "", - SmokeTest::_smokeCase14), + SmokeTest::_smokeCase13), new SmokeCase( "deleteApiDocumentAccessGroup", "DELETE", "/v1/apis/{namespace}/{slug}/access-group", "", - SmokeTest::_smokeCase15), - new SmokeCase("list", "GET", "/v1/schemas/{namespace}", "", SmokeTest::_smokeCase16), + SmokeTest::_smokeCase14), + new SmokeCase("list", "GET", "/v1/schemas/{namespace}", "", SmokeTest::_smokeCase15), new SmokeCase( "create", "POST", "/v1/schemas/{namespace}", "required params", - SmokeTest::_smokeCase17), + SmokeTest::_smokeCase16), new SmokeCase( - "create", "POST", "/v1/schemas/{namespace}", "all params", SmokeTest::_smokeCase18), + "create", "POST", "/v1/schemas/{namespace}", "all params", SmokeTest::_smokeCase17), new SmokeCase( "update", "PATCH", "/v1/schemas/{namespace}/{slug}", "required params", - SmokeTest::_smokeCase19), + SmokeTest::_smokeCase18), new SmokeCase( "update", "PATCH", "/v1/schemas/{namespace}/{slug}", "all params", - SmokeTest::_smokeCase20), + SmokeTest::_smokeCase19), new SmokeCase( - "delete", "DELETE", "/v1/schemas/{namespace}/{slug}", "", SmokeTest::_smokeCase21), + "delete", "DELETE", "/v1/schemas/{namespace}/{slug}", "", SmokeTest::_smokeCase20), new SmokeCase( "retrieve", "GET", "/v1/schemas/{namespace}/{slug}/version/{semver}", "", - SmokeTest::_smokeCase22), + SmokeTest::_smokeCase21), new SmokeCase( "delete", "DELETE", "/v1/schemas/{namespace}/{slug}/version/{semver}", "", + SmokeTest::_smokeCase22), + new SmokeCase( + "create", + "POST", + "/v1/schemas/{namespace}/{slug}/version", + "required params", SmokeTest::_smokeCase23), new SmokeCase( "create", "POST", "/v1/schemas/{namespace}/{slug}/version", - "", + "all params", SmokeTest::_smokeCase24), new SmokeCase( "create", From 443f8c3daf74a9380e383d3db6632ab0fb339797 Mon Sep 17 00:00:00 2001 From: scalarbot Date: Fri, 2 Oct 2026 00:39:52 +0000 Subject: [PATCH 3/6] feat(api): add operation accessGroups.create (+66 more changes) - Added operation `accessGroups.create` (`POST /v1/access-groups`). - Added operation `accessGroups.retrieve` (`GET /v1/access-groups/{slug}`). - Added operation `accessGroups.update` (`PATCH /v1/access-groups/{slug}`). - Added operation `accessGroups.delete` (`DELETE /v1/access-groups/{slug}`). - Added operation `accessGroups.domains.create` (`POST /v1/access-groups/{slug}/domains`). - Added operation `accessGroups.domains.delete` (`DELETE /v1/access-groups/{slug}/domains`). - Added operation `teams.members.list` (`GET /v1/teams/members`). - Added operation `teams.members.update` (`PATCH /v1/teams/members/{uid}`). - Added operation `teams.members.delete` (`DELETE /v1/teams/members/{uid}`). - Added operation `teams.invites.member` (`POST /v1/teams/invites`). - Added operation `teams.invites.resend` (`PATCH /v1/teams/invites/{uid}`). - Added operation `teams.invites.cancel` (`DELETE /v1/teams/invites/{uid}`). - Added operation `scalarDocs.listProjects` (`GET /v1/docs`). - Added operation `scalarDocs.createProject` (`POST /v1/docs`). - Added operation `scalarDocs.retrieveProject` (`GET /v1/docs/{slug}`). - Added operation `scalarDocs.updateProject` (`PATCH /v1/docs/{slug}`). - Added operation `scalarDocs.deleteProject` (`DELETE /v1/docs/{slug}`). - Added operation `scalarDocs.publishProject` (`POST /v1/docs/{slug}/publish`). - Added operation `scalarDocs.listProjectConfig` (`GET /v1/docs/{slug}/config`). - Added operation `scalarDocs.updateProjectConfig` (`PUT /v1/docs/{slug}/config`). - Added operation `scalarDocs.listProjectDomain` (`GET /v1/docs/{slug}/domain`). - Added operation `scalarDocs.listProjectDomainStatus` (`GET /v1/docs/{slug}/domain/status`). - Added operation `sdks.list` (`GET /v1/sdks`). - Added operation `sdks.create` (`POST /v1/sdks`). - Added operation `sdks.retrieve` (`GET /v1/sdks/{uid}`). - Added operation `sdks.update` (`PATCH /v1/sdks/{uid}`). - Added operation `sdks.delete` (`DELETE /v1/sdks/{uid}`). - Added operation `sdks.build` (`POST /v1/sdks/{uid}/build`). - Added operation `sdks.versions.create` (`POST /v1/sdks/{uid}/versions`). - Added operation `sdks.versions.delete` (`DELETE /v1/sdks/{uid}/versions/{version}`). - Added operation `sdks.repositories.link` (`POST /v1/sdks/{uid}/repositories`). - Added operation `sdks.repositories.unlink` (`DELETE /v1/sdks/{uid}/repositories/{language}`). - Added operation `sdks.repositories.updatePublishing` (`POST /v1/sdks/{uid}/repositories/{language}/publishing`). - Added operation `mcp.servers.list` (`GET /v1/mcp/servers`). - Added operation `mcp.servers.create` (`POST /v1/mcp/servers`). - Added operation `mcp.servers.retrieve` (`GET /v1/mcp/servers/{id}`). - Added operation `mcp.servers.update` (`PATCH /v1/mcp/servers/{id}`). - Added operation `mcp.servers.delete` (`DELETE /v1/mcp/servers/{id}`). - Added operation `mcp.servers.installations.list` (`GET /v1/mcp/servers/{id}/installations`). - Added operation `mcp.servers.installations.create` (`POST /v1/mcp/servers/{id}/installations`). - Added operation `mcp.servers.installations.retrieve` (`GET /v1/mcp/servers/{id}/installations/{installationId}`). - Added operation `mcp.servers.installations.update` (`PATCH /v1/mcp/servers/{id}/installations/{installationId}`). - Added operation `mcp.servers.installations.delete` (`DELETE /v1/mcp/servers/{id}/installations/{installationId}`). - Added operation `mcp.servers.installations.createAccessGroup` (`POST /v1/mcp/servers/{id}/installations/{installationId}/access-group`). - Added operation `mcp.servers.installations.deleteAccessGroup` (`DELETE /v1/mcp/servers/{id}/installations/{installationId}/access-group`). - Added operation `oAuth.oauthAuthorize` (`GET /v1/oauth/authorize`). - Added operation `oAuth.oauthToken` (`POST /v1/oauth/token`). - Added operation `oAuth.oauthRevoke` (`POST /v1/oauth/revoke`). - Added operation `oAuth.oauthAuthorizationServerMetadata` (`GET /.well-known/oauth-authorization-server`). - Added schema `access_group_name`. - Added schema `email_domain`. - Added schema `team_member`. - Added schema `role`. - Added schema `team_invite`. - Added schema `sdk`. - Added schema `sdk_target_summary`. - Added schema `sdk_version`. - Added schema `docs_project`. - Added schema `mcp_server`. - Added schema `mcp_installation`. - Added schema `mcp_installation_list_item`. - Added schema `oauth_token`. - Added schema `oauth_scope`. - Added schema `oauth_error`. - Added schema `oauth_token_request`. - Added schema `oauth_revoke_request`. - Added schema `oauth_authorization_server_metadata`. Build: fp8dFvEDjyiCAhKbA7qeF --- api.md | 1311 +- .../kotlin/com/scalar/client/ScalarClient.kt | 26 + .../com/scalar/client/ScalarClientAsync.kt | 26 + .../scalar/client/ScalarClientAsyncImpl.kt | 58 + .../com/scalar/client/ScalarClientImpl.kt | 56 + .../com/scalar/models/ManagedDocVersion.kt | 182 +- .../accessGroups/AccessGroupCreateParams.kt | 530 + .../accessGroups/AccessGroupCreateResponse.kt | 338 + .../accessGroups/AccessGroupDeleteParams.kt | 230 + .../accessGroups/AccessGroupRetrieveParams.kt | 195 + .../AccessGroupRetrieveResponse.kt | 338 + .../accessGroups/AccessGroupUpdateParams.kt | 470 + .../domains/DomainCreateParams.kt | 441 + .../domains/DomainDeleteParams.kt | 441 + .../models/authentication/TeamSummary.kt | 245 + ...tionListCurrentUserResponse.kt => User.kt} | 305 +- ...inPortalListResponse.kt => LoginPortal.kt} | 28 +- .../models/mcp/servers/McpInstallation.kt | 567 + .../scalar/models/mcp/servers/McpServer.kt | 366 + .../models/mcp/servers/ServerCreateParams.kt | 656 + .../mcp/servers/ServerCreateResponse.kt | 222 + .../models/mcp/servers/ServerDeleteParams.kt | 229 + .../models/mcp/servers/ServerListParams.kt | 170 + .../mcp/servers/ServerRetrieveParams.kt | 189 + .../models/mcp/servers/ServerUpdateParams.kt | 718 + .../InstallationCreateAccessGroupParams.kt | 471 + .../installations/InstallationCreateParams.kt | 684 + .../InstallationDeleteAccessGroupParams.kt | 471 + .../installations/InstallationDeleteParams.kt | 260 + .../installations/InstallationListParams.kt | 189 + .../InstallationRetrieveParams.kt | 218 + .../installations/InstallationUpdateParams.kt | 887 ++ .../installations/McpInstallationListItem.kt | 323 + ...hOauthAuthorizationServerMetadataParams.kt | 182 + .../models/oAuth/OAuthOauthAuthorizeParams.kt | 177 + .../models/oAuth/OAuthOauthRevokeParams.kt | 620 + .../models/oAuth/OAuthOauthTokenParams.kt | 883 ++ .../models/oAuth/OAuthOauthTokenResponse.kt | 232 + .../oAuth/OauthAuthorizationServerMetadata.kt | 719 + .../com/scalar/models/oAuth/OauthError.kt | 223 + .../com/scalar/models/oAuth/OauthScope.kt | 144 + .../com/scalar/models/oAuth/OauthToken.kt | 339 + ...ApiDocumentsResponse.kt => ApiDocument.kt} | 45 +- .../com/scalar/models/registry/Method.kt | 180 + .../{RuleListRulesetsResponse.kt => Rule.kt} | 34 +- .../models/scalarDocs/ActiveDeployment.kt | 251 + .../scalar/models/scalarDocs/DocsProject.kt | 601 + ...ListGuidesResponse.kt => GithubProject.kt} | 816 +- .../scalarDocs/GithubProjectRepository.kt | 489 + .../ScalarDocCreateProjectParams.kt | 1383 ++ .../ScalarDocDeleteProjectParams.kt | 232 + .../ScalarDocListProjectConfigParams.kt | 219 + .../ScalarDocListProjectConfigResponse.kt | 285 + .../ScalarDocListProjectDomainParams.kt | 198 + .../ScalarDocListProjectDomainResponse.kt | 240 + .../ScalarDocListProjectDomainStatusParams.kt | 203 + ...calarDocListProjectDomainStatusResponse.kt | 652 + .../scalarDocs/ScalarDocListProjectsParams.kt | 202 + .../ScalarDocListProjectsResponse.kt | 232 + .../ScalarDocPublishProjectParams.kt | 537 + .../ScalarDocPublishProjectResponse.kt | 182 + .../ScalarDocRetrieveProjectParams.kt | 196 + .../ScalarDocUpdateProjectConfigParams.kt | 679 + .../ScalarDocUpdateProjectConfigResponse.kt | 259 + .../ScalarDocUpdateProjectParams.kt | 1083 ++ .../models/schemas/ManagedSchemaVersion.kt | 344 + .../Schema.kt} | 204 +- .../models/schemas/SchemaListResponse.kt | 762 - .../main/kotlin/com/scalar/models/sdks/Sdk.kt | 599 + .../com/scalar/models/sdks/SdkBuildParams.kt | 704 + .../scalar/models/sdks/SdkBuildResponse.kt | 175 + .../com/scalar/models/sdks/SdkCreateParams.kt | 947 ++ .../com/scalar/models/sdks/SdkDeleteParams.kt | 229 + .../com/scalar/models/sdks/SdkListParams.kt | 196 + .../com/scalar/models/sdks/SdkListResponse.kt | 228 + .../scalar/models/sdks/SdkRetrieveParams.kt | 189 + .../scalar/models/sdks/SdkTargetSummary.kt | 415 + .../com/scalar/models/sdks/SdkUpdateParams.kt | 728 + .../com/scalar/models/sdks/SdkVersion.kt | 715 + .../sdks/repositories/RepositoryLinkParams.kt | 855 ++ .../repositories/RepositoryLinkResponse.kt | 212 + .../repositories/RepositoryUnlinkParams.kt | 463 + .../RepositoryUpdatePublishingParams.kt | 1118 ++ .../sdks/versions/VersionCreateParams.kt | 510 + .../sdks/versions/VersionDeleteParams.kt | 258 + .../teams/{TeamListResponse.kt => Team.kt} | 32 +- .../teams/invites/InviteCancelParams.kt | 229 + .../teams/invites/InviteMemberParams.kt | 484 + .../teams/invites/InviteResendParams.kt | 229 + .../com/scalar/models/teams/invites/Role.kt | 150 + .../teams/members/MemberDeleteParams.kt | 229 + .../models/teams/members/MemberListParams.kt | 170 + .../teams/members/MemberListResponse.kt | 255 + .../teams/members/MemberUpdateParams.kt | 438 + .../scalar/models/teams/members/TeamInvite.kt | 282 + .../scalar/models/teams/members/TeamMember.kt | 285 + .../themes/{ThemeListResponse.kt => Theme.kt} | 30 +- .../services/async/AccessGroupServiceAsync.kt | 319 + .../async/AccessGroupServiceAsyncImpl.kt | 215 + .../async/AuthenticationServiceAsync.kt | 24 +- .../async/AuthenticationServiceAsyncImpl.kt | 10 +- .../services/async/LoginPortalServiceAsync.kt | 19 +- .../async/LoginPortalServiceAsyncImpl.kt | 10 +- .../scalar/services/async/McpServiceAsync.kt | 39 + .../services/async/McpServiceAsyncImpl.kt | 44 + .../services/async/OAuthServiceAsync.kt | 209 + .../services/async/OAuthServiceAsyncImpl.kt | 201 + .../services/async/RegistryServiceAsync.kt | 50 +- .../async/RegistryServiceAsyncImpl.kt | 19 +- .../scalar/services/async/RuleServiceAsync.kt | 31 +- .../services/async/RuleServiceAsyncImpl.kt | 10 +- .../services/async/ScalarDocServiceAsync.kt | 728 +- .../async/ScalarDocServiceAsyncImpl.kt | 415 +- .../services/async/SchemaServiceAsync.kt | 35 +- .../services/async/SchemaServiceAsyncImpl.kt | 10 +- .../scalar/services/async/SdkServiceAsync.kt | 387 + .../services/async/SdkServiceAsyncImpl.kt | 311 + .../scalar/services/async/TeamServiceAsync.kt | 37 +- .../services/async/TeamServiceAsyncImpl.kt | 38 +- .../services/async/ThemeServiceAsync.kt | 23 +- .../services/async/ThemeServiceAsyncImpl.kt | 10 +- .../async/accessGroups/DomainServiceAsync.kt | 144 + .../accessGroups/DomainServiceAsyncImpl.kt | 119 + .../services/async/mcp/ServerServiceAsync.kt | 322 + .../async/mcp/ServerServiceAsyncImpl.kt | 262 + .../mcp/servers/InstallationServiceAsync.kt | 460 + .../servers/InstallationServiceAsyncImpl.kt | 361 + .../async/sdks/RepositoryServiceAsync.kt | 203 + .../async/sdks/RepositoryServiceAsyncImpl.kt | 176 + .../async/sdks/VersionServiceAsync.kt | 138 + .../async/sdks/VersionServiceAsyncImpl.kt | 125 + .../async/teams/InviteServiceAsync.kt | 198 + .../async/teams/InviteServiceAsyncImpl.kt | 151 + .../async/teams/MemberServiceAsync.kt | 198 + .../async/teams/MemberServiceAsyncImpl.kt | 158 + .../services/blocking/AccessGroupService.kt | 308 + .../blocking/AccessGroupServiceImpl.kt | 196 + .../blocking/AuthenticationService.kt | 26 +- .../blocking/AuthenticationServiceImpl.kt | 10 +- .../services/blocking/LoginPortalService.kt | 20 +- .../blocking/LoginPortalServiceImpl.kt | 10 +- .../scalar/services/blocking/McpService.kt | 39 + .../services/blocking/McpServiceImpl.kt | 43 + .../scalar/services/blocking/OAuthService.kt | 211 + .../services/blocking/OAuthServiceImpl.kt | 186 + .../services/blocking/RegistryService.kt | 58 +- .../services/blocking/RegistryServiceImpl.kt | 19 +- .../scalar/services/blocking/RuleService.kt | 37 +- .../services/blocking/RuleServiceImpl.kt | 10 +- .../services/blocking/ScalarDocService.kt | 736 +- .../services/blocking/ScalarDocServiceImpl.kt | 385 +- .../scalar/services/blocking/SchemaService.kt | 34 +- .../services/blocking/SchemaServiceImpl.kt | 13 +- .../scalar/services/blocking/SdkService.kt | 381 + .../services/blocking/SdkServiceImpl.kt | 271 + .../scalar/services/blocking/TeamService.kt | 33 +- .../services/blocking/TeamServiceImpl.kt | 41 +- .../scalar/services/blocking/ThemeService.kt | 19 +- .../services/blocking/ThemeServiceImpl.kt | 13 +- .../blocking/accessGroups/DomainService.kt | 140 + .../accessGroups/DomainServiceImpl.kt | 106 + .../services/blocking/mcp/ServerService.kt | 310 + .../blocking/mcp/ServerServiceImpl.kt | 234 + .../mcp/servers/InstallationService.kt | 455 + .../mcp/servers/InstallationServiceImpl.kt | 336 + .../blocking/sdks/RepositoryService.kt | 199 + .../blocking/sdks/RepositoryServiceImpl.kt | 163 + .../services/blocking/sdks/VersionService.kt | 135 + .../blocking/sdks/VersionServiceImpl.kt | 112 + .../services/blocking/teams/InviteService.kt | 191 + .../blocking/teams/InviteServiceImpl.kt | 132 + .../services/blocking/teams/MemberService.kt | 192 + .../blocking/teams/MemberServiceImpl.kt | 142 + .../proguard/ProGuardCompatibilityTest.kt | 20 + scalar-sdk.manifest.json | 12671 ++++++++++++++-- tests/smoke-test.java | 927 +- 176 files changed, 58875 insertions(+), 4119 deletions(-) create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupCreateParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupCreateResponse.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupDeleteParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupRetrieveParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupRetrieveResponse.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupUpdateParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/domains/DomainCreateParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/domains/DomainDeleteParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/authentication/TeamSummary.kt rename scalar-java-core/src/main/kotlin/com/scalar/models/authentication/{AuthenticationListCurrentUserResponse.kt => User.kt} (58%) rename scalar-java-core/src/main/kotlin/com/scalar/models/loginPortals/{LoginPortalListResponse.kt => LoginPortal.kt} (90%) create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/McpInstallation.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/McpServer.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/ServerCreateParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/ServerCreateResponse.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/ServerDeleteParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/ServerListParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/ServerRetrieveParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/ServerUpdateParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/InstallationCreateAccessGroupParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/InstallationCreateParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/InstallationDeleteAccessGroupParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/InstallationDeleteParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/InstallationListParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/InstallationRetrieveParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/InstallationUpdateParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/McpInstallationListItem.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthAuthorizationServerMetadataParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthAuthorizeParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthRevokeParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthTokenParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthTokenResponse.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OauthAuthorizationServerMetadata.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OauthError.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OauthScope.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OauthToken.kt rename scalar-java-core/src/main/kotlin/com/scalar/models/registry/{RegistryListApiDocumentsResponse.kt => ApiDocument.kt} (91%) create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/registry/Method.kt rename scalar-java-core/src/main/kotlin/com/scalar/models/rules/{RuleListRulesetsResponse.kt => Rule.kt} (91%) create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ActiveDeployment.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/DocsProject.kt rename scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/{ScalarDocListGuidesResponse.kt => GithubProject.kt} (52%) create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/GithubProjectRepository.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocCreateProjectParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocDeleteProjectParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectConfigParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectConfigResponse.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectDomainParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectDomainResponse.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectDomainStatusParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectDomainStatusResponse.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectsParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectsResponse.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocPublishProjectParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocPublishProjectResponse.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocRetrieveProjectParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocUpdateProjectConfigParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocUpdateProjectConfigResponse.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocUpdateProjectParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/schemas/ManagedSchemaVersion.kt rename scalar-java-core/src/main/kotlin/com/scalar/models/{registry/RegistryListAllApiDocumentsResponse.kt => schemas/Schema.kt} (72%) delete mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/schemas/SchemaListResponse.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/sdks/Sdk.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkBuildParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkBuildResponse.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkCreateParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkDeleteParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkListParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkListResponse.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkRetrieveParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkTargetSummary.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkUpdateParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkVersion.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/sdks/repositories/RepositoryLinkParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/sdks/repositories/RepositoryLinkResponse.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/sdks/repositories/RepositoryUnlinkParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/sdks/repositories/RepositoryUpdatePublishingParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/sdks/versions/VersionCreateParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/sdks/versions/VersionDeleteParams.kt rename scalar-java-core/src/main/kotlin/com/scalar/models/teams/{TeamListResponse.kt => Team.kt} (92%) create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/teams/invites/InviteCancelParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/teams/invites/InviteMemberParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/teams/invites/InviteResendParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/teams/invites/Role.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/teams/members/MemberDeleteParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/teams/members/MemberListParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/teams/members/MemberListResponse.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/teams/members/MemberUpdateParams.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/teams/members/TeamInvite.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/teams/members/TeamMember.kt rename scalar-java-core/src/main/kotlin/com/scalar/models/themes/{ThemeListResponse.kt => Theme.kt} (92%) create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/async/AccessGroupServiceAsync.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/async/AccessGroupServiceAsyncImpl.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/async/McpServiceAsync.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/async/McpServiceAsyncImpl.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/async/OAuthServiceAsync.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/async/OAuthServiceAsyncImpl.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/async/SdkServiceAsync.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/async/SdkServiceAsyncImpl.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/async/accessGroups/DomainServiceAsync.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/async/accessGroups/DomainServiceAsyncImpl.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/async/mcp/ServerServiceAsync.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/async/mcp/ServerServiceAsyncImpl.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/async/mcp/servers/InstallationServiceAsync.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/async/mcp/servers/InstallationServiceAsyncImpl.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/async/sdks/RepositoryServiceAsync.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/async/sdks/RepositoryServiceAsyncImpl.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/async/sdks/VersionServiceAsync.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/async/sdks/VersionServiceAsyncImpl.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/async/teams/InviteServiceAsync.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/async/teams/InviteServiceAsyncImpl.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/async/teams/MemberServiceAsync.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/async/teams/MemberServiceAsyncImpl.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/blocking/AccessGroupService.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/blocking/AccessGroupServiceImpl.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/blocking/McpService.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/blocking/McpServiceImpl.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/blocking/OAuthService.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/blocking/OAuthServiceImpl.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/blocking/SdkService.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/blocking/SdkServiceImpl.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/blocking/accessGroups/DomainService.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/blocking/accessGroups/DomainServiceImpl.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/blocking/mcp/ServerService.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/blocking/mcp/ServerServiceImpl.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/blocking/mcp/servers/InstallationService.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/blocking/mcp/servers/InstallationServiceImpl.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/blocking/sdks/RepositoryService.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/blocking/sdks/RepositoryServiceImpl.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/blocking/sdks/VersionService.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/blocking/sdks/VersionServiceImpl.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/blocking/teams/InviteService.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/blocking/teams/InviteServiceImpl.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/blocking/teams/MemberService.kt create mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/blocking/teams/MemberServiceImpl.kt diff --git a/api.md b/api.md index a9d5d76..2fc0860 100644 --- a/api.md +++ b/api.md @@ -35,6 +35,14 @@ Complete reference of every operation, grouped by resource. See [the README](./R - [Delete a login portal](#delete-a-login-portal) - [Create a portal](#create-a-portal) - [List all portals](#list-all-portals) +- [`AccessGroups`](#accessgroups) + - [Create an access group](#create-an-access-group) + - [Get an access group](#get-an-access-group) + - [Update an access group](#update-an-access-group) + - [Delete an access group](#delete-an-access-group) + - [`AccessGroups Domains`](#accessgroups-domains) + - [Add an allowed email domain](#add-an-allowed-email-domain) + - [Remove an allowed email domain](#remove-an-allowed-email-domain) - [`Rules`](#rules) - [List all rules](#list-all-rules) - [Create a rule](#create-a-rule) @@ -52,15 +60,67 @@ Complete reference of every operation, grouped by resource. See [the README](./R - [Get a theme](#get-a-theme) - [`Teams`](#teams) - [List teams](#list-teams) + - [`Teams Members`](#teams-members) + - [List team members](#list-team-members) + - [Change a member role](#change-a-member-role) + - [Remove a member](#remove-a-member) + - [`Teams Invites`](#teams-invites) + - [Invite a member](#invite-a-member) + - [Resend an invite](#resend-an-invite) + - [Cancel an invite](#cancel-an-invite) - [`ScalarDocs`](#scalardocs) - [List all projects](#list-all-projects) - [Create a project](#create-a-project) - [Publish a project](#publish-a-project) + - [List all docs projects](#list-all-docs-projects) + - [Create a docs project](#create-a-docs-project) + - [Get a docs project](#get-a-docs-project) + - [Update a docs project](#update-a-docs-project) + - [Delete a docs project](#delete-a-docs-project) + - [Publish a docs project](#publish-a-docs-project) + - [Read the site config](#read-the-site-config) + - [Write the site config](#write-the-site-config) + - [Get the site domains](#get-the-site-domains) + - [Check domain DNS](#check-domain-dns) - [`Namespaces`](#namespaces) - [List namespaces](#list-namespaces) - [`Authentication`](#authentication) - [Exchange token](#exchange-token) - [Get current user](#get-current-user) +- [`Sdks`](#sdks) + - [List all SDKs](#list-all-sdks) + - [Create an SDK](#create-an-sdk) + - [Get an SDK](#get-an-sdk) + - [Update an SDK](#update-an-sdk) + - [Delete an SDK](#delete-an-sdk) + - [Build an SDK](#build-an-sdk) + - [`Sdks Versions`](#sdks-versions) + - [Create an SDK version](#create-an-sdk-version) + - [Delete an SDK version](#delete-an-sdk-version) + - [`Sdks Repositories`](#sdks-repositories) + - [Link a repository](#link-a-repository) + - [Unlink a repository](#unlink-a-repository) + - [Update publishing settings](#update-publishing-settings) +- [`Mcp`](#mcp) + - [`Mcp Servers`](#mcp-servers) + - [List all MCP servers](#list-all-mcp-servers) + - [Create an MCP server](#create-an-mcp-server) + - [Get an MCP server](#get-an-mcp-server) + - [Update an MCP server](#update-an-mcp-server) + - [Delete an MCP server](#delete-an-mcp-server) + - [`Mcp Servers Installations`](#mcp-servers-installations) + - [List installations](#list-installations) + - [Create an installation](#create-an-installation) + - [Get an installation](#get-an-installation) + - [Update an installation](#update-an-installation) + - [Delete an installation](#delete-an-installation) + - [Add an access group](#add-an-access-group) + - [Remove an access group](#remove-an-access-group) +- [`OAuth`](#oauth) + - [Start an OAuth authorization](#start-an-oauth-authorization) + - [Exchange a code or refresh token](#exchange-a-code-or-refresh-token) + - [Revoke a refresh token](#revoke-a-refresh-token) + - [Authorization server metadata](#authorization-server-metadata) ## Setup @@ -83,7 +143,7 @@ List all API documents across every namespace the caller can access. | Direction | Type | | --- | --- | | Request | [`RegistryListAllApiDocumentsParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/registry/RegistryListAllApiDocumentsParams.kt) | -| Response | [`List`](./scalar-java-core/src/main/kotlin/com/scalar/models/registry/RegistryListAllApiDocumentsResponse.kt) | +| Response | [`List`](./scalar-java-core/src/main/kotlin/com/scalar/models/registry/ApiDocument.kt) | ```java import com.scalar.client.ScalarClient; @@ -104,7 +164,7 @@ List API documents in a namespace. | Direction | Type | | --- | --- | | Request | [`RegistryListApiDocumentsParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/registry/RegistryListApiDocumentsParams.kt) | -| Response | [`List`](./scalar-java-core/src/main/kotlin/com/scalar/models/registry/RegistryListApiDocumentsResponse.kt) | +| Response | [`List`](./scalar-java-core/src/main/kotlin/com/scalar/models/registry/ApiDocument.kt) | ```java import com.scalar.client.ScalarClient; @@ -404,7 +464,7 @@ List schemas in a namespace. | Direction | Type | | --- | --- | | Request | [`SchemaListParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/schemas/SchemaListParams.kt) | -| Response | [`List`](./scalar-java-core/src/main/kotlin/com/scalar/models/schemas/SchemaListResponse.kt) | +| Response | [`List`](./scalar-java-core/src/main/kotlin/com/scalar/models/schemas/Schema.kt) | ```java import com.scalar.client.ScalarClient; @@ -777,7 +837,7 @@ List all login portals for the current team. | Direction | Type | | --- | --- | | Request | [`LoginPortalListParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/loginPortals/LoginPortalListParams.kt) | -| Response | [`List`](./scalar-java-core/src/main/kotlin/com/scalar/models/loginPortals/LoginPortalListResponse.kt) | +| Response | [`List`](./scalar-java-core/src/main/kotlin/com/scalar/models/loginPortals/LoginPortal.kt) | ```java import com.scalar.client.ScalarClient; @@ -791,6 +851,146 @@ var loginPortal = client.loginPortals().list(); System.out.println(loginPortal); ``` +## `AccessGroups` + +Access Groups + +### Create an access group + +Create a group for the current team. Requires docs edit permission and the access groups billing feature. Domains are exact email domains, without wildcards or implicit subdomain matching. + +| Direction | Type | +| --- | --- | +| Request | [`AccessGroupCreateParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupCreateParams.kt) | +| Response | [`AccessGroupCreateResponse`](./scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupCreateResponse.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +var accessGroup = client.accessGroups().create(); + +System.out.println(accessGroup); +``` + +### Get an access group + +Get a group and its email and domain allowlists by slug. + +| Direction | Type | +| --- | --- | +| Request | [`AccessGroupRetrieveParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupRetrieveParams.kt) | +| Response | [`AccessGroupRetrieveResponse`](./scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupRetrieveResponse.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.accessGroups.AccessGroupRetrieveParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +AccessGroupRetrieveParams params = AccessGroupRetrieveParams.builder().slug("slug").build(); +var accessGroup = client.accessGroups().retrieve(params); + +System.out.println(accessGroup); +``` + +### Update an access group + +Update group metadata. Requires docs edit permission. After changing the slug, use the new slug in subsequent requests. + +| Direction | Type | +| --- | --- | +| Request | [`AccessGroupUpdateParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupUpdateParams.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.accessGroups.AccessGroupUpdateParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +AccessGroupUpdateParams params = AccessGroupUpdateParams.builder().pathSlug("pathSlug").build(); +var accessGroup = client.accessGroups().update(params); + +System.out.println(accessGroup); +``` + +### Delete an access group + +Delete a group and remove its project assignments. Requires docs edit permission. + +| Direction | Type | +| --- | --- | +| Request | [`AccessGroupDeleteParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupDeleteParams.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.accessGroups.AccessGroupDeleteParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +AccessGroupDeleteParams params = AccessGroupDeleteParams.builder().slug("slug").build(); +var accessGroup = client.accessGroups().delete(params); + +System.out.println(accessGroup); +``` + +### `AccessGroups Domains` + +Access Groups + +#### Add an allowed email domain + +Allow an exact email domain in a group. Requires docs edit permission. A group supports up to 1000 domains. + +| Direction | Type | +| --- | --- | +| Request | [`DomainCreateParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/domains/DomainCreateParams.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.accessGroups.domains.DomainCreateParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +DomainCreateParams params = DomainCreateParams.builder().slug("slug").domain("").build(); +var domain = client.accessGroups().domains().create(params); + +System.out.println(domain); +``` + +#### Remove an allowed email domain + +Remove an exact email domain from a group. Requires docs edit permission. Other allowed domains and emails are preserved. + +| Direction | Type | +| --- | --- | +| Request | [`DomainDeleteParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/domains/DomainDeleteParams.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.accessGroups.domains.DomainDeleteParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +DomainDeleteParams params = DomainDeleteParams.builder().slug("slug").domain("").build(); +var domain = client.accessGroups().domains().delete(params); + +System.out.println(domain); +``` + ## `Rules` Rules @@ -802,7 +1002,7 @@ List all rulesets in a namespace. | Direction | Type | | --- | --- | | Request | [`RuleListRulesetsParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/rules/RuleListRulesetsParams.kt) | -| Response | [`List`](./scalar-java-core/src/main/kotlin/com/scalar/models/rules/RuleListRulesetsResponse.kt) | +| Response | [`List`](./scalar-java-core/src/main/kotlin/com/scalar/models/rules/Rule.kt) | ```java import com.scalar.client.ScalarClient; @@ -986,7 +1186,7 @@ List all team themes. | Direction | Type | | --- | --- | | Request | [`ThemeListParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/themes/ThemeListParams.kt) | -| Response | [`List`](./scalar-java-core/src/main/kotlin/com/scalar/models/themes/ThemeListResponse.kt) | +| Response | [`List`](./scalar-java-core/src/main/kotlin/com/scalar/models/themes/Theme.kt) | ```java import com.scalar.client.ScalarClient; @@ -1123,7 +1323,7 @@ List all available teams | Direction | Type | | --- | --- | | Request | [`TeamListParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/teams/TeamListParams.kt) | -| Response | [`List`](./scalar-java-core/src/main/kotlin/com/scalar/models/teams/TeamListResponse.kt) | +| Response | [`List`](./scalar-java-core/src/main/kotlin/com/scalar/models/teams/Team.kt) | ```java import com.scalar.client.ScalarClient; @@ -1137,6 +1337,148 @@ var team = client.teams().list(); System.out.println(team); ``` +### `Teams Members` + +Teams + +#### List team members + +List the members of the current team, along with the invites still outstanding. + +| Direction | Type | +| --- | --- | +| Request | [`MemberListParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/teams/members/MemberListParams.kt) | +| Response | [`MemberListResponse`](./scalar-java-core/src/main/kotlin/com/scalar/models/teams/members/MemberListResponse.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +var member = client.teams().members().list(); + +System.out.println(member); +``` + +#### Change a member role + +Change what a member of the current team is allowed to do. + +| Direction | Type | +| --- | --- | +| Request | [`MemberUpdateParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/teams/members/MemberUpdateParams.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.teams.invites.Role; +import com.scalar.models.teams.members.MemberUpdateParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +MemberUpdateParams params = MemberUpdateParams.builder().uid("uidxx").role(Role.OWNER).build(); +var member = client.teams().members().update(params); + +System.out.println(member); +``` + +#### Remove a member + +Remove someone from the current team. + +| Direction | Type | +| --- | --- | +| Request | [`MemberDeleteParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/teams/members/MemberDeleteParams.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.teams.members.MemberDeleteParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +MemberDeleteParams params = MemberDeleteParams.builder().uid("uidxx").build(); +var member = client.teams().members().delete(params); + +System.out.println(member); +``` + +### `Teams Invites` + +Teams + +#### Invite a member + +Invite someone to the current team by email. + +| Direction | Type | +| --- | --- | +| Request | [`InviteMemberParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/teams/invites/InviteMemberParams.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.teams.invites.InviteMemberParams; +import com.scalar.models.teams.invites.Role; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +InviteMemberParams params = + InviteMemberParams.builder().email("user@example.com").role(Role.OWNER).build(); +var invite = client.teams().invites().member(params); + +System.out.println(invite); +``` + +#### Resend an invite + +Send the invite email again. + +| Direction | Type | +| --- | --- | +| Request | [`InviteResendParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/teams/invites/InviteResendParams.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.teams.invites.InviteResendParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +InviteResendParams params = InviteResendParams.builder().uid("uidxx").build(); +var invite = client.teams().invites().resend(params); + +System.out.println(invite); +``` + +#### Cancel an invite + +Withdraw an invite that has not been accepted. + +| Direction | Type | +| --- | --- | +| Request | [`InviteCancelParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/teams/invites/InviteCancelParams.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.teams.invites.InviteCancelParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +InviteCancelParams params = InviteCancelParams.builder().uid("uidxx").build(); +var invite = client.teams().invites().cancel(params); + +System.out.println(invite); +``` + ## `ScalarDocs` Scalar Docs @@ -1148,7 +1490,7 @@ List all guide projects. | Direction | Type | | --- | --- | | Request | [`ScalarDocListGuidesParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListGuidesParams.kt) | -| Response | [`List`](./scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListGuidesResponse.kt) | +| Response | [`List`](./scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/GithubProject.kt) | ```java import com.scalar.client.ScalarClient; @@ -1214,75 +1556,980 @@ var scalarDoc = client.scalarDocs().publishGuide(params); System.out.println(scalarDoc); ``` -## `Namespaces` +### List all docs projects -Namespaces +List every docs project on the team. -### List namespaces +| Direction | Type | +| --- | --- | +| Request | [`ScalarDocListProjectsParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectsParams.kt) | +| Response | [`ScalarDocListProjectsResponse`](./scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectsResponse.kt) | -Get all namespaces for the current team +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +var scalarDoc = client.scalarDocs().listProjects(); + +System.out.println(scalarDoc); +``` + +### Create a docs project + +Create a docs project. Omit `provider` to have Scalar host the repository. | Direction | Type | | --- | --- | -| Request | [`NamespaceListParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/namespaces/NamespaceListParams.kt) | +| Request | [`ScalarDocCreateProjectParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocCreateProjectParams.kt) | +| Response | [`DocsProject`](./scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/DocsProject.kt) | ```java import com.scalar.client.ScalarClient; import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.scalarDocs.ScalarDocCreateProjectParams; ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); -var namespace = client.namespaces().list(); +ScalarDocCreateProjectParams params = + ScalarDocCreateProjectParams.builder() + .name("") + .provider(ScalarDocCreateProjectParams.Provider.of("forgejo")) + .build(); +var scalarDoc = client.scalarDocs().createProject(params); -System.out.println(namespace); +System.out.println(scalarDoc); ``` -## `Authentication` +### Get a docs project -Authentication +Get a single docs project by its slug. -### Exchange token +| Direction | Type | +| --- | --- | +| Request | [`ScalarDocRetrieveProjectParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocRetrieveProjectParams.kt) | +| Response | [`DocsProject`](./scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/DocsProject.kt) | -Exchange an API key for an access token. +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.scalarDocs.ScalarDocRetrieveProjectParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +ScalarDocRetrieveProjectParams params = + ScalarDocRetrieveProjectParams.builder().slug("slug").build(); +var scalarDoc = client.scalarDocs().retrieveProject(params); + +System.out.println(scalarDoc); +``` + +### Update a docs project + +Update project settings. Set `isPrivate` with `accessGroups` to put the site behind a login. | Direction | Type | | --- | --- | -| Request | [`AuthenticationExchangePersonalTokenParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/authentication/AuthenticationExchangePersonalTokenParams.kt) | -| Response | [`AuthenticationExchangePersonalTokenResponse`](./scalar-java-core/src/main/kotlin/com/scalar/models/authentication/AuthenticationExchangePersonalTokenResponse.kt) | +| Request | [`ScalarDocUpdateProjectParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocUpdateProjectParams.kt) | ```java import com.scalar.client.ScalarClient; import com.scalar.client.okhttp.ScalarOkHttpClient; -import com.scalar.models.authentication.AuthenticationExchangePersonalTokenParams; +import com.scalar.models.scalarDocs.ScalarDocUpdateProjectParams; ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); -AuthenticationExchangePersonalTokenParams params = - AuthenticationExchangePersonalTokenParams.builder().personalToken("").build(); -var authentication = client.authentication().exchangePersonalToken(params); +ScalarDocUpdateProjectParams params = + ScalarDocUpdateProjectParams.builder().slug("slug").build(); +var scalarDoc = client.scalarDocs().updateProject(params); -System.out.println(authentication); +System.out.println(scalarDoc); ``` -### Get current user +### Delete a docs project -Get the authenticated user, including their available teams and theme. +Delete a docs project, its deploys, its publish records and its cached builds. | Direction | Type | | --- | --- | -| Request | [`AuthenticationListCurrentUserParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/authentication/AuthenticationListCurrentUserParams.kt) | -| Response | [`AuthenticationListCurrentUserResponse`](./scalar-java-core/src/main/kotlin/com/scalar/models/authentication/AuthenticationListCurrentUserResponse.kt) | +| Request | [`ScalarDocDeleteProjectParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocDeleteProjectParams.kt) | ```java import com.scalar.client.ScalarClient; import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.scalarDocs.ScalarDocDeleteProjectParams; ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); -var authentication = client.authentication().listCurrentUser(); +ScalarDocDeleteProjectParams params = + ScalarDocDeleteProjectParams.builder().slug("slug").build(); +var scalarDoc = client.scalarDocs().deleteProject(params); -System.out.println(authentication); +System.out.println(scalarDoc); +``` + +### Publish a docs project + +Start a build and deploy. The returned `publishUid` identifies the publish record. + +| Direction | Type | +| --- | --- | +| Request | [`ScalarDocPublishProjectParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocPublishProjectParams.kt) | +| Response | [`ScalarDocPublishProjectResponse`](./scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocPublishProjectResponse.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.scalarDocs.ScalarDocPublishProjectParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +ScalarDocPublishProjectParams params = + ScalarDocPublishProjectParams.builder().slug("slug").build(); +var scalarDoc = client.scalarDocs().publishProject(params); + +System.out.println(scalarDoc); +``` + +### Read the site config + +Read `scalar.config.json` straight from the project repository, without cloning it. `baseToken` is the compare-and-swap handle for a later write. + +| Direction | Type | +| --- | --- | +| Request | [`ScalarDocListProjectConfigParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectConfigParams.kt) | +| Response | [`ScalarDocListProjectConfigResponse`](./scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectConfigResponse.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.scalarDocs.ScalarDocListProjectConfigParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +ScalarDocListProjectConfigParams params = + ScalarDocListProjectConfigParams.builder().slug("slug").build(); +var scalarDoc = client.scalarDocs().listProjectConfig(params); + +System.out.println(scalarDoc); +``` + +### Write the site config + +Commit `scalar.config.json` straight to the project repository. Pass the `baseToken` from the read this edit was based on; a conflict means the file moved underneath it. + +| Direction | Type | +| --- | --- | +| Request | [`ScalarDocUpdateProjectConfigParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocUpdateProjectConfigParams.kt) | +| Response | [`ScalarDocUpdateProjectConfigResponse`](./scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocUpdateProjectConfigResponse.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.scalarDocs.ScalarDocUpdateProjectConfigParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +ScalarDocUpdateProjectConfigParams params = + ScalarDocUpdateProjectConfigParams.builder().slug("slug").content("").build(); +var scalarDoc = client.scalarDocs().updateProjectConfig(params); + +System.out.println(scalarDoc); +``` + +### Get the site domains + +The domains the project serves on — the Scalar-hosted one and the custom one, when set. + +| Direction | Type | +| --- | --- | +| Request | [`ScalarDocListProjectDomainParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectDomainParams.kt) | +| Response | [`ScalarDocListProjectDomainResponse`](./scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectDomainResponse.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.scalarDocs.ScalarDocListProjectDomainParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +ScalarDocListProjectDomainParams params = + ScalarDocListProjectDomainParams.builder().slug("slug").build(); +var scalarDoc = client.scalarDocs().listProjectDomain(params); + +System.out.println(scalarDoc); +``` + +### Check domain DNS + +Whether the project custom domain points at Scalar yet. `expected` is the CNAME record to create; `found` is what resolves today. A project with no custom domain reports `verified` with no expected record, because Scalar serves its own subdomain directly. + +| Direction | Type | +| --- | --- | +| Request | [`ScalarDocListProjectDomainStatusParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectDomainStatusParams.kt) | +| Response | [`ScalarDocListProjectDomainStatusResponse`](./scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectDomainStatusResponse.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.scalarDocs.ScalarDocListProjectDomainStatusParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +ScalarDocListProjectDomainStatusParams params = + ScalarDocListProjectDomainStatusParams.builder().slug("slug").build(); +var scalarDoc = client.scalarDocs().listProjectDomainStatus(params); + +System.out.println(scalarDoc); +``` + +## `Namespaces` + +Namespaces + +### List namespaces + +Get all namespaces for the current team + +| Direction | Type | +| --- | --- | +| Request | [`NamespaceListParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/namespaces/NamespaceListParams.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +var namespace = client.namespaces().list(); + +System.out.println(namespace); +``` + +## `Authentication` + +Authentication + +### Exchange token + +Exchange an API key for an access token. + +| Direction | Type | +| --- | --- | +| Request | [`AuthenticationExchangePersonalTokenParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/authentication/AuthenticationExchangePersonalTokenParams.kt) | +| Response | [`AuthenticationExchangePersonalTokenResponse`](./scalar-java-core/src/main/kotlin/com/scalar/models/authentication/AuthenticationExchangePersonalTokenResponse.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.authentication.AuthenticationExchangePersonalTokenParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +AuthenticationExchangePersonalTokenParams params = + AuthenticationExchangePersonalTokenParams.builder().personalToken("").build(); +var authentication = client.authentication().exchangePersonalToken(params); + +System.out.println(authentication); +``` + +### Get current user + +Get the authenticated user, including their available teams and theme. + +| Direction | Type | +| --- | --- | +| Request | [`AuthenticationListCurrentUserParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/authentication/AuthenticationListCurrentUserParams.kt) | +| Response | [`User`](./scalar-java-core/src/main/kotlin/com/scalar/models/authentication/User.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +var authentication = client.authentication().listCurrentUser(); + +System.out.println(authentication); +``` + +## `Sdks` + +SDKs + +### List all SDKs + +List every SDK on the team. + +| Direction | Type | +| --- | --- | +| Request | [`SdkListParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkListParams.kt) | +| Response | [`SdkListResponse`](./scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkListResponse.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +var sdk = client.sdks().list(); + +System.out.println(sdk); +``` + +### Create an SDK + +Create an SDK from an API document, targeting one or more languages. + +| Direction | Type | +| --- | --- | +| Request | [`SdkCreateParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkCreateParams.kt) | +| Response | [`Uid`](./scalar-java-core/src/main/kotlin/com/scalar/models/Uid.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.sdks.SdkCreateParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +SdkCreateParams params = + SdkCreateParams.builder() + .apiUid("xxxxx") + .languages(java.util.List.of(SdkCreateParams.Language.of("typescript"))) + .build(); +var sdk = client.sdks().create(params); + +System.out.println(sdk); +``` + +### Get an SDK + +Get a single SDK by its uid. + +| Direction | Type | +| --- | --- | +| Request | [`SdkRetrieveParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkRetrieveParams.kt) | +| Response | [`Sdk`](./scalar-java-core/src/main/kotlin/com/scalar/models/sdks/Sdk.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.sdks.SdkRetrieveParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +SdkRetrieveParams params = SdkRetrieveParams.builder().uid("uidxx").build(); +var sdk = client.sdks().retrieve(params); + +System.out.println(sdk); +``` + +### Update an SDK + +Update SDK metadata, its linked API, or its config. + +| Direction | Type | +| --- | --- | +| Request | [`SdkUpdateParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkUpdateParams.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.sdks.SdkUpdateParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +SdkUpdateParams params = SdkUpdateParams.builder().uid("uidxx").build(); +var sdk = client.sdks().update(params); + +System.out.println(sdk); +``` + +### Delete an SDK + +Delete an SDK and every version it holds. + +| Direction | Type | +| --- | --- | +| Request | [`SdkDeleteParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkDeleteParams.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.sdks.SdkDeleteParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +SdkDeleteParams params = SdkDeleteParams.builder().uid("uidxx").build(); +var sdk = client.sdks().delete(params); + +System.out.println(sdk); +``` + +### Build an SDK + +Start a build. Omit `version` to build the current work — the open draft, else the latest version — and the resolved version comes back in the response. + +| Direction | Type | +| --- | --- | +| Request | [`SdkBuildParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkBuildParams.kt) | +| Response | [`SdkBuildResponse`](./scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkBuildResponse.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.sdks.SdkBuildParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +SdkBuildParams params = SdkBuildParams.builder().uid("uidxx").build(); +var sdk = client.sdks().build(params); + +System.out.println(sdk); +``` + +### `Sdks Versions` + +SDKs + +#### Create an SDK version + +Create a new SDK version against a specific API version. + +| Direction | Type | +| --- | --- | +| Request | [`VersionCreateParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/sdks/versions/VersionCreateParams.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.sdks.versions.VersionCreateParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +VersionCreateParams params = + VersionCreateParams.builder().uid("uidxx").version("").apiVersion("").build(); +var version = client.sdks().versions().create(params); + +System.out.println(version); +``` + +#### Delete an SDK version + +Permanently delete one version of an SDK. + +| Direction | Type | +| --- | --- | +| Request | [`VersionDeleteParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/sdks/versions/VersionDeleteParams.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.sdks.versions.VersionDeleteParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +VersionDeleteParams params = + VersionDeleteParams.builder().uid("uidxx").version("version").build(); +var version = client.sdks().versions().delete(params); + +System.out.println(version); +``` + +### `Sdks Repositories` + +SDKs + +#### Link a repository + +Link one language target to a GitHub repository, so builds sync there. + +| Direction | Type | +| --- | --- | +| Request | [`RepositoryLinkParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/sdks/repositories/RepositoryLinkParams.kt) | +| Response | [`RepositoryLinkResponse`](./scalar-java-core/src/main/kotlin/com/scalar/models/sdks/repositories/RepositoryLinkResponse.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.sdks.repositories.RepositoryLinkParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +RepositoryLinkParams params = + RepositoryLinkParams.builder() + .uid("uidxx") + .language(RepositoryLinkParams.Language.of("typescript")) + .repositoryId(0L) + .baseBranch("") + .build(); +var repository = client.sdks().repositories().link(params); + +System.out.println(repository); +``` + +#### Unlink a repository + +Unlink one language target from its repository. + +| Direction | Type | +| --- | --- | +| Request | [`RepositoryUnlinkParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/sdks/repositories/RepositoryUnlinkParams.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.sdks.repositories.RepositoryUnlinkParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +RepositoryUnlinkParams params = + RepositoryUnlinkParams.builder() + .uid("uidxx") + .language(RepositoryUnlinkParams.Language.of("typescript")) + .build(); +var repository = client.sdks().repositories().unlink(params); + +System.out.println(repository); +``` + +#### Update publishing settings + +Toggle publish-on-merge and the release settings for a linked target. + +| Direction | Type | +| --- | --- | +| Request | [`RepositoryUpdatePublishingParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/sdks/repositories/RepositoryUpdatePublishingParams.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.sdks.repositories.RepositoryUpdatePublishingParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +RepositoryUpdatePublishingParams params = + RepositoryUpdatePublishingParams.builder() + .uid("uidxx") + .language(RepositoryUpdatePublishingParams.Language.of("typescript")) + .publishOnMerge(false) + .build(); +var repository = client.sdks().repositories().updatePublishing(params); + +System.out.println(repository); +``` + +## `Mcp` + +### `Mcp Servers` + +MCP + +#### List all MCP servers + +List every MCP server on the team. + +| Direction | Type | +| --- | --- | +| Request | [`ServerListParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/ServerListParams.kt) | +| Response | [`List`](./scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/McpServer.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +var server = client.mcp().servers().list(); + +System.out.println(server); +``` + +#### Create an MCP server + +Create an MCP server over one or more API document versions. The response carries the server and its first installation. + +| Direction | Type | +| --- | --- | +| Request | [`ServerCreateParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/ServerCreateParams.kt) | +| Response | [`ServerCreateResponse`](./scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/ServerCreateResponse.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.mcp.servers.ServerCreateParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +ServerCreateParams params = ServerCreateParams.builder().name("x").build(); +var server = client.mcp().servers().create(params); + +System.out.println(server); +``` + +#### Get an MCP server + +Get a single MCP server by its id. + +| Direction | Type | +| --- | --- | +| Request | [`ServerRetrieveParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/ServerRetrieveParams.kt) | +| Response | [`McpServer`](./scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/McpServer.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.mcp.servers.ServerRetrieveParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +ServerRetrieveParams params = ServerRetrieveParams.builder().id("id").build(); +var server = client.mcp().servers().retrieve(params); + +System.out.println(server); +``` + +#### Update an MCP server + +Update MCP server metadata and which tools it exposes. + +| Direction | Type | +| --- | --- | +| Request | [`ServerUpdateParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/ServerUpdateParams.kt) | +| Response | [`McpServer`](./scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/McpServer.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.mcp.servers.ServerUpdateParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +ServerUpdateParams params = ServerUpdateParams.builder().id("id").build(); +var server = client.mcp().servers().update(params); + +System.out.println(server); +``` + +#### Delete an MCP server + +Delete an MCP server and every installation it serves. + +| Direction | Type | +| --- | --- | +| Request | [`ServerDeleteParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/ServerDeleteParams.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.mcp.servers.ServerDeleteParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +ServerDeleteParams params = ServerDeleteParams.builder().id("id").build(); +var server = client.mcp().servers().delete(params); + +System.out.println(server); +``` + +#### `Mcp Servers Installations` + +MCP + +##### List installations + +List the installations of an MCP server. An installation is what an MCP client connects to. + +| Direction | Type | +| --- | --- | +| Request | [`InstallationListParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/InstallationListParams.kt) | +| Response | [`List`](./scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/McpInstallationListItem.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.mcp.servers.installations.InstallationListParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +InstallationListParams params = InstallationListParams.builder().id("id").build(); +var installation = client.mcp().servers().installations().list(params); + +System.out.println(installation); +``` + +##### Create an installation + +Create an installation of an MCP server. `documentAuth` holds the credentials the server presents to the upstream API and is never returned. + +| Direction | Type | +| --- | --- | +| Request | [`InstallationCreateParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/InstallationCreateParams.kt) | +| Response | [`McpInstallation`](./scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/McpInstallation.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.mcp.servers.installations.InstallationCreateParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +InstallationCreateParams params = + InstallationCreateParams.builder() + .id("id") + .name("x") + .documentAuth(InstallationCreateParams.DocumentAuth.builder().build()) + .build(); +var installation = client.mcp().servers().installations().create(params); + +System.out.println(installation); +``` + +##### Get an installation + +Get a single installation of an MCP server. + +| Direction | Type | +| --- | --- | +| Request | [`InstallationRetrieveParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/InstallationRetrieveParams.kt) | +| Response | [`McpInstallation`](./scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/McpInstallation.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.mcp.servers.installations.InstallationRetrieveParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +InstallationRetrieveParams params = + InstallationRetrieveParams.builder().id("id").installationId("installationId").build(); +var installation = client.mcp().servers().installations().retrieve(params); + +System.out.println(installation); +``` + +##### Update an installation + +Update an installation. Set `isPrivate` and add access groups to put it behind a login. + +| Direction | Type | +| --- | --- | +| Request | [`InstallationUpdateParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/InstallationUpdateParams.kt) | +| Response | [`McpInstallation`](./scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/McpInstallation.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.mcp.servers.installations.InstallationUpdateParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +InstallationUpdateParams params = + InstallationUpdateParams.builder().id("id").installationId("installationId").build(); +var installation = client.mcp().servers().installations().update(params); + +System.out.println(installation); +``` + +##### Delete an installation + +Delete an installation of an MCP server. + +| Direction | Type | +| --- | --- | +| Request | [`InstallationDeleteParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/InstallationDeleteParams.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.mcp.servers.installations.InstallationDeleteParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +InstallationDeleteParams params = + InstallationDeleteParams.builder().id("id").installationId("installationId").build(); +var installation = client.mcp().servers().installations().delete(params); + +System.out.println(installation); +``` + +##### Add an access group + +Let an access group reach a private installation. + +| Direction | Type | +| --- | --- | +| Request | [`InstallationCreateAccessGroupParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/InstallationCreateAccessGroupParams.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.mcp.servers.installations.InstallationCreateAccessGroupParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +InstallationCreateAccessGroupParams params = + InstallationCreateAccessGroupParams.builder() + .id("id") + .installationId("installationId") + .accessGroupUid("xxxxx") + .build(); +var installation = client.mcp().servers().installations().createAccessGroup(params); + +System.out.println(installation); +``` + +##### Remove an access group + +Stop an access group reaching a private installation. + +| Direction | Type | +| --- | --- | +| Request | [`InstallationDeleteAccessGroupParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/InstallationDeleteAccessGroupParams.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.mcp.servers.installations.InstallationDeleteAccessGroupParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +InstallationDeleteAccessGroupParams params = + InstallationDeleteAccessGroupParams.builder() + .id("id") + .installationId("installationId") + .accessGroupUid("xxxxx") + .build(); +var installation = client.mcp().servers().installations().deleteAccessGroup(params); + +System.out.println(installation); +``` + +## `OAuth` + +OAuth + +### Start an OAuth authorization + +Authorization endpoint (RFC 6749 §4.1.1 with PKCE, RFC 7636). Validates the request and sends the user to the Scalar dashboard to approve it; the user returns to `redirect_uri` with a `code` to exchange at the token endpoint. Only `response_type=code` with `code_challenge_method=S256` is supported. + +| Direction | Type | +| --- | --- | +| Request | [`OAuthOauthAuthorizeParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthAuthorizeParams.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +var oAuth = client.oAuth().oauthAuthorize(); + +System.out.println(oAuth); +``` + +### Exchange a code or refresh token + +Token endpoint (RFC 6749 §4.1.3 and §6). Accepts `application/x-www-form-urlencoded`. Confidential clients authenticate with HTTP Basic or `client_secret` in the body; public clients send `client_id` alone. The `authorization_code` grant needs `code`, `redirect_uri` and `code_verifier`; the `refresh_token` grant needs `refresh_token` and may narrow `scope`. + +| Direction | Type | +| --- | --- | +| Request | [`OAuthOauthTokenParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthTokenParams.kt) | +| Response | [`OAuthOauthTokenResponse`](./scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthTokenResponse.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.oAuth.OAuthOauthTokenParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +OAuthOauthTokenParams params = OAuthOauthTokenParams.builder().grantType("").build(); +var oAuth = client.oAuth().oauthToken(params); + +System.out.println(oAuth); +``` + +### Revoke a refresh token + +Revocation endpoint (RFC 7009). Revokes the refresh token and every token issued alongside it. The client authenticates as it does at the token endpoint. Responds 200 whether or not the token was live, as the RFC requires. + +| Direction | Type | +| --- | --- | +| Request | [`OAuthOauthRevokeParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthRevokeParams.kt) | +| Response | [`OauthError?`](./scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OauthError.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.oAuth.OAuthOauthRevokeParams; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +OAuthOauthRevokeParams params = OAuthOauthRevokeParams.builder().token("").build(); +var oAuth = client.oAuth().oauthRevoke(params); + +System.out.println(oAuth); +``` + +### Authorization server metadata + +Discovery document for OAuth clients (RFC 8414): where the endpoints are and what they support. + +| Direction | Type | +| --- | --- | +| Request | [`OAuthOauthAuthorizationServerMetadataParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthAuthorizationServerMetadataParams.kt) | +| Response | [`OauthAuthorizationServerMetadata`](./scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OauthAuthorizationServerMetadata.kt) | + +```java +import com.scalar.client.ScalarClient; +import com.scalar.client.okhttp.ScalarOkHttpClient; + +ScalarClient client = + ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); + +var oAuth = client.oAuth().oauthAuthorizationServerMetadata(); + +System.out.println(oAuth); ``` diff --git a/scalar-java-core/src/main/kotlin/com/scalar/client/ScalarClient.kt b/scalar-java-core/src/main/kotlin/com/scalar/client/ScalarClient.kt index c86cce7..c49cf0e 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/client/ScalarClient.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/client/ScalarClient.kt @@ -3,13 +3,17 @@ package com.scalar.client import com.scalar.core.ClientOptions +import com.scalar.services.blocking.AccessGroupService import com.scalar.services.blocking.AuthenticationService import com.scalar.services.blocking.LoginPortalService +import com.scalar.services.blocking.McpService import com.scalar.services.blocking.NamespaceService +import com.scalar.services.blocking.OAuthService import com.scalar.services.blocking.RegistryService import com.scalar.services.blocking.RuleService import com.scalar.services.blocking.ScalarDocService import com.scalar.services.blocking.SchemaService +import com.scalar.services.blocking.SdkService import com.scalar.services.blocking.TeamService import com.scalar.services.blocking.ThemeService import java.util.function.Consumer @@ -59,6 +63,9 @@ interface ScalarClient { /** Login Portals */ fun loginPortals(): LoginPortalService + /** Access Groups */ + fun accessGroups(): AccessGroupService + /** Rules */ fun rules(): RuleService @@ -77,6 +84,14 @@ interface ScalarClient { /** Authentication */ fun authentication(): AuthenticationService + /** SDKs */ + fun sdks(): SdkService + + fun mcp(): McpService + + /** OAuth */ + fun oAuth(): OAuthService + /** * Closes this client, relinquishing any underlying resources. * @@ -109,6 +124,9 @@ interface ScalarClient { /** Login Portals */ fun loginPortals(): LoginPortalService.WithRawResponse + /** Access Groups */ + fun accessGroups(): AccessGroupService.WithRawResponse + /** Rules */ fun rules(): RuleService.WithRawResponse @@ -126,5 +144,13 @@ interface ScalarClient { /** Authentication */ fun authentication(): AuthenticationService.WithRawResponse + + /** SDKs */ + fun sdks(): SdkService.WithRawResponse + + fun mcp(): McpService.WithRawResponse + + /** OAuth */ + fun oAuth(): OAuthService.WithRawResponse } } diff --git a/scalar-java-core/src/main/kotlin/com/scalar/client/ScalarClientAsync.kt b/scalar-java-core/src/main/kotlin/com/scalar/client/ScalarClientAsync.kt index 76d7d33..bdfdcfa 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/client/ScalarClientAsync.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/client/ScalarClientAsync.kt @@ -3,13 +3,17 @@ package com.scalar.client import com.scalar.core.ClientOptions +import com.scalar.services.async.AccessGroupServiceAsync import com.scalar.services.async.AuthenticationServiceAsync import com.scalar.services.async.LoginPortalServiceAsync +import com.scalar.services.async.McpServiceAsync import com.scalar.services.async.NamespaceServiceAsync +import com.scalar.services.async.OAuthServiceAsync import com.scalar.services.async.RegistryServiceAsync import com.scalar.services.async.RuleServiceAsync import com.scalar.services.async.ScalarDocServiceAsync import com.scalar.services.async.SchemaServiceAsync +import com.scalar.services.async.SdkServiceAsync import com.scalar.services.async.TeamServiceAsync import com.scalar.services.async.ThemeServiceAsync import java.util.function.Consumer @@ -59,6 +63,9 @@ interface ScalarClientAsync { /** Login Portals */ fun loginPortals(): LoginPortalServiceAsync + /** Access Groups */ + fun accessGroups(): AccessGroupServiceAsync + /** Rules */ fun rules(): RuleServiceAsync @@ -77,6 +84,14 @@ interface ScalarClientAsync { /** Authentication */ fun authentication(): AuthenticationServiceAsync + /** SDKs */ + fun sdks(): SdkServiceAsync + + fun mcp(): McpServiceAsync + + /** OAuth */ + fun oAuth(): OAuthServiceAsync + /** * Closes this client, relinquishing any underlying resources. * @@ -111,6 +126,9 @@ interface ScalarClientAsync { /** Login Portals */ fun loginPortals(): LoginPortalServiceAsync.WithRawResponse + /** Access Groups */ + fun accessGroups(): AccessGroupServiceAsync.WithRawResponse + /** Rules */ fun rules(): RuleServiceAsync.WithRawResponse @@ -128,5 +146,13 @@ interface ScalarClientAsync { /** Authentication */ fun authentication(): AuthenticationServiceAsync.WithRawResponse + + /** SDKs */ + fun sdks(): SdkServiceAsync.WithRawResponse + + fun mcp(): McpServiceAsync.WithRawResponse + + /** OAuth */ + fun oAuth(): OAuthServiceAsync.WithRawResponse } } diff --git a/scalar-java-core/src/main/kotlin/com/scalar/client/ScalarClientAsyncImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/client/ScalarClientAsyncImpl.kt index ba4dc24..ade5e83 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/client/ScalarClientAsyncImpl.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/client/ScalarClientAsyncImpl.kt @@ -4,12 +4,18 @@ package com.scalar.client import com.scalar.core.ClientOptions import com.scalar.core.getPackageVersion +import com.scalar.services.async.AccessGroupServiceAsync +import com.scalar.services.async.AccessGroupServiceAsyncImpl import com.scalar.services.async.AuthenticationServiceAsync import com.scalar.services.async.AuthenticationServiceAsyncImpl import com.scalar.services.async.LoginPortalServiceAsync import com.scalar.services.async.LoginPortalServiceAsyncImpl +import com.scalar.services.async.McpServiceAsync +import com.scalar.services.async.McpServiceAsyncImpl import com.scalar.services.async.NamespaceServiceAsync import com.scalar.services.async.NamespaceServiceAsyncImpl +import com.scalar.services.async.OAuthServiceAsync +import com.scalar.services.async.OAuthServiceAsyncImpl import com.scalar.services.async.RegistryServiceAsync import com.scalar.services.async.RegistryServiceAsyncImpl import com.scalar.services.async.RuleServiceAsync @@ -18,6 +24,8 @@ import com.scalar.services.async.ScalarDocServiceAsync import com.scalar.services.async.ScalarDocServiceAsyncImpl import com.scalar.services.async.SchemaServiceAsync import com.scalar.services.async.SchemaServiceAsyncImpl +import com.scalar.services.async.SdkServiceAsync +import com.scalar.services.async.SdkServiceAsyncImpl import com.scalar.services.async.TeamServiceAsync import com.scalar.services.async.TeamServiceAsyncImpl import com.scalar.services.async.ThemeServiceAsync @@ -53,6 +61,10 @@ class ScalarClientAsyncImpl(private val clientOptions: ClientOptions) : ScalarCl LoginPortalServiceAsyncImpl(clientOptionsWithUserAgent) } + private val accessGroups: AccessGroupServiceAsync by lazy { + AccessGroupServiceAsyncImpl(clientOptionsWithUserAgent) + } + private val rules: RuleServiceAsync by lazy { RuleServiceAsyncImpl(clientOptionsWithUserAgent) } private val themes: ThemeServiceAsync by lazy { @@ -73,6 +85,14 @@ class ScalarClientAsyncImpl(private val clientOptions: ClientOptions) : ScalarCl AuthenticationServiceAsyncImpl(clientOptionsWithUserAgent) } + private val sdks: SdkServiceAsync by lazy { SdkServiceAsyncImpl(clientOptionsWithUserAgent) } + + private val mcp: McpServiceAsync by lazy { McpServiceAsyncImpl(clientOptionsWithUserAgent) } + + private val oAuth: OAuthServiceAsync by lazy { + OAuthServiceAsyncImpl(clientOptionsWithUserAgent) + } + override fun sync(): ScalarClient = sync override fun withRawResponse(): ScalarClientAsync.WithRawResponse = withRawResponse @@ -89,6 +109,9 @@ class ScalarClientAsyncImpl(private val clientOptions: ClientOptions) : ScalarCl /** Login Portals */ override fun loginPortals(): LoginPortalServiceAsync = loginPortals + /** Access Groups */ + override fun accessGroups(): AccessGroupServiceAsync = accessGroups + /** Rules */ override fun rules(): RuleServiceAsync = rules @@ -107,6 +130,14 @@ class ScalarClientAsyncImpl(private val clientOptions: ClientOptions) : ScalarCl /** Authentication */ override fun authentication(): AuthenticationServiceAsync = authentication + /** SDKs */ + override fun sdks(): SdkServiceAsync = sdks + + override fun mcp(): McpServiceAsync = mcp + + /** OAuth */ + override fun oAuth(): OAuthServiceAsync = oAuth + override fun close() = clientOptions.close() class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : @@ -124,6 +155,10 @@ class ScalarClientAsyncImpl(private val clientOptions: ClientOptions) : ScalarCl LoginPortalServiceAsyncImpl.WithRawResponseImpl(clientOptions) } + private val accessGroups: AccessGroupServiceAsync.WithRawResponse by lazy { + AccessGroupServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + private val rules: RuleServiceAsync.WithRawResponse by lazy { RuleServiceAsyncImpl.WithRawResponseImpl(clientOptions) } @@ -148,6 +183,18 @@ class ScalarClientAsyncImpl(private val clientOptions: ClientOptions) : ScalarCl AuthenticationServiceAsyncImpl.WithRawResponseImpl(clientOptions) } + private val sdks: SdkServiceAsync.WithRawResponse by lazy { + SdkServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val mcp: McpServiceAsync.WithRawResponse by lazy { + McpServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val oAuth: OAuthServiceAsync.WithRawResponse by lazy { + OAuthServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + override fun withOptions( modifier: Consumer ): ScalarClientAsync.WithRawResponse = @@ -164,6 +211,9 @@ class ScalarClientAsyncImpl(private val clientOptions: ClientOptions) : ScalarCl /** Login Portals */ override fun loginPortals(): LoginPortalServiceAsync.WithRawResponse = loginPortals + /** Access Groups */ + override fun accessGroups(): AccessGroupServiceAsync.WithRawResponse = accessGroups + /** Rules */ override fun rules(): RuleServiceAsync.WithRawResponse = rules @@ -181,5 +231,13 @@ class ScalarClientAsyncImpl(private val clientOptions: ClientOptions) : ScalarCl /** Authentication */ override fun authentication(): AuthenticationServiceAsync.WithRawResponse = authentication + + /** SDKs */ + override fun sdks(): SdkServiceAsync.WithRawResponse = sdks + + override fun mcp(): McpServiceAsync.WithRawResponse = mcp + + /** OAuth */ + override fun oAuth(): OAuthServiceAsync.WithRawResponse = oAuth } } diff --git a/scalar-java-core/src/main/kotlin/com/scalar/client/ScalarClientImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/client/ScalarClientImpl.kt index 4e1eea5..b7360f7 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/client/ScalarClientImpl.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/client/ScalarClientImpl.kt @@ -4,12 +4,18 @@ package com.scalar.client import com.scalar.core.ClientOptions import com.scalar.core.getPackageVersion +import com.scalar.services.blocking.AccessGroupService +import com.scalar.services.blocking.AccessGroupServiceImpl import com.scalar.services.blocking.AuthenticationService import com.scalar.services.blocking.AuthenticationServiceImpl import com.scalar.services.blocking.LoginPortalService import com.scalar.services.blocking.LoginPortalServiceImpl +import com.scalar.services.blocking.McpService +import com.scalar.services.blocking.McpServiceImpl import com.scalar.services.blocking.NamespaceService import com.scalar.services.blocking.NamespaceServiceImpl +import com.scalar.services.blocking.OAuthService +import com.scalar.services.blocking.OAuthServiceImpl import com.scalar.services.blocking.RegistryService import com.scalar.services.blocking.RegistryServiceImpl import com.scalar.services.blocking.RuleService @@ -18,6 +24,8 @@ import com.scalar.services.blocking.ScalarDocService import com.scalar.services.blocking.ScalarDocServiceImpl import com.scalar.services.blocking.SchemaService import com.scalar.services.blocking.SchemaServiceImpl +import com.scalar.services.blocking.SdkService +import com.scalar.services.blocking.SdkServiceImpl import com.scalar.services.blocking.TeamService import com.scalar.services.blocking.TeamServiceImpl import com.scalar.services.blocking.ThemeService @@ -51,6 +59,10 @@ class ScalarClientImpl(private val clientOptions: ClientOptions) : ScalarClient LoginPortalServiceImpl(clientOptionsWithUserAgent) } + private val accessGroups: AccessGroupService by lazy { + AccessGroupServiceImpl(clientOptionsWithUserAgent) + } + private val rules: RuleService by lazy { RuleServiceImpl(clientOptionsWithUserAgent) } private val themes: ThemeService by lazy { ThemeServiceImpl(clientOptionsWithUserAgent) } @@ -69,6 +81,12 @@ class ScalarClientImpl(private val clientOptions: ClientOptions) : ScalarClient AuthenticationServiceImpl(clientOptionsWithUserAgent) } + private val sdks: SdkService by lazy { SdkServiceImpl(clientOptionsWithUserAgent) } + + private val mcp: McpService by lazy { McpServiceImpl(clientOptionsWithUserAgent) } + + private val oAuth: OAuthService by lazy { OAuthServiceImpl(clientOptionsWithUserAgent) } + override fun async(): ScalarClientAsync = async override fun withRawResponse(): ScalarClient.WithRawResponse = withRawResponse @@ -85,6 +103,9 @@ class ScalarClientImpl(private val clientOptions: ClientOptions) : ScalarClient /** Login Portals */ override fun loginPortals(): LoginPortalService = loginPortals + /** Access Groups */ + override fun accessGroups(): AccessGroupService = accessGroups + /** Rules */ override fun rules(): RuleService = rules @@ -103,6 +124,14 @@ class ScalarClientImpl(private val clientOptions: ClientOptions) : ScalarClient /** Authentication */ override fun authentication(): AuthenticationService = authentication + /** SDKs */ + override fun sdks(): SdkService = sdks + + override fun mcp(): McpService = mcp + + /** OAuth */ + override fun oAuth(): OAuthService = oAuth + override fun close() = clientOptions.close() class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : @@ -120,6 +149,10 @@ class ScalarClientImpl(private val clientOptions: ClientOptions) : ScalarClient LoginPortalServiceImpl.WithRawResponseImpl(clientOptions) } + private val accessGroups: AccessGroupService.WithRawResponse by lazy { + AccessGroupServiceImpl.WithRawResponseImpl(clientOptions) + } + private val rules: RuleService.WithRawResponse by lazy { RuleServiceImpl.WithRawResponseImpl(clientOptions) } @@ -144,6 +177,18 @@ class ScalarClientImpl(private val clientOptions: ClientOptions) : ScalarClient AuthenticationServiceImpl.WithRawResponseImpl(clientOptions) } + private val sdks: SdkService.WithRawResponse by lazy { + SdkServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val mcp: McpService.WithRawResponse by lazy { + McpServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val oAuth: OAuthService.WithRawResponse by lazy { + OAuthServiceImpl.WithRawResponseImpl(clientOptions) + } + override fun withOptions( modifier: Consumer ): ScalarClient.WithRawResponse = @@ -160,6 +205,9 @@ class ScalarClientImpl(private val clientOptions: ClientOptions) : ScalarClient /** Login Portals */ override fun loginPortals(): LoginPortalService.WithRawResponse = loginPortals + /** Access Groups */ + override fun accessGroups(): AccessGroupService.WithRawResponse = accessGroups + /** Rules */ override fun rules(): RuleService.WithRawResponse = rules @@ -177,5 +225,13 @@ class ScalarClientImpl(private val clientOptions: ClientOptions) : ScalarClient /** Authentication */ override fun authentication(): AuthenticationService.WithRawResponse = authentication + + /** SDKs */ + override fun sdks(): SdkService.WithRawResponse = sdks + + override fun mcp(): McpService.WithRawResponse = mcp + + /** OAuth */ + override fun oAuth(): OAuthService.WithRawResponse = oAuth } } diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/ManagedDocVersion.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/ManagedDocVersion.kt index cc17557..7719c28 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/models/ManagedDocVersion.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/ManagedDocVersion.kt @@ -15,6 +15,7 @@ import com.scalar.core.checkKnown import com.scalar.core.checkRequired import com.scalar.core.toImmutable import com.scalar.errors.ScalarInvalidDataException +import com.scalar.models.registry.Method import java.util.Collections import java.util.Objects import java.util.Optional @@ -886,187 +887,6 @@ private constructor( (method.asKnown().getOrNull()?.validity() ?: 0) + (enabledTools.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) - class Method @JsonCreator private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val DELETE = of("delete") - - @JvmField val GET = of("get") - - @JvmField val HEAD = of("head") - - @JvmField val OPTIONS = of("options") - - @JvmField val PATCH = of("patch") - - @JvmField val POST = of("post") - - @JvmField val PUT = of("put") - - @JvmField val QUERY = of("query") - - @JvmField val TRACE = of("trace") - - @JvmStatic fun of(value: String) = Method(JsonField.of(value)) - } - - /** An enum containing [Method]'s known values. */ - enum class Known { - DELETE, - GET, - HEAD, - OPTIONS, - PATCH, - POST, - PUT, - QUERY, - TRACE, - } - - /** - * An enum containing [Method]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Method] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DELETE, - GET, - HEAD, - OPTIONS, - PATCH, - POST, - PUT, - QUERY, - TRACE, - /** - * An enum member indicating that [Method] was instantiated with an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - DELETE -> Value.DELETE - GET -> Value.GET - HEAD -> Value.HEAD - OPTIONS -> Value.OPTIONS - PATCH -> Value.PATCH - POST -> Value.POST - PUT -> Value.PUT - QUERY -> Value.QUERY - TRACE -> Value.TRACE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ScalarInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - DELETE -> Known.DELETE - GET -> Known.GET - HEAD -> Known.HEAD - OPTIONS -> Known.OPTIONS - PATCH -> Known.PATCH - POST -> Known.POST - PUT -> Known.PUT - QUERY -> Known.QUERY - TRACE -> Known.TRACE - else -> throw ScalarInvalidDataException("Unknown Method: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ScalarInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ScalarInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ScalarInvalidDataException if any value type in this object doesn't match its - * expected type. - */ - fun validate(): Method = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ScalarInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Method && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class EnabledTool @JsonCreator private constructor(private val value: JsonField) : Enum { diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupCreateParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupCreateParams.kt new file mode 100644 index 0000000..4f8a40c --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupCreateParams.kt @@ -0,0 +1,530 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.accessGroups + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.Params +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * Create a group for the current team. Requires docs edit permission and the access groups billing + * feature. Domains are exact email domains, without wildcards or implicit subdomain matching. + */ +class AccessGroupCreateParams +private constructor( + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun name(): Optional = body.name() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun slug(): Optional = body.slug() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun allowedDomains(): Optional = body.allowedDomains() + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _name(): JsonField = body._name() + + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _slug(): JsonField = body._slug() + + /** + * Returns the raw JSON value of [allowedDomains]. + * + * Unlike [allowedDomains], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _allowedDomains(): JsonField = body._allowedDomains() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): AccessGroupCreateParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [AccessGroupCreateParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [AccessGroupCreateParams]. */ + class Builder internal constructor() { + + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(accessGroupCreateParams: AccessGroupCreateParams) = apply { + body = accessGroupCreateParams.body.toBuilder() + additionalHeaders = accessGroupCreateParams.additionalHeaders.toBuilder() + additionalQueryParams = accessGroupCreateParams.additionalQueryParams.toBuilder() + } + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [name] + * - [slug] + * - [allowedDomains] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + fun name(name: String) = apply { body.name(name) } + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { body.name(name) } + + fun slug(slug: String) = apply { body.slug(slug) } + + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun slug(slug: JsonField) = apply { body.slug(slug) } + + fun allowedDomains(allowedDomains: Any?) = apply { body.allowedDomains(allowedDomains) } + + /** Alias for calling [Builder.allowedDomains] with `allowedDomains.orElse(null)`. */ + fun allowedDomains(allowedDomains: Optional) = apply { + body.allowedDomains(allowedDomains.getOrNull()) + } + + /** + * Sets [Builder.allowedDomains] to an arbitrary JSON value. + * + * You should usually call [Builder.allowedDomains] with a well-typed [Any] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun allowedDomains(allowedDomains: JsonField) = apply { + body.allowedDomains(allowedDomains) + } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [AccessGroupCreateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): AccessGroupCreateParams = + AccessGroupCreateParams( + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val name: JsonField, + private val slug: JsonField, + private val allowedDomains: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), + @JsonProperty("allowedDomains") + @ExcludeMissing + allowedDomains: JsonField = JsonMissing.of(), + ) : this(name, slug, allowedDomains, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun name(): Optional = name.getOptional("name") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun slug(): Optional = slug.getOptional("slug") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun allowedDomains(): Optional = allowedDomains.getOptional("allowedDomains") + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug + + /** + * Returns the raw JSON value of [allowedDomains]. + * + * Unlike [allowedDomains], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("allowedDomains") + @ExcludeMissing + fun _allowedDomains(): JsonField = allowedDomains + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Body]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var name: JsonField = JsonMissing.of() + private var slug: JsonField = JsonMissing.of() + private var allowedDomains: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + name = body.name + slug = body.slug + allowedDomains = body.allowedDomains + additionalProperties = body.additionalProperties.toMutableMap() + } + + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + fun slug(slug: String) = slug(JsonField.of(slug)) + + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun slug(slug: JsonField) = apply { this.slug = slug } + + fun allowedDomains(allowedDomains: Any?) = + allowedDomains(JsonField.ofNullable(allowedDomains)) + + /** Alias for calling [Builder.allowedDomains] with `allowedDomains.orElse(null)`. */ + fun allowedDomains(allowedDomains: Optional) = + allowedDomains(allowedDomains.getOrNull()) + + /** + * Sets [Builder.allowedDomains] to an arbitrary JSON value. + * + * You should usually call [Builder.allowedDomains] with a well-typed [Any] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun allowedDomains(allowedDomains: JsonField) = apply { + this.allowedDomains = allowedDomains + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Body = + Body(name, slug, allowedDomains, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Body = apply { + if (validated) { + return@apply + } + + name() + slug() + allowedDomains() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (name.asKnown().isPresent) 1 else 0) + + (if (slug.asKnown().isPresent) 1 else 0) + + (if (allowedDomains.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + name == other.name && + slug == other.slug && + allowedDomains == other.allowedDomains && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(name, slug, allowedDomains, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{name=$name, slug=$slug, allowedDomains=$allowedDomains, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AccessGroupCreateParams && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = Objects.hash(body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "AccessGroupCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupCreateResponse.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupCreateResponse.kt new file mode 100644 index 0000000..ce77e94 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupCreateResponse.kt @@ -0,0 +1,338 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.accessGroups + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.checkRequired +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class AccessGroupCreateResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val uid: JsonField, + private val name: JsonField, + private val slug: JsonField, + private val allowedDomains: JsonField, + private val allowedEmails: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("uid") @ExcludeMissing uid: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), + @JsonProperty("allowedDomains") + @ExcludeMissing + allowedDomains: JsonField = JsonMissing.of(), + @JsonProperty("allowedEmails") + @ExcludeMissing + allowedEmails: JsonField = JsonMissing.of(), + ) : this(uid, name, slug, allowedDomains, allowedEmails, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun uid(): String = uid.getRequired("uid") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun slug(): String = slug.getRequired("slug") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun allowedDomains(): Optional = allowedDomains.getOptional("allowedDomains") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun allowedEmails(): Optional = allowedEmails.getOptional("allowedEmails") + + /** + * Returns the raw JSON value of [uid]. + * + * Unlike [uid], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("uid") @ExcludeMissing fun _uid(): JsonField = uid + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug + + /** + * Returns the raw JSON value of [allowedDomains]. + * + * Unlike [allowedDomains], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("allowedDomains") + @ExcludeMissing + fun _allowedDomains(): JsonField = allowedDomains + + /** + * Returns the raw JSON value of [allowedEmails]. + * + * Unlike [allowedEmails], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("allowedEmails") + @ExcludeMissing + fun _allowedEmails(): JsonField = allowedEmails + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [AccessGroupCreateResponse]. + * + * The following fields are required: + * ```kotlin + * .uid() + * .name() + * .slug() + * .allowedDomains() + * .allowedEmails() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [AccessGroupCreateResponse]. */ + class Builder internal constructor() { + + private var uid: JsonField? = null + private var name: JsonField? = null + private var slug: JsonField? = null + private var allowedDomains: JsonField? = null + private var allowedEmails: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(accessGroupCreateResponse: AccessGroupCreateResponse) = apply { + uid = accessGroupCreateResponse.uid + name = accessGroupCreateResponse.name + slug = accessGroupCreateResponse.slug + allowedDomains = accessGroupCreateResponse.allowedDomains + allowedEmails = accessGroupCreateResponse.allowedEmails + additionalProperties = accessGroupCreateResponse.additionalProperties.toMutableMap() + } + + fun uid(uid: String) = uid(JsonField.of(uid)) + + /** + * Sets [Builder.uid] to an arbitrary JSON value. + * + * You should usually call [Builder.uid] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun uid(uid: JsonField) = apply { this.uid = uid } + + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + fun slug(slug: String) = slug(JsonField.of(slug)) + + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun slug(slug: JsonField) = apply { this.slug = slug } + + fun allowedDomains(allowedDomains: Any?) = + allowedDomains(JsonField.ofNullable(allowedDomains)) + + /** Alias for calling [Builder.allowedDomains] with `allowedDomains.orElse(null)`. */ + fun allowedDomains(allowedDomains: Optional) = + allowedDomains(allowedDomains.getOrNull()) + + /** + * Sets [Builder.allowedDomains] to an arbitrary JSON value. + * + * You should usually call [Builder.allowedDomains] with a well-typed [Any] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun allowedDomains(allowedDomains: JsonField) = apply { + this.allowedDomains = allowedDomains + } + + fun allowedEmails(allowedEmails: Any?) = allowedEmails(JsonField.ofNullable(allowedEmails)) + + /** Alias for calling [Builder.allowedEmails] with `allowedEmails.orElse(null)`. */ + fun allowedEmails(allowedEmails: Optional) = allowedEmails(allowedEmails.getOrNull()) + + /** + * Sets [Builder.allowedEmails] to an arbitrary JSON value. + * + * You should usually call [Builder.allowedEmails] with a well-typed [Any] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun allowedEmails(allowedEmails: JsonField) = apply { + this.allowedEmails = allowedEmails + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [AccessGroupCreateResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .uid() + * .name() + * .slug() + * .allowedDomains() + * .allowedEmails() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): AccessGroupCreateResponse = + AccessGroupCreateResponse( + checkRequired("uid", uid), + checkRequired("name", name), + checkRequired("slug", slug), + checkRequired("allowedDomains", allowedDomains), + checkRequired("allowedEmails", allowedEmails), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): AccessGroupCreateResponse = apply { + if (validated) { + return@apply + } + + uid() + name() + slug() + allowedDomains() + allowedEmails() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (uid.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (slug.asKnown().isPresent) 1 else 0) + + (if (allowedDomains.asKnown().isPresent) 1 else 0) + + (if (allowedEmails.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AccessGroupCreateResponse && + uid == other.uid && + name == other.name && + slug == other.slug && + allowedDomains == other.allowedDomains && + allowedEmails == other.allowedEmails && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(uid, name, slug, allowedDomains, allowedEmails, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "AccessGroupCreateResponse{uid=$uid, name=$name, slug=$slug, allowedDomains=$allowedDomains, allowedEmails=$allowedEmails, additionalProperties=$additionalProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupDeleteParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupDeleteParams.kt new file mode 100644 index 0000000..a9041a6 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupDeleteParams.kt @@ -0,0 +1,230 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.accessGroups + +import com.scalar.core.JsonValue +import com.scalar.core.Params +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import com.scalar.core.toImmutable +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Delete a group and remove its project assignments. Requires docs edit permission. */ +class AccessGroupDeleteParams +private constructor( + private val slug: String?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, + private val additionalBodyProperties: Map, +) : Params { + + fun slug(): Optional = Optional.ofNullable(slug) + + /** Additional body properties to send with the request. */ + fun _additionalBodyProperties(): Map = additionalBodyProperties + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): AccessGroupDeleteParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [AccessGroupDeleteParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [AccessGroupDeleteParams]. */ + class Builder internal constructor() { + + private var slug: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(accessGroupDeleteParams: AccessGroupDeleteParams) = apply { + slug = accessGroupDeleteParams.slug + additionalHeaders = accessGroupDeleteParams.additionalHeaders.toBuilder() + additionalQueryParams = accessGroupDeleteParams.additionalQueryParams.toBuilder() + additionalBodyProperties = + accessGroupDeleteParams.additionalBodyProperties.toMutableMap() + } + + fun slug(slug: String?) = apply { this.slug = slug } + + /** Alias for calling [Builder.slug] with `slug.orElse(null)`. */ + fun slug(slug: Optional) = slug(slug.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + putAllAdditionalBodyProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { + additionalBodyProperties.remove(key) + } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalBodyProperty) + } + + /** + * Returns an immutable instance of [AccessGroupDeleteParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): AccessGroupDeleteParams = + AccessGroupDeleteParams( + slug, + additionalHeaders.build(), + additionalQueryParams.build(), + additionalBodyProperties.toImmutable(), + ) + } + + fun _body(): Optional> = + Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) + + fun _pathParam(index: Int): String = + when (index) { + 0 -> slug ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AccessGroupDeleteParams && + slug == other.slug && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams && + additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int = + Objects.hash(slug, additionalHeaders, additionalQueryParams, additionalBodyProperties) + + override fun toString() = + "AccessGroupDeleteParams{slug=$slug, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupRetrieveParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupRetrieveParams.kt new file mode 100644 index 0000000..8236fac --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupRetrieveParams.kt @@ -0,0 +1,195 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.accessGroups + +import com.scalar.core.Params +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Get a group and its email and domain allowlists by slug. */ +class AccessGroupRetrieveParams +private constructor( + private val slug: String?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun slug(): Optional = Optional.ofNullable(slug) + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): AccessGroupRetrieveParams = builder().build() + + /** + * Returns a mutable builder for constructing an instance of [AccessGroupRetrieveParams]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [AccessGroupRetrieveParams]. */ + class Builder internal constructor() { + + private var slug: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(accessGroupRetrieveParams: AccessGroupRetrieveParams) = apply { + slug = accessGroupRetrieveParams.slug + additionalHeaders = accessGroupRetrieveParams.additionalHeaders.toBuilder() + additionalQueryParams = accessGroupRetrieveParams.additionalQueryParams.toBuilder() + } + + fun slug(slug: String?) = apply { this.slug = slug } + + /** Alias for calling [Builder.slug] with `slug.orElse(null)`. */ + fun slug(slug: Optional) = slug(slug.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [AccessGroupRetrieveParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): AccessGroupRetrieveParams = + AccessGroupRetrieveParams( + slug, + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _pathParam(index: Int): String = + when (index) { + 0 -> slug ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AccessGroupRetrieveParams && + slug == other.slug && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = Objects.hash(slug, additionalHeaders, additionalQueryParams) + + override fun toString() = + "AccessGroupRetrieveParams{slug=$slug, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupRetrieveResponse.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupRetrieveResponse.kt new file mode 100644 index 0000000..0c2d013 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupRetrieveResponse.kt @@ -0,0 +1,338 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.accessGroups + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.checkRequired +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class AccessGroupRetrieveResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val uid: JsonField, + private val name: JsonField, + private val slug: JsonField, + private val allowedDomains: JsonField, + private val allowedEmails: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("uid") @ExcludeMissing uid: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), + @JsonProperty("allowedDomains") + @ExcludeMissing + allowedDomains: JsonField = JsonMissing.of(), + @JsonProperty("allowedEmails") + @ExcludeMissing + allowedEmails: JsonField = JsonMissing.of(), + ) : this(uid, name, slug, allowedDomains, allowedEmails, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun uid(): String = uid.getRequired("uid") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun slug(): String = slug.getRequired("slug") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun allowedDomains(): Optional = allowedDomains.getOptional("allowedDomains") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun allowedEmails(): Optional = allowedEmails.getOptional("allowedEmails") + + /** + * Returns the raw JSON value of [uid]. + * + * Unlike [uid], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("uid") @ExcludeMissing fun _uid(): JsonField = uid + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug + + /** + * Returns the raw JSON value of [allowedDomains]. + * + * Unlike [allowedDomains], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("allowedDomains") + @ExcludeMissing + fun _allowedDomains(): JsonField = allowedDomains + + /** + * Returns the raw JSON value of [allowedEmails]. + * + * Unlike [allowedEmails], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("allowedEmails") + @ExcludeMissing + fun _allowedEmails(): JsonField = allowedEmails + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [AccessGroupRetrieveResponse]. + * + * The following fields are required: + * ```kotlin + * .uid() + * .name() + * .slug() + * .allowedDomains() + * .allowedEmails() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [AccessGroupRetrieveResponse]. */ + class Builder internal constructor() { + + private var uid: JsonField? = null + private var name: JsonField? = null + private var slug: JsonField? = null + private var allowedDomains: JsonField? = null + private var allowedEmails: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(accessGroupRetrieveResponse: AccessGroupRetrieveResponse) = apply { + uid = accessGroupRetrieveResponse.uid + name = accessGroupRetrieveResponse.name + slug = accessGroupRetrieveResponse.slug + allowedDomains = accessGroupRetrieveResponse.allowedDomains + allowedEmails = accessGroupRetrieveResponse.allowedEmails + additionalProperties = accessGroupRetrieveResponse.additionalProperties.toMutableMap() + } + + fun uid(uid: String) = uid(JsonField.of(uid)) + + /** + * Sets [Builder.uid] to an arbitrary JSON value. + * + * You should usually call [Builder.uid] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun uid(uid: JsonField) = apply { this.uid = uid } + + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + fun slug(slug: String) = slug(JsonField.of(slug)) + + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun slug(slug: JsonField) = apply { this.slug = slug } + + fun allowedDomains(allowedDomains: Any?) = + allowedDomains(JsonField.ofNullable(allowedDomains)) + + /** Alias for calling [Builder.allowedDomains] with `allowedDomains.orElse(null)`. */ + fun allowedDomains(allowedDomains: Optional) = + allowedDomains(allowedDomains.getOrNull()) + + /** + * Sets [Builder.allowedDomains] to an arbitrary JSON value. + * + * You should usually call [Builder.allowedDomains] with a well-typed [Any] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun allowedDomains(allowedDomains: JsonField) = apply { + this.allowedDomains = allowedDomains + } + + fun allowedEmails(allowedEmails: Any?) = allowedEmails(JsonField.ofNullable(allowedEmails)) + + /** Alias for calling [Builder.allowedEmails] with `allowedEmails.orElse(null)`. */ + fun allowedEmails(allowedEmails: Optional) = allowedEmails(allowedEmails.getOrNull()) + + /** + * Sets [Builder.allowedEmails] to an arbitrary JSON value. + * + * You should usually call [Builder.allowedEmails] with a well-typed [Any] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun allowedEmails(allowedEmails: JsonField) = apply { + this.allowedEmails = allowedEmails + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [AccessGroupRetrieveResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .uid() + * .name() + * .slug() + * .allowedDomains() + * .allowedEmails() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): AccessGroupRetrieveResponse = + AccessGroupRetrieveResponse( + checkRequired("uid", uid), + checkRequired("name", name), + checkRequired("slug", slug), + checkRequired("allowedDomains", allowedDomains), + checkRequired("allowedEmails", allowedEmails), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): AccessGroupRetrieveResponse = apply { + if (validated) { + return@apply + } + + uid() + name() + slug() + allowedDomains() + allowedEmails() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (uid.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (slug.asKnown().isPresent) 1 else 0) + + (if (allowedDomains.asKnown().isPresent) 1 else 0) + + (if (allowedEmails.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AccessGroupRetrieveResponse && + uid == other.uid && + name == other.name && + slug == other.slug && + allowedDomains == other.allowedDomains && + allowedEmails == other.allowedEmails && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(uid, name, slug, allowedDomains, allowedEmails, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "AccessGroupRetrieveResponse{uid=$uid, name=$name, slug=$slug, allowedDomains=$allowedDomains, allowedEmails=$allowedEmails, additionalProperties=$additionalProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupUpdateParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupUpdateParams.kt new file mode 100644 index 0000000..765a4ff --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupUpdateParams.kt @@ -0,0 +1,470 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.accessGroups + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.Params +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * Update group metadata. Requires docs edit permission. After changing the slug, use the new slug + * in subsequent requests. + */ +class AccessGroupUpdateParams +private constructor( + private val pathSlug: String?, + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun name(): Optional = body.name() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun bodySlug(): Optional = body.bodySlug() + + fun pathSlug(): Optional = Optional.ofNullable(pathSlug) + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _name(): JsonField = body._name() + + /** + * Returns the raw JSON value of [bodySlug]. + * + * Unlike [bodySlug], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _bodySlug(): JsonField = body._bodySlug() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): AccessGroupUpdateParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [AccessGroupUpdateParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [AccessGroupUpdateParams]. */ + class Builder internal constructor() { + + private var pathSlug: String? = null + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(accessGroupUpdateParams: AccessGroupUpdateParams) = apply { + pathSlug = accessGroupUpdateParams.pathSlug + body = accessGroupUpdateParams.body.toBuilder() + additionalHeaders = accessGroupUpdateParams.additionalHeaders.toBuilder() + additionalQueryParams = accessGroupUpdateParams.additionalQueryParams.toBuilder() + } + + fun pathSlug(pathSlug: String?) = apply { this.pathSlug = pathSlug } + + /** Alias for calling [Builder.pathSlug] with `pathSlug.orElse(null)`. */ + fun pathSlug(pathSlug: Optional) = pathSlug(pathSlug.getOrNull()) + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [name] + * - [bodySlug] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + fun name(name: String) = apply { body.name(name) } + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { body.name(name) } + + fun bodySlug(bodySlug: String) = apply { body.bodySlug(bodySlug) } + + /** + * Sets [Builder.bodySlug] to an arbitrary JSON value. + * + * You should usually call [Builder.bodySlug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun bodySlug(bodySlug: JsonField) = apply { body.bodySlug(bodySlug) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [AccessGroupUpdateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): AccessGroupUpdateParams = + AccessGroupUpdateParams( + pathSlug, + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> pathSlug ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val name: JsonField, + private val bodySlug: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("slug") @ExcludeMissing bodySlug: JsonField = JsonMissing.of(), + ) : this(name, bodySlug, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun name(): Optional = name.getOptional("name") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun bodySlug(): Optional = bodySlug.getOptional("slug") + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [bodySlug]. + * + * Unlike [bodySlug], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("slug") @ExcludeMissing fun _bodySlug(): JsonField = bodySlug + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Body]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var name: JsonField = JsonMissing.of() + private var bodySlug: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + name = body.name + bodySlug = body.bodySlug + additionalProperties = body.additionalProperties.toMutableMap() + } + + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + fun bodySlug(bodySlug: String) = bodySlug(JsonField.of(bodySlug)) + + /** + * Sets [Builder.bodySlug] to an arbitrary JSON value. + * + * You should usually call [Builder.bodySlug] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun bodySlug(bodySlug: JsonField) = apply { this.bodySlug = bodySlug } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Body = Body(name, bodySlug, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Body = apply { + if (validated) { + return@apply + } + + name() + bodySlug() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (name.asKnown().isPresent) 1 else 0) + (if (bodySlug.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + name == other.name && + bodySlug == other.bodySlug && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(name, bodySlug, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{name=$name, bodySlug=$bodySlug, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AccessGroupUpdateParams && + pathSlug == other.pathSlug && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash(pathSlug, body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "AccessGroupUpdateParams{pathSlug=$pathSlug, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/domains/DomainCreateParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/domains/DomainCreateParams.kt new file mode 100644 index 0000000..2706ca7 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/domains/DomainCreateParams.kt @@ -0,0 +1,441 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.accessGroups.domains + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.Params +import com.scalar.core.checkRequired +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * Allow an exact email domain in a group. Requires docs edit permission. A group supports up to + * 1000 domains. + */ +class DomainCreateParams +private constructor( + private val slug: String?, + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun domain(): String = body.domain() + + fun slug(): Optional = Optional.ofNullable(slug) + + /** + * Returns the raw JSON value of [domain]. + * + * Unlike [domain], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _domain(): JsonField = body._domain() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [DomainCreateParams]. + * + * The following fields are required: + * ```kotlin + * .domain() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [DomainCreateParams]. */ + class Builder internal constructor() { + + private var slug: String? = null + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(domainCreateParams: DomainCreateParams) = apply { + slug = domainCreateParams.slug + body = domainCreateParams.body.toBuilder() + additionalHeaders = domainCreateParams.additionalHeaders.toBuilder() + additionalQueryParams = domainCreateParams.additionalQueryParams.toBuilder() + } + + fun slug(slug: String?) = apply { this.slug = slug } + + /** Alias for calling [Builder.slug] with `slug.orElse(null)`. */ + fun slug(slug: Optional) = slug(slug.getOrNull()) + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [domain] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + fun domain(domain: String) = apply { body.domain(domain) } + + /** + * Sets [Builder.domain] to an arbitrary JSON value. + * + * You should usually call [Builder.domain] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun domain(domain: JsonField) = apply { body.domain(domain) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [DomainCreateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .domain() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): DomainCreateParams = + DomainCreateParams( + slug, + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> slug ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val domain: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("domain") @ExcludeMissing domain: JsonField = JsonMissing.of() + ) : this(domain, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun domain(): String = domain.getRequired("domain") + + /** + * Returns the raw JSON value of [domain]. + * + * Unlike [domain], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("domain") @ExcludeMissing fun _domain(): JsonField = domain + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```kotlin + * .domain() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var domain: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + domain = body.domain + additionalProperties = body.additionalProperties.toMutableMap() + } + + fun domain(domain: String) = domain(JsonField.of(domain)) + + /** + * Sets [Builder.domain] to an arbitrary JSON value. + * + * You should usually call [Builder.domain] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun domain(domain: JsonField) = apply { this.domain = domain } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .domain() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Body = + Body(checkRequired("domain", domain), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Body = apply { + if (validated) { + return@apply + } + + domain() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (if (domain.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + domain == other.domain && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(domain, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "Body{domain=$domain, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is DomainCreateParams && + slug == other.slug && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash(slug, body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "DomainCreateParams{slug=$slug, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/domains/DomainDeleteParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/domains/DomainDeleteParams.kt new file mode 100644 index 0000000..e179ceb --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/domains/DomainDeleteParams.kt @@ -0,0 +1,441 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.accessGroups.domains + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.Params +import com.scalar.core.checkRequired +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * Remove an exact email domain from a group. Requires docs edit permission. Other allowed domains + * and emails are preserved. + */ +class DomainDeleteParams +private constructor( + private val slug: String?, + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun domain(): String = body.domain() + + fun slug(): Optional = Optional.ofNullable(slug) + + /** + * Returns the raw JSON value of [domain]. + * + * Unlike [domain], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _domain(): JsonField = body._domain() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [DomainDeleteParams]. + * + * The following fields are required: + * ```kotlin + * .domain() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [DomainDeleteParams]. */ + class Builder internal constructor() { + + private var slug: String? = null + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(domainDeleteParams: DomainDeleteParams) = apply { + slug = domainDeleteParams.slug + body = domainDeleteParams.body.toBuilder() + additionalHeaders = domainDeleteParams.additionalHeaders.toBuilder() + additionalQueryParams = domainDeleteParams.additionalQueryParams.toBuilder() + } + + fun slug(slug: String?) = apply { this.slug = slug } + + /** Alias for calling [Builder.slug] with `slug.orElse(null)`. */ + fun slug(slug: Optional) = slug(slug.getOrNull()) + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [domain] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + fun domain(domain: String) = apply { body.domain(domain) } + + /** + * Sets [Builder.domain] to an arbitrary JSON value. + * + * You should usually call [Builder.domain] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun domain(domain: JsonField) = apply { body.domain(domain) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [DomainDeleteParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .domain() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): DomainDeleteParams = + DomainDeleteParams( + slug, + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> slug ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val domain: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("domain") @ExcludeMissing domain: JsonField = JsonMissing.of() + ) : this(domain, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun domain(): String = domain.getRequired("domain") + + /** + * Returns the raw JSON value of [domain]. + * + * Unlike [domain], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("domain") @ExcludeMissing fun _domain(): JsonField = domain + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```kotlin + * .domain() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var domain: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + domain = body.domain + additionalProperties = body.additionalProperties.toMutableMap() + } + + fun domain(domain: String) = domain(JsonField.of(domain)) + + /** + * Sets [Builder.domain] to an arbitrary JSON value. + * + * You should usually call [Builder.domain] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun domain(domain: JsonField) = apply { this.domain = domain } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .domain() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Body = + Body(checkRequired("domain", domain), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Body = apply { + if (validated) { + return@apply + } + + domain() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (if (domain.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + domain == other.domain && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(domain, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "Body{domain=$domain, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is DomainDeleteParams && + slug == other.slug && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash(slug, body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "DomainDeleteParams{slug=$slug, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/authentication/TeamSummary.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/authentication/TeamSummary.kt new file mode 100644 index 0000000..96690a6 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/authentication/TeamSummary.kt @@ -0,0 +1,245 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.authentication + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.checkRequired +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional + +class TeamSummary +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val uid: JsonField, + private val name: JsonField, + private val imageUri: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("uid") @ExcludeMissing uid: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("imageUri") @ExcludeMissing imageUri: JsonField = JsonMissing.of(), + ) : this(uid, name, imageUri, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun uid(): String = uid.getRequired("uid") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun imageUri(): Optional = imageUri.getOptional("imageUri") + + /** + * Returns the raw JSON value of [uid]. + * + * Unlike [uid], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("uid") @ExcludeMissing fun _uid(): JsonField = uid + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [imageUri]. + * + * Unlike [imageUri], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("imageUri") @ExcludeMissing fun _imageUri(): JsonField = imageUri + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [TeamSummary]. + * + * The following fields are required: + * ```kotlin + * .uid() + * .name() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [TeamSummary]. */ + class Builder internal constructor() { + + private var uid: JsonField? = null + private var name: JsonField? = null + private var imageUri: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(teamSummary: TeamSummary) = apply { + uid = teamSummary.uid + name = teamSummary.name + imageUri = teamSummary.imageUri + additionalProperties = teamSummary.additionalProperties.toMutableMap() + } + + fun uid(uid: String) = uid(JsonField.of(uid)) + + /** + * Sets [Builder.uid] to an arbitrary JSON value. + * + * You should usually call [Builder.uid] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun uid(uid: JsonField) = apply { this.uid = uid } + + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + fun imageUri(imageUri: String) = imageUri(JsonField.of(imageUri)) + + /** + * Sets [Builder.imageUri] to an arbitrary JSON value. + * + * You should usually call [Builder.imageUri] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun imageUri(imageUri: JsonField) = apply { this.imageUri = imageUri } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [TeamSummary]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .uid() + * .name() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): TeamSummary = + TeamSummary( + checkRequired("uid", uid), + checkRequired("name", name), + imageUri, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): TeamSummary = apply { + if (validated) { + return@apply + } + + uid() + name() + imageUri() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (uid.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (imageUri.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is TeamSummary && + uid == other.uid && + name == other.name && + imageUri == other.imageUri && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(uid, name, imageUri, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "TeamSummary{uid=$uid, name=$name, imageUri=$imageUri, additionalProperties=$additionalProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/authentication/AuthenticationListCurrentUserResponse.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/authentication/User.kt similarity index 58% rename from scalar-java-core/src/main/kotlin/com/scalar/models/authentication/AuthenticationListCurrentUserResponse.kt rename to scalar-java-core/src/main/kotlin/com/scalar/models/authentication/User.kt index 0d2d266..74db486 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/models/authentication/AuthenticationListCurrentUserResponse.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/authentication/User.kt @@ -19,7 +19,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -class AuthenticationListCurrentUserResponse +class User @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val uid: JsonField, @@ -29,7 +29,7 @@ private constructor( private val theme: JsonField, private val activeTeamId: JsonField, private val hasGithub: JsonField, - private val teams: JsonField>, + private val teams: JsonField>, private val additionalProperties: MutableMap, ) { @@ -44,7 +44,9 @@ private constructor( @ExcludeMissing activeTeamId: JsonField = JsonMissing.of(), @JsonProperty("hasGithub") @ExcludeMissing hasGithub: JsonField = JsonMissing.of(), - @JsonProperty("teams") @ExcludeMissing teams: JsonField> = JsonMissing.of(), + @JsonProperty("teams") + @ExcludeMissing + teams: JsonField> = JsonMissing.of(), ) : this( uid, createdAt, @@ -103,7 +105,7 @@ private constructor( * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun teams(): List = teams.getRequired("teams") + fun teams(): List = teams.getRequired("teams") /** * Returns the raw JSON value of [uid]. @@ -161,7 +163,7 @@ private constructor( * * Unlike [teams], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("teams") @ExcludeMissing fun _teams(): JsonField> = teams + @JsonProperty("teams") @ExcludeMissing fun _teams(): JsonField> = teams @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -178,8 +180,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [AuthenticationListCurrentUserResponse]. + * Returns a mutable builder for constructing an instance of [User]. * * The following fields are required: * ```kotlin @@ -195,7 +196,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [AuthenticationListCurrentUserResponse]. */ + /** A builder for [User]. */ class Builder internal constructor() { private var uid: JsonField? = null @@ -205,23 +206,20 @@ private constructor( private var theme: JsonField = JsonMissing.of() private var activeTeamId: JsonField? = null private var hasGithub: JsonField? = null - private var teams: JsonField>? = null + private var teams: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - authenticationListCurrentUserResponse: AuthenticationListCurrentUserResponse - ) = apply { - uid = authenticationListCurrentUserResponse.uid - createdAt = authenticationListCurrentUserResponse.createdAt - updatedAt = authenticationListCurrentUserResponse.updatedAt - email = authenticationListCurrentUserResponse.email - theme = authenticationListCurrentUserResponse.theme - activeTeamId = authenticationListCurrentUserResponse.activeTeamId - hasGithub = authenticationListCurrentUserResponse.hasGithub - teams = authenticationListCurrentUserResponse.teams.map { it.toMutableList() } - additionalProperties = - authenticationListCurrentUserResponse.additionalProperties.toMutableMap() + internal fun from(user: User) = apply { + uid = user.uid + createdAt = user.createdAt + updatedAt = user.updatedAt + email = user.email + theme = user.theme + activeTeamId = user.activeTeamId + hasGithub = user.hasGithub + teams = user.teams.map { it.toMutableList() } + additionalProperties = user.additionalProperties.toMutableMap() } fun uid(uid: String) = uid(JsonField.of(uid)) @@ -301,25 +299,25 @@ private constructor( */ fun hasGithub(hasGithub: JsonField) = apply { this.hasGithub = hasGithub } - fun teams(teams: List) = teams(JsonField.of(teams)) + fun teams(teams: List) = teams(JsonField.of(teams)) /** * Sets [Builder.teams] to an arbitrary JSON value. * - * You should usually call [Builder.teams] with a well-typed `List` value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. + * You should usually call [Builder.teams] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun teams(teams: JsonField>) = apply { + fun teams(teams: JsonField>) = apply { this.teams = teams.map { it.toMutableList() } } /** - * Adds a single [Team] to [teams]. + * Adds a single [TeamSummary] to [teams]. * * @throws IllegalStateException if the field was previously set to a non-list. */ - fun addTeam(team: Team) = apply { + fun addTeam(team: TeamSummary) = apply { teams = (teams ?: JsonField.of(mutableListOf())).also { checkKnown("teams", it).add(team) } } @@ -344,7 +342,7 @@ private constructor( } /** - * Returns an immutable instance of [AuthenticationListCurrentUserResponse]. + * Returns an immutable instance of [User]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -361,8 +359,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): AuthenticationListCurrentUserResponse = - AuthenticationListCurrentUserResponse( + fun build(): User = + User( checkRequired("uid", uid), checkRequired("createdAt", createdAt), checkRequired("updatedAt", updatedAt), @@ -385,7 +383,7 @@ private constructor( * @throws ScalarInvalidDataException if any value type in this object doesn't match its * expected type. */ - fun validate(): AuthenticationListCurrentUserResponse = apply { + fun validate(): User = apply { if (validated) { return@apply } @@ -425,249 +423,12 @@ private constructor( (if (hasGithub.asKnown().isPresent) 1 else 0) + (teams.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) - class Team - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val uid: JsonField, - private val name: JsonField, - private val imageUri: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("uid") @ExcludeMissing uid: JsonField = JsonMissing.of(), - @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), - @JsonProperty("imageUri") - @ExcludeMissing - imageUri: JsonField = JsonMissing.of(), - ) : this(uid, name, imageUri, mutableMapOf()) - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun uid(): String = uid.getRequired("uid") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun name(): String = name.getRequired("name") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun imageUri(): Optional = imageUri.getOptional("imageUri") - - /** - * Returns the raw JSON value of [uid]. - * - * Unlike [uid], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("uid") @ExcludeMissing fun _uid(): JsonField = uid - - /** - * Returns the raw JSON value of [name]. - * - * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - /** - * Returns the raw JSON value of [imageUri]. - * - * Unlike [imageUri], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("imageUri") @ExcludeMissing fun _imageUri(): JsonField = imageUri - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [Team]. - * - * The following fields are required: - * ```kotlin - * .uid() - * .name() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Team]. */ - class Builder internal constructor() { - - private var uid: JsonField? = null - private var name: JsonField? = null - private var imageUri: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(team: Team) = apply { - uid = team.uid - name = team.name - imageUri = team.imageUri - additionalProperties = team.additionalProperties.toMutableMap() - } - - fun uid(uid: String) = uid(JsonField.of(uid)) - - /** - * Sets [Builder.uid] to an arbitrary JSON value. - * - * You should usually call [Builder.uid] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun uid(uid: JsonField) = apply { this.uid = uid } - - fun name(name: String) = name(JsonField.of(name)) - - /** - * Sets [Builder.name] to an arbitrary JSON value. - * - * You should usually call [Builder.name] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun name(name: JsonField) = apply { this.name = name } - - fun imageUri(imageUri: String) = imageUri(JsonField.of(imageUri)) - - /** - * Sets [Builder.imageUri] to an arbitrary JSON value. - * - * You should usually call [Builder.imageUri] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun imageUri(imageUri: JsonField) = apply { this.imageUri = imageUri } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Team]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```kotlin - * .uid() - * .name() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Team = - Team( - checkRequired("uid", uid), - checkRequired("name", name), - imageUri, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws ScalarInvalidDataException if any value type in this object doesn't match its - * expected type. - */ - fun validate(): Team = apply { - if (validated) { - return@apply - } - - uid() - name() - imageUri() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ScalarInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (uid.asKnown().isPresent) 1 else 0) + - (if (name.asKnown().isPresent) 1 else 0) + - (if (imageUri.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Team && - uid == other.uid && - name == other.name && - imageUri == other.imageUri && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(uid, name, imageUri, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Team{uid=$uid, name=$name, imageUri=$imageUri, additionalProperties=$additionalProperties}" - } - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is AuthenticationListCurrentUserResponse && + return other is User && uid == other.uid && createdAt == other.createdAt && updatedAt == other.updatedAt && @@ -696,5 +457,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AuthenticationListCurrentUserResponse{uid=$uid, createdAt=$createdAt, updatedAt=$updatedAt, email=$email, theme=$theme, activeTeamId=$activeTeamId, hasGithub=$hasGithub, teams=$teams, additionalProperties=$additionalProperties}" + "User{uid=$uid, createdAt=$createdAt, updatedAt=$updatedAt, email=$email, theme=$theme, activeTeamId=$activeTeamId, hasGithub=$hasGithub, teams=$teams, additionalProperties=$additionalProperties}" } diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/loginPortals/LoginPortalListResponse.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/loginPortals/LoginPortal.kt similarity index 90% rename from scalar-java-core/src/main/kotlin/com/scalar/models/loginPortals/LoginPortalListResponse.kt rename to scalar-java-core/src/main/kotlin/com/scalar/models/loginPortals/LoginPortal.kt index d68b7cf..ef6741c 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/models/loginPortals/LoginPortalListResponse.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/loginPortals/LoginPortal.kt @@ -15,7 +15,7 @@ import com.scalar.errors.ScalarInvalidDataException import java.util.Collections import java.util.Objects -class LoginPortalListResponse +class LoginPortal @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val uid: JsonField, @@ -85,7 +85,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [LoginPortalListResponse]. + * Returns a mutable builder for constructing an instance of [LoginPortal]. * * The following fields are required: * ```kotlin @@ -97,7 +97,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [LoginPortalListResponse]. */ + /** A builder for [LoginPortal]. */ class Builder internal constructor() { private var uid: JsonField? = null @@ -106,11 +106,11 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(loginPortalListResponse: LoginPortalListResponse) = apply { - uid = loginPortalListResponse.uid - title = loginPortalListResponse.title - slug = loginPortalListResponse.slug - additionalProperties = loginPortalListResponse.additionalProperties.toMutableMap() + internal fun from(loginPortal: LoginPortal) = apply { + uid = loginPortal.uid + title = loginPortal.title + slug = loginPortal.slug + additionalProperties = loginPortal.additionalProperties.toMutableMap() } fun uid(uid: String) = uid(JsonField.of(uid)) @@ -163,7 +163,7 @@ private constructor( } /** - * Returns an immutable instance of [LoginPortalListResponse]. + * Returns an immutable instance of [LoginPortal]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -176,8 +176,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): LoginPortalListResponse = - LoginPortalListResponse( + fun build(): LoginPortal = + LoginPortal( checkRequired("uid", uid), checkRequired("title", title), checkRequired("slug", slug), @@ -195,7 +195,7 @@ private constructor( * @throws ScalarInvalidDataException if any value type in this object doesn't match its * expected type. */ - fun validate(): LoginPortalListResponse = apply { + fun validate(): LoginPortal = apply { if (validated) { return@apply } @@ -230,7 +230,7 @@ private constructor( return true } - return other is LoginPortalListResponse && + return other is LoginPortal && uid == other.uid && title == other.title && slug == other.slug && @@ -242,5 +242,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "LoginPortalListResponse{uid=$uid, title=$title, slug=$slug, additionalProperties=$additionalProperties}" + "LoginPortal{uid=$uid, title=$title, slug=$slug, additionalProperties=$additionalProperties}" } diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/McpInstallation.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/McpInstallation.kt new file mode 100644 index 0000000..ea3c52e --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/McpInstallation.kt @@ -0,0 +1,567 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.mcp.servers + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.checkKnown +import com.scalar.core.checkRequired +import com.scalar.core.toImmutable +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class McpInstallation +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val mcpServerId: JsonField, + private val name: JsonField, + private val slug: JsonField, + private val isPrivate: JsonField, + private val accessGroups: JsonField>, + private val loginPortalUid: JsonField, + private val mcpVersion: JsonField, + private val piiRedactionEnabled: JsonField, + private val credentialRedactionEnabled: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("mcpServerId") + @ExcludeMissing + mcpServerId: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), + @JsonProperty("isPrivate") @ExcludeMissing isPrivate: JsonField = JsonMissing.of(), + @JsonProperty("accessGroups") + @ExcludeMissing + accessGroups: JsonField> = JsonMissing.of(), + @JsonProperty("loginPortalUid") + @ExcludeMissing + loginPortalUid: JsonField = JsonMissing.of(), + @JsonProperty("mcpVersion") + @ExcludeMissing + mcpVersion: JsonField = JsonMissing.of(), + @JsonProperty("piiRedactionEnabled") + @ExcludeMissing + piiRedactionEnabled: JsonField = JsonMissing.of(), + @JsonProperty("credentialRedactionEnabled") + @ExcludeMissing + credentialRedactionEnabled: JsonField = JsonMissing.of(), + ) : this( + id, + mcpServerId, + name, + slug, + isPrivate, + accessGroups, + loginPortalUid, + mcpVersion, + piiRedactionEnabled, + credentialRedactionEnabled, + mutableMapOf(), + ) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun mcpServerId(): String = mcpServerId.getRequired("mcpServerId") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun slug(): String = slug.getRequired("slug") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun isPrivate(): Boolean = isPrivate.getRequired("isPrivate") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun accessGroups(): List = accessGroups.getRequired("accessGroups") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun loginPortalUid(): Optional = loginPortalUid.getOptional("loginPortalUid") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun mcpVersion(): Optional = mcpVersion.getOptional("mcpVersion") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun piiRedactionEnabled(): Boolean = piiRedactionEnabled.getRequired("piiRedactionEnabled") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun credentialRedactionEnabled(): Boolean = + credentialRedactionEnabled.getRequired("credentialRedactionEnabled") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [mcpServerId]. + * + * Unlike [mcpServerId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("mcpServerId") @ExcludeMissing fun _mcpServerId(): JsonField = mcpServerId + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug + + /** + * Returns the raw JSON value of [isPrivate]. + * + * Unlike [isPrivate], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("isPrivate") @ExcludeMissing fun _isPrivate(): JsonField = isPrivate + + /** + * Returns the raw JSON value of [accessGroups]. + * + * Unlike [accessGroups], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("accessGroups") + @ExcludeMissing + fun _accessGroups(): JsonField> = accessGroups + + /** + * Returns the raw JSON value of [loginPortalUid]. + * + * Unlike [loginPortalUid], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("loginPortalUid") + @ExcludeMissing + fun _loginPortalUid(): JsonField = loginPortalUid + + /** + * Returns the raw JSON value of [mcpVersion]. + * + * Unlike [mcpVersion], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("mcpVersion") @ExcludeMissing fun _mcpVersion(): JsonField = mcpVersion + + /** + * Returns the raw JSON value of [piiRedactionEnabled]. + * + * Unlike [piiRedactionEnabled], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("piiRedactionEnabled") + @ExcludeMissing + fun _piiRedactionEnabled(): JsonField = piiRedactionEnabled + + /** + * Returns the raw JSON value of [credentialRedactionEnabled]. + * + * Unlike [credentialRedactionEnabled], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("credentialRedactionEnabled") + @ExcludeMissing + fun _credentialRedactionEnabled(): JsonField = credentialRedactionEnabled + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [McpInstallation]. + * + * The following fields are required: + * ```kotlin + * .id() + * .mcpServerId() + * .name() + * .slug() + * .isPrivate() + * .accessGroups() + * .loginPortalUid() + * .mcpVersion() + * .piiRedactionEnabled() + * .credentialRedactionEnabled() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [McpInstallation]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var mcpServerId: JsonField? = null + private var name: JsonField? = null + private var slug: JsonField? = null + private var isPrivate: JsonField? = null + private var accessGroups: JsonField>? = null + private var loginPortalUid: JsonField? = null + private var mcpVersion: JsonField? = null + private var piiRedactionEnabled: JsonField? = null + private var credentialRedactionEnabled: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(mcpInstallation: McpInstallation) = apply { + id = mcpInstallation.id + mcpServerId = mcpInstallation.mcpServerId + name = mcpInstallation.name + slug = mcpInstallation.slug + isPrivate = mcpInstallation.isPrivate + accessGroups = mcpInstallation.accessGroups.map { it.toMutableList() } + loginPortalUid = mcpInstallation.loginPortalUid + mcpVersion = mcpInstallation.mcpVersion + piiRedactionEnabled = mcpInstallation.piiRedactionEnabled + credentialRedactionEnabled = mcpInstallation.credentialRedactionEnabled + additionalProperties = mcpInstallation.additionalProperties.toMutableMap() + } + + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + fun mcpServerId(mcpServerId: String) = mcpServerId(JsonField.of(mcpServerId)) + + /** + * Sets [Builder.mcpServerId] to an arbitrary JSON value. + * + * You should usually call [Builder.mcpServerId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun mcpServerId(mcpServerId: JsonField) = apply { this.mcpServerId = mcpServerId } + + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + fun slug(slug: String) = slug(JsonField.of(slug)) + + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun slug(slug: JsonField) = apply { this.slug = slug } + + fun isPrivate(isPrivate: Boolean) = isPrivate(JsonField.of(isPrivate)) + + /** + * Sets [Builder.isPrivate] to an arbitrary JSON value. + * + * You should usually call [Builder.isPrivate] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun isPrivate(isPrivate: JsonField) = apply { this.isPrivate = isPrivate } + + fun accessGroups(accessGroups: List) = accessGroups(JsonField.of(accessGroups)) + + /** + * Sets [Builder.accessGroups] to an arbitrary JSON value. + * + * You should usually call [Builder.accessGroups] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun accessGroups(accessGroups: JsonField>) = apply { + this.accessGroups = accessGroups.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [accessGroups]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addAccessGroup(accessGroup: String) = apply { + accessGroups = + (accessGroups ?: JsonField.of(mutableListOf())).also { + checkKnown("accessGroups", it).add(accessGroup) + } + } + + fun loginPortalUid(loginPortalUid: String?) = + loginPortalUid(JsonField.ofNullable(loginPortalUid)) + + /** Alias for calling [Builder.loginPortalUid] with `loginPortalUid.orElse(null)`. */ + fun loginPortalUid(loginPortalUid: Optional) = + loginPortalUid(loginPortalUid.getOrNull()) + + /** + * Sets [Builder.loginPortalUid] to an arbitrary JSON value. + * + * You should usually call [Builder.loginPortalUid] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun loginPortalUid(loginPortalUid: JsonField) = apply { + this.loginPortalUid = loginPortalUid + } + + fun mcpVersion(mcpVersion: String?) = mcpVersion(JsonField.ofNullable(mcpVersion)) + + /** Alias for calling [Builder.mcpVersion] with `mcpVersion.orElse(null)`. */ + fun mcpVersion(mcpVersion: Optional) = mcpVersion(mcpVersion.getOrNull()) + + /** + * Sets [Builder.mcpVersion] to an arbitrary JSON value. + * + * You should usually call [Builder.mcpVersion] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun mcpVersion(mcpVersion: JsonField) = apply { this.mcpVersion = mcpVersion } + + fun piiRedactionEnabled(piiRedactionEnabled: Boolean) = + piiRedactionEnabled(JsonField.of(piiRedactionEnabled)) + + /** + * Sets [Builder.piiRedactionEnabled] to an arbitrary JSON value. + * + * You should usually call [Builder.piiRedactionEnabled] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun piiRedactionEnabled(piiRedactionEnabled: JsonField) = apply { + this.piiRedactionEnabled = piiRedactionEnabled + } + + fun credentialRedactionEnabled(credentialRedactionEnabled: Boolean) = + credentialRedactionEnabled(JsonField.of(credentialRedactionEnabled)) + + /** + * Sets [Builder.credentialRedactionEnabled] to an arbitrary JSON value. + * + * You should usually call [Builder.credentialRedactionEnabled] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun credentialRedactionEnabled(credentialRedactionEnabled: JsonField) = apply { + this.credentialRedactionEnabled = credentialRedactionEnabled + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [McpInstallation]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .id() + * .mcpServerId() + * .name() + * .slug() + * .isPrivate() + * .accessGroups() + * .loginPortalUid() + * .mcpVersion() + * .piiRedactionEnabled() + * .credentialRedactionEnabled() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): McpInstallation = + McpInstallation( + checkRequired("id", id), + checkRequired("mcpServerId", mcpServerId), + checkRequired("name", name), + checkRequired("slug", slug), + checkRequired("isPrivate", isPrivate), + checkRequired("accessGroups", accessGroups).map { it.toImmutable() }, + checkRequired("loginPortalUid", loginPortalUid), + checkRequired("mcpVersion", mcpVersion), + checkRequired("piiRedactionEnabled", piiRedactionEnabled), + checkRequired("credentialRedactionEnabled", credentialRedactionEnabled), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): McpInstallation = apply { + if (validated) { + return@apply + } + + id() + mcpServerId() + name() + slug() + isPrivate() + accessGroups() + loginPortalUid() + mcpVersion() + piiRedactionEnabled() + credentialRedactionEnabled() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (mcpServerId.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (slug.asKnown().isPresent) 1 else 0) + + (if (isPrivate.asKnown().isPresent) 1 else 0) + + (accessGroups.asKnown().getOrNull()?.size ?: 0) + + (if (loginPortalUid.asKnown().isPresent) 1 else 0) + + (if (mcpVersion.asKnown().isPresent) 1 else 0) + + (if (piiRedactionEnabled.asKnown().isPresent) 1 else 0) + + (if (credentialRedactionEnabled.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is McpInstallation && + id == other.id && + mcpServerId == other.mcpServerId && + name == other.name && + slug == other.slug && + isPrivate == other.isPrivate && + accessGroups == other.accessGroups && + loginPortalUid == other.loginPortalUid && + mcpVersion == other.mcpVersion && + piiRedactionEnabled == other.piiRedactionEnabled && + credentialRedactionEnabled == other.credentialRedactionEnabled && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + mcpServerId, + name, + slug, + isPrivate, + accessGroups, + loginPortalUid, + mcpVersion, + piiRedactionEnabled, + credentialRedactionEnabled, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "McpInstallation{id=$id, mcpServerId=$mcpServerId, name=$name, slug=$slug, isPrivate=$isPrivate, accessGroups=$accessGroups, loginPortalUid=$loginPortalUid, mcpVersion=$mcpVersion, piiRedactionEnabled=$piiRedactionEnabled, credentialRedactionEnabled=$credentialRedactionEnabled, additionalProperties=$additionalProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/McpServer.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/McpServer.kt new file mode 100644 index 0000000..f3af744 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/McpServer.kt @@ -0,0 +1,366 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.mcp.servers + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.checkRequired +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects + +class McpServer +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val name: JsonField, + private val slug: JsonField, + private val autoAddOperations: JsonField, + private val createdAt: JsonField, + private val updatedAt: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), + @JsonProperty("autoAddOperations") + @ExcludeMissing + autoAddOperations: JsonField = JsonMissing.of(), + @JsonProperty("createdAt") @ExcludeMissing createdAt: JsonField = JsonMissing.of(), + @JsonProperty("updatedAt") @ExcludeMissing updatedAt: JsonField = JsonMissing.of(), + ) : this(id, name, slug, autoAddOperations, createdAt, updatedAt, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun slug(): String = slug.getRequired("slug") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun autoAddOperations(): Boolean = autoAddOperations.getRequired("autoAddOperations") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun createdAt(): String = createdAt.getRequired("createdAt") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun updatedAt(): String = updatedAt.getRequired("updatedAt") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug + + /** + * Returns the raw JSON value of [autoAddOperations]. + * + * Unlike [autoAddOperations], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("autoAddOperations") + @ExcludeMissing + fun _autoAddOperations(): JsonField = autoAddOperations + + /** + * Returns the raw JSON value of [createdAt]. + * + * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("createdAt") @ExcludeMissing fun _createdAt(): JsonField = createdAt + + /** + * Returns the raw JSON value of [updatedAt]. + * + * Unlike [updatedAt], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("updatedAt") @ExcludeMissing fun _updatedAt(): JsonField = updatedAt + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [McpServer]. + * + * The following fields are required: + * ```kotlin + * .id() + * .name() + * .slug() + * .autoAddOperations() + * .createdAt() + * .updatedAt() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [McpServer]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var name: JsonField? = null + private var slug: JsonField? = null + private var autoAddOperations: JsonField? = null + private var createdAt: JsonField? = null + private var updatedAt: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(mcpServer: McpServer) = apply { + id = mcpServer.id + name = mcpServer.name + slug = mcpServer.slug + autoAddOperations = mcpServer.autoAddOperations + createdAt = mcpServer.createdAt + updatedAt = mcpServer.updatedAt + additionalProperties = mcpServer.additionalProperties.toMutableMap() + } + + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + fun slug(slug: String) = slug(JsonField.of(slug)) + + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun slug(slug: JsonField) = apply { this.slug = slug } + + fun autoAddOperations(autoAddOperations: Boolean) = + autoAddOperations(JsonField.of(autoAddOperations)) + + /** + * Sets [Builder.autoAddOperations] to an arbitrary JSON value. + * + * You should usually call [Builder.autoAddOperations] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun autoAddOperations(autoAddOperations: JsonField) = apply { + this.autoAddOperations = autoAddOperations + } + + fun createdAt(createdAt: String) = createdAt(JsonField.of(createdAt)) + + /** + * Sets [Builder.createdAt] to an arbitrary JSON value. + * + * You should usually call [Builder.createdAt] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } + + fun updatedAt(updatedAt: String) = updatedAt(JsonField.of(updatedAt)) + + /** + * Sets [Builder.updatedAt] to an arbitrary JSON value. + * + * You should usually call [Builder.updatedAt] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun updatedAt(updatedAt: JsonField) = apply { this.updatedAt = updatedAt } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [McpServer]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .id() + * .name() + * .slug() + * .autoAddOperations() + * .createdAt() + * .updatedAt() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): McpServer = + McpServer( + checkRequired("id", id), + checkRequired("name", name), + checkRequired("slug", slug), + checkRequired("autoAddOperations", autoAddOperations), + checkRequired("createdAt", createdAt), + checkRequired("updatedAt", updatedAt), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): McpServer = apply { + if (validated) { + return@apply + } + + id() + name() + slug() + autoAddOperations() + createdAt() + updatedAt() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (slug.asKnown().isPresent) 1 else 0) + + (if (autoAddOperations.asKnown().isPresent) 1 else 0) + + (if (createdAt.asKnown().isPresent) 1 else 0) + + (if (updatedAt.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is McpServer && + id == other.id && + name == other.name && + slug == other.slug && + autoAddOperations == other.autoAddOperations && + createdAt == other.createdAt && + updatedAt == other.updatedAt && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + name, + slug, + autoAddOperations, + createdAt, + updatedAt, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "McpServer{id=$id, name=$name, slug=$slug, autoAddOperations=$autoAddOperations, createdAt=$createdAt, updatedAt=$updatedAt, additionalProperties=$additionalProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/ServerCreateParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/ServerCreateParams.kt new file mode 100644 index 0000000..213ee77 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/ServerCreateParams.kt @@ -0,0 +1,656 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.mcp.servers + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.Params +import com.scalar.core.checkKnown +import com.scalar.core.checkRequired +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import com.scalar.core.toImmutable +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * Create an MCP server over one or more API document versions. The response carries the server and + * its first installation. + */ +class ServerCreateParams +private constructor( + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = body.name() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun slug(): Optional = body.slug() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun versionUids(): Optional> = body.versionUids() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun projectUids(): Optional> = body.projectUids() + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _name(): JsonField = body._name() + + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _slug(): JsonField = body._slug() + + /** + * Returns the raw JSON value of [versionUids]. + * + * Unlike [versionUids], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _versionUids(): JsonField> = body._versionUids() + + /** + * Returns the raw JSON value of [projectUids]. + * + * Unlike [projectUids], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _projectUids(): JsonField> = body._projectUids() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [ServerCreateParams]. + * + * The following fields are required: + * ```kotlin + * .name() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ServerCreateParams]. */ + class Builder internal constructor() { + + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(serverCreateParams: ServerCreateParams) = apply { + body = serverCreateParams.body.toBuilder() + additionalHeaders = serverCreateParams.additionalHeaders.toBuilder() + additionalQueryParams = serverCreateParams.additionalQueryParams.toBuilder() + } + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [name] + * - [slug] + * - [versionUids] + * - [projectUids] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + fun name(name: String) = apply { body.name(name) } + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { body.name(name) } + + fun slug(slug: String) = apply { body.slug(slug) } + + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun slug(slug: JsonField) = apply { body.slug(slug) } + + fun versionUids(versionUids: List) = apply { body.versionUids(versionUids) } + + /** + * Sets [Builder.versionUids] to an arbitrary JSON value. + * + * You should usually call [Builder.versionUids] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun versionUids(versionUids: JsonField>) = apply { + body.versionUids(versionUids) + } + + /** + * Adds a single [String] to [versionUids]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addVersionUid(versionUid: String) = apply { body.addVersionUid(versionUid) } + + fun projectUids(projectUids: List) = apply { body.projectUids(projectUids) } + + /** + * Sets [Builder.projectUids] to an arbitrary JSON value. + * + * You should usually call [Builder.projectUids] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun projectUids(projectUids: JsonField>) = apply { + body.projectUids(projectUids) + } + + /** + * Adds a single [String] to [projectUids]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addProjectUid(projectUid: String) = apply { body.addProjectUid(projectUid) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [ServerCreateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .name() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ServerCreateParams = + ServerCreateParams( + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val name: JsonField, + private val slug: JsonField, + private val versionUids: JsonField>, + private val projectUids: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), + @JsonProperty("versionUids") + @ExcludeMissing + versionUids: JsonField> = JsonMissing.of(), + @JsonProperty("projectUids") + @ExcludeMissing + projectUids: JsonField> = JsonMissing.of(), + ) : this(name, slug, versionUids, projectUids, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun slug(): Optional = slug.getOptional("slug") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun versionUids(): Optional> = versionUids.getOptional("versionUids") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun projectUids(): Optional> = projectUids.getOptional("projectUids") + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug + + /** + * Returns the raw JSON value of [versionUids]. + * + * Unlike [versionUids], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("versionUids") + @ExcludeMissing + fun _versionUids(): JsonField> = versionUids + + /** + * Returns the raw JSON value of [projectUids]. + * + * Unlike [projectUids], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("projectUids") + @ExcludeMissing + fun _projectUids(): JsonField> = projectUids + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```kotlin + * .name() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var name: JsonField? = null + private var slug: JsonField = JsonMissing.of() + private var versionUids: JsonField>? = null + private var projectUids: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + name = body.name + slug = body.slug + versionUids = body.versionUids.map { it.toMutableList() } + projectUids = body.projectUids.map { it.toMutableList() } + additionalProperties = body.additionalProperties.toMutableMap() + } + + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + fun slug(slug: String) = slug(JsonField.of(slug)) + + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun slug(slug: JsonField) = apply { this.slug = slug } + + fun versionUids(versionUids: List) = versionUids(JsonField.of(versionUids)) + + /** + * Sets [Builder.versionUids] to an arbitrary JSON value. + * + * You should usually call [Builder.versionUids] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun versionUids(versionUids: JsonField>) = apply { + this.versionUids = versionUids.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [versionUids]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addVersionUid(versionUid: String) = apply { + versionUids = + (versionUids ?: JsonField.of(mutableListOf())).also { + checkKnown("versionUids", it).add(versionUid) + } + } + + fun projectUids(projectUids: List) = projectUids(JsonField.of(projectUids)) + + /** + * Sets [Builder.projectUids] to an arbitrary JSON value. + * + * You should usually call [Builder.projectUids] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun projectUids(projectUids: JsonField>) = apply { + this.projectUids = projectUids.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [projectUids]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addProjectUid(projectUid: String) = apply { + projectUids = + (projectUids ?: JsonField.of(mutableListOf())).also { + checkKnown("projectUids", it).add(projectUid) + } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .name() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Body = + Body( + checkRequired("name", name), + slug, + (versionUids ?: JsonMissing.of()).map { it.toImmutable() }, + (projectUids ?: JsonMissing.of()).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Body = apply { + if (validated) { + return@apply + } + + name() + slug() + versionUids() + projectUids() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (name.asKnown().isPresent) 1 else 0) + + (if (slug.asKnown().isPresent) 1 else 0) + + (versionUids.asKnown().getOrNull()?.size ?: 0) + + (projectUids.asKnown().getOrNull()?.size ?: 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + name == other.name && + slug == other.slug && + versionUids == other.versionUids && + projectUids == other.projectUids && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(name, slug, versionUids, projectUids, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{name=$name, slug=$slug, versionUids=$versionUids, projectUids=$projectUids, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ServerCreateParams && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = Objects.hash(body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "ServerCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/ServerCreateResponse.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/ServerCreateResponse.kt new file mode 100644 index 0000000..0eb7332 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/ServerCreateResponse.kt @@ -0,0 +1,222 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.mcp.servers + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.checkRequired +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import kotlin.jvm.optionals.getOrNull + +class ServerCreateResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val server: JsonField, + private val installation: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("server") @ExcludeMissing server: JsonField = JsonMissing.of(), + @JsonProperty("installation") + @ExcludeMissing + installation: JsonField = JsonMissing.of(), + ) : this(server, installation, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun server(): McpServer = server.getRequired("server") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun installation(): McpInstallation = installation.getRequired("installation") + + /** + * Returns the raw JSON value of [server]. + * + * Unlike [server], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("server") @ExcludeMissing fun _server(): JsonField = server + + /** + * Returns the raw JSON value of [installation]. + * + * Unlike [installation], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("installation") + @ExcludeMissing + fun _installation(): JsonField = installation + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [ServerCreateResponse]. + * + * The following fields are required: + * ```kotlin + * .server() + * .installation() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ServerCreateResponse]. */ + class Builder internal constructor() { + + private var server: JsonField? = null + private var installation: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(serverCreateResponse: ServerCreateResponse) = apply { + server = serverCreateResponse.server + installation = serverCreateResponse.installation + additionalProperties = serverCreateResponse.additionalProperties.toMutableMap() + } + + fun server(server: McpServer) = server(JsonField.of(server)) + + /** + * Sets [Builder.server] to an arbitrary JSON value. + * + * You should usually call [Builder.server] with a well-typed [McpServer] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun server(server: JsonField) = apply { this.server = server } + + fun installation(installation: McpInstallation) = installation(JsonField.of(installation)) + + /** + * Sets [Builder.installation] to an arbitrary JSON value. + * + * You should usually call [Builder.installation] with a well-typed [McpInstallation] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun installation(installation: JsonField) = apply { + this.installation = installation + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ServerCreateResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .server() + * .installation() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ServerCreateResponse = + ServerCreateResponse( + checkRequired("server", server), + checkRequired("installation", installation), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): ServerCreateResponse = apply { + if (validated) { + return@apply + } + + server().validate() + installation().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (server.asKnown().getOrNull()?.validity() ?: 0) + + (installation.asKnown().getOrNull()?.validity() ?: 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ServerCreateResponse && + server == other.server && + installation == other.installation && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(server, installation, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ServerCreateResponse{server=$server, installation=$installation, additionalProperties=$additionalProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/ServerDeleteParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/ServerDeleteParams.kt new file mode 100644 index 0000000..61c89a5 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/ServerDeleteParams.kt @@ -0,0 +1,229 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.mcp.servers + +import com.scalar.core.JsonValue +import com.scalar.core.Params +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import com.scalar.core.toImmutable +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Delete an MCP server and every installation it serves. */ +class ServerDeleteParams +private constructor( + private val id: String?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, + private val additionalBodyProperties: Map, +) : Params { + + fun id(): Optional = Optional.ofNullable(id) + + /** Additional body properties to send with the request. */ + fun _additionalBodyProperties(): Map = additionalBodyProperties + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): ServerDeleteParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [ServerDeleteParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ServerDeleteParams]. */ + class Builder internal constructor() { + + private var id: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(serverDeleteParams: ServerDeleteParams) = apply { + id = serverDeleteParams.id + additionalHeaders = serverDeleteParams.additionalHeaders.toBuilder() + additionalQueryParams = serverDeleteParams.additionalQueryParams.toBuilder() + additionalBodyProperties = serverDeleteParams.additionalBodyProperties.toMutableMap() + } + + fun id(id: String?) = apply { this.id = id } + + /** Alias for calling [Builder.id] with `id.orElse(null)`. */ + fun id(id: Optional) = id(id.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + putAllAdditionalBodyProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { + additionalBodyProperties.remove(key) + } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalBodyProperty) + } + + /** + * Returns an immutable instance of [ServerDeleteParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ServerDeleteParams = + ServerDeleteParams( + id, + additionalHeaders.build(), + additionalQueryParams.build(), + additionalBodyProperties.toImmutable(), + ) + } + + fun _body(): Optional> = + Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) + + fun _pathParam(index: Int): String = + when (index) { + 0 -> id ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ServerDeleteParams && + id == other.id && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams && + additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int = + Objects.hash(id, additionalHeaders, additionalQueryParams, additionalBodyProperties) + + override fun toString() = + "ServerDeleteParams{id=$id, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/ServerListParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/ServerListParams.kt new file mode 100644 index 0000000..9639ae8 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/ServerListParams.kt @@ -0,0 +1,170 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.mcp.servers + +import com.scalar.core.Params +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import java.util.Objects + +/** List every MCP server on the team. */ +class ServerListParams +private constructor( + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): ServerListParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [ServerListParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ServerListParams]. */ + class Builder internal constructor() { + + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(serverListParams: ServerListParams) = apply { + additionalHeaders = serverListParams.additionalHeaders.toBuilder() + additionalQueryParams = serverListParams.additionalQueryParams.toBuilder() + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [ServerListParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ServerListParams = + ServerListParams(additionalHeaders.build(), additionalQueryParams.build()) + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ServerListParams && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = Objects.hash(additionalHeaders, additionalQueryParams) + + override fun toString() = + "ServerListParams{additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/ServerRetrieveParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/ServerRetrieveParams.kt new file mode 100644 index 0000000..59e405b --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/ServerRetrieveParams.kt @@ -0,0 +1,189 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.mcp.servers + +import com.scalar.core.Params +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Get a single MCP server by its id. */ +class ServerRetrieveParams +private constructor( + private val id: String?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun id(): Optional = Optional.ofNullable(id) + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): ServerRetrieveParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [ServerRetrieveParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ServerRetrieveParams]. */ + class Builder internal constructor() { + + private var id: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(serverRetrieveParams: ServerRetrieveParams) = apply { + id = serverRetrieveParams.id + additionalHeaders = serverRetrieveParams.additionalHeaders.toBuilder() + additionalQueryParams = serverRetrieveParams.additionalQueryParams.toBuilder() + } + + fun id(id: String?) = apply { this.id = id } + + /** Alias for calling [Builder.id] with `id.orElse(null)`. */ + fun id(id: Optional) = id(id.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [ServerRetrieveParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ServerRetrieveParams = + ServerRetrieveParams(id, additionalHeaders.build(), additionalQueryParams.build()) + } + + fun _pathParam(index: Int): String = + when (index) { + 0 -> id ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ServerRetrieveParams && + id == other.id && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = Objects.hash(id, additionalHeaders, additionalQueryParams) + + override fun toString() = + "ServerRetrieveParams{id=$id, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/ServerUpdateParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/ServerUpdateParams.kt new file mode 100644 index 0000000..327114a --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/ServerUpdateParams.kt @@ -0,0 +1,718 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.mcp.servers + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.Params +import com.scalar.core.checkKnown +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import com.scalar.core.toImmutable +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Update MCP server metadata and which tools it exposes. */ +class ServerUpdateParams +private constructor( + private val id: String?, + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun name(): Optional = body.name() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun slug(): Optional = body.slug() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun autoAddOperations(): Optional = body.autoAddOperations() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun operations(): Optional> = body.operations() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun docsPages(): Optional> = body.docsPages() + + fun id(): Optional = Optional.ofNullable(id) + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _name(): JsonField = body._name() + + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _slug(): JsonField = body._slug() + + /** + * Returns the raw JSON value of [autoAddOperations]. + * + * Unlike [autoAddOperations], this method doesn't throw if the JSON field has an unexpected + * type. + */ + fun _autoAddOperations(): JsonField = body._autoAddOperations() + + /** + * Returns the raw JSON value of [operations]. + * + * Unlike [operations], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _operations(): JsonField> = body._operations() + + /** + * Returns the raw JSON value of [docsPages]. + * + * Unlike [docsPages], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _docsPages(): JsonField> = body._docsPages() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): ServerUpdateParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [ServerUpdateParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ServerUpdateParams]. */ + class Builder internal constructor() { + + private var id: String? = null + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(serverUpdateParams: ServerUpdateParams) = apply { + id = serverUpdateParams.id + body = serverUpdateParams.body.toBuilder() + additionalHeaders = serverUpdateParams.additionalHeaders.toBuilder() + additionalQueryParams = serverUpdateParams.additionalQueryParams.toBuilder() + } + + fun id(id: String?) = apply { this.id = id } + + /** Alias for calling [Builder.id] with `id.orElse(null)`. */ + fun id(id: Optional) = id(id.getOrNull()) + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [name] + * - [slug] + * - [autoAddOperations] + * - [operations] + * - [docsPages] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + fun name(name: String) = apply { body.name(name) } + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { body.name(name) } + + fun slug(slug: String) = apply { body.slug(slug) } + + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun slug(slug: JsonField) = apply { body.slug(slug) } + + fun autoAddOperations(autoAddOperations: Boolean) = apply { + body.autoAddOperations(autoAddOperations) + } + + /** + * Sets [Builder.autoAddOperations] to an arbitrary JSON value. + * + * You should usually call [Builder.autoAddOperations] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun autoAddOperations(autoAddOperations: JsonField) = apply { + body.autoAddOperations(autoAddOperations) + } + + fun operations(operations: List) = apply { body.operations(operations) } + + /** + * Sets [Builder.operations] to an arbitrary JSON value. + * + * You should usually call [Builder.operations] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun operations(operations: JsonField>) = apply { body.operations(operations) } + + /** + * Adds a single [String] to [operations]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addOperation(operation: String) = apply { body.addOperation(operation) } + + fun docsPages(docsPages: List) = apply { body.docsPages(docsPages) } + + /** + * Sets [Builder.docsPages] to an arbitrary JSON value. + * + * You should usually call [Builder.docsPages] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun docsPages(docsPages: JsonField>) = apply { body.docsPages(docsPages) } + + /** + * Adds a single [String] to [docsPages]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addDocsPage(docsPage: String) = apply { body.addDocsPage(docsPage) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [ServerUpdateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ServerUpdateParams = + ServerUpdateParams( + id, + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> id ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val name: JsonField, + private val slug: JsonField, + private val autoAddOperations: JsonField, + private val operations: JsonField>, + private val docsPages: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), + @JsonProperty("autoAddOperations") + @ExcludeMissing + autoAddOperations: JsonField = JsonMissing.of(), + @JsonProperty("operations") + @ExcludeMissing + operations: JsonField> = JsonMissing.of(), + @JsonProperty("docsPages") + @ExcludeMissing + docsPages: JsonField> = JsonMissing.of(), + ) : this(name, slug, autoAddOperations, operations, docsPages, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun name(): Optional = name.getOptional("name") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun slug(): Optional = slug.getOptional("slug") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun autoAddOperations(): Optional = + autoAddOperations.getOptional("autoAddOperations") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun operations(): Optional> = operations.getOptional("operations") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun docsPages(): Optional> = docsPages.getOptional("docsPages") + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug + + /** + * Returns the raw JSON value of [autoAddOperations]. + * + * Unlike [autoAddOperations], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("autoAddOperations") + @ExcludeMissing + fun _autoAddOperations(): JsonField = autoAddOperations + + /** + * Returns the raw JSON value of [operations]. + * + * Unlike [operations], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("operations") + @ExcludeMissing + fun _operations(): JsonField> = operations + + /** + * Returns the raw JSON value of [docsPages]. + * + * Unlike [docsPages], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("docsPages") + @ExcludeMissing + fun _docsPages(): JsonField> = docsPages + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Body]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var name: JsonField = JsonMissing.of() + private var slug: JsonField = JsonMissing.of() + private var autoAddOperations: JsonField = JsonMissing.of() + private var operations: JsonField>? = null + private var docsPages: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + name = body.name + slug = body.slug + autoAddOperations = body.autoAddOperations + operations = body.operations.map { it.toMutableList() } + docsPages = body.docsPages.map { it.toMutableList() } + additionalProperties = body.additionalProperties.toMutableMap() + } + + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + fun slug(slug: String) = slug(JsonField.of(slug)) + + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun slug(slug: JsonField) = apply { this.slug = slug } + + fun autoAddOperations(autoAddOperations: Boolean) = + autoAddOperations(JsonField.of(autoAddOperations)) + + /** + * Sets [Builder.autoAddOperations] to an arbitrary JSON value. + * + * You should usually call [Builder.autoAddOperations] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun autoAddOperations(autoAddOperations: JsonField) = apply { + this.autoAddOperations = autoAddOperations + } + + fun operations(operations: List) = operations(JsonField.of(operations)) + + /** + * Sets [Builder.operations] to an arbitrary JSON value. + * + * You should usually call [Builder.operations] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun operations(operations: JsonField>) = apply { + this.operations = operations.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [operations]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addOperation(operation: String) = apply { + operations = + (operations ?: JsonField.of(mutableListOf())).also { + checkKnown("operations", it).add(operation) + } + } + + fun docsPages(docsPages: List) = docsPages(JsonField.of(docsPages)) + + /** + * Sets [Builder.docsPages] to an arbitrary JSON value. + * + * You should usually call [Builder.docsPages] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun docsPages(docsPages: JsonField>) = apply { + this.docsPages = docsPages.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [docsPages]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addDocsPage(docsPage: String) = apply { + docsPages = + (docsPages ?: JsonField.of(mutableListOf())).also { + checkKnown("docsPages", it).add(docsPage) + } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Body = + Body( + name, + slug, + autoAddOperations, + (operations ?: JsonMissing.of()).map { it.toImmutable() }, + (docsPages ?: JsonMissing.of()).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Body = apply { + if (validated) { + return@apply + } + + name() + slug() + autoAddOperations() + operations() + docsPages() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (name.asKnown().isPresent) 1 else 0) + + (if (slug.asKnown().isPresent) 1 else 0) + + (if (autoAddOperations.asKnown().isPresent) 1 else 0) + + (operations.asKnown().getOrNull()?.size ?: 0) + + (docsPages.asKnown().getOrNull()?.size ?: 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + name == other.name && + slug == other.slug && + autoAddOperations == other.autoAddOperations && + operations == other.operations && + docsPages == other.docsPages && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + name, + slug, + autoAddOperations, + operations, + docsPages, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{name=$name, slug=$slug, autoAddOperations=$autoAddOperations, operations=$operations, docsPages=$docsPages, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ServerUpdateParams && + id == other.id && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = Objects.hash(id, body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "ServerUpdateParams{id=$id, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/InstallationCreateAccessGroupParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/InstallationCreateAccessGroupParams.kt new file mode 100644 index 0000000..f25fad9 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/InstallationCreateAccessGroupParams.kt @@ -0,0 +1,471 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.mcp.servers.installations + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.Params +import com.scalar.core.checkRequired +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Let an access group reach a private installation. */ +class InstallationCreateAccessGroupParams +private constructor( + private val id: String, + private val installationId: String?, + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun accessGroupUid(): String = body.accessGroupUid() + + fun id(): String = id + + fun installationId(): Optional = Optional.ofNullable(installationId) + + /** + * Returns the raw JSON value of [accessGroupUid]. + * + * Unlike [accessGroupUid], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _accessGroupUid(): JsonField = body._accessGroupUid() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [InstallationCreateAccessGroupParams]. + * + * The following fields are required: + * ```kotlin + * .id() + * .accessGroupUid() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InstallationCreateAccessGroupParams]. */ + class Builder internal constructor() { + + private var id: String? = null + private var installationId: String? = null + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from( + installationCreateAccessGroupParams: InstallationCreateAccessGroupParams + ) = apply { + id = installationCreateAccessGroupParams.id + installationId = installationCreateAccessGroupParams.installationId + body = installationCreateAccessGroupParams.body.toBuilder() + additionalHeaders = installationCreateAccessGroupParams.additionalHeaders.toBuilder() + additionalQueryParams = + installationCreateAccessGroupParams.additionalQueryParams.toBuilder() + } + + fun id(id: String) = apply { this.id = id } + + fun installationId(installationId: String?) = apply { this.installationId = installationId } + + /** Alias for calling [Builder.installationId] with `installationId.orElse(null)`. */ + fun installationId(installationId: Optional) = + installationId(installationId.getOrNull()) + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [accessGroupUid] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + fun accessGroupUid(accessGroupUid: String) = apply { body.accessGroupUid(accessGroupUid) } + + /** + * Sets [Builder.accessGroupUid] to an arbitrary JSON value. + * + * You should usually call [Builder.accessGroupUid] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun accessGroupUid(accessGroupUid: JsonField) = apply { + body.accessGroupUid(accessGroupUid) + } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [InstallationCreateAccessGroupParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .id() + * .accessGroupUid() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): InstallationCreateAccessGroupParams = + InstallationCreateAccessGroupParams( + checkRequired("id", id), + installationId, + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> id + 1 -> installationId ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val accessGroupUid: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("accessGroupUid") + @ExcludeMissing + accessGroupUid: JsonField = JsonMissing.of() + ) : this(accessGroupUid, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun accessGroupUid(): String = accessGroupUid.getRequired("accessGroupUid") + + /** + * Returns the raw JSON value of [accessGroupUid]. + * + * Unlike [accessGroupUid], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("accessGroupUid") + @ExcludeMissing + fun _accessGroupUid(): JsonField = accessGroupUid + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```kotlin + * .accessGroupUid() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var accessGroupUid: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + accessGroupUid = body.accessGroupUid + additionalProperties = body.additionalProperties.toMutableMap() + } + + fun accessGroupUid(accessGroupUid: String) = + accessGroupUid(JsonField.of(accessGroupUid)) + + /** + * Sets [Builder.accessGroupUid] to an arbitrary JSON value. + * + * You should usually call [Builder.accessGroupUid] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun accessGroupUid(accessGroupUid: JsonField) = apply { + this.accessGroupUid = accessGroupUid + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .accessGroupUid() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Body = + Body( + checkRequired("accessGroupUid", accessGroupUid), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Body = apply { + if (validated) { + return@apply + } + + accessGroupUid() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = (if (accessGroupUid.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + accessGroupUid == other.accessGroupUid && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(accessGroupUid, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{accessGroupUid=$accessGroupUid, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is InstallationCreateAccessGroupParams && + id == other.id && + installationId == other.installationId && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash(id, installationId, body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "InstallationCreateAccessGroupParams{id=$id, installationId=$installationId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/InstallationCreateParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/InstallationCreateParams.kt new file mode 100644 index 0000000..2a511ce --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/InstallationCreateParams.kt @@ -0,0 +1,684 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.mcp.servers.installations + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.Params +import com.scalar.core.checkRequired +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import com.scalar.core.toImmutable +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * Create an installation of an MCP server. `documentAuth` holds the credentials the server presents + * to the upstream API and is never returned. + */ +class InstallationCreateParams +private constructor( + private val id: String?, + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = body.name() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun slug(): Optional = body.slug() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun documentAuth(): DocumentAuth = body.documentAuth() + + fun id(): Optional = Optional.ofNullable(id) + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _name(): JsonField = body._name() + + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _slug(): JsonField = body._slug() + + /** + * Returns the raw JSON value of [documentAuth]. + * + * Unlike [documentAuth], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _documentAuth(): JsonField = body._documentAuth() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [InstallationCreateParams]. + * + * The following fields are required: + * ```kotlin + * .name() + * .documentAuth() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InstallationCreateParams]. */ + class Builder internal constructor() { + + private var id: String? = null + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(installationCreateParams: InstallationCreateParams) = apply { + id = installationCreateParams.id + body = installationCreateParams.body.toBuilder() + additionalHeaders = installationCreateParams.additionalHeaders.toBuilder() + additionalQueryParams = installationCreateParams.additionalQueryParams.toBuilder() + } + + fun id(id: String?) = apply { this.id = id } + + /** Alias for calling [Builder.id] with `id.orElse(null)`. */ + fun id(id: Optional) = id(id.getOrNull()) + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [name] + * - [slug] + * - [documentAuth] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + fun name(name: String) = apply { body.name(name) } + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { body.name(name) } + + fun slug(slug: String) = apply { body.slug(slug) } + + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun slug(slug: JsonField) = apply { body.slug(slug) } + + fun documentAuth(documentAuth: DocumentAuth) = apply { body.documentAuth(documentAuth) } + + /** + * Sets [Builder.documentAuth] to an arbitrary JSON value. + * + * You should usually call [Builder.documentAuth] with a well-typed [DocumentAuth] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun documentAuth(documentAuth: JsonField) = apply { + body.documentAuth(documentAuth) + } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [InstallationCreateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .name() + * .documentAuth() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): InstallationCreateParams = + InstallationCreateParams( + id, + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> id ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val name: JsonField, + private val slug: JsonField, + private val documentAuth: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), + @JsonProperty("documentAuth") + @ExcludeMissing + documentAuth: JsonField = JsonMissing.of(), + ) : this(name, slug, documentAuth, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun slug(): Optional = slug.getOptional("slug") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun documentAuth(): DocumentAuth = documentAuth.getRequired("documentAuth") + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug + + /** + * Returns the raw JSON value of [documentAuth]. + * + * Unlike [documentAuth], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("documentAuth") + @ExcludeMissing + fun _documentAuth(): JsonField = documentAuth + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```kotlin + * .name() + * .documentAuth() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var name: JsonField? = null + private var slug: JsonField = JsonMissing.of() + private var documentAuth: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + name = body.name + slug = body.slug + documentAuth = body.documentAuth + additionalProperties = body.additionalProperties.toMutableMap() + } + + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + fun slug(slug: String) = slug(JsonField.of(slug)) + + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun slug(slug: JsonField) = apply { this.slug = slug } + + fun documentAuth(documentAuth: DocumentAuth) = documentAuth(JsonField.of(documentAuth)) + + /** + * Sets [Builder.documentAuth] to an arbitrary JSON value. + * + * You should usually call [Builder.documentAuth] with a well-typed [DocumentAuth] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun documentAuth(documentAuth: JsonField) = apply { + this.documentAuth = documentAuth + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .name() + * .documentAuth() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Body = + Body( + checkRequired("name", name), + slug, + checkRequired("documentAuth", documentAuth), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Body = apply { + if (validated) { + return@apply + } + + name() + slug() + documentAuth().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (name.asKnown().isPresent) 1 else 0) + + (if (slug.asKnown().isPresent) 1 else 0) + + (documentAuth.asKnown().getOrNull()?.validity() ?: 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + name == other.name && + slug == other.slug && + documentAuth == other.documentAuth && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(name, slug, documentAuth, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{name=$name, slug=$slug, documentAuth=$documentAuth, additionalProperties=$additionalProperties}" + } + + class DocumentAuth + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [DocumentAuth]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [DocumentAuth]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(documentAuth: DocumentAuth) = apply { + additionalProperties = documentAuth.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [DocumentAuth]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): DocumentAuth = DocumentAuth(additionalProperties.toImmutable()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): DocumentAuth = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = additionalProperties.count { (_, value) -> + !value.isNull() && !value.isMissing() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is DocumentAuth && additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "DocumentAuth{additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is InstallationCreateParams && + id == other.id && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = Objects.hash(id, body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "InstallationCreateParams{id=$id, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/InstallationDeleteAccessGroupParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/InstallationDeleteAccessGroupParams.kt new file mode 100644 index 0000000..60ee8bf --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/InstallationDeleteAccessGroupParams.kt @@ -0,0 +1,471 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.mcp.servers.installations + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.Params +import com.scalar.core.checkRequired +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Stop an access group reaching a private installation. */ +class InstallationDeleteAccessGroupParams +private constructor( + private val id: String, + private val installationId: String?, + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun accessGroupUid(): String = body.accessGroupUid() + + fun id(): String = id + + fun installationId(): Optional = Optional.ofNullable(installationId) + + /** + * Returns the raw JSON value of [accessGroupUid]. + * + * Unlike [accessGroupUid], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _accessGroupUid(): JsonField = body._accessGroupUid() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [InstallationDeleteAccessGroupParams]. + * + * The following fields are required: + * ```kotlin + * .id() + * .accessGroupUid() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InstallationDeleteAccessGroupParams]. */ + class Builder internal constructor() { + + private var id: String? = null + private var installationId: String? = null + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from( + installationDeleteAccessGroupParams: InstallationDeleteAccessGroupParams + ) = apply { + id = installationDeleteAccessGroupParams.id + installationId = installationDeleteAccessGroupParams.installationId + body = installationDeleteAccessGroupParams.body.toBuilder() + additionalHeaders = installationDeleteAccessGroupParams.additionalHeaders.toBuilder() + additionalQueryParams = + installationDeleteAccessGroupParams.additionalQueryParams.toBuilder() + } + + fun id(id: String) = apply { this.id = id } + + fun installationId(installationId: String?) = apply { this.installationId = installationId } + + /** Alias for calling [Builder.installationId] with `installationId.orElse(null)`. */ + fun installationId(installationId: Optional) = + installationId(installationId.getOrNull()) + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [accessGroupUid] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + fun accessGroupUid(accessGroupUid: String) = apply { body.accessGroupUid(accessGroupUid) } + + /** + * Sets [Builder.accessGroupUid] to an arbitrary JSON value. + * + * You should usually call [Builder.accessGroupUid] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun accessGroupUid(accessGroupUid: JsonField) = apply { + body.accessGroupUid(accessGroupUid) + } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [InstallationDeleteAccessGroupParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .id() + * .accessGroupUid() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): InstallationDeleteAccessGroupParams = + InstallationDeleteAccessGroupParams( + checkRequired("id", id), + installationId, + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> id + 1 -> installationId ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val accessGroupUid: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("accessGroupUid") + @ExcludeMissing + accessGroupUid: JsonField = JsonMissing.of() + ) : this(accessGroupUid, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun accessGroupUid(): String = accessGroupUid.getRequired("accessGroupUid") + + /** + * Returns the raw JSON value of [accessGroupUid]. + * + * Unlike [accessGroupUid], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("accessGroupUid") + @ExcludeMissing + fun _accessGroupUid(): JsonField = accessGroupUid + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```kotlin + * .accessGroupUid() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var accessGroupUid: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + accessGroupUid = body.accessGroupUid + additionalProperties = body.additionalProperties.toMutableMap() + } + + fun accessGroupUid(accessGroupUid: String) = + accessGroupUid(JsonField.of(accessGroupUid)) + + /** + * Sets [Builder.accessGroupUid] to an arbitrary JSON value. + * + * You should usually call [Builder.accessGroupUid] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun accessGroupUid(accessGroupUid: JsonField) = apply { + this.accessGroupUid = accessGroupUid + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .accessGroupUid() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Body = + Body( + checkRequired("accessGroupUid", accessGroupUid), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Body = apply { + if (validated) { + return@apply + } + + accessGroupUid() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = (if (accessGroupUid.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + accessGroupUid == other.accessGroupUid && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(accessGroupUid, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{accessGroupUid=$accessGroupUid, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is InstallationDeleteAccessGroupParams && + id == other.id && + installationId == other.installationId && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash(id, installationId, body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "InstallationDeleteAccessGroupParams{id=$id, installationId=$installationId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/InstallationDeleteParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/InstallationDeleteParams.kt new file mode 100644 index 0000000..6fda23b --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/InstallationDeleteParams.kt @@ -0,0 +1,260 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.mcp.servers.installations + +import com.scalar.core.JsonValue +import com.scalar.core.Params +import com.scalar.core.checkRequired +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import com.scalar.core.toImmutable +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Delete an installation of an MCP server. */ +class InstallationDeleteParams +private constructor( + private val id: String, + private val installationId: String?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, + private val additionalBodyProperties: Map, +) : Params { + + fun id(): String = id + + fun installationId(): Optional = Optional.ofNullable(installationId) + + /** Additional body properties to send with the request. */ + fun _additionalBodyProperties(): Map = additionalBodyProperties + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [InstallationDeleteParams]. + * + * The following fields are required: + * ```kotlin + * .id() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InstallationDeleteParams]. */ + class Builder internal constructor() { + + private var id: String? = null + private var installationId: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(installationDeleteParams: InstallationDeleteParams) = apply { + id = installationDeleteParams.id + installationId = installationDeleteParams.installationId + additionalHeaders = installationDeleteParams.additionalHeaders.toBuilder() + additionalQueryParams = installationDeleteParams.additionalQueryParams.toBuilder() + additionalBodyProperties = + installationDeleteParams.additionalBodyProperties.toMutableMap() + } + + fun id(id: String) = apply { this.id = id } + + fun installationId(installationId: String?) = apply { this.installationId = installationId } + + /** Alias for calling [Builder.installationId] with `installationId.orElse(null)`. */ + fun installationId(installationId: Optional) = + installationId(installationId.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + putAllAdditionalBodyProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { + additionalBodyProperties.remove(key) + } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalBodyProperty) + } + + /** + * Returns an immutable instance of [InstallationDeleteParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .id() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): InstallationDeleteParams = + InstallationDeleteParams( + checkRequired("id", id), + installationId, + additionalHeaders.build(), + additionalQueryParams.build(), + additionalBodyProperties.toImmutable(), + ) + } + + fun _body(): Optional> = + Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) + + fun _pathParam(index: Int): String = + when (index) { + 0 -> id + 1 -> installationId ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is InstallationDeleteParams && + id == other.id && + installationId == other.installationId && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams && + additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int = + Objects.hash( + id, + installationId, + additionalHeaders, + additionalQueryParams, + additionalBodyProperties, + ) + + override fun toString() = + "InstallationDeleteParams{id=$id, installationId=$installationId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/InstallationListParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/InstallationListParams.kt new file mode 100644 index 0000000..cbf96ae --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/InstallationListParams.kt @@ -0,0 +1,189 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.mcp.servers.installations + +import com.scalar.core.Params +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** List the installations of an MCP server. An installation is what an MCP client connects to. */ +class InstallationListParams +private constructor( + private val id: String?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun id(): Optional = Optional.ofNullable(id) + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): InstallationListParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [InstallationListParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InstallationListParams]. */ + class Builder internal constructor() { + + private var id: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(installationListParams: InstallationListParams) = apply { + id = installationListParams.id + additionalHeaders = installationListParams.additionalHeaders.toBuilder() + additionalQueryParams = installationListParams.additionalQueryParams.toBuilder() + } + + fun id(id: String?) = apply { this.id = id } + + /** Alias for calling [Builder.id] with `id.orElse(null)`. */ + fun id(id: Optional) = id(id.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [InstallationListParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): InstallationListParams = + InstallationListParams(id, additionalHeaders.build(), additionalQueryParams.build()) + } + + fun _pathParam(index: Int): String = + when (index) { + 0 -> id ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is InstallationListParams && + id == other.id && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = Objects.hash(id, additionalHeaders, additionalQueryParams) + + override fun toString() = + "InstallationListParams{id=$id, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/InstallationRetrieveParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/InstallationRetrieveParams.kt new file mode 100644 index 0000000..2174b1b --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/InstallationRetrieveParams.kt @@ -0,0 +1,218 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.mcp.servers.installations + +import com.scalar.core.Params +import com.scalar.core.checkRequired +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Get a single installation of an MCP server. */ +class InstallationRetrieveParams +private constructor( + private val id: String, + private val installationId: String?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun id(): String = id + + fun installationId(): Optional = Optional.ofNullable(installationId) + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [InstallationRetrieveParams]. + * + * The following fields are required: + * ```kotlin + * .id() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InstallationRetrieveParams]. */ + class Builder internal constructor() { + + private var id: String? = null + private var installationId: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(installationRetrieveParams: InstallationRetrieveParams) = apply { + id = installationRetrieveParams.id + installationId = installationRetrieveParams.installationId + additionalHeaders = installationRetrieveParams.additionalHeaders.toBuilder() + additionalQueryParams = installationRetrieveParams.additionalQueryParams.toBuilder() + } + + fun id(id: String) = apply { this.id = id } + + fun installationId(installationId: String?) = apply { this.installationId = installationId } + + /** Alias for calling [Builder.installationId] with `installationId.orElse(null)`. */ + fun installationId(installationId: Optional) = + installationId(installationId.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [InstallationRetrieveParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .id() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): InstallationRetrieveParams = + InstallationRetrieveParams( + checkRequired("id", id), + installationId, + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _pathParam(index: Int): String = + when (index) { + 0 -> id + 1 -> installationId ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is InstallationRetrieveParams && + id == other.id && + installationId == other.installationId && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash(id, installationId, additionalHeaders, additionalQueryParams) + + override fun toString() = + "InstallationRetrieveParams{id=$id, installationId=$installationId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/InstallationUpdateParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/InstallationUpdateParams.kt new file mode 100644 index 0000000..a3bbcb2 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/InstallationUpdateParams.kt @@ -0,0 +1,887 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.mcp.servers.installations + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.Params +import com.scalar.core.checkRequired +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import com.scalar.core.toImmutable +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Update an installation. Set `isPrivate` and add access groups to put it behind a login. */ +class InstallationUpdateParams +private constructor( + private val id: String, + private val installationId: String?, + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun name(): Optional = body.name() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun slug(): Optional = body.slug() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun isPrivate(): Optional = body.isPrivate() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun loginPortalUid(): Optional = body.loginPortalUid() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun documentAuth(): Optional = body.documentAuth() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun mcpVersion(): Optional = body.mcpVersion() + + fun id(): String = id + + fun installationId(): Optional = Optional.ofNullable(installationId) + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _name(): JsonField = body._name() + + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _slug(): JsonField = body._slug() + + /** + * Returns the raw JSON value of [isPrivate]. + * + * Unlike [isPrivate], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _isPrivate(): JsonField = body._isPrivate() + + /** + * Returns the raw JSON value of [loginPortalUid]. + * + * Unlike [loginPortalUid], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _loginPortalUid(): JsonField = body._loginPortalUid() + + /** + * Returns the raw JSON value of [documentAuth]. + * + * Unlike [documentAuth], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _documentAuth(): JsonField = body._documentAuth() + + /** + * Returns the raw JSON value of [mcpVersion]. + * + * Unlike [mcpVersion], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _mcpVersion(): JsonField = body._mcpVersion() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [InstallationUpdateParams]. + * + * The following fields are required: + * ```kotlin + * .id() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InstallationUpdateParams]. */ + class Builder internal constructor() { + + private var id: String? = null + private var installationId: String? = null + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(installationUpdateParams: InstallationUpdateParams) = apply { + id = installationUpdateParams.id + installationId = installationUpdateParams.installationId + body = installationUpdateParams.body.toBuilder() + additionalHeaders = installationUpdateParams.additionalHeaders.toBuilder() + additionalQueryParams = installationUpdateParams.additionalQueryParams.toBuilder() + } + + fun id(id: String) = apply { this.id = id } + + fun installationId(installationId: String?) = apply { this.installationId = installationId } + + /** Alias for calling [Builder.installationId] with `installationId.orElse(null)`. */ + fun installationId(installationId: Optional) = + installationId(installationId.getOrNull()) + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [name] + * - [slug] + * - [isPrivate] + * - [loginPortalUid] + * - [documentAuth] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + fun name(name: String) = apply { body.name(name) } + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { body.name(name) } + + fun slug(slug: String) = apply { body.slug(slug) } + + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun slug(slug: JsonField) = apply { body.slug(slug) } + + fun isPrivate(isPrivate: Boolean) = apply { body.isPrivate(isPrivate) } + + /** + * Sets [Builder.isPrivate] to an arbitrary JSON value. + * + * You should usually call [Builder.isPrivate] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun isPrivate(isPrivate: JsonField) = apply { body.isPrivate(isPrivate) } + + fun loginPortalUid(loginPortalUid: String?) = apply { body.loginPortalUid(loginPortalUid) } + + /** Alias for calling [Builder.loginPortalUid] with `loginPortalUid.orElse(null)`. */ + fun loginPortalUid(loginPortalUid: Optional) = apply { + body.loginPortalUid(loginPortalUid.getOrNull()) + } + + /** + * Sets [Builder.loginPortalUid] to an arbitrary JSON value. + * + * You should usually call [Builder.loginPortalUid] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun loginPortalUid(loginPortalUid: JsonField) = apply { + body.loginPortalUid(loginPortalUid) + } + + fun documentAuth(documentAuth: DocumentAuth) = apply { body.documentAuth(documentAuth) } + + /** + * Sets [Builder.documentAuth] to an arbitrary JSON value. + * + * You should usually call [Builder.documentAuth] with a well-typed [DocumentAuth] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun documentAuth(documentAuth: JsonField) = apply { + body.documentAuth(documentAuth) + } + + fun mcpVersion(mcpVersion: String?) = apply { body.mcpVersion(mcpVersion) } + + /** Alias for calling [Builder.mcpVersion] with `mcpVersion.orElse(null)`. */ + fun mcpVersion(mcpVersion: Optional) = apply { + body.mcpVersion(mcpVersion.getOrNull()) + } + + /** + * Sets [Builder.mcpVersion] to an arbitrary JSON value. + * + * You should usually call [Builder.mcpVersion] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun mcpVersion(mcpVersion: JsonField) = apply { body.mcpVersion(mcpVersion) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [InstallationUpdateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .id() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): InstallationUpdateParams = + InstallationUpdateParams( + checkRequired("id", id), + installationId, + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> id + 1 -> installationId ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val name: JsonField, + private val slug: JsonField, + private val isPrivate: JsonField, + private val loginPortalUid: JsonField, + private val documentAuth: JsonField, + private val mcpVersion: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), + @JsonProperty("isPrivate") + @ExcludeMissing + isPrivate: JsonField = JsonMissing.of(), + @JsonProperty("loginPortalUid") + @ExcludeMissing + loginPortalUid: JsonField = JsonMissing.of(), + @JsonProperty("documentAuth") + @ExcludeMissing + documentAuth: JsonField = JsonMissing.of(), + @JsonProperty("mcpVersion") + @ExcludeMissing + mcpVersion: JsonField = JsonMissing.of(), + ) : this(name, slug, isPrivate, loginPortalUid, documentAuth, mcpVersion, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun name(): Optional = name.getOptional("name") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun slug(): Optional = slug.getOptional("slug") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun isPrivate(): Optional = isPrivate.getOptional("isPrivate") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun loginPortalUid(): Optional = loginPortalUid.getOptional("loginPortalUid") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun documentAuth(): Optional = documentAuth.getOptional("documentAuth") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun mcpVersion(): Optional = mcpVersion.getOptional("mcpVersion") + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug + + /** + * Returns the raw JSON value of [isPrivate]. + * + * Unlike [isPrivate], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("isPrivate") @ExcludeMissing fun _isPrivate(): JsonField = isPrivate + + /** + * Returns the raw JSON value of [loginPortalUid]. + * + * Unlike [loginPortalUid], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("loginPortalUid") + @ExcludeMissing + fun _loginPortalUid(): JsonField = loginPortalUid + + /** + * Returns the raw JSON value of [documentAuth]. + * + * Unlike [documentAuth], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("documentAuth") + @ExcludeMissing + fun _documentAuth(): JsonField = documentAuth + + /** + * Returns the raw JSON value of [mcpVersion]. + * + * Unlike [mcpVersion], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("mcpVersion") + @ExcludeMissing + fun _mcpVersion(): JsonField = mcpVersion + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Body]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var name: JsonField = JsonMissing.of() + private var slug: JsonField = JsonMissing.of() + private var isPrivate: JsonField = JsonMissing.of() + private var loginPortalUid: JsonField = JsonMissing.of() + private var documentAuth: JsonField = JsonMissing.of() + private var mcpVersion: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + name = body.name + slug = body.slug + isPrivate = body.isPrivate + loginPortalUid = body.loginPortalUid + documentAuth = body.documentAuth + mcpVersion = body.mcpVersion + additionalProperties = body.additionalProperties.toMutableMap() + } + + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + fun slug(slug: String) = slug(JsonField.of(slug)) + + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun slug(slug: JsonField) = apply { this.slug = slug } + + fun isPrivate(isPrivate: Boolean) = isPrivate(JsonField.of(isPrivate)) + + /** + * Sets [Builder.isPrivate] to an arbitrary JSON value. + * + * You should usually call [Builder.isPrivate] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun isPrivate(isPrivate: JsonField) = apply { this.isPrivate = isPrivate } + + fun loginPortalUid(loginPortalUid: String?) = + loginPortalUid(JsonField.ofNullable(loginPortalUid)) + + /** Alias for calling [Builder.loginPortalUid] with `loginPortalUid.orElse(null)`. */ + fun loginPortalUid(loginPortalUid: Optional) = + loginPortalUid(loginPortalUid.getOrNull()) + + /** + * Sets [Builder.loginPortalUid] to an arbitrary JSON value. + * + * You should usually call [Builder.loginPortalUid] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun loginPortalUid(loginPortalUid: JsonField) = apply { + this.loginPortalUid = loginPortalUid + } + + fun documentAuth(documentAuth: DocumentAuth) = documentAuth(JsonField.of(documentAuth)) + + /** + * Sets [Builder.documentAuth] to an arbitrary JSON value. + * + * You should usually call [Builder.documentAuth] with a well-typed [DocumentAuth] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun documentAuth(documentAuth: JsonField) = apply { + this.documentAuth = documentAuth + } + + fun mcpVersion(mcpVersion: String?) = mcpVersion(JsonField.ofNullable(mcpVersion)) + + /** Alias for calling [Builder.mcpVersion] with `mcpVersion.orElse(null)`. */ + fun mcpVersion(mcpVersion: Optional) = mcpVersion(mcpVersion.getOrNull()) + + /** + * Sets [Builder.mcpVersion] to an arbitrary JSON value. + * + * You should usually call [Builder.mcpVersion] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun mcpVersion(mcpVersion: JsonField) = apply { this.mcpVersion = mcpVersion } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Body = + Body( + name, + slug, + isPrivate, + loginPortalUid, + documentAuth, + mcpVersion, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Body = apply { + if (validated) { + return@apply + } + + name() + slug() + isPrivate() + loginPortalUid() + documentAuth().ifPresent { it.validate() } + mcpVersion() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (name.asKnown().isPresent) 1 else 0) + + (if (slug.asKnown().isPresent) 1 else 0) + + (if (isPrivate.asKnown().isPresent) 1 else 0) + + (if (loginPortalUid.asKnown().isPresent) 1 else 0) + + (documentAuth.asKnown().getOrNull()?.validity() ?: 0) + + (if (mcpVersion.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + name == other.name && + slug == other.slug && + isPrivate == other.isPrivate && + loginPortalUid == other.loginPortalUid && + documentAuth == other.documentAuth && + mcpVersion == other.mcpVersion && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + name, + slug, + isPrivate, + loginPortalUid, + documentAuth, + mcpVersion, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{name=$name, slug=$slug, isPrivate=$isPrivate, loginPortalUid=$loginPortalUid, documentAuth=$documentAuth, mcpVersion=$mcpVersion, additionalProperties=$additionalProperties}" + } + + class DocumentAuth + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [DocumentAuth]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [DocumentAuth]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(documentAuth: DocumentAuth) = apply { + additionalProperties = documentAuth.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [DocumentAuth]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): DocumentAuth = DocumentAuth(additionalProperties.toImmutable()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): DocumentAuth = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = additionalProperties.count { (_, value) -> + !value.isNull() && !value.isMissing() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is DocumentAuth && additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "DocumentAuth{additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is InstallationUpdateParams && + id == other.id && + installationId == other.installationId && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash(id, installationId, body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "InstallationUpdateParams{id=$id, installationId=$installationId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/McpInstallationListItem.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/McpInstallationListItem.kt new file mode 100644 index 0000000..9b2cdf5 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/mcp/servers/installations/McpInstallationListItem.kt @@ -0,0 +1,323 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.mcp.servers.installations + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.checkRequired +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class McpInstallationListItem +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val name: JsonField, + private val slug: JsonField, + private val isPrivate: JsonField, + private val mcpVersion: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), + @JsonProperty("isPrivate") @ExcludeMissing isPrivate: JsonField = JsonMissing.of(), + @JsonProperty("mcpVersion") + @ExcludeMissing + mcpVersion: JsonField = JsonMissing.of(), + ) : this(id, name, slug, isPrivate, mcpVersion, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun slug(): String = slug.getRequired("slug") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun isPrivate(): Boolean = isPrivate.getRequired("isPrivate") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun mcpVersion(): Optional = mcpVersion.getOptional("mcpVersion") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug + + /** + * Returns the raw JSON value of [isPrivate]. + * + * Unlike [isPrivate], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("isPrivate") @ExcludeMissing fun _isPrivate(): JsonField = isPrivate + + /** + * Returns the raw JSON value of [mcpVersion]. + * + * Unlike [mcpVersion], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("mcpVersion") @ExcludeMissing fun _mcpVersion(): JsonField = mcpVersion + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [McpInstallationListItem]. + * + * The following fields are required: + * ```kotlin + * .id() + * .name() + * .slug() + * .isPrivate() + * .mcpVersion() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [McpInstallationListItem]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var name: JsonField? = null + private var slug: JsonField? = null + private var isPrivate: JsonField? = null + private var mcpVersion: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(mcpInstallationListItem: McpInstallationListItem) = apply { + id = mcpInstallationListItem.id + name = mcpInstallationListItem.name + slug = mcpInstallationListItem.slug + isPrivate = mcpInstallationListItem.isPrivate + mcpVersion = mcpInstallationListItem.mcpVersion + additionalProperties = mcpInstallationListItem.additionalProperties.toMutableMap() + } + + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + fun slug(slug: String) = slug(JsonField.of(slug)) + + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun slug(slug: JsonField) = apply { this.slug = slug } + + fun isPrivate(isPrivate: Boolean) = isPrivate(JsonField.of(isPrivate)) + + /** + * Sets [Builder.isPrivate] to an arbitrary JSON value. + * + * You should usually call [Builder.isPrivate] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun isPrivate(isPrivate: JsonField) = apply { this.isPrivate = isPrivate } + + fun mcpVersion(mcpVersion: String?) = mcpVersion(JsonField.ofNullable(mcpVersion)) + + /** Alias for calling [Builder.mcpVersion] with `mcpVersion.orElse(null)`. */ + fun mcpVersion(mcpVersion: Optional) = mcpVersion(mcpVersion.getOrNull()) + + /** + * Sets [Builder.mcpVersion] to an arbitrary JSON value. + * + * You should usually call [Builder.mcpVersion] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun mcpVersion(mcpVersion: JsonField) = apply { this.mcpVersion = mcpVersion } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [McpInstallationListItem]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .id() + * .name() + * .slug() + * .isPrivate() + * .mcpVersion() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): McpInstallationListItem = + McpInstallationListItem( + checkRequired("id", id), + checkRequired("name", name), + checkRequired("slug", slug), + checkRequired("isPrivate", isPrivate), + checkRequired("mcpVersion", mcpVersion), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): McpInstallationListItem = apply { + if (validated) { + return@apply + } + + id() + name() + slug() + isPrivate() + mcpVersion() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (slug.asKnown().isPresent) 1 else 0) + + (if (isPrivate.asKnown().isPresent) 1 else 0) + + (if (mcpVersion.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is McpInstallationListItem && + id == other.id && + name == other.name && + slug == other.slug && + isPrivate == other.isPrivate && + mcpVersion == other.mcpVersion && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(id, name, slug, isPrivate, mcpVersion, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "McpInstallationListItem{id=$id, name=$name, slug=$slug, isPrivate=$isPrivate, mcpVersion=$mcpVersion, additionalProperties=$additionalProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthAuthorizationServerMetadataParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthAuthorizationServerMetadataParams.kt new file mode 100644 index 0000000..8aabf6c --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthAuthorizationServerMetadataParams.kt @@ -0,0 +1,182 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.oAuth + +import com.scalar.core.Params +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import java.util.Objects + +/** + * Discovery document for OAuth clients (RFC 8414): where the endpoints are and what they support. + */ +class OAuthOauthAuthorizationServerMetadataParams +private constructor( + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): OAuthOauthAuthorizationServerMetadataParams = builder().build() + + /** + * Returns a mutable builder for constructing an instance of + * [OAuthOauthAuthorizationServerMetadataParams]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [OAuthOauthAuthorizationServerMetadataParams]. */ + class Builder internal constructor() { + + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from( + oAuthOauthAuthorizationServerMetadataParams: OAuthOauthAuthorizationServerMetadataParams + ) = apply { + additionalHeaders = + oAuthOauthAuthorizationServerMetadataParams.additionalHeaders.toBuilder() + additionalQueryParams = + oAuthOauthAuthorizationServerMetadataParams.additionalQueryParams.toBuilder() + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [OAuthOauthAuthorizationServerMetadataParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): OAuthOauthAuthorizationServerMetadataParams = + OAuthOauthAuthorizationServerMetadataParams( + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is OAuthOauthAuthorizationServerMetadataParams && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = Objects.hash(additionalHeaders, additionalQueryParams) + + override fun toString() = + "OAuthOauthAuthorizationServerMetadataParams{additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthAuthorizeParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthAuthorizeParams.kt new file mode 100644 index 0000000..befaac0 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthAuthorizeParams.kt @@ -0,0 +1,177 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.oAuth + +import com.scalar.core.Params +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import java.util.Objects + +/** + * Authorization endpoint (RFC 6749 §4.1.1 with PKCE, RFC 7636). Validates the request and sends the + * user to the Scalar dashboard to approve it; the user returns to `redirect_uri` with a `code` to + * exchange at the token endpoint. Only `response_type=code` with `code_challenge_method=S256` is + * supported. + */ +class OAuthOauthAuthorizeParams +private constructor( + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): OAuthOauthAuthorizeParams = builder().build() + + /** + * Returns a mutable builder for constructing an instance of [OAuthOauthAuthorizeParams]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [OAuthOauthAuthorizeParams]. */ + class Builder internal constructor() { + + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(oAuthOauthAuthorizeParams: OAuthOauthAuthorizeParams) = apply { + additionalHeaders = oAuthOauthAuthorizeParams.additionalHeaders.toBuilder() + additionalQueryParams = oAuthOauthAuthorizeParams.additionalQueryParams.toBuilder() + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [OAuthOauthAuthorizeParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): OAuthOauthAuthorizeParams = + OAuthOauthAuthorizeParams(additionalHeaders.build(), additionalQueryParams.build()) + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is OAuthOauthAuthorizeParams && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = Objects.hash(additionalHeaders, additionalQueryParams) + + override fun toString() = + "OAuthOauthAuthorizeParams{additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthRevokeParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthRevokeParams.kt new file mode 100644 index 0000000..091c7f7 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthRevokeParams.kt @@ -0,0 +1,620 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.oAuth + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.Params +import com.scalar.core.checkRequired +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional + +/** + * Revocation endpoint (RFC 7009). Revokes the refresh token and every token issued alongside it. + * The client authenticates as it does at the token endpoint. Responds 200 whether or not the token + * was live, as the RFC requires. + */ +class OAuthOauthRevokeParams +private constructor( + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun token(): String = body.token() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun tokenTypeHint(): Optional = body.tokenTypeHint() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun clientId(): Optional = body.clientId() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun clientSecret(): Optional = body.clientSecret() + + /** + * Returns the raw JSON value of [token]. + * + * Unlike [token], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _token(): JsonField = body._token() + + /** + * Returns the raw JSON value of [tokenTypeHint]. + * + * Unlike [tokenTypeHint], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _tokenTypeHint(): JsonField = body._tokenTypeHint() + + /** + * Returns the raw JSON value of [clientId]. + * + * Unlike [clientId], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _clientId(): JsonField = body._clientId() + + /** + * Returns the raw JSON value of [clientSecret]. + * + * Unlike [clientSecret], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _clientSecret(): JsonField = body._clientSecret() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [OAuthOauthRevokeParams]. + * + * The following fields are required: + * ```kotlin + * .token() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [OAuthOauthRevokeParams]. */ + class Builder internal constructor() { + + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(oAuthOauthRevokeParams: OAuthOauthRevokeParams) = apply { + body = oAuthOauthRevokeParams.body.toBuilder() + additionalHeaders = oAuthOauthRevokeParams.additionalHeaders.toBuilder() + additionalQueryParams = oAuthOauthRevokeParams.additionalQueryParams.toBuilder() + } + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [token] + * - [tokenTypeHint] + * - [clientId] + * - [clientSecret] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + fun token(token: String) = apply { body.token(token) } + + /** + * Sets [Builder.token] to an arbitrary JSON value. + * + * You should usually call [Builder.token] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun token(token: JsonField) = apply { body.token(token) } + + fun tokenTypeHint(tokenTypeHint: String) = apply { body.tokenTypeHint(tokenTypeHint) } + + /** + * Sets [Builder.tokenTypeHint] to an arbitrary JSON value. + * + * You should usually call [Builder.tokenTypeHint] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun tokenTypeHint(tokenTypeHint: JsonField) = apply { + body.tokenTypeHint(tokenTypeHint) + } + + fun clientId(clientId: String) = apply { body.clientId(clientId) } + + /** + * Sets [Builder.clientId] to an arbitrary JSON value. + * + * You should usually call [Builder.clientId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun clientId(clientId: JsonField) = apply { body.clientId(clientId) } + + fun clientSecret(clientSecret: String) = apply { body.clientSecret(clientSecret) } + + /** + * Sets [Builder.clientSecret] to an arbitrary JSON value. + * + * You should usually call [Builder.clientSecret] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun clientSecret(clientSecret: JsonField) = apply { + body.clientSecret(clientSecret) + } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [OAuthOauthRevokeParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .token() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): OAuthOauthRevokeParams = + OAuthOauthRevokeParams( + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val token: JsonField, + private val tokenTypeHint: JsonField, + private val clientId: JsonField, + private val clientSecret: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), + @JsonProperty("token_type_hint") + @ExcludeMissing + tokenTypeHint: JsonField = JsonMissing.of(), + @JsonProperty("client_id") + @ExcludeMissing + clientId: JsonField = JsonMissing.of(), + @JsonProperty("client_secret") + @ExcludeMissing + clientSecret: JsonField = JsonMissing.of(), + ) : this(token, tokenTypeHint, clientId, clientSecret, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun token(): String = token.getRequired("token") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun tokenTypeHint(): Optional = tokenTypeHint.getOptional("token_type_hint") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun clientId(): Optional = clientId.getOptional("client_id") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun clientSecret(): Optional = clientSecret.getOptional("client_secret") + + /** + * Returns the raw JSON value of [token]. + * + * Unlike [token], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("token") @ExcludeMissing fun _token(): JsonField = token + + /** + * Returns the raw JSON value of [tokenTypeHint]. + * + * Unlike [tokenTypeHint], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("token_type_hint") + @ExcludeMissing + fun _tokenTypeHint(): JsonField = tokenTypeHint + + /** + * Returns the raw JSON value of [clientId]. + * + * Unlike [clientId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("client_id") @ExcludeMissing fun _clientId(): JsonField = clientId + + /** + * Returns the raw JSON value of [clientSecret]. + * + * Unlike [clientSecret], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("client_secret") + @ExcludeMissing + fun _clientSecret(): JsonField = clientSecret + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```kotlin + * .token() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var token: JsonField? = null + private var tokenTypeHint: JsonField = JsonMissing.of() + private var clientId: JsonField = JsonMissing.of() + private var clientSecret: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + token = body.token + tokenTypeHint = body.tokenTypeHint + clientId = body.clientId + clientSecret = body.clientSecret + additionalProperties = body.additionalProperties.toMutableMap() + } + + fun token(token: String) = token(JsonField.of(token)) + + /** + * Sets [Builder.token] to an arbitrary JSON value. + * + * You should usually call [Builder.token] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun token(token: JsonField) = apply { this.token = token } + + fun tokenTypeHint(tokenTypeHint: String) = tokenTypeHint(JsonField.of(tokenTypeHint)) + + /** + * Sets [Builder.tokenTypeHint] to an arbitrary JSON value. + * + * You should usually call [Builder.tokenTypeHint] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun tokenTypeHint(tokenTypeHint: JsonField) = apply { + this.tokenTypeHint = tokenTypeHint + } + + fun clientId(clientId: String) = clientId(JsonField.of(clientId)) + + /** + * Sets [Builder.clientId] to an arbitrary JSON value. + * + * You should usually call [Builder.clientId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun clientId(clientId: JsonField) = apply { this.clientId = clientId } + + fun clientSecret(clientSecret: String) = clientSecret(JsonField.of(clientSecret)) + + /** + * Sets [Builder.clientSecret] to an arbitrary JSON value. + * + * You should usually call [Builder.clientSecret] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun clientSecret(clientSecret: JsonField) = apply { + this.clientSecret = clientSecret + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .token() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Body = + Body( + checkRequired("token", token), + tokenTypeHint, + clientId, + clientSecret, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Body = apply { + if (validated) { + return@apply + } + + token() + tokenTypeHint() + clientId() + clientSecret() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (token.asKnown().isPresent) 1 else 0) + + (if (tokenTypeHint.asKnown().isPresent) 1 else 0) + + (if (clientId.asKnown().isPresent) 1 else 0) + + (if (clientSecret.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + token == other.token && + tokenTypeHint == other.tokenTypeHint && + clientId == other.clientId && + clientSecret == other.clientSecret && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(token, tokenTypeHint, clientId, clientSecret, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{token=$token, tokenTypeHint=$tokenTypeHint, clientId=$clientId, clientSecret=$clientSecret, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is OAuthOauthRevokeParams && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = Objects.hash(body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "OAuthOauthRevokeParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthTokenParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthTokenParams.kt new file mode 100644 index 0000000..73d2e79 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthTokenParams.kt @@ -0,0 +1,883 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.oAuth + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.Params +import com.scalar.core.checkRequired +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional + +/** + * Token endpoint (RFC 6749 §4.1.3 and §6). Accepts `application/x-www-form-urlencoded`. + * Confidential clients authenticate with HTTP Basic or `client_secret` in the body; public clients + * send `client_id` alone. The `authorization_code` grant needs `code`, `redirect_uri` and + * `code_verifier`; the `refresh_token` grant needs `refresh_token` and may narrow `scope`. + */ +class OAuthOauthTokenParams +private constructor( + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun grantType(): String = body.grantType() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun clientId(): Optional = body.clientId() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun clientSecret(): Optional = body.clientSecret() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun code(): Optional = body.code() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun redirectUri(): Optional = body.redirectUri() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun codeVerifier(): Optional = body.codeVerifier() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun refreshToken(): Optional = body.refreshToken() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun scope(): Optional = body.scope() + + /** + * Returns the raw JSON value of [grantType]. + * + * Unlike [grantType], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _grantType(): JsonField = body._grantType() + + /** + * Returns the raw JSON value of [clientId]. + * + * Unlike [clientId], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _clientId(): JsonField = body._clientId() + + /** + * Returns the raw JSON value of [clientSecret]. + * + * Unlike [clientSecret], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _clientSecret(): JsonField = body._clientSecret() + + /** + * Returns the raw JSON value of [code]. + * + * Unlike [code], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _code(): JsonField = body._code() + + /** + * Returns the raw JSON value of [redirectUri]. + * + * Unlike [redirectUri], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _redirectUri(): JsonField = body._redirectUri() + + /** + * Returns the raw JSON value of [codeVerifier]. + * + * Unlike [codeVerifier], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _codeVerifier(): JsonField = body._codeVerifier() + + /** + * Returns the raw JSON value of [refreshToken]. + * + * Unlike [refreshToken], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _refreshToken(): JsonField = body._refreshToken() + + /** + * Returns the raw JSON value of [scope]. + * + * Unlike [scope], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _scope(): JsonField = body._scope() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [OAuthOauthTokenParams]. + * + * The following fields are required: + * ```kotlin + * .grantType() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [OAuthOauthTokenParams]. */ + class Builder internal constructor() { + + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(oAuthOauthTokenParams: OAuthOauthTokenParams) = apply { + body = oAuthOauthTokenParams.body.toBuilder() + additionalHeaders = oAuthOauthTokenParams.additionalHeaders.toBuilder() + additionalQueryParams = oAuthOauthTokenParams.additionalQueryParams.toBuilder() + } + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [grantType] + * - [clientId] + * - [clientSecret] + * - [code] + * - [redirectUri] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + fun grantType(grantType: String) = apply { body.grantType(grantType) } + + /** + * Sets [Builder.grantType] to an arbitrary JSON value. + * + * You should usually call [Builder.grantType] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun grantType(grantType: JsonField) = apply { body.grantType(grantType) } + + fun clientId(clientId: String) = apply { body.clientId(clientId) } + + /** + * Sets [Builder.clientId] to an arbitrary JSON value. + * + * You should usually call [Builder.clientId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun clientId(clientId: JsonField) = apply { body.clientId(clientId) } + + fun clientSecret(clientSecret: String) = apply { body.clientSecret(clientSecret) } + + /** + * Sets [Builder.clientSecret] to an arbitrary JSON value. + * + * You should usually call [Builder.clientSecret] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun clientSecret(clientSecret: JsonField) = apply { + body.clientSecret(clientSecret) + } + + fun code(code: String) = apply { body.code(code) } + + /** + * Sets [Builder.code] to an arbitrary JSON value. + * + * You should usually call [Builder.code] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun code(code: JsonField) = apply { body.code(code) } + + fun redirectUri(redirectUri: String) = apply { body.redirectUri(redirectUri) } + + /** + * Sets [Builder.redirectUri] to an arbitrary JSON value. + * + * You should usually call [Builder.redirectUri] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun redirectUri(redirectUri: JsonField) = apply { body.redirectUri(redirectUri) } + + fun codeVerifier(codeVerifier: String) = apply { body.codeVerifier(codeVerifier) } + + /** + * Sets [Builder.codeVerifier] to an arbitrary JSON value. + * + * You should usually call [Builder.codeVerifier] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun codeVerifier(codeVerifier: JsonField) = apply { + body.codeVerifier(codeVerifier) + } + + fun refreshToken(refreshToken: String) = apply { body.refreshToken(refreshToken) } + + /** + * Sets [Builder.refreshToken] to an arbitrary JSON value. + * + * You should usually call [Builder.refreshToken] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun refreshToken(refreshToken: JsonField) = apply { + body.refreshToken(refreshToken) + } + + fun scope(scope: String) = apply { body.scope(scope) } + + /** + * Sets [Builder.scope] to an arbitrary JSON value. + * + * You should usually call [Builder.scope] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun scope(scope: JsonField) = apply { body.scope(scope) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [OAuthOauthTokenParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .grantType() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): OAuthOauthTokenParams = + OAuthOauthTokenParams( + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val grantType: JsonField, + private val clientId: JsonField, + private val clientSecret: JsonField, + private val code: JsonField, + private val redirectUri: JsonField, + private val codeVerifier: JsonField, + private val refreshToken: JsonField, + private val scope: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("grant_type") + @ExcludeMissing + grantType: JsonField = JsonMissing.of(), + @JsonProperty("client_id") + @ExcludeMissing + clientId: JsonField = JsonMissing.of(), + @JsonProperty("client_secret") + @ExcludeMissing + clientSecret: JsonField = JsonMissing.of(), + @JsonProperty("code") @ExcludeMissing code: JsonField = JsonMissing.of(), + @JsonProperty("redirect_uri") + @ExcludeMissing + redirectUri: JsonField = JsonMissing.of(), + @JsonProperty("code_verifier") + @ExcludeMissing + codeVerifier: JsonField = JsonMissing.of(), + @JsonProperty("refresh_token") + @ExcludeMissing + refreshToken: JsonField = JsonMissing.of(), + @JsonProperty("scope") @ExcludeMissing scope: JsonField = JsonMissing.of(), + ) : this( + grantType, + clientId, + clientSecret, + code, + redirectUri, + codeVerifier, + refreshToken, + scope, + mutableMapOf(), + ) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun grantType(): String = grantType.getRequired("grant_type") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun clientId(): Optional = clientId.getOptional("client_id") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun clientSecret(): Optional = clientSecret.getOptional("client_secret") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun code(): Optional = code.getOptional("code") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun redirectUri(): Optional = redirectUri.getOptional("redirect_uri") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun codeVerifier(): Optional = codeVerifier.getOptional("code_verifier") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun refreshToken(): Optional = refreshToken.getOptional("refresh_token") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun scope(): Optional = scope.getOptional("scope") + + /** + * Returns the raw JSON value of [grantType]. + * + * Unlike [grantType], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("grant_type") @ExcludeMissing fun _grantType(): JsonField = grantType + + /** + * Returns the raw JSON value of [clientId]. + * + * Unlike [clientId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("client_id") @ExcludeMissing fun _clientId(): JsonField = clientId + + /** + * Returns the raw JSON value of [clientSecret]. + * + * Unlike [clientSecret], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("client_secret") + @ExcludeMissing + fun _clientSecret(): JsonField = clientSecret + + /** + * Returns the raw JSON value of [code]. + * + * Unlike [code], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("code") @ExcludeMissing fun _code(): JsonField = code + + /** + * Returns the raw JSON value of [redirectUri]. + * + * Unlike [redirectUri], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("redirect_uri") + @ExcludeMissing + fun _redirectUri(): JsonField = redirectUri + + /** + * Returns the raw JSON value of [codeVerifier]. + * + * Unlike [codeVerifier], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("code_verifier") + @ExcludeMissing + fun _codeVerifier(): JsonField = codeVerifier + + /** + * Returns the raw JSON value of [refreshToken]. + * + * Unlike [refreshToken], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("refresh_token") + @ExcludeMissing + fun _refreshToken(): JsonField = refreshToken + + /** + * Returns the raw JSON value of [scope]. + * + * Unlike [scope], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("scope") @ExcludeMissing fun _scope(): JsonField = scope + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```kotlin + * .grantType() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var grantType: JsonField? = null + private var clientId: JsonField = JsonMissing.of() + private var clientSecret: JsonField = JsonMissing.of() + private var code: JsonField = JsonMissing.of() + private var redirectUri: JsonField = JsonMissing.of() + private var codeVerifier: JsonField = JsonMissing.of() + private var refreshToken: JsonField = JsonMissing.of() + private var scope: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + grantType = body.grantType + clientId = body.clientId + clientSecret = body.clientSecret + code = body.code + redirectUri = body.redirectUri + codeVerifier = body.codeVerifier + refreshToken = body.refreshToken + scope = body.scope + additionalProperties = body.additionalProperties.toMutableMap() + } + + fun grantType(grantType: String) = grantType(JsonField.of(grantType)) + + /** + * Sets [Builder.grantType] to an arbitrary JSON value. + * + * You should usually call [Builder.grantType] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun grantType(grantType: JsonField) = apply { this.grantType = grantType } + + fun clientId(clientId: String) = clientId(JsonField.of(clientId)) + + /** + * Sets [Builder.clientId] to an arbitrary JSON value. + * + * You should usually call [Builder.clientId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun clientId(clientId: JsonField) = apply { this.clientId = clientId } + + fun clientSecret(clientSecret: String) = clientSecret(JsonField.of(clientSecret)) + + /** + * Sets [Builder.clientSecret] to an arbitrary JSON value. + * + * You should usually call [Builder.clientSecret] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun clientSecret(clientSecret: JsonField) = apply { + this.clientSecret = clientSecret + } + + fun code(code: String) = code(JsonField.of(code)) + + /** + * Sets [Builder.code] to an arbitrary JSON value. + * + * You should usually call [Builder.code] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun code(code: JsonField) = apply { this.code = code } + + fun redirectUri(redirectUri: String) = redirectUri(JsonField.of(redirectUri)) + + /** + * Sets [Builder.redirectUri] to an arbitrary JSON value. + * + * You should usually call [Builder.redirectUri] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun redirectUri(redirectUri: JsonField) = apply { + this.redirectUri = redirectUri + } + + fun codeVerifier(codeVerifier: String) = codeVerifier(JsonField.of(codeVerifier)) + + /** + * Sets [Builder.codeVerifier] to an arbitrary JSON value. + * + * You should usually call [Builder.codeVerifier] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun codeVerifier(codeVerifier: JsonField) = apply { + this.codeVerifier = codeVerifier + } + + fun refreshToken(refreshToken: String) = refreshToken(JsonField.of(refreshToken)) + + /** + * Sets [Builder.refreshToken] to an arbitrary JSON value. + * + * You should usually call [Builder.refreshToken] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun refreshToken(refreshToken: JsonField) = apply { + this.refreshToken = refreshToken + } + + fun scope(scope: String) = scope(JsonField.of(scope)) + + /** + * Sets [Builder.scope] to an arbitrary JSON value. + * + * You should usually call [Builder.scope] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun scope(scope: JsonField) = apply { this.scope = scope } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .grantType() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Body = + Body( + checkRequired("grantType", grantType), + clientId, + clientSecret, + code, + redirectUri, + codeVerifier, + refreshToken, + scope, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Body = apply { + if (validated) { + return@apply + } + + grantType() + clientId() + clientSecret() + code() + redirectUri() + codeVerifier() + refreshToken() + scope() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (grantType.asKnown().isPresent) 1 else 0) + + (if (clientId.asKnown().isPresent) 1 else 0) + + (if (clientSecret.asKnown().isPresent) 1 else 0) + + (if (code.asKnown().isPresent) 1 else 0) + + (if (redirectUri.asKnown().isPresent) 1 else 0) + + (if (codeVerifier.asKnown().isPresent) 1 else 0) + + (if (refreshToken.asKnown().isPresent) 1 else 0) + + (if (scope.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + grantType == other.grantType && + clientId == other.clientId && + clientSecret == other.clientSecret && + code == other.code && + redirectUri == other.redirectUri && + codeVerifier == other.codeVerifier && + refreshToken == other.refreshToken && + scope == other.scope && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + grantType, + clientId, + clientSecret, + code, + redirectUri, + codeVerifier, + refreshToken, + scope, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{grantType=$grantType, clientId=$clientId, clientSecret=$clientSecret, code=$code, redirectUri=$redirectUri, codeVerifier=$codeVerifier, refreshToken=$refreshToken, scope=$scope, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is OAuthOauthTokenParams && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = Objects.hash(body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "OAuthOauthTokenParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthTokenResponse.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthTokenResponse.kt new file mode 100644 index 0000000..6f94887 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthTokenResponse.kt @@ -0,0 +1,232 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.oAuth + +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.scalar.core.BaseDeserializer +import com.scalar.core.BaseSerializer +import com.scalar.core.JsonValue +import com.scalar.core.allMaxBy +import com.scalar.core.getOrThrow +import com.scalar.errors.ScalarInvalidDataException +import java.util.Objects +import java.util.Optional + +@JsonDeserialize(using = OAuthOauthTokenResponse.Deserializer::class) +@JsonSerialize(using = OAuthOauthTokenResponse.Serializer::class) +class OAuthOauthTokenResponse +private constructor( + private val token: OauthToken? = null, + private val error: OauthError? = null, + private val _json: JsonValue? = null, +) { + + fun token(): Optional = Optional.ofNullable(token) + + fun error(): Optional = Optional.ofNullable(error) + + fun isToken(): Boolean = token != null + + fun isError(): Boolean = error != null + + fun asToken(): OauthToken = token.getOrThrow("token") + + fun asError(): OauthError = error.getOrThrow("error") + + fun _json(): Optional = Optional.ofNullable(_json) + + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.scalar.core.JsonValue; + * import java.util.Optional; + * + * Optional result = + * oAuthOauthTokenResponse.accept( + * new OAuthOauthTokenResponse.Visitor>() { + * @Override + * public Optional visitToken(OauthToken token) { + * return Optional.of(token.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ScalarInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ + fun accept(visitor: Visitor): T = + when { + token != null -> visitor.visitToken(token) + error != null -> visitor.visitError(error) + else -> visitor.unknown(_json) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): OAuthOauthTokenResponse = apply { + if (validated) { + return@apply + } + + accept( + object : Visitor { + override fun visitToken(token: OauthToken) { + token.validate() + } + + override fun visitError(error: OauthError) { + error.validate() + } + } + ) + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + accept( + object : Visitor { + override fun visitToken(token: OauthToken) = token.validity() + + override fun visitError(error: OauthError) = error.validity() + + override fun unknown(json: JsonValue?) = 0 + } + ) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is OAuthOauthTokenResponse && token == other.token && error == other.error + } + + override fun hashCode(): Int = Objects.hash(token, error) + + override fun toString(): String = + when { + token != null -> "OAuthOauthTokenResponse{token=$token}" + error != null -> "OAuthOauthTokenResponse{error=$error}" + _json != null -> "OAuthOauthTokenResponse{_unknown=$_json}" + else -> throw IllegalStateException("Invalid OAuthOauthTokenResponse") + } + + companion object { + + @JvmStatic fun ofToken(token: OauthToken) = OAuthOauthTokenResponse(token = token) + + @JvmStatic fun ofError(error: OauthError) = OAuthOauthTokenResponse(error = error) + } + + /** + * An interface that defines how to map each variant of [OAuthOauthTokenResponse] to a value of + * type [T]. + */ + interface Visitor { + + fun visitToken(token: OauthToken): T + + fun visitError(error: OauthError): T + + /** + * Maps an unknown variant of [OAuthOauthTokenResponse] to a value of type [T]. + * + * An instance of [OAuthOauthTokenResponse] can contain an unknown variant if it was + * deserialized from data that doesn't match any known variant. For example, if the SDK is + * on an older version than the API, then the API may respond with new variants that the SDK + * is unaware of. + * + * @throws ScalarInvalidDataException in the default implementation. + */ + fun unknown(json: JsonValue?): T { + throw ScalarInvalidDataException("Unknown OAuthOauthTokenResponse: $json") + } + } + + internal class Deserializer : + BaseDeserializer(OAuthOauthTokenResponse::class) { + + override fun ObjectCodec.deserialize(node: JsonNode): OAuthOauthTokenResponse { + val json = JsonValue.fromJsonNode(node) + + val bestMatches = + sequenceOf( + tryDeserialize(node, jacksonTypeRef())?.let { + OAuthOauthTokenResponse(token = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + OAuthOauthTokenResponse(error = it, _json = json) + }, + ) + .filterNotNull() + .allMaxBy { it.validity() } + .toList() + return when (bestMatches.size) { + // This can happen if what we're deserializing is completely incompatible with all + // the possible variants (e.g. deserializing from boolean). + 0 -> OAuthOauthTokenResponse(_json = json) + 1 -> bestMatches.single() + // If there's more than one match with the highest validity, then use the first + // completely valid match, or simply the first match if none are completely valid. + else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first() + } + } + } + + internal class Serializer : + BaseSerializer(OAuthOauthTokenResponse::class) { + + override fun serialize( + value: OAuthOauthTokenResponse, + generator: JsonGenerator, + provider: SerializerProvider, + ) { + when { + value.token != null -> generator.writeObject(value.token) + value.error != null -> generator.writeObject(value.error) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid OAuthOauthTokenResponse") + } + } + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OauthAuthorizationServerMetadata.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OauthAuthorizationServerMetadata.kt new file mode 100644 index 0000000..7b467b1 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OauthAuthorizationServerMetadata.kt @@ -0,0 +1,719 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.oAuth + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.checkKnown +import com.scalar.core.checkRequired +import com.scalar.core.toImmutable +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import kotlin.jvm.optionals.getOrNull + +class OauthAuthorizationServerMetadata +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val issuer: JsonField, + private val authorizationEndpoint: JsonField, + private val tokenEndpoint: JsonField, + private val revocationEndpoint: JsonField, + private val responseTypesSupported: JsonField>, + private val grantTypesSupported: JsonField>, + private val codeChallengeMethodsSupported: JsonField>, + private val tokenEndpointAuthMethodsSupported: JsonField>, + private val revocationEndpointAuthMethodsSupported: JsonField>, + private val scopesSupported: JsonField>, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("issuer") @ExcludeMissing issuer: JsonField = JsonMissing.of(), + @JsonProperty("authorization_endpoint") + @ExcludeMissing + authorizationEndpoint: JsonField = JsonMissing.of(), + @JsonProperty("token_endpoint") + @ExcludeMissing + tokenEndpoint: JsonField = JsonMissing.of(), + @JsonProperty("revocation_endpoint") + @ExcludeMissing + revocationEndpoint: JsonField = JsonMissing.of(), + @JsonProperty("response_types_supported") + @ExcludeMissing + responseTypesSupported: JsonField> = JsonMissing.of(), + @JsonProperty("grant_types_supported") + @ExcludeMissing + grantTypesSupported: JsonField> = JsonMissing.of(), + @JsonProperty("code_challenge_methods_supported") + @ExcludeMissing + codeChallengeMethodsSupported: JsonField> = JsonMissing.of(), + @JsonProperty("token_endpoint_auth_methods_supported") + @ExcludeMissing + tokenEndpointAuthMethodsSupported: JsonField> = JsonMissing.of(), + @JsonProperty("revocation_endpoint_auth_methods_supported") + @ExcludeMissing + revocationEndpointAuthMethodsSupported: JsonField> = JsonMissing.of(), + @JsonProperty("scopes_supported") + @ExcludeMissing + scopesSupported: JsonField> = JsonMissing.of(), + ) : this( + issuer, + authorizationEndpoint, + tokenEndpoint, + revocationEndpoint, + responseTypesSupported, + grantTypesSupported, + codeChallengeMethodsSupported, + tokenEndpointAuthMethodsSupported, + revocationEndpointAuthMethodsSupported, + scopesSupported, + mutableMapOf(), + ) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun issuer(): String = issuer.getRequired("issuer") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun authorizationEndpoint(): String = + authorizationEndpoint.getRequired("authorization_endpoint") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun tokenEndpoint(): String = tokenEndpoint.getRequired("token_endpoint") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun revocationEndpoint(): String = revocationEndpoint.getRequired("revocation_endpoint") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun responseTypesSupported(): List = + responseTypesSupported.getRequired("response_types_supported") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun grantTypesSupported(): List = + grantTypesSupported.getRequired("grant_types_supported") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun codeChallengeMethodsSupported(): List = + codeChallengeMethodsSupported.getRequired("code_challenge_methods_supported") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun tokenEndpointAuthMethodsSupported(): List = + tokenEndpointAuthMethodsSupported.getRequired("token_endpoint_auth_methods_supported") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun revocationEndpointAuthMethodsSupported(): List = + revocationEndpointAuthMethodsSupported.getRequired( + "revocation_endpoint_auth_methods_supported" + ) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun scopesSupported(): List = scopesSupported.getRequired("scopes_supported") + + /** + * Returns the raw JSON value of [issuer]. + * + * Unlike [issuer], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("issuer") @ExcludeMissing fun _issuer(): JsonField = issuer + + /** + * Returns the raw JSON value of [authorizationEndpoint]. + * + * Unlike [authorizationEndpoint], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("authorization_endpoint") + @ExcludeMissing + fun _authorizationEndpoint(): JsonField = authorizationEndpoint + + /** + * Returns the raw JSON value of [tokenEndpoint]. + * + * Unlike [tokenEndpoint], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("token_endpoint") + @ExcludeMissing + fun _tokenEndpoint(): JsonField = tokenEndpoint + + /** + * Returns the raw JSON value of [revocationEndpoint]. + * + * Unlike [revocationEndpoint], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("revocation_endpoint") + @ExcludeMissing + fun _revocationEndpoint(): JsonField = revocationEndpoint + + /** + * Returns the raw JSON value of [responseTypesSupported]. + * + * Unlike [responseTypesSupported], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("response_types_supported") + @ExcludeMissing + fun _responseTypesSupported(): JsonField> = responseTypesSupported + + /** + * Returns the raw JSON value of [grantTypesSupported]. + * + * Unlike [grantTypesSupported], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("grant_types_supported") + @ExcludeMissing + fun _grantTypesSupported(): JsonField> = grantTypesSupported + + /** + * Returns the raw JSON value of [codeChallengeMethodsSupported]. + * + * Unlike [codeChallengeMethodsSupported], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("code_challenge_methods_supported") + @ExcludeMissing + fun _codeChallengeMethodsSupported(): JsonField> = codeChallengeMethodsSupported + + /** + * Returns the raw JSON value of [tokenEndpointAuthMethodsSupported]. + * + * Unlike [tokenEndpointAuthMethodsSupported], this method doesn't throw if the JSON field has + * an unexpected type. + */ + @JsonProperty("token_endpoint_auth_methods_supported") + @ExcludeMissing + fun _tokenEndpointAuthMethodsSupported(): JsonField> = + tokenEndpointAuthMethodsSupported + + /** + * Returns the raw JSON value of [revocationEndpointAuthMethodsSupported]. + * + * Unlike [revocationEndpointAuthMethodsSupported], this method doesn't throw if the JSON field + * has an unexpected type. + */ + @JsonProperty("revocation_endpoint_auth_methods_supported") + @ExcludeMissing + fun _revocationEndpointAuthMethodsSupported(): JsonField> = + revocationEndpointAuthMethodsSupported + + /** + * Returns the raw JSON value of [scopesSupported]. + * + * Unlike [scopesSupported], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("scopes_supported") + @ExcludeMissing + fun _scopesSupported(): JsonField> = scopesSupported + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [OauthAuthorizationServerMetadata]. + * + * The following fields are required: + * ```kotlin + * .issuer() + * .authorizationEndpoint() + * .tokenEndpoint() + * .revocationEndpoint() + * .responseTypesSupported() + * .grantTypesSupported() + * .codeChallengeMethodsSupported() + * .tokenEndpointAuthMethodsSupported() + * .revocationEndpointAuthMethodsSupported() + * .scopesSupported() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [OauthAuthorizationServerMetadata]. */ + class Builder internal constructor() { + + private var issuer: JsonField? = null + private var authorizationEndpoint: JsonField? = null + private var tokenEndpoint: JsonField? = null + private var revocationEndpoint: JsonField? = null + private var responseTypesSupported: JsonField>? = null + private var grantTypesSupported: JsonField>? = null + private var codeChallengeMethodsSupported: JsonField>? = null + private var tokenEndpointAuthMethodsSupported: JsonField>? = null + private var revocationEndpointAuthMethodsSupported: JsonField>? = null + private var scopesSupported: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(oauthAuthorizationServerMetadata: OauthAuthorizationServerMetadata) = + apply { + issuer = oauthAuthorizationServerMetadata.issuer + authorizationEndpoint = oauthAuthorizationServerMetadata.authorizationEndpoint + tokenEndpoint = oauthAuthorizationServerMetadata.tokenEndpoint + revocationEndpoint = oauthAuthorizationServerMetadata.revocationEndpoint + responseTypesSupported = + oauthAuthorizationServerMetadata.responseTypesSupported.map { + it.toMutableList() + } + grantTypesSupported = + oauthAuthorizationServerMetadata.grantTypesSupported.map { it.toMutableList() } + codeChallengeMethodsSupported = + oauthAuthorizationServerMetadata.codeChallengeMethodsSupported.map { + it.toMutableList() + } + tokenEndpointAuthMethodsSupported = + oauthAuthorizationServerMetadata.tokenEndpointAuthMethodsSupported.map { + it.toMutableList() + } + revocationEndpointAuthMethodsSupported = + oauthAuthorizationServerMetadata.revocationEndpointAuthMethodsSupported.map { + it.toMutableList() + } + scopesSupported = + oauthAuthorizationServerMetadata.scopesSupported.map { it.toMutableList() } + additionalProperties = + oauthAuthorizationServerMetadata.additionalProperties.toMutableMap() + } + + fun issuer(issuer: String) = issuer(JsonField.of(issuer)) + + /** + * Sets [Builder.issuer] to an arbitrary JSON value. + * + * You should usually call [Builder.issuer] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun issuer(issuer: JsonField) = apply { this.issuer = issuer } + + fun authorizationEndpoint(authorizationEndpoint: String) = + authorizationEndpoint(JsonField.of(authorizationEndpoint)) + + /** + * Sets [Builder.authorizationEndpoint] to an arbitrary JSON value. + * + * You should usually call [Builder.authorizationEndpoint] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun authorizationEndpoint(authorizationEndpoint: JsonField) = apply { + this.authorizationEndpoint = authorizationEndpoint + } + + fun tokenEndpoint(tokenEndpoint: String) = tokenEndpoint(JsonField.of(tokenEndpoint)) + + /** + * Sets [Builder.tokenEndpoint] to an arbitrary JSON value. + * + * You should usually call [Builder.tokenEndpoint] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun tokenEndpoint(tokenEndpoint: JsonField) = apply { + this.tokenEndpoint = tokenEndpoint + } + + fun revocationEndpoint(revocationEndpoint: String) = + revocationEndpoint(JsonField.of(revocationEndpoint)) + + /** + * Sets [Builder.revocationEndpoint] to an arbitrary JSON value. + * + * You should usually call [Builder.revocationEndpoint] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun revocationEndpoint(revocationEndpoint: JsonField) = apply { + this.revocationEndpoint = revocationEndpoint + } + + fun responseTypesSupported(responseTypesSupported: List) = + responseTypesSupported(JsonField.of(responseTypesSupported)) + + /** + * Sets [Builder.responseTypesSupported] to an arbitrary JSON value. + * + * You should usually call [Builder.responseTypesSupported] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun responseTypesSupported(responseTypesSupported: JsonField>) = apply { + this.responseTypesSupported = responseTypesSupported.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [Builder.responseTypesSupported]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addResponseTypesSupported(responseTypesSupported: String) = apply { + this.responseTypesSupported = + (this.responseTypesSupported ?: JsonField.of(mutableListOf())).also { + checkKnown("responseTypesSupported", it).add(responseTypesSupported) + } + } + + fun grantTypesSupported(grantTypesSupported: List) = + grantTypesSupported(JsonField.of(grantTypesSupported)) + + /** + * Sets [Builder.grantTypesSupported] to an arbitrary JSON value. + * + * You should usually call [Builder.grantTypesSupported] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun grantTypesSupported(grantTypesSupported: JsonField>) = apply { + this.grantTypesSupported = grantTypesSupported.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [Builder.grantTypesSupported]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addGrantTypesSupported(grantTypesSupported: String) = apply { + this.grantTypesSupported = + (this.grantTypesSupported ?: JsonField.of(mutableListOf())).also { + checkKnown("grantTypesSupported", it).add(grantTypesSupported) + } + } + + fun codeChallengeMethodsSupported(codeChallengeMethodsSupported: List) = + codeChallengeMethodsSupported(JsonField.of(codeChallengeMethodsSupported)) + + /** + * Sets [Builder.codeChallengeMethodsSupported] to an arbitrary JSON value. + * + * You should usually call [Builder.codeChallengeMethodsSupported] with a well-typed + * `List` value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun codeChallengeMethodsSupported(codeChallengeMethodsSupported: JsonField>) = + apply { + this.codeChallengeMethodsSupported = codeChallengeMethodsSupported.map { + it.toMutableList() + } + } + + /** + * Adds a single [String] to [Builder.codeChallengeMethodsSupported]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addCodeChallengeMethodsSupported(codeChallengeMethodsSupported: String) = apply { + this.codeChallengeMethodsSupported = + (this.codeChallengeMethodsSupported ?: JsonField.of(mutableListOf())).also { + checkKnown("codeChallengeMethodsSupported", it) + .add(codeChallengeMethodsSupported) + } + } + + fun tokenEndpointAuthMethodsSupported(tokenEndpointAuthMethodsSupported: List) = + tokenEndpointAuthMethodsSupported(JsonField.of(tokenEndpointAuthMethodsSupported)) + + /** + * Sets [Builder.tokenEndpointAuthMethodsSupported] to an arbitrary JSON value. + * + * You should usually call [Builder.tokenEndpointAuthMethodsSupported] with a well-typed + * `List` value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun tokenEndpointAuthMethodsSupported( + tokenEndpointAuthMethodsSupported: JsonField> + ) = apply { + this.tokenEndpointAuthMethodsSupported = tokenEndpointAuthMethodsSupported.map { + it.toMutableList() + } + } + + /** + * Adds a single [String] to [Builder.tokenEndpointAuthMethodsSupported]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addTokenEndpointAuthMethodsSupported(tokenEndpointAuthMethodsSupported: String) = + apply { + this.tokenEndpointAuthMethodsSupported = + (this.tokenEndpointAuthMethodsSupported ?: JsonField.of(mutableListOf())).also { + checkKnown("tokenEndpointAuthMethodsSupported", it) + .add(tokenEndpointAuthMethodsSupported) + } + } + + fun revocationEndpointAuthMethodsSupported( + revocationEndpointAuthMethodsSupported: List + ) = + revocationEndpointAuthMethodsSupported( + JsonField.of(revocationEndpointAuthMethodsSupported) + ) + + /** + * Sets [Builder.revocationEndpointAuthMethodsSupported] to an arbitrary JSON value. + * + * You should usually call [Builder.revocationEndpointAuthMethodsSupported] with a + * well-typed `List` value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ + fun revocationEndpointAuthMethodsSupported( + revocationEndpointAuthMethodsSupported: JsonField> + ) = apply { + this.revocationEndpointAuthMethodsSupported = + revocationEndpointAuthMethodsSupported.map { + it.toMutableList() + } + } + + /** + * Adds a single [String] to [Builder.revocationEndpointAuthMethodsSupported]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addRevocationEndpointAuthMethodsSupported( + revocationEndpointAuthMethodsSupported: String + ) = apply { + this.revocationEndpointAuthMethodsSupported = + (this.revocationEndpointAuthMethodsSupported ?: JsonField.of(mutableListOf())) + .also { + checkKnown("revocationEndpointAuthMethodsSupported", it) + .add(revocationEndpointAuthMethodsSupported) + } + } + + fun scopesSupported(scopesSupported: List) = + scopesSupported(JsonField.of(scopesSupported)) + + /** + * Sets [Builder.scopesSupported] to an arbitrary JSON value. + * + * You should usually call [Builder.scopesSupported] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun scopesSupported(scopesSupported: JsonField>) = apply { + this.scopesSupported = scopesSupported.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [Builder.scopesSupported]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addScopesSupported(scopesSupported: String) = apply { + this.scopesSupported = + (this.scopesSupported ?: JsonField.of(mutableListOf())).also { + checkKnown("scopesSupported", it).add(scopesSupported) + } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [OauthAuthorizationServerMetadata]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .issuer() + * .authorizationEndpoint() + * .tokenEndpoint() + * .revocationEndpoint() + * .responseTypesSupported() + * .grantTypesSupported() + * .codeChallengeMethodsSupported() + * .tokenEndpointAuthMethodsSupported() + * .revocationEndpointAuthMethodsSupported() + * .scopesSupported() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): OauthAuthorizationServerMetadata = + OauthAuthorizationServerMetadata( + checkRequired("issuer", issuer), + checkRequired("authorizationEndpoint", authorizationEndpoint), + checkRequired("tokenEndpoint", tokenEndpoint), + checkRequired("revocationEndpoint", revocationEndpoint), + checkRequired("responseTypesSupported", responseTypesSupported).map { + it.toImmutable() + }, + checkRequired("grantTypesSupported", grantTypesSupported).map { it.toImmutable() }, + checkRequired("codeChallengeMethodsSupported", codeChallengeMethodsSupported).map { + it.toImmutable() + }, + checkRequired( + "tokenEndpointAuthMethodsSupported", + tokenEndpointAuthMethodsSupported, + ) + .map { it.toImmutable() }, + checkRequired( + "revocationEndpointAuthMethodsSupported", + revocationEndpointAuthMethodsSupported, + ) + .map { it.toImmutable() }, + checkRequired("scopesSupported", scopesSupported).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): OauthAuthorizationServerMetadata = apply { + if (validated) { + return@apply + } + + issuer() + authorizationEndpoint() + tokenEndpoint() + revocationEndpoint() + responseTypesSupported() + grantTypesSupported() + codeChallengeMethodsSupported() + tokenEndpointAuthMethodsSupported() + revocationEndpointAuthMethodsSupported() + scopesSupported() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (issuer.asKnown().isPresent) 1 else 0) + + (if (authorizationEndpoint.asKnown().isPresent) 1 else 0) + + (if (tokenEndpoint.asKnown().isPresent) 1 else 0) + + (if (revocationEndpoint.asKnown().isPresent) 1 else 0) + + (responseTypesSupported.asKnown().getOrNull()?.size ?: 0) + + (grantTypesSupported.asKnown().getOrNull()?.size ?: 0) + + (codeChallengeMethodsSupported.asKnown().getOrNull()?.size ?: 0) + + (tokenEndpointAuthMethodsSupported.asKnown().getOrNull()?.size ?: 0) + + (revocationEndpointAuthMethodsSupported.asKnown().getOrNull()?.size ?: 0) + + (scopesSupported.asKnown().getOrNull()?.size ?: 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is OauthAuthorizationServerMetadata && + issuer == other.issuer && + authorizationEndpoint == other.authorizationEndpoint && + tokenEndpoint == other.tokenEndpoint && + revocationEndpoint == other.revocationEndpoint && + responseTypesSupported == other.responseTypesSupported && + grantTypesSupported == other.grantTypesSupported && + codeChallengeMethodsSupported == other.codeChallengeMethodsSupported && + tokenEndpointAuthMethodsSupported == other.tokenEndpointAuthMethodsSupported && + revocationEndpointAuthMethodsSupported == + other.revocationEndpointAuthMethodsSupported && + scopesSupported == other.scopesSupported && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + issuer, + authorizationEndpoint, + tokenEndpoint, + revocationEndpoint, + responseTypesSupported, + grantTypesSupported, + codeChallengeMethodsSupported, + tokenEndpointAuthMethodsSupported, + revocationEndpointAuthMethodsSupported, + scopesSupported, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "OauthAuthorizationServerMetadata{issuer=$issuer, authorizationEndpoint=$authorizationEndpoint, tokenEndpoint=$tokenEndpoint, revocationEndpoint=$revocationEndpoint, responseTypesSupported=$responseTypesSupported, grantTypesSupported=$grantTypesSupported, codeChallengeMethodsSupported=$codeChallengeMethodsSupported, tokenEndpointAuthMethodsSupported=$tokenEndpointAuthMethodsSupported, revocationEndpointAuthMethodsSupported=$revocationEndpointAuthMethodsSupported, scopesSupported=$scopesSupported, additionalProperties=$additionalProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OauthError.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OauthError.kt new file mode 100644 index 0000000..0b46beb --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OauthError.kt @@ -0,0 +1,223 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.oAuth + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.checkRequired +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional + +class OauthError +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val error: JsonField, + private val errorDescription: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("error") @ExcludeMissing error: JsonField = JsonMissing.of(), + @JsonProperty("error_description") + @ExcludeMissing + errorDescription: JsonField = JsonMissing.of(), + ) : this(error, errorDescription, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun error(): String = error.getRequired("error") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun errorDescription(): Optional = errorDescription.getOptional("error_description") + + /** + * Returns the raw JSON value of [error]. + * + * Unlike [error], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("error") @ExcludeMissing fun _error(): JsonField = error + + /** + * Returns the raw JSON value of [errorDescription]. + * + * Unlike [errorDescription], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("error_description") + @ExcludeMissing + fun _errorDescription(): JsonField = errorDescription + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [OauthError]. + * + * The following fields are required: + * ```kotlin + * .error() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [OauthError]. */ + class Builder internal constructor() { + + private var error: JsonField? = null + private var errorDescription: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(oauthError: OauthError) = apply { + error = oauthError.error + errorDescription = oauthError.errorDescription + additionalProperties = oauthError.additionalProperties.toMutableMap() + } + + fun error(error: String) = error(JsonField.of(error)) + + /** + * Sets [Builder.error] to an arbitrary JSON value. + * + * You should usually call [Builder.error] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun error(error: JsonField) = apply { this.error = error } + + fun errorDescription(errorDescription: String) = + errorDescription(JsonField.of(errorDescription)) + + /** + * Sets [Builder.errorDescription] to an arbitrary JSON value. + * + * You should usually call [Builder.errorDescription] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun errorDescription(errorDescription: JsonField) = apply { + this.errorDescription = errorDescription + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [OauthError]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .error() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): OauthError = + OauthError( + checkRequired("error", error), + errorDescription, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): OauthError = apply { + if (validated) { + return@apply + } + + error() + errorDescription() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (error.asKnown().isPresent) 1 else 0) + + (if (errorDescription.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is OauthError && + error == other.error && + errorDescription == other.errorDescription && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(error, errorDescription, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "OauthError{error=$error, errorDescription=$errorDescription, additionalProperties=$additionalProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OauthScope.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OauthScope.kt new file mode 100644 index 0000000..77e83e7 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OauthScope.kt @@ -0,0 +1,144 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.oAuth + +import com.fasterxml.jackson.annotation.JsonCreator +import com.scalar.core.Enum +import com.scalar.core.JsonField +import com.scalar.errors.ScalarInvalidDataException + +class OauthScope @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't match + * any known member, and you want to know that value. For example, if the SDK is on an older + * version than the API, then the API may respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val READ = of("read") + + @JvmField val WRITE = of("write") + + @JvmField val ADMIN = of("admin") + + @JvmStatic fun of(value: String) = OauthScope(JsonField.of(value)) + } + + /** An enum containing [OauthScope]'s known values. */ + enum class Known { + READ, + WRITE, + ADMIN, + } + + /** + * An enum containing [OauthScope]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [OauthScope] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the SDK + * is on an older version than the API, then the API may respond with new members that the SDK + * is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + READ, + WRITE, + ADMIN, + /** An enum member indicating that [OauthScope] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] if + * the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want to + * throw for the unknown case. + */ + fun value(): Value = + when (this) { + READ -> Value.READ + WRITE -> Value.WRITE + ADMIN -> Value.ADMIN + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't want + * to throw for the unknown case. + * + * @throws ScalarInvalidDataException if this class instance's value is a not a known member. + */ + fun known(): Known = + when (this) { + READ -> Known.READ + WRITE -> Known.WRITE + ADMIN -> Known.ADMIN + else -> throw ScalarInvalidDataException("Unknown OauthScope: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging and + * generally doesn't throw. + * + * @throws ScalarInvalidDataException if this class instance's value does not have the expected + * primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { ScalarInvalidDataException("Value is not a String") } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): OauthScope = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is OauthScope && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OauthToken.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OauthToken.kt new file mode 100644 index 0000000..fd95450 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OauthToken.kt @@ -0,0 +1,339 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.oAuth + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.checkRequired +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import kotlin.jvm.optionals.getOrNull + +class OauthToken +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val accessToken: JsonField, + private val tokenType: JsonValue, + private val expiresIn: JsonField, + private val refreshToken: JsonField, + private val scope: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("access_token") + @ExcludeMissing + accessToken: JsonField = JsonMissing.of(), + @JsonProperty("token_type") @ExcludeMissing tokenType: JsonValue = JsonMissing.of(), + @JsonProperty("expires_in") @ExcludeMissing expiresIn: JsonField = JsonMissing.of(), + @JsonProperty("refresh_token") + @ExcludeMissing + refreshToken: JsonField = JsonMissing.of(), + @JsonProperty("scope") @ExcludeMissing scope: JsonField = JsonMissing.of(), + ) : this(accessToken, tokenType, expiresIn, refreshToken, scope, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun accessToken(): String = accessToken.getRequired("access_token") + + /** + * Expected to always return the following: + * ```kotlin + * JsonValue.from("Bearer") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server responded + * with an unexpected value). + */ + @JsonProperty("token_type") @ExcludeMissing fun _tokenType(): JsonValue = tokenType + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun expiresIn(): Long = expiresIn.getRequired("expires_in") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun refreshToken(): String = refreshToken.getRequired("refresh_token") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun scope(): OauthScope = scope.getRequired("scope") + + /** + * Returns the raw JSON value of [accessToken]. + * + * Unlike [accessToken], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("access_token") + @ExcludeMissing + fun _accessToken(): JsonField = accessToken + + /** + * Returns the raw JSON value of [expiresIn]. + * + * Unlike [expiresIn], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("expires_in") @ExcludeMissing fun _expiresIn(): JsonField = expiresIn + + /** + * Returns the raw JSON value of [refreshToken]. + * + * Unlike [refreshToken], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("refresh_token") + @ExcludeMissing + fun _refreshToken(): JsonField = refreshToken + + /** + * Returns the raw JSON value of [scope]. + * + * Unlike [scope], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("scope") @ExcludeMissing fun _scope(): JsonField = scope + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [OauthToken]. + * + * The following fields are required: + * ```kotlin + * .accessToken() + * .expiresIn() + * .refreshToken() + * .scope() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [OauthToken]. */ + class Builder internal constructor() { + + private var accessToken: JsonField? = null + private var tokenType: JsonValue = JsonValue.from("Bearer") + private var expiresIn: JsonField? = null + private var refreshToken: JsonField? = null + private var scope: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(oauthToken: OauthToken) = apply { + accessToken = oauthToken.accessToken + tokenType = oauthToken.tokenType + expiresIn = oauthToken.expiresIn + refreshToken = oauthToken.refreshToken + scope = oauthToken.scope + additionalProperties = oauthToken.additionalProperties.toMutableMap() + } + + fun accessToken(accessToken: String) = accessToken(JsonField.of(accessToken)) + + /** + * Sets [Builder.accessToken] to an arbitrary JSON value. + * + * You should usually call [Builder.accessToken] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun accessToken(accessToken: JsonField) = apply { this.accessToken = accessToken } + + /** + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```kotlin + * JsonValue.from("Bearer") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun tokenType(tokenType: JsonValue) = apply { this.tokenType = tokenType } + + fun expiresIn(expiresIn: Long) = expiresIn(JsonField.of(expiresIn)) + + /** + * Sets [Builder.expiresIn] to an arbitrary JSON value. + * + * You should usually call [Builder.expiresIn] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun expiresIn(expiresIn: JsonField) = apply { this.expiresIn = expiresIn } + + fun refreshToken(refreshToken: String) = refreshToken(JsonField.of(refreshToken)) + + /** + * Sets [Builder.refreshToken] to an arbitrary JSON value. + * + * You should usually call [Builder.refreshToken] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun refreshToken(refreshToken: JsonField) = apply { + this.refreshToken = refreshToken + } + + fun scope(scope: OauthScope) = scope(JsonField.of(scope)) + + /** + * Sets [Builder.scope] to an arbitrary JSON value. + * + * You should usually call [Builder.scope] with a well-typed [OauthScope] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun scope(scope: JsonField) = apply { this.scope = scope } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [OauthToken]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .accessToken() + * .expiresIn() + * .refreshToken() + * .scope() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): OauthToken = + OauthToken( + checkRequired("accessToken", accessToken), + tokenType, + checkRequired("expiresIn", expiresIn), + checkRequired("refreshToken", refreshToken), + checkRequired("scope", scope), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): OauthToken = apply { + if (validated) { + return@apply + } + + accessToken() + _tokenType().let { + if (it != JsonValue.from("Bearer")) { + throw ScalarInvalidDataException("'tokenType' is invalid, received $it") + } + } + expiresIn() + refreshToken() + scope().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (accessToken.asKnown().isPresent) 1 else 0) + + tokenType.let { if (it == JsonValue.from("Bearer")) 1 else 0 } + + (if (expiresIn.asKnown().isPresent) 1 else 0) + + (if (refreshToken.asKnown().isPresent) 1 else 0) + + (scope.asKnown().getOrNull()?.validity() ?: 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is OauthToken && + accessToken == other.accessToken && + tokenType == other.tokenType && + expiresIn == other.expiresIn && + refreshToken == other.refreshToken && + scope == other.scope && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + accessToken, + tokenType, + expiresIn, + refreshToken, + scope, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "OauthToken{accessToken=$accessToken, tokenType=$tokenType, expiresIn=$expiresIn, refreshToken=$refreshToken, scope=$scope, additionalProperties=$additionalProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/registry/RegistryListApiDocumentsResponse.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/registry/ApiDocument.kt similarity index 91% rename from scalar-java-core/src/main/kotlin/com/scalar/models/registry/RegistryListApiDocumentsResponse.kt rename to scalar-java-core/src/main/kotlin/com/scalar/models/registry/ApiDocument.kt index 1ba98b7..5c70063 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/models/registry/RegistryListApiDocumentsResponse.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/registry/ApiDocument.kt @@ -20,7 +20,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -class RegistryListApiDocumentsResponse +class ApiDocument @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val uid: JsonField, @@ -197,8 +197,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [RegistryListApiDocumentsResponse]. + * Returns a mutable builder for constructing an instance of [ApiDocument]. * * The following fields are required: * ```kotlin @@ -216,7 +215,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [RegistryListApiDocumentsResponse]. */ + /** A builder for [ApiDocument]. */ class Builder internal constructor() { private var uid: JsonField? = null @@ -231,20 +230,18 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(registryListApiDocumentsResponse: RegistryListApiDocumentsResponse) = - apply { - uid = registryListApiDocumentsResponse.uid - version = registryListApiDocumentsResponse.version - title = registryListApiDocumentsResponse.title - slug = registryListApiDocumentsResponse.slug - description = registryListApiDocumentsResponse.description - namespace = registryListApiDocumentsResponse.namespace - isPrivate = registryListApiDocumentsResponse.isPrivate - tags = registryListApiDocumentsResponse.tags - versions = registryListApiDocumentsResponse.versions.map { it.toMutableList() } - additionalProperties = - registryListApiDocumentsResponse.additionalProperties.toMutableMap() - } + internal fun from(apiDocument: ApiDocument) = apply { + uid = apiDocument.uid + version = apiDocument.version + title = apiDocument.title + slug = apiDocument.slug + description = apiDocument.description + namespace = apiDocument.namespace + isPrivate = apiDocument.isPrivate + tags = apiDocument.tags + versions = apiDocument.versions.map { it.toMutableList() } + additionalProperties = apiDocument.additionalProperties.toMutableMap() + } fun uid(uid: String) = uid(JsonField.of(uid)) @@ -377,7 +374,7 @@ private constructor( } /** - * Returns an immutable instance of [RegistryListApiDocumentsResponse]. + * Returns an immutable instance of [ApiDocument]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -396,8 +393,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): RegistryListApiDocumentsResponse = - RegistryListApiDocumentsResponse( + fun build(): ApiDocument = + ApiDocument( checkRequired("uid", uid), checkRequired("version", version), checkRequired("title", title), @@ -421,7 +418,7 @@ private constructor( * @throws ScalarInvalidDataException if any value type in this object doesn't match its * expected type. */ - fun validate(): RegistryListApiDocumentsResponse = apply { + fun validate(): ApiDocument = apply { if (validated) { return@apply } @@ -468,7 +465,7 @@ private constructor( return true } - return other is RegistryListApiDocumentsResponse && + return other is ApiDocument && uid == other.uid && version == other.version && title == other.title && @@ -499,5 +496,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "RegistryListApiDocumentsResponse{uid=$uid, version=$version, title=$title, slug=$slug, description=$description, namespace=$namespace, isPrivate=$isPrivate, tags=$tags, versions=$versions, additionalProperties=$additionalProperties}" + "ApiDocument{uid=$uid, version=$version, title=$title, slug=$slug, description=$description, namespace=$namespace, isPrivate=$isPrivate, tags=$tags, versions=$versions, additionalProperties=$additionalProperties}" } diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/registry/Method.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/registry/Method.kt new file mode 100644 index 0000000..7d4df91 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/registry/Method.kt @@ -0,0 +1,180 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.registry + +import com.fasterxml.jackson.annotation.JsonCreator +import com.scalar.core.Enum +import com.scalar.core.JsonField +import com.scalar.errors.ScalarInvalidDataException + +class Method @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't match + * any known member, and you want to know that value. For example, if the SDK is on an older + * version than the API, then the API may respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val DELETE = of("delete") + + @JvmField val GET = of("get") + + @JvmField val HEAD = of("head") + + @JvmField val OPTIONS = of("options") + + @JvmField val PATCH = of("patch") + + @JvmField val POST = of("post") + + @JvmField val PUT = of("put") + + @JvmField val QUERY = of("query") + + @JvmField val TRACE = of("trace") + + @JvmStatic fun of(value: String) = Method(JsonField.of(value)) + } + + /** An enum containing [Method]'s known values. */ + enum class Known { + DELETE, + GET, + HEAD, + OPTIONS, + PATCH, + POST, + PUT, + QUERY, + TRACE, + } + + /** + * An enum containing [Method]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Method] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the SDK + * is on an older version than the API, then the API may respond with new members that the SDK + * is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DELETE, + GET, + HEAD, + OPTIONS, + PATCH, + POST, + PUT, + QUERY, + TRACE, + /** An enum member indicating that [Method] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] if + * the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want to + * throw for the unknown case. + */ + fun value(): Value = + when (this) { + DELETE -> Value.DELETE + GET -> Value.GET + HEAD -> Value.HEAD + OPTIONS -> Value.OPTIONS + PATCH -> Value.PATCH + POST -> Value.POST + PUT -> Value.PUT + QUERY -> Value.QUERY + TRACE -> Value.TRACE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't want + * to throw for the unknown case. + * + * @throws ScalarInvalidDataException if this class instance's value is a not a known member. + */ + fun known(): Known = + when (this) { + DELETE -> Known.DELETE + GET -> Known.GET + HEAD -> Known.HEAD + OPTIONS -> Known.OPTIONS + PATCH -> Known.PATCH + POST -> Known.POST + PUT -> Known.PUT + QUERY -> Known.QUERY + TRACE -> Known.TRACE + else -> throw ScalarInvalidDataException("Unknown Method: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging and + * generally doesn't throw. + * + * @throws ScalarInvalidDataException if this class instance's value does not have the expected + * primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { ScalarInvalidDataException("Value is not a String") } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Method = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Method && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/rules/RuleListRulesetsResponse.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/rules/Rule.kt similarity index 91% rename from scalar-java-core/src/main/kotlin/com/scalar/models/rules/RuleListRulesetsResponse.kt rename to scalar-java-core/src/main/kotlin/com/scalar/models/rules/Rule.kt index 784e18a..e07d9f2 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/models/rules/RuleListRulesetsResponse.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/rules/Rule.kt @@ -15,7 +15,7 @@ import com.scalar.errors.ScalarInvalidDataException import java.util.Collections import java.util.Objects -class RuleListRulesetsResponse +class Rule @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val uid: JsonField, @@ -132,7 +132,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [RuleListRulesetsResponse]. + * Returns a mutable builder for constructing an instance of [Rule]. * * The following fields are required: * ```kotlin @@ -147,7 +147,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [RuleListRulesetsResponse]. */ + /** A builder for [Rule]. */ class Builder internal constructor() { private var uid: JsonField? = null @@ -159,14 +159,14 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(ruleListRulesetsResponse: RuleListRulesetsResponse) = apply { - uid = ruleListRulesetsResponse.uid - title = ruleListRulesetsResponse.title - description = ruleListRulesetsResponse.description - slug = ruleListRulesetsResponse.slug - namespace = ruleListRulesetsResponse.namespace - isPrivate = ruleListRulesetsResponse.isPrivate - additionalProperties = ruleListRulesetsResponse.additionalProperties.toMutableMap() + internal fun from(rule: Rule) = apply { + uid = rule.uid + title = rule.title + description = rule.description + slug = rule.slug + namespace = rule.namespace + isPrivate = rule.isPrivate + additionalProperties = rule.additionalProperties.toMutableMap() } fun uid(uid: String) = uid(JsonField.of(uid)) @@ -252,7 +252,7 @@ private constructor( } /** - * Returns an immutable instance of [RuleListRulesetsResponse]. + * Returns an immutable instance of [Rule]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -268,8 +268,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): RuleListRulesetsResponse = - RuleListRulesetsResponse( + fun build(): Rule = + Rule( checkRequired("uid", uid), checkRequired("title", title), checkRequired("description", description), @@ -290,7 +290,7 @@ private constructor( * @throws ScalarInvalidDataException if any value type in this object doesn't match its * expected type. */ - fun validate(): RuleListRulesetsResponse = apply { + fun validate(): Rule = apply { if (validated) { return@apply } @@ -331,7 +331,7 @@ private constructor( return true } - return other is RuleListRulesetsResponse && + return other is Rule && uid == other.uid && title == other.title && description == other.description && @@ -348,5 +348,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "RuleListRulesetsResponse{uid=$uid, title=$title, description=$description, slug=$slug, namespace=$namespace, isPrivate=$isPrivate, additionalProperties=$additionalProperties}" + "Rule{uid=$uid, title=$title, description=$description, slug=$slug, namespace=$namespace, isPrivate=$isPrivate, additionalProperties=$additionalProperties}" } diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ActiveDeployment.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ActiveDeployment.kt new file mode 100644 index 0000000..02c7170 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ActiveDeployment.kt @@ -0,0 +1,251 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.scalarDocs + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.checkRequired +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects + +class ActiveDeployment +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val uid: JsonField, + private val domain: JsonField, + private val publishedAt: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("uid") @ExcludeMissing uid: JsonField = JsonMissing.of(), + @JsonProperty("domain") @ExcludeMissing domain: JsonField = JsonMissing.of(), + @JsonProperty("publishedAt") + @ExcludeMissing + publishedAt: JsonField = JsonMissing.of(), + ) : this(uid, domain, publishedAt, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun uid(): String = uid.getRequired("uid") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun domain(): String = domain.getRequired("domain") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun publishedAt(): Long = publishedAt.getRequired("publishedAt") + + /** + * Returns the raw JSON value of [uid]. + * + * Unlike [uid], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("uid") @ExcludeMissing fun _uid(): JsonField = uid + + /** + * Returns the raw JSON value of [domain]. + * + * Unlike [domain], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("domain") @ExcludeMissing fun _domain(): JsonField = domain + + /** + * Returns the raw JSON value of [publishedAt]. + * + * Unlike [publishedAt], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("publishedAt") @ExcludeMissing fun _publishedAt(): JsonField = publishedAt + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [ActiveDeployment]. + * + * The following fields are required: + * ```kotlin + * .uid() + * .domain() + * .publishedAt() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ActiveDeployment]. */ + class Builder internal constructor() { + + private var uid: JsonField? = null + private var domain: JsonField? = null + private var publishedAt: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(activeDeployment: ActiveDeployment) = apply { + uid = activeDeployment.uid + domain = activeDeployment.domain + publishedAt = activeDeployment.publishedAt + additionalProperties = activeDeployment.additionalProperties.toMutableMap() + } + + fun uid(uid: String) = uid(JsonField.of(uid)) + + /** + * Sets [Builder.uid] to an arbitrary JSON value. + * + * You should usually call [Builder.uid] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun uid(uid: JsonField) = apply { this.uid = uid } + + fun domain(domain: String) = domain(JsonField.of(domain)) + + /** + * Sets [Builder.domain] to an arbitrary JSON value. + * + * You should usually call [Builder.domain] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun domain(domain: JsonField) = apply { this.domain = domain } + + fun publishedAt(publishedAt: Long) = publishedAt(JsonField.of(publishedAt)) + + /** + * Sets [Builder.publishedAt] to an arbitrary JSON value. + * + * You should usually call [Builder.publishedAt] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun publishedAt(publishedAt: JsonField) = apply { this.publishedAt = publishedAt } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ActiveDeployment]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .uid() + * .domain() + * .publishedAt() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ActiveDeployment = + ActiveDeployment( + checkRequired("uid", uid), + checkRequired("domain", domain), + checkRequired("publishedAt", publishedAt), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): ActiveDeployment = apply { + if (validated) { + return@apply + } + + uid() + domain() + publishedAt() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (uid.asKnown().isPresent) 1 else 0) + + (if (domain.asKnown().isPresent) 1 else 0) + + (if (publishedAt.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ActiveDeployment && + uid == other.uid && + domain == other.domain && + publishedAt == other.publishedAt && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(uid, domain, publishedAt, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ActiveDeployment{uid=$uid, domain=$domain, publishedAt=$publishedAt, additionalProperties=$additionalProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/DocsProject.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/DocsProject.kt new file mode 100644 index 0000000..de6efcc --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/DocsProject.kt @@ -0,0 +1,601 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.scalarDocs + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.checkRequired +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class DocsProject +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val uid: JsonField, + private val name: JsonField, + private val slug: JsonField, + private val isPrivate: JsonField, + private val accessGroups: JsonField, + private val loginPortalUid: JsonField, + private val activeThemeId: JsonField, + private val agentEnabled: JsonField, + private val analyticsEnabled: JsonField, + private val lastPublished: JsonField, + private val publishStatus: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("uid") @ExcludeMissing uid: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), + @JsonProperty("isPrivate") @ExcludeMissing isPrivate: JsonField = JsonMissing.of(), + @JsonProperty("accessGroups") + @ExcludeMissing + accessGroups: JsonField = JsonMissing.of(), + @JsonProperty("loginPortalUid") + @ExcludeMissing + loginPortalUid: JsonField = JsonMissing.of(), + @JsonProperty("activeThemeId") + @ExcludeMissing + activeThemeId: JsonField = JsonMissing.of(), + @JsonProperty("agentEnabled") + @ExcludeMissing + agentEnabled: JsonField = JsonMissing.of(), + @JsonProperty("analyticsEnabled") + @ExcludeMissing + analyticsEnabled: JsonField = JsonMissing.of(), + @JsonProperty("lastPublished") + @ExcludeMissing + lastPublished: JsonField = JsonMissing.of(), + @JsonProperty("publishStatus") + @ExcludeMissing + publishStatus: JsonField = JsonMissing.of(), + ) : this( + uid, + name, + slug, + isPrivate, + accessGroups, + loginPortalUid, + activeThemeId, + agentEnabled, + analyticsEnabled, + lastPublished, + publishStatus, + mutableMapOf(), + ) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun uid(): String = uid.getRequired("uid") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun slug(): String = slug.getRequired("slug") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun isPrivate(): Boolean = isPrivate.getRequired("isPrivate") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun accessGroups(): Optional = accessGroups.getOptional("accessGroups") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun loginPortalUid(): String = loginPortalUid.getRequired("loginPortalUid") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun activeThemeId(): String = activeThemeId.getRequired("activeThemeId") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun agentEnabled(): Boolean = agentEnabled.getRequired("agentEnabled") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun analyticsEnabled(): Boolean = analyticsEnabled.getRequired("analyticsEnabled") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun lastPublished(): Optional = lastPublished.getOptional("lastPublished") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun publishStatus(): String = publishStatus.getRequired("publishStatus") + + /** + * Returns the raw JSON value of [uid]. + * + * Unlike [uid], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("uid") @ExcludeMissing fun _uid(): JsonField = uid + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug + + /** + * Returns the raw JSON value of [isPrivate]. + * + * Unlike [isPrivate], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("isPrivate") @ExcludeMissing fun _isPrivate(): JsonField = isPrivate + + /** + * Returns the raw JSON value of [accessGroups]. + * + * Unlike [accessGroups], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("accessGroups") @ExcludeMissing fun _accessGroups(): JsonField = accessGroups + + /** + * Returns the raw JSON value of [loginPortalUid]. + * + * Unlike [loginPortalUid], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("loginPortalUid") + @ExcludeMissing + fun _loginPortalUid(): JsonField = loginPortalUid + + /** + * Returns the raw JSON value of [activeThemeId]. + * + * Unlike [activeThemeId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("activeThemeId") + @ExcludeMissing + fun _activeThemeId(): JsonField = activeThemeId + + /** + * Returns the raw JSON value of [agentEnabled]. + * + * Unlike [agentEnabled], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("agentEnabled") + @ExcludeMissing + fun _agentEnabled(): JsonField = agentEnabled + + /** + * Returns the raw JSON value of [analyticsEnabled]. + * + * Unlike [analyticsEnabled], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("analyticsEnabled") + @ExcludeMissing + fun _analyticsEnabled(): JsonField = analyticsEnabled + + /** + * Returns the raw JSON value of [lastPublished]. + * + * Unlike [lastPublished], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("lastPublished") + @ExcludeMissing + fun _lastPublished(): JsonField = lastPublished + + /** + * Returns the raw JSON value of [publishStatus]. + * + * Unlike [publishStatus], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("publishStatus") + @ExcludeMissing + fun _publishStatus(): JsonField = publishStatus + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [DocsProject]. + * + * The following fields are required: + * ```kotlin + * .uid() + * .name() + * .slug() + * .isPrivate() + * .accessGroups() + * .loginPortalUid() + * .activeThemeId() + * .agentEnabled() + * .analyticsEnabled() + * .lastPublished() + * .publishStatus() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [DocsProject]. */ + class Builder internal constructor() { + + private var uid: JsonField? = null + private var name: JsonField? = null + private var slug: JsonField? = null + private var isPrivate: JsonField? = null + private var accessGroups: JsonField? = null + private var loginPortalUid: JsonField? = null + private var activeThemeId: JsonField? = null + private var agentEnabled: JsonField? = null + private var analyticsEnabled: JsonField? = null + private var lastPublished: JsonField? = null + private var publishStatus: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(docsProject: DocsProject) = apply { + uid = docsProject.uid + name = docsProject.name + slug = docsProject.slug + isPrivate = docsProject.isPrivate + accessGroups = docsProject.accessGroups + loginPortalUid = docsProject.loginPortalUid + activeThemeId = docsProject.activeThemeId + agentEnabled = docsProject.agentEnabled + analyticsEnabled = docsProject.analyticsEnabled + lastPublished = docsProject.lastPublished + publishStatus = docsProject.publishStatus + additionalProperties = docsProject.additionalProperties.toMutableMap() + } + + fun uid(uid: String) = uid(JsonField.of(uid)) + + /** + * Sets [Builder.uid] to an arbitrary JSON value. + * + * You should usually call [Builder.uid] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun uid(uid: JsonField) = apply { this.uid = uid } + + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + fun slug(slug: String) = slug(JsonField.of(slug)) + + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun slug(slug: JsonField) = apply { this.slug = slug } + + fun isPrivate(isPrivate: Boolean) = isPrivate(JsonField.of(isPrivate)) + + /** + * Sets [Builder.isPrivate] to an arbitrary JSON value. + * + * You should usually call [Builder.isPrivate] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun isPrivate(isPrivate: JsonField) = apply { this.isPrivate = isPrivate } + + fun accessGroups(accessGroups: Any?) = accessGroups(JsonField.ofNullable(accessGroups)) + + /** Alias for calling [Builder.accessGroups] with `accessGroups.orElse(null)`. */ + fun accessGroups(accessGroups: Optional) = accessGroups(accessGroups.getOrNull()) + + /** + * Sets [Builder.accessGroups] to an arbitrary JSON value. + * + * You should usually call [Builder.accessGroups] with a well-typed [Any] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun accessGroups(accessGroups: JsonField) = apply { this.accessGroups = accessGroups } + + fun loginPortalUid(loginPortalUid: String) = loginPortalUid(JsonField.of(loginPortalUid)) + + /** + * Sets [Builder.loginPortalUid] to an arbitrary JSON value. + * + * You should usually call [Builder.loginPortalUid] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun loginPortalUid(loginPortalUid: JsonField) = apply { + this.loginPortalUid = loginPortalUid + } + + fun activeThemeId(activeThemeId: String) = activeThemeId(JsonField.of(activeThemeId)) + + /** + * Sets [Builder.activeThemeId] to an arbitrary JSON value. + * + * You should usually call [Builder.activeThemeId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun activeThemeId(activeThemeId: JsonField) = apply { + this.activeThemeId = activeThemeId + } + + fun agentEnabled(agentEnabled: Boolean) = agentEnabled(JsonField.of(agentEnabled)) + + /** + * Sets [Builder.agentEnabled] to an arbitrary JSON value. + * + * You should usually call [Builder.agentEnabled] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun agentEnabled(agentEnabled: JsonField) = apply { + this.agentEnabled = agentEnabled + } + + fun analyticsEnabled(analyticsEnabled: Boolean) = + analyticsEnabled(JsonField.of(analyticsEnabled)) + + /** + * Sets [Builder.analyticsEnabled] to an arbitrary JSON value. + * + * You should usually call [Builder.analyticsEnabled] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun analyticsEnabled(analyticsEnabled: JsonField) = apply { + this.analyticsEnabled = analyticsEnabled + } + + fun lastPublished(lastPublished: Long?) = lastPublished(JsonField.ofNullable(lastPublished)) + + /** + * Alias for [Builder.lastPublished]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun lastPublished(lastPublished: Long) = lastPublished(lastPublished as Long?) + + /** Alias for calling [Builder.lastPublished] with `lastPublished.orElse(null)`. */ + fun lastPublished(lastPublished: Optional) = lastPublished(lastPublished.getOrNull()) + + /** + * Sets [Builder.lastPublished] to an arbitrary JSON value. + * + * You should usually call [Builder.lastPublished] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun lastPublished(lastPublished: JsonField) = apply { + this.lastPublished = lastPublished + } + + fun publishStatus(publishStatus: String) = publishStatus(JsonField.of(publishStatus)) + + /** + * Sets [Builder.publishStatus] to an arbitrary JSON value. + * + * You should usually call [Builder.publishStatus] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun publishStatus(publishStatus: JsonField) = apply { + this.publishStatus = publishStatus + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [DocsProject]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .uid() + * .name() + * .slug() + * .isPrivate() + * .accessGroups() + * .loginPortalUid() + * .activeThemeId() + * .agentEnabled() + * .analyticsEnabled() + * .lastPublished() + * .publishStatus() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): DocsProject = + DocsProject( + checkRequired("uid", uid), + checkRequired("name", name), + checkRequired("slug", slug), + checkRequired("isPrivate", isPrivate), + checkRequired("accessGroups", accessGroups), + checkRequired("loginPortalUid", loginPortalUid), + checkRequired("activeThemeId", activeThemeId), + checkRequired("agentEnabled", agentEnabled), + checkRequired("analyticsEnabled", analyticsEnabled), + checkRequired("lastPublished", lastPublished), + checkRequired("publishStatus", publishStatus), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): DocsProject = apply { + if (validated) { + return@apply + } + + uid() + name() + slug() + isPrivate() + accessGroups() + loginPortalUid() + activeThemeId() + agentEnabled() + analyticsEnabled() + lastPublished() + publishStatus() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (uid.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (slug.asKnown().isPresent) 1 else 0) + + (if (isPrivate.asKnown().isPresent) 1 else 0) + + (if (accessGroups.asKnown().isPresent) 1 else 0) + + (if (loginPortalUid.asKnown().isPresent) 1 else 0) + + (if (activeThemeId.asKnown().isPresent) 1 else 0) + + (if (agentEnabled.asKnown().isPresent) 1 else 0) + + (if (analyticsEnabled.asKnown().isPresent) 1 else 0) + + (if (lastPublished.asKnown().isPresent) 1 else 0) + + (if (publishStatus.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is DocsProject && + uid == other.uid && + name == other.name && + slug == other.slug && + isPrivate == other.isPrivate && + accessGroups == other.accessGroups && + loginPortalUid == other.loginPortalUid && + activeThemeId == other.activeThemeId && + agentEnabled == other.agentEnabled && + analyticsEnabled == other.analyticsEnabled && + lastPublished == other.lastPublished && + publishStatus == other.publishStatus && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + uid, + name, + slug, + isPrivate, + accessGroups, + loginPortalUid, + activeThemeId, + agentEnabled, + analyticsEnabled, + lastPublished, + publishStatus, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "DocsProject{uid=$uid, name=$name, slug=$slug, isPrivate=$isPrivate, accessGroups=$accessGroups, loginPortalUid=$loginPortalUid, activeThemeId=$activeThemeId, agentEnabled=$agentEnabled, analyticsEnabled=$analyticsEnabled, lastPublished=$lastPublished, publishStatus=$publishStatus, additionalProperties=$additionalProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListGuidesResponse.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/GithubProject.kt similarity index 52% rename from scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListGuidesResponse.kt rename to scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/GithubProject.kt index 45ec53d..63bf32b 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListGuidesResponse.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/GithubProject.kt @@ -17,7 +17,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -class ScalarDocListGuidesResponse +class GithubProject @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val uid: JsonField, @@ -38,7 +38,7 @@ private constructor( private val slug: JsonField, private val publishStatus: JsonField, private val publishMessage: JsonField, - private val repository: JsonField, + private val repository: JsonField, private val additionalProperties: MutableMap, ) { @@ -88,7 +88,7 @@ private constructor( publishMessage: JsonField = JsonMissing.of(), @JsonProperty("repository") @ExcludeMissing - repository: JsonField = JsonMissing.of(), + repository: JsonField = JsonMissing.of(), ) : this( uid, createdAt, @@ -225,7 +225,7 @@ private constructor( * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun repository(): Optional = repository.getOptional("repository") + fun repository(): Optional = repository.getOptional("repository") /** * Returns the raw JSON value of [uid]. @@ -383,7 +383,7 @@ private constructor( */ @JsonProperty("repository") @ExcludeMissing - fun _repository(): JsonField = repository + fun _repository(): JsonField = repository @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -400,7 +400,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [ScalarDocListGuidesResponse]. + * Returns a mutable builder for constructing an instance of [GithubProject]. * * The following fields are required: * ```kotlin @@ -426,7 +426,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [ScalarDocListGuidesResponse]. */ + /** A builder for [GithubProject]. */ class Builder internal constructor() { private var uid: JsonField? = null @@ -447,31 +447,31 @@ private constructor( private var slug: JsonField? = null private var publishStatus: JsonField? = null private var publishMessage: JsonField? = null - private var repository: JsonField = JsonMissing.of() + private var repository: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(scalarDocListGuidesResponse: ScalarDocListGuidesResponse) = apply { - uid = scalarDocListGuidesResponse.uid - createdAt = scalarDocListGuidesResponse.createdAt - updatedAt = scalarDocListGuidesResponse.updatedAt - name = scalarDocListGuidesResponse.name - activeDeployment = scalarDocListGuidesResponse.activeDeployment - lastPublished = scalarDocListGuidesResponse.lastPublished - lastPublishedUid = scalarDocListGuidesResponse.lastPublishedUid - loginPortalUid = scalarDocListGuidesResponse.loginPortalUid - userInfoHookUrl = scalarDocListGuidesResponse.userInfoHookUrl - activeThemeId = scalarDocListGuidesResponse.activeThemeId - typesenseId = scalarDocListGuidesResponse.typesenseId - isPrivate = scalarDocListGuidesResponse.isPrivate - agentEnabled = scalarDocListGuidesResponse.agentEnabled - analyticsEnabled = scalarDocListGuidesResponse.analyticsEnabled - accessGroups = scalarDocListGuidesResponse.accessGroups - slug = scalarDocListGuidesResponse.slug - publishStatus = scalarDocListGuidesResponse.publishStatus - publishMessage = scalarDocListGuidesResponse.publishMessage - repository = scalarDocListGuidesResponse.repository - additionalProperties = scalarDocListGuidesResponse.additionalProperties.toMutableMap() + internal fun from(githubProject: GithubProject) = apply { + uid = githubProject.uid + createdAt = githubProject.createdAt + updatedAt = githubProject.updatedAt + name = githubProject.name + activeDeployment = githubProject.activeDeployment + lastPublished = githubProject.lastPublished + lastPublishedUid = githubProject.lastPublishedUid + loginPortalUid = githubProject.loginPortalUid + userInfoHookUrl = githubProject.userInfoHookUrl + activeThemeId = githubProject.activeThemeId + typesenseId = githubProject.typesenseId + isPrivate = githubProject.isPrivate + agentEnabled = githubProject.agentEnabled + analyticsEnabled = githubProject.analyticsEnabled + accessGroups = githubProject.accessGroups + slug = githubProject.slug + publishStatus = githubProject.publishStatus + publishMessage = githubProject.publishMessage + repository = githubProject.repository + additionalProperties = githubProject.additionalProperties.toMutableMap() } fun uid(uid: String) = uid(JsonField.of(uid)) @@ -712,19 +712,23 @@ private constructor( this.publishMessage = publishMessage } - fun repository(repository: Repository?) = repository(JsonField.ofNullable(repository)) + fun repository(repository: GithubProjectRepository?) = + repository(JsonField.ofNullable(repository)) /** Alias for calling [Builder.repository] with `repository.orElse(null)`. */ - fun repository(repository: Optional) = repository(repository.getOrNull()) + fun repository(repository: Optional) = + repository(repository.getOrNull()) /** * Sets [Builder.repository] to an arbitrary JSON value. * - * You should usually call [Builder.repository] with a well-typed [Repository] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * You should usually call [Builder.repository] with a well-typed [GithubProjectRepository] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - fun repository(repository: JsonField) = apply { this.repository = repository } + fun repository(repository: JsonField) = apply { + this.repository = repository + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -746,7 +750,7 @@ private constructor( } /** - * Returns an immutable instance of [ScalarDocListGuidesResponse]. + * Returns an immutable instance of [GithubProject]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -773,8 +777,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): ScalarDocListGuidesResponse = - ScalarDocListGuidesResponse( + fun build(): GithubProject = + GithubProject( checkRequired("uid", uid), checkRequired("createdAt", createdAt), checkRequired("updatedAt", updatedAt), @@ -808,7 +812,7 @@ private constructor( * @throws ScalarInvalidDataException if any value type in this object doesn't match its * expected type. */ - fun validate(): ScalarDocListGuidesResponse = apply { + fun validate(): GithubProject = apply { if (validated) { return@apply } @@ -870,742 +874,12 @@ private constructor( (if (publishMessage.asKnown().isPresent) 1 else 0) + (repository.asKnown().getOrNull()?.validity() ?: 0) - class ActiveDeployment - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val uid: JsonField, - private val domain: JsonField, - private val publishedAt: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("uid") @ExcludeMissing uid: JsonField = JsonMissing.of(), - @JsonProperty("domain") @ExcludeMissing domain: JsonField = JsonMissing.of(), - @JsonProperty("publishedAt") - @ExcludeMissing - publishedAt: JsonField = JsonMissing.of(), - ) : this(uid, domain, publishedAt, mutableMapOf()) - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun uid(): String = uid.getRequired("uid") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun domain(): String = domain.getRequired("domain") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun publishedAt(): Long = publishedAt.getRequired("publishedAt") - - /** - * Returns the raw JSON value of [uid]. - * - * Unlike [uid], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("uid") @ExcludeMissing fun _uid(): JsonField = uid - - /** - * Returns the raw JSON value of [domain]. - * - * Unlike [domain], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("domain") @ExcludeMissing fun _domain(): JsonField = domain - - /** - * Returns the raw JSON value of [publishedAt]. - * - * Unlike [publishedAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("publishedAt") - @ExcludeMissing - fun _publishedAt(): JsonField = publishedAt - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [ActiveDeployment]. - * - * The following fields are required: - * ```kotlin - * .uid() - * .domain() - * .publishedAt() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [ActiveDeployment]. */ - class Builder internal constructor() { - - private var uid: JsonField? = null - private var domain: JsonField? = null - private var publishedAt: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(activeDeployment: ActiveDeployment) = apply { - uid = activeDeployment.uid - domain = activeDeployment.domain - publishedAt = activeDeployment.publishedAt - additionalProperties = activeDeployment.additionalProperties.toMutableMap() - } - - fun uid(uid: String) = uid(JsonField.of(uid)) - - /** - * Sets [Builder.uid] to an arbitrary JSON value. - * - * You should usually call [Builder.uid] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun uid(uid: JsonField) = apply { this.uid = uid } - - fun domain(domain: String) = domain(JsonField.of(domain)) - - /** - * Sets [Builder.domain] to an arbitrary JSON value. - * - * You should usually call [Builder.domain] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun domain(domain: JsonField) = apply { this.domain = domain } - - fun publishedAt(publishedAt: Long) = publishedAt(JsonField.of(publishedAt)) - - /** - * Sets [Builder.publishedAt] to an arbitrary JSON value. - * - * You should usually call [Builder.publishedAt] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun publishedAt(publishedAt: JsonField) = apply { this.publishedAt = publishedAt } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [ActiveDeployment]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```kotlin - * .uid() - * .domain() - * .publishedAt() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): ActiveDeployment = - ActiveDeployment( - checkRequired("uid", uid), - checkRequired("domain", domain), - checkRequired("publishedAt", publishedAt), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws ScalarInvalidDataException if any value type in this object doesn't match its - * expected type. - */ - fun validate(): ActiveDeployment = apply { - if (validated) { - return@apply - } - - uid() - domain() - publishedAt() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ScalarInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (uid.asKnown().isPresent) 1 else 0) + - (if (domain.asKnown().isPresent) 1 else 0) + - (if (publishedAt.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ActiveDeployment && - uid == other.uid && - domain == other.domain && - publishedAt == other.publishedAt && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(uid, domain, publishedAt, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "ActiveDeployment{uid=$uid, domain=$domain, publishedAt=$publishedAt, additionalProperties=$additionalProperties}" - } - - class Repository - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val linkedBy: JsonField, - private val id: JsonField, - private val name: JsonField, - private val configPath: JsonField, - private val branch: JsonField, - private val publishOnMerge: JsonField, - private val publishPreviews: JsonField, - private val prComments: JsonField, - private val expired: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("linkedBy") - @ExcludeMissing - linkedBy: JsonField = JsonMissing.of(), - @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), - @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), - @JsonProperty("configPath") - @ExcludeMissing - configPath: JsonField = JsonMissing.of(), - @JsonProperty("branch") @ExcludeMissing branch: JsonField = JsonMissing.of(), - @JsonProperty("publishOnMerge") - @ExcludeMissing - publishOnMerge: JsonField = JsonMissing.of(), - @JsonProperty("publishPreviews") - @ExcludeMissing - publishPreviews: JsonField = JsonMissing.of(), - @JsonProperty("prComments") - @ExcludeMissing - prComments: JsonField = JsonMissing.of(), - @JsonProperty("expired") @ExcludeMissing expired: JsonField = JsonMissing.of(), - ) : this( - linkedBy, - id, - name, - configPath, - branch, - publishOnMerge, - publishPreviews, - prComments, - expired, - mutableMapOf(), - ) - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun linkedBy(): String = linkedBy.getRequired("linkedBy") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun id(): Double = id.getRequired("id") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun name(): String = name.getRequired("name") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun configPath(): String = configPath.getRequired("configPath") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun branch(): String = branch.getRequired("branch") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun publishOnMerge(): Boolean = publishOnMerge.getRequired("publishOnMerge") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun publishPreviews(): Boolean = publishPreviews.getRequired("publishPreviews") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun prComments(): Boolean = prComments.getRequired("prComments") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun expired(): Boolean = expired.getRequired("expired") - - /** - * Returns the raw JSON value of [linkedBy]. - * - * Unlike [linkedBy], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("linkedBy") @ExcludeMissing fun _linkedBy(): JsonField = linkedBy - - /** - * Returns the raw JSON value of [id]. - * - * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - - /** - * Returns the raw JSON value of [name]. - * - * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - /** - * Returns the raw JSON value of [configPath]. - * - * Unlike [configPath], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("configPath") - @ExcludeMissing - fun _configPath(): JsonField = configPath - - /** - * Returns the raw JSON value of [branch]. - * - * Unlike [branch], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("branch") @ExcludeMissing fun _branch(): JsonField = branch - - /** - * Returns the raw JSON value of [publishOnMerge]. - * - * Unlike [publishOnMerge], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("publishOnMerge") - @ExcludeMissing - fun _publishOnMerge(): JsonField = publishOnMerge - - /** - * Returns the raw JSON value of [publishPreviews]. - * - * Unlike [publishPreviews], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("publishPreviews") - @ExcludeMissing - fun _publishPreviews(): JsonField = publishPreviews - - /** - * Returns the raw JSON value of [prComments]. - * - * Unlike [prComments], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("prComments") - @ExcludeMissing - fun _prComments(): JsonField = prComments - - /** - * Returns the raw JSON value of [expired]. - * - * Unlike [expired], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("expired") @ExcludeMissing fun _expired(): JsonField = expired - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [Repository]. - * - * The following fields are required: - * ```kotlin - * .linkedBy() - * .id() - * .name() - * .configPath() - * .branch() - * .publishOnMerge() - * .publishPreviews() - * .prComments() - * .expired() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Repository]. */ - class Builder internal constructor() { - - private var linkedBy: JsonField? = null - private var id: JsonField? = null - private var name: JsonField? = null - private var configPath: JsonField? = null - private var branch: JsonField? = null - private var publishOnMerge: JsonField? = null - private var publishPreviews: JsonField? = null - private var prComments: JsonField? = null - private var expired: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(repository: Repository) = apply { - linkedBy = repository.linkedBy - id = repository.id - name = repository.name - configPath = repository.configPath - branch = repository.branch - publishOnMerge = repository.publishOnMerge - publishPreviews = repository.publishPreviews - prComments = repository.prComments - expired = repository.expired - additionalProperties = repository.additionalProperties.toMutableMap() - } - - fun linkedBy(linkedBy: String) = linkedBy(JsonField.of(linkedBy)) - - /** - * Sets [Builder.linkedBy] to an arbitrary JSON value. - * - * You should usually call [Builder.linkedBy] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun linkedBy(linkedBy: JsonField) = apply { this.linkedBy = linkedBy } - - fun id(id: Double) = id(JsonField.of(id)) - - /** - * Sets [Builder.id] to an arbitrary JSON value. - * - * You should usually call [Builder.id] with a well-typed [Double] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun id(id: JsonField) = apply { this.id = id } - - fun name(name: String) = name(JsonField.of(name)) - - /** - * Sets [Builder.name] to an arbitrary JSON value. - * - * You should usually call [Builder.name] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun name(name: JsonField) = apply { this.name = name } - - fun configPath(configPath: String) = configPath(JsonField.of(configPath)) - - /** - * Sets [Builder.configPath] to an arbitrary JSON value. - * - * You should usually call [Builder.configPath] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun configPath(configPath: JsonField) = apply { this.configPath = configPath } - - fun branch(branch: String) = branch(JsonField.of(branch)) - - /** - * Sets [Builder.branch] to an arbitrary JSON value. - * - * You should usually call [Builder.branch] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun branch(branch: JsonField) = apply { this.branch = branch } - - fun publishOnMerge(publishOnMerge: Boolean) = - publishOnMerge(JsonField.of(publishOnMerge)) - - /** - * Sets [Builder.publishOnMerge] to an arbitrary JSON value. - * - * You should usually call [Builder.publishOnMerge] with a well-typed [Boolean] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun publishOnMerge(publishOnMerge: JsonField) = apply { - this.publishOnMerge = publishOnMerge - } - - fun publishPreviews(publishPreviews: Boolean) = - publishPreviews(JsonField.of(publishPreviews)) - - /** - * Sets [Builder.publishPreviews] to an arbitrary JSON value. - * - * You should usually call [Builder.publishPreviews] with a well-typed [Boolean] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun publishPreviews(publishPreviews: JsonField) = apply { - this.publishPreviews = publishPreviews - } - - fun prComments(prComments: Boolean) = prComments(JsonField.of(prComments)) - - /** - * Sets [Builder.prComments] to an arbitrary JSON value. - * - * You should usually call [Builder.prComments] with a well-typed [Boolean] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun prComments(prComments: JsonField) = apply { this.prComments = prComments } - - fun expired(expired: Boolean) = expired(JsonField.of(expired)) - - /** - * Sets [Builder.expired] to an arbitrary JSON value. - * - * You should usually call [Builder.expired] with a well-typed [Boolean] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun expired(expired: JsonField) = apply { this.expired = expired } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Repository]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```kotlin - * .linkedBy() - * .id() - * .name() - * .configPath() - * .branch() - * .publishOnMerge() - * .publishPreviews() - * .prComments() - * .expired() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Repository = - Repository( - checkRequired("linkedBy", linkedBy), - checkRequired("id", id), - checkRequired("name", name), - checkRequired("configPath", configPath), - checkRequired("branch", branch), - checkRequired("publishOnMerge", publishOnMerge), - checkRequired("publishPreviews", publishPreviews), - checkRequired("prComments", prComments), - checkRequired("expired", expired), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws ScalarInvalidDataException if any value type in this object doesn't match its - * expected type. - */ - fun validate(): Repository = apply { - if (validated) { - return@apply - } - - linkedBy() - id() - name() - configPath() - branch() - publishOnMerge() - publishPreviews() - prComments() - expired() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ScalarInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (linkedBy.asKnown().isPresent) 1 else 0) + - (if (id.asKnown().isPresent) 1 else 0) + - (if (name.asKnown().isPresent) 1 else 0) + - (if (configPath.asKnown().isPresent) 1 else 0) + - (if (branch.asKnown().isPresent) 1 else 0) + - (if (publishOnMerge.asKnown().isPresent) 1 else 0) + - (if (publishPreviews.asKnown().isPresent) 1 else 0) + - (if (prComments.asKnown().isPresent) 1 else 0) + - (if (expired.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Repository && - linkedBy == other.linkedBy && - id == other.id && - name == other.name && - configPath == other.configPath && - branch == other.branch && - publishOnMerge == other.publishOnMerge && - publishPreviews == other.publishPreviews && - prComments == other.prComments && - expired == other.expired && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - linkedBy, - id, - name, - configPath, - branch, - publishOnMerge, - publishPreviews, - prComments, - expired, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Repository{linkedBy=$linkedBy, id=$id, name=$name, configPath=$configPath, branch=$branch, publishOnMerge=$publishOnMerge, publishPreviews=$publishPreviews, prComments=$prComments, expired=$expired, additionalProperties=$additionalProperties}" - } - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is ScalarDocListGuidesResponse && + return other is GithubProject && uid == other.uid && createdAt == other.createdAt && updatedAt == other.updatedAt && @@ -1656,5 +930,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "ScalarDocListGuidesResponse{uid=$uid, createdAt=$createdAt, updatedAt=$updatedAt, name=$name, activeDeployment=$activeDeployment, lastPublished=$lastPublished, lastPublishedUid=$lastPublishedUid, loginPortalUid=$loginPortalUid, userInfoHookUrl=$userInfoHookUrl, activeThemeId=$activeThemeId, typesenseId=$typesenseId, isPrivate=$isPrivate, agentEnabled=$agentEnabled, analyticsEnabled=$analyticsEnabled, accessGroups=$accessGroups, slug=$slug, publishStatus=$publishStatus, publishMessage=$publishMessage, repository=$repository, additionalProperties=$additionalProperties}" + "GithubProject{uid=$uid, createdAt=$createdAt, updatedAt=$updatedAt, name=$name, activeDeployment=$activeDeployment, lastPublished=$lastPublished, lastPublishedUid=$lastPublishedUid, loginPortalUid=$loginPortalUid, userInfoHookUrl=$userInfoHookUrl, activeThemeId=$activeThemeId, typesenseId=$typesenseId, isPrivate=$isPrivate, agentEnabled=$agentEnabled, analyticsEnabled=$analyticsEnabled, accessGroups=$accessGroups, slug=$slug, publishStatus=$publishStatus, publishMessage=$publishMessage, repository=$repository, additionalProperties=$additionalProperties}" } diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/GithubProjectRepository.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/GithubProjectRepository.kt new file mode 100644 index 0000000..ac19519 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/GithubProjectRepository.kt @@ -0,0 +1,489 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.scalarDocs + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.checkRequired +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects + +class GithubProjectRepository +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val linkedBy: JsonField, + private val id: JsonField, + private val name: JsonField, + private val configPath: JsonField, + private val branch: JsonField, + private val publishOnMerge: JsonField, + private val publishPreviews: JsonField, + private val prComments: JsonField, + private val expired: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("linkedBy") @ExcludeMissing linkedBy: JsonField = JsonMissing.of(), + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("configPath") + @ExcludeMissing + configPath: JsonField = JsonMissing.of(), + @JsonProperty("branch") @ExcludeMissing branch: JsonField = JsonMissing.of(), + @JsonProperty("publishOnMerge") + @ExcludeMissing + publishOnMerge: JsonField = JsonMissing.of(), + @JsonProperty("publishPreviews") + @ExcludeMissing + publishPreviews: JsonField = JsonMissing.of(), + @JsonProperty("prComments") + @ExcludeMissing + prComments: JsonField = JsonMissing.of(), + @JsonProperty("expired") @ExcludeMissing expired: JsonField = JsonMissing.of(), + ) : this( + linkedBy, + id, + name, + configPath, + branch, + publishOnMerge, + publishPreviews, + prComments, + expired, + mutableMapOf(), + ) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun linkedBy(): String = linkedBy.getRequired("linkedBy") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): Double = id.getRequired("id") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun configPath(): String = configPath.getRequired("configPath") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun branch(): String = branch.getRequired("branch") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun publishOnMerge(): Boolean = publishOnMerge.getRequired("publishOnMerge") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun publishPreviews(): Boolean = publishPreviews.getRequired("publishPreviews") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun prComments(): Boolean = prComments.getRequired("prComments") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun expired(): Boolean = expired.getRequired("expired") + + /** + * Returns the raw JSON value of [linkedBy]. + * + * Unlike [linkedBy], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("linkedBy") @ExcludeMissing fun _linkedBy(): JsonField = linkedBy + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [configPath]. + * + * Unlike [configPath], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("configPath") @ExcludeMissing fun _configPath(): JsonField = configPath + + /** + * Returns the raw JSON value of [branch]. + * + * Unlike [branch], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("branch") @ExcludeMissing fun _branch(): JsonField = branch + + /** + * Returns the raw JSON value of [publishOnMerge]. + * + * Unlike [publishOnMerge], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("publishOnMerge") + @ExcludeMissing + fun _publishOnMerge(): JsonField = publishOnMerge + + /** + * Returns the raw JSON value of [publishPreviews]. + * + * Unlike [publishPreviews], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("publishPreviews") + @ExcludeMissing + fun _publishPreviews(): JsonField = publishPreviews + + /** + * Returns the raw JSON value of [prComments]. + * + * Unlike [prComments], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("prComments") @ExcludeMissing fun _prComments(): JsonField = prComments + + /** + * Returns the raw JSON value of [expired]. + * + * Unlike [expired], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("expired") @ExcludeMissing fun _expired(): JsonField = expired + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [GithubProjectRepository]. + * + * The following fields are required: + * ```kotlin + * .linkedBy() + * .id() + * .name() + * .configPath() + * .branch() + * .publishOnMerge() + * .publishPreviews() + * .prComments() + * .expired() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [GithubProjectRepository]. */ + class Builder internal constructor() { + + private var linkedBy: JsonField? = null + private var id: JsonField? = null + private var name: JsonField? = null + private var configPath: JsonField? = null + private var branch: JsonField? = null + private var publishOnMerge: JsonField? = null + private var publishPreviews: JsonField? = null + private var prComments: JsonField? = null + private var expired: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(githubProjectRepository: GithubProjectRepository) = apply { + linkedBy = githubProjectRepository.linkedBy + id = githubProjectRepository.id + name = githubProjectRepository.name + configPath = githubProjectRepository.configPath + branch = githubProjectRepository.branch + publishOnMerge = githubProjectRepository.publishOnMerge + publishPreviews = githubProjectRepository.publishPreviews + prComments = githubProjectRepository.prComments + expired = githubProjectRepository.expired + additionalProperties = githubProjectRepository.additionalProperties.toMutableMap() + } + + fun linkedBy(linkedBy: String) = linkedBy(JsonField.of(linkedBy)) + + /** + * Sets [Builder.linkedBy] to an arbitrary JSON value. + * + * You should usually call [Builder.linkedBy] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun linkedBy(linkedBy: JsonField) = apply { this.linkedBy = linkedBy } + + fun id(id: Double) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [Double] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + fun configPath(configPath: String) = configPath(JsonField.of(configPath)) + + /** + * Sets [Builder.configPath] to an arbitrary JSON value. + * + * You should usually call [Builder.configPath] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun configPath(configPath: JsonField) = apply { this.configPath = configPath } + + fun branch(branch: String) = branch(JsonField.of(branch)) + + /** + * Sets [Builder.branch] to an arbitrary JSON value. + * + * You should usually call [Builder.branch] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun branch(branch: JsonField) = apply { this.branch = branch } + + fun publishOnMerge(publishOnMerge: Boolean) = publishOnMerge(JsonField.of(publishOnMerge)) + + /** + * Sets [Builder.publishOnMerge] to an arbitrary JSON value. + * + * You should usually call [Builder.publishOnMerge] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun publishOnMerge(publishOnMerge: JsonField) = apply { + this.publishOnMerge = publishOnMerge + } + + fun publishPreviews(publishPreviews: Boolean) = + publishPreviews(JsonField.of(publishPreviews)) + + /** + * Sets [Builder.publishPreviews] to an arbitrary JSON value. + * + * You should usually call [Builder.publishPreviews] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun publishPreviews(publishPreviews: JsonField) = apply { + this.publishPreviews = publishPreviews + } + + fun prComments(prComments: Boolean) = prComments(JsonField.of(prComments)) + + /** + * Sets [Builder.prComments] to an arbitrary JSON value. + * + * You should usually call [Builder.prComments] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun prComments(prComments: JsonField) = apply { this.prComments = prComments } + + fun expired(expired: Boolean) = expired(JsonField.of(expired)) + + /** + * Sets [Builder.expired] to an arbitrary JSON value. + * + * You should usually call [Builder.expired] with a well-typed [Boolean] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun expired(expired: JsonField) = apply { this.expired = expired } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [GithubProjectRepository]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .linkedBy() + * .id() + * .name() + * .configPath() + * .branch() + * .publishOnMerge() + * .publishPreviews() + * .prComments() + * .expired() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): GithubProjectRepository = + GithubProjectRepository( + checkRequired("linkedBy", linkedBy), + checkRequired("id", id), + checkRequired("name", name), + checkRequired("configPath", configPath), + checkRequired("branch", branch), + checkRequired("publishOnMerge", publishOnMerge), + checkRequired("publishPreviews", publishPreviews), + checkRequired("prComments", prComments), + checkRequired("expired", expired), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): GithubProjectRepository = apply { + if (validated) { + return@apply + } + + linkedBy() + id() + name() + configPath() + branch() + publishOnMerge() + publishPreviews() + prComments() + expired() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (linkedBy.asKnown().isPresent) 1 else 0) + + (if (id.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (configPath.asKnown().isPresent) 1 else 0) + + (if (branch.asKnown().isPresent) 1 else 0) + + (if (publishOnMerge.asKnown().isPresent) 1 else 0) + + (if (publishPreviews.asKnown().isPresent) 1 else 0) + + (if (prComments.asKnown().isPresent) 1 else 0) + + (if (expired.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is GithubProjectRepository && + linkedBy == other.linkedBy && + id == other.id && + name == other.name && + configPath == other.configPath && + branch == other.branch && + publishOnMerge == other.publishOnMerge && + publishPreviews == other.publishPreviews && + prComments == other.prComments && + expired == other.expired && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + linkedBy, + id, + name, + configPath, + branch, + publishOnMerge, + publishPreviews, + prComments, + expired, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "GithubProjectRepository{linkedBy=$linkedBy, id=$id, name=$name, configPath=$configPath, branch=$branch, publishOnMerge=$publishOnMerge, publishPreviews=$publishPreviews, prComments=$prComments, expired=$expired, additionalProperties=$additionalProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocCreateProjectParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocCreateProjectParams.kt new file mode 100644 index 0000000..3636fc0 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocCreateProjectParams.kt @@ -0,0 +1,1383 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.scalarDocs + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.Enum +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.Params +import com.scalar.core.checkRequired +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Create a docs project. Omit `provider` to have Scalar host the repository. */ +class ScalarDocCreateProjectParams +private constructor( + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = body.name() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun slug(): Optional = body.slug() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun isPrivate(): Optional = body.isPrivate() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun blank(): Optional = body.blank() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun provider(): Provider = body.provider() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun githubRepository(): Optional = body.githubRepository() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun bitbucketRepository(): Optional = body.bitbucketRepository() + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _name(): JsonField = body._name() + + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _slug(): JsonField = body._slug() + + /** + * Returns the raw JSON value of [isPrivate]. + * + * Unlike [isPrivate], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _isPrivate(): JsonField = body._isPrivate() + + /** + * Returns the raw JSON value of [blank]. + * + * Unlike [blank], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _blank(): JsonField = body._blank() + + /** + * Returns the raw JSON value of [provider]. + * + * Unlike [provider], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _provider(): JsonField = body._provider() + + /** + * Returns the raw JSON value of [githubRepository]. + * + * Unlike [githubRepository], this method doesn't throw if the JSON field has an unexpected + * type. + */ + fun _githubRepository(): JsonField = body._githubRepository() + + /** + * Returns the raw JSON value of [bitbucketRepository]. + * + * Unlike [bitbucketRepository], this method doesn't throw if the JSON field has an unexpected + * type. + */ + fun _bitbucketRepository(): JsonField = body._bitbucketRepository() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [ScalarDocCreateProjectParams]. + * + * The following fields are required: + * ```kotlin + * .name() + * .provider() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ScalarDocCreateProjectParams]. */ + class Builder internal constructor() { + + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(scalarDocCreateProjectParams: ScalarDocCreateProjectParams) = apply { + body = scalarDocCreateProjectParams.body.toBuilder() + additionalHeaders = scalarDocCreateProjectParams.additionalHeaders.toBuilder() + additionalQueryParams = scalarDocCreateProjectParams.additionalQueryParams.toBuilder() + } + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [name] + * - [slug] + * - [isPrivate] + * - [blank] + * - [provider] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + fun name(name: String) = apply { body.name(name) } + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { body.name(name) } + + fun slug(slug: String) = apply { body.slug(slug) } + + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun slug(slug: JsonField) = apply { body.slug(slug) } + + fun isPrivate(isPrivate: Boolean) = apply { body.isPrivate(isPrivate) } + + /** + * Sets [Builder.isPrivate] to an arbitrary JSON value. + * + * You should usually call [Builder.isPrivate] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun isPrivate(isPrivate: JsonField) = apply { body.isPrivate(isPrivate) } + + fun blank(blank: Boolean) = apply { body.blank(blank) } + + /** + * Sets [Builder.blank] to an arbitrary JSON value. + * + * You should usually call [Builder.blank] with a well-typed [Boolean] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun blank(blank: JsonField) = apply { body.blank(blank) } + + fun provider(provider: Provider) = apply { body.provider(provider) } + + /** + * Sets [Builder.provider] to an arbitrary JSON value. + * + * You should usually call [Builder.provider] with a well-typed [Provider] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun provider(provider: JsonField) = apply { body.provider(provider) } + + fun githubRepository(githubRepository: GithubRepository) = apply { + body.githubRepository(githubRepository) + } + + /** + * Sets [Builder.githubRepository] to an arbitrary JSON value. + * + * You should usually call [Builder.githubRepository] with a well-typed [GithubRepository] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun githubRepository(githubRepository: JsonField) = apply { + body.githubRepository(githubRepository) + } + + fun bitbucketRepository(bitbucketRepository: BitbucketRepository) = apply { + body.bitbucketRepository(bitbucketRepository) + } + + /** + * Sets [Builder.bitbucketRepository] to an arbitrary JSON value. + * + * You should usually call [Builder.bitbucketRepository] with a well-typed + * [BitbucketRepository] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun bitbucketRepository(bitbucketRepository: JsonField) = apply { + body.bitbucketRepository(bitbucketRepository) + } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [ScalarDocCreateProjectParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .name() + * .provider() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ScalarDocCreateProjectParams = + ScalarDocCreateProjectParams( + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val name: JsonField, + private val slug: JsonField, + private val isPrivate: JsonField, + private val blank: JsonField, + private val provider: JsonField, + private val githubRepository: JsonField, + private val bitbucketRepository: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), + @JsonProperty("isPrivate") + @ExcludeMissing + isPrivate: JsonField = JsonMissing.of(), + @JsonProperty("blank") @ExcludeMissing blank: JsonField = JsonMissing.of(), + @JsonProperty("provider") + @ExcludeMissing + provider: JsonField = JsonMissing.of(), + @JsonProperty("githubRepository") + @ExcludeMissing + githubRepository: JsonField = JsonMissing.of(), + @JsonProperty("bitbucketRepository") + @ExcludeMissing + bitbucketRepository: JsonField = JsonMissing.of(), + ) : this( + name, + slug, + isPrivate, + blank, + provider, + githubRepository, + bitbucketRepository, + mutableMapOf(), + ) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun slug(): Optional = slug.getOptional("slug") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun isPrivate(): Optional = isPrivate.getOptional("isPrivate") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun blank(): Optional = blank.getOptional("blank") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun provider(): Provider = provider.getRequired("provider") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun githubRepository(): Optional = + githubRepository.getOptional("githubRepository") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun bitbucketRepository(): Optional = + bitbucketRepository.getOptional("bitbucketRepository") + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug + + /** + * Returns the raw JSON value of [isPrivate]. + * + * Unlike [isPrivate], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("isPrivate") @ExcludeMissing fun _isPrivate(): JsonField = isPrivate + + /** + * Returns the raw JSON value of [blank]. + * + * Unlike [blank], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("blank") @ExcludeMissing fun _blank(): JsonField = blank + + /** + * Returns the raw JSON value of [provider]. + * + * Unlike [provider], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("provider") @ExcludeMissing fun _provider(): JsonField = provider + + /** + * Returns the raw JSON value of [githubRepository]. + * + * Unlike [githubRepository], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("githubRepository") + @ExcludeMissing + fun _githubRepository(): JsonField = githubRepository + + /** + * Returns the raw JSON value of [bitbucketRepository]. + * + * Unlike [bitbucketRepository], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("bitbucketRepository") + @ExcludeMissing + fun _bitbucketRepository(): JsonField = bitbucketRepository + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```kotlin + * .name() + * .provider() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var name: JsonField? = null + private var slug: JsonField = JsonMissing.of() + private var isPrivate: JsonField = JsonMissing.of() + private var blank: JsonField = JsonMissing.of() + private var provider: JsonField? = null + private var githubRepository: JsonField = JsonMissing.of() + private var bitbucketRepository: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + name = body.name + slug = body.slug + isPrivate = body.isPrivate + blank = body.blank + provider = body.provider + githubRepository = body.githubRepository + bitbucketRepository = body.bitbucketRepository + additionalProperties = body.additionalProperties.toMutableMap() + } + + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + fun slug(slug: String) = slug(JsonField.of(slug)) + + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun slug(slug: JsonField) = apply { this.slug = slug } + + fun isPrivate(isPrivate: Boolean) = isPrivate(JsonField.of(isPrivate)) + + /** + * Sets [Builder.isPrivate] to an arbitrary JSON value. + * + * You should usually call [Builder.isPrivate] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun isPrivate(isPrivate: JsonField) = apply { this.isPrivate = isPrivate } + + fun blank(blank: Boolean) = blank(JsonField.of(blank)) + + /** + * Sets [Builder.blank] to an arbitrary JSON value. + * + * You should usually call [Builder.blank] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun blank(blank: JsonField) = apply { this.blank = blank } + + fun provider(provider: Provider) = provider(JsonField.of(provider)) + + /** + * Sets [Builder.provider] to an arbitrary JSON value. + * + * You should usually call [Builder.provider] with a well-typed [Provider] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun provider(provider: JsonField) = apply { this.provider = provider } + + fun githubRepository(githubRepository: GithubRepository) = + githubRepository(JsonField.of(githubRepository)) + + /** + * Sets [Builder.githubRepository] to an arbitrary JSON value. + * + * You should usually call [Builder.githubRepository] with a well-typed + * [GithubRepository] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun githubRepository(githubRepository: JsonField) = apply { + this.githubRepository = githubRepository + } + + fun bitbucketRepository(bitbucketRepository: BitbucketRepository) = + bitbucketRepository(JsonField.of(bitbucketRepository)) + + /** + * Sets [Builder.bitbucketRepository] to an arbitrary JSON value. + * + * You should usually call [Builder.bitbucketRepository] with a well-typed + * [BitbucketRepository] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ + fun bitbucketRepository(bitbucketRepository: JsonField) = apply { + this.bitbucketRepository = bitbucketRepository + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .name() + * .provider() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Body = + Body( + checkRequired("name", name), + slug, + isPrivate, + blank, + checkRequired("provider", provider), + githubRepository, + bitbucketRepository, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Body = apply { + if (validated) { + return@apply + } + + name() + slug() + isPrivate() + blank() + provider().validate() + githubRepository().ifPresent { it.validate() } + bitbucketRepository().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (name.asKnown().isPresent) 1 else 0) + + (if (slug.asKnown().isPresent) 1 else 0) + + (if (isPrivate.asKnown().isPresent) 1 else 0) + + (if (blank.asKnown().isPresent) 1 else 0) + + (provider.asKnown().getOrNull()?.validity() ?: 0) + + (githubRepository.asKnown().getOrNull()?.validity() ?: 0) + + (bitbucketRepository.asKnown().getOrNull()?.validity() ?: 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + name == other.name && + slug == other.slug && + isPrivate == other.isPrivate && + blank == other.blank && + provider == other.provider && + githubRepository == other.githubRepository && + bitbucketRepository == other.bitbucketRepository && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + name, + slug, + isPrivate, + blank, + provider, + githubRepository, + bitbucketRepository, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{name=$name, slug=$slug, isPrivate=$isPrivate, blank=$blank, provider=$provider, githubRepository=$githubRepository, bitbucketRepository=$bitbucketRepository, additionalProperties=$additionalProperties}" + } + + class Provider @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val FORGEJO = of("forgejo") + + @JvmField val GITHUB = of("github") + + @JvmField val BITBUCKET = of("bitbucket") + + @JvmStatic fun of(value: String) = Provider(JsonField.of(value)) + } + + /** An enum containing [Provider]'s known values. */ + enum class Known { + FORGEJO, + GITHUB, + BITBUCKET, + } + + /** + * An enum containing [Provider]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Provider] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + FORGEJO, + GITHUB, + BITBUCKET, + /** An enum member indicating that [Provider] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + FORGEJO -> Value.FORGEJO + GITHUB -> Value.GITHUB + BITBUCKET -> Value.BITBUCKET + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws ScalarInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + FORGEJO -> Known.FORGEJO + GITHUB -> Known.GITHUB + BITBUCKET -> Known.BITBUCKET + else -> throw ScalarInvalidDataException("Unknown Provider: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws ScalarInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { ScalarInvalidDataException("Value is not a String") } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Provider = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Provider && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class GithubRepository + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val installationId: JsonField, + private val repoId: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("installationId") + @ExcludeMissing + installationId: JsonField = JsonMissing.of(), + @JsonProperty("repoId") @ExcludeMissing repoId: JsonField = JsonMissing.of(), + ) : this(installationId, repoId, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun installationId(): Long = installationId.getRequired("installationId") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun repoId(): Long = repoId.getRequired("repoId") + + /** + * Returns the raw JSON value of [installationId]. + * + * Unlike [installationId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("installationId") + @ExcludeMissing + fun _installationId(): JsonField = installationId + + /** + * Returns the raw JSON value of [repoId]. + * + * Unlike [repoId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("repoId") @ExcludeMissing fun _repoId(): JsonField = repoId + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [GithubRepository]. + * + * The following fields are required: + * ```kotlin + * .installationId() + * .repoId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [GithubRepository]. */ + class Builder internal constructor() { + + private var installationId: JsonField? = null + private var repoId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(githubRepository: GithubRepository) = apply { + installationId = githubRepository.installationId + repoId = githubRepository.repoId + additionalProperties = githubRepository.additionalProperties.toMutableMap() + } + + fun installationId(installationId: Long) = installationId(JsonField.of(installationId)) + + /** + * Sets [Builder.installationId] to an arbitrary JSON value. + * + * You should usually call [Builder.installationId] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun installationId(installationId: JsonField) = apply { + this.installationId = installationId + } + + fun repoId(repoId: Long) = repoId(JsonField.of(repoId)) + + /** + * Sets [Builder.repoId] to an arbitrary JSON value. + * + * You should usually call [Builder.repoId] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun repoId(repoId: JsonField) = apply { this.repoId = repoId } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [GithubRepository]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .installationId() + * .repoId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): GithubRepository = + GithubRepository( + checkRequired("installationId", installationId), + checkRequired("repoId", repoId), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): GithubRepository = apply { + if (validated) { + return@apply + } + + installationId() + repoId() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (installationId.asKnown().isPresent) 1 else 0) + + (if (repoId.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is GithubRepository && + installationId == other.installationId && + repoId == other.repoId && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(installationId, repoId, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "GithubRepository{installationId=$installationId, repoId=$repoId, additionalProperties=$additionalProperties}" + } + + class BitbucketRepository + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val workspaceUuid: JsonField, + private val repoUuid: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("workspaceUuid") + @ExcludeMissing + workspaceUuid: JsonField = JsonMissing.of(), + @JsonProperty("repoUuid") + @ExcludeMissing + repoUuid: JsonField = JsonMissing.of(), + ) : this(workspaceUuid, repoUuid, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun workspaceUuid(): String = workspaceUuid.getRequired("workspaceUuid") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun repoUuid(): String = repoUuid.getRequired("repoUuid") + + /** + * Returns the raw JSON value of [workspaceUuid]. + * + * Unlike [workspaceUuid], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("workspaceUuid") + @ExcludeMissing + fun _workspaceUuid(): JsonField = workspaceUuid + + /** + * Returns the raw JSON value of [repoUuid]. + * + * Unlike [repoUuid], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("repoUuid") @ExcludeMissing fun _repoUuid(): JsonField = repoUuid + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [BitbucketRepository]. + * + * The following fields are required: + * ```kotlin + * .workspaceUuid() + * .repoUuid() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BitbucketRepository]. */ + class Builder internal constructor() { + + private var workspaceUuid: JsonField? = null + private var repoUuid: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(bitbucketRepository: BitbucketRepository) = apply { + workspaceUuid = bitbucketRepository.workspaceUuid + repoUuid = bitbucketRepository.repoUuid + additionalProperties = bitbucketRepository.additionalProperties.toMutableMap() + } + + fun workspaceUuid(workspaceUuid: String) = workspaceUuid(JsonField.of(workspaceUuid)) + + /** + * Sets [Builder.workspaceUuid] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceUuid] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun workspaceUuid(workspaceUuid: JsonField) = apply { + this.workspaceUuid = workspaceUuid + } + + fun repoUuid(repoUuid: String) = repoUuid(JsonField.of(repoUuid)) + + /** + * Sets [Builder.repoUuid] to an arbitrary JSON value. + * + * You should usually call [Builder.repoUuid] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun repoUuid(repoUuid: JsonField) = apply { this.repoUuid = repoUuid } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [BitbucketRepository]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .workspaceUuid() + * .repoUuid() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): BitbucketRepository = + BitbucketRepository( + checkRequired("workspaceUuid", workspaceUuid), + checkRequired("repoUuid", repoUuid), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BitbucketRepository = apply { + if (validated) { + return@apply + } + + workspaceUuid() + repoUuid() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (workspaceUuid.asKnown().isPresent) 1 else 0) + + (if (repoUuid.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BitbucketRepository && + workspaceUuid == other.workspaceUuid && + repoUuid == other.repoUuid && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(workspaceUuid, repoUuid, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BitbucketRepository{workspaceUuid=$workspaceUuid, repoUuid=$repoUuid, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ScalarDocCreateProjectParams && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = Objects.hash(body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "ScalarDocCreateProjectParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocDeleteProjectParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocDeleteProjectParams.kt new file mode 100644 index 0000000..1760e06 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocDeleteProjectParams.kt @@ -0,0 +1,232 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.scalarDocs + +import com.scalar.core.JsonValue +import com.scalar.core.Params +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import com.scalar.core.toImmutable +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Delete a docs project, its deploys, its publish records and its cached builds. */ +class ScalarDocDeleteProjectParams +private constructor( + private val slug: String?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, + private val additionalBodyProperties: Map, +) : Params { + + fun slug(): Optional = Optional.ofNullable(slug) + + /** Additional body properties to send with the request. */ + fun _additionalBodyProperties(): Map = additionalBodyProperties + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): ScalarDocDeleteProjectParams = builder().build() + + /** + * Returns a mutable builder for constructing an instance of [ScalarDocDeleteProjectParams]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ScalarDocDeleteProjectParams]. */ + class Builder internal constructor() { + + private var slug: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(scalarDocDeleteProjectParams: ScalarDocDeleteProjectParams) = apply { + slug = scalarDocDeleteProjectParams.slug + additionalHeaders = scalarDocDeleteProjectParams.additionalHeaders.toBuilder() + additionalQueryParams = scalarDocDeleteProjectParams.additionalQueryParams.toBuilder() + additionalBodyProperties = + scalarDocDeleteProjectParams.additionalBodyProperties.toMutableMap() + } + + fun slug(slug: String?) = apply { this.slug = slug } + + /** Alias for calling [Builder.slug] with `slug.orElse(null)`. */ + fun slug(slug: Optional) = slug(slug.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + putAllAdditionalBodyProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { + additionalBodyProperties.remove(key) + } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalBodyProperty) + } + + /** + * Returns an immutable instance of [ScalarDocDeleteProjectParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ScalarDocDeleteProjectParams = + ScalarDocDeleteProjectParams( + slug, + additionalHeaders.build(), + additionalQueryParams.build(), + additionalBodyProperties.toImmutable(), + ) + } + + fun _body(): Optional> = + Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) + + fun _pathParam(index: Int): String = + when (index) { + 0 -> slug ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ScalarDocDeleteProjectParams && + slug == other.slug && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams && + additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int = + Objects.hash(slug, additionalHeaders, additionalQueryParams, additionalBodyProperties) + + override fun toString() = + "ScalarDocDeleteProjectParams{slug=$slug, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectConfigParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectConfigParams.kt new file mode 100644 index 0000000..78246b9 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectConfigParams.kt @@ -0,0 +1,219 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.scalarDocs + +import com.scalar.core.Params +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * Read `scalar.config.json` straight from the project repository, without cloning it. `baseToken` + * is the compare-and-swap handle for a later write. + */ +class ScalarDocListProjectConfigParams +private constructor( + private val slug: String?, + private val ref: String?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun slug(): Optional = Optional.ofNullable(slug) + + fun ref(): Optional = Optional.ofNullable(ref) + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): ScalarDocListProjectConfigParams = builder().build() + + /** + * Returns a mutable builder for constructing an instance of + * [ScalarDocListProjectConfigParams]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ScalarDocListProjectConfigParams]. */ + class Builder internal constructor() { + + private var slug: String? = null + private var ref: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(scalarDocListProjectConfigParams: ScalarDocListProjectConfigParams) = + apply { + slug = scalarDocListProjectConfigParams.slug + ref = scalarDocListProjectConfigParams.ref + additionalHeaders = scalarDocListProjectConfigParams.additionalHeaders.toBuilder() + additionalQueryParams = + scalarDocListProjectConfigParams.additionalQueryParams.toBuilder() + } + + fun slug(slug: String?) = apply { this.slug = slug } + + /** Alias for calling [Builder.slug] with `slug.orElse(null)`. */ + fun slug(slug: Optional) = slug(slug.getOrNull()) + + fun ref(ref: String?) = apply { this.ref = ref } + + /** Alias for calling [Builder.ref] with `ref.orElse(null)`. */ + fun ref(ref: Optional) = ref(ref.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [ScalarDocListProjectConfigParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ScalarDocListProjectConfigParams = + ScalarDocListProjectConfigParams( + slug, + ref, + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _pathParam(index: Int): String = + when (index) { + 0 -> slug ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + ref?.let { put("ref", it) } + putAll(additionalQueryParams) + } + .build() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ScalarDocListProjectConfigParams && + slug == other.slug && + ref == other.ref && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = Objects.hash(slug, ref, additionalHeaders, additionalQueryParams) + + override fun toString() = + "ScalarDocListProjectConfigParams{slug=$slug, ref=$ref, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectConfigResponse.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectConfigResponse.kt new file mode 100644 index 0000000..102fe1a --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectConfigResponse.kt @@ -0,0 +1,285 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.scalarDocs + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.checkRequired +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects + +class ScalarDocListProjectConfigResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val path: JsonField, + private val content: JsonField, + private val ref: JsonField, + private val baseToken: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("path") @ExcludeMissing path: JsonField = JsonMissing.of(), + @JsonProperty("content") @ExcludeMissing content: JsonField = JsonMissing.of(), + @JsonProperty("ref") @ExcludeMissing ref: JsonField = JsonMissing.of(), + @JsonProperty("baseToken") @ExcludeMissing baseToken: JsonField = JsonMissing.of(), + ) : this(path, content, ref, baseToken, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun path(): String = path.getRequired("path") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun content(): String = content.getRequired("content") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun ref(): String = ref.getRequired("ref") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun baseToken(): String = baseToken.getRequired("baseToken") + + /** + * Returns the raw JSON value of [path]. + * + * Unlike [path], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("path") @ExcludeMissing fun _path(): JsonField = path + + /** + * Returns the raw JSON value of [content]. + * + * Unlike [content], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("content") @ExcludeMissing fun _content(): JsonField = content + + /** + * Returns the raw JSON value of [ref]. + * + * Unlike [ref], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ref") @ExcludeMissing fun _ref(): JsonField = ref + + /** + * Returns the raw JSON value of [baseToken]. + * + * Unlike [baseToken], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("baseToken") @ExcludeMissing fun _baseToken(): JsonField = baseToken + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [ScalarDocListProjectConfigResponse]. + * + * The following fields are required: + * ```kotlin + * .path() + * .content() + * .ref() + * .baseToken() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ScalarDocListProjectConfigResponse]. */ + class Builder internal constructor() { + + private var path: JsonField? = null + private var content: JsonField? = null + private var ref: JsonField? = null + private var baseToken: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(scalarDocListProjectConfigResponse: ScalarDocListProjectConfigResponse) = + apply { + path = scalarDocListProjectConfigResponse.path + content = scalarDocListProjectConfigResponse.content + ref = scalarDocListProjectConfigResponse.ref + baseToken = scalarDocListProjectConfigResponse.baseToken + additionalProperties = + scalarDocListProjectConfigResponse.additionalProperties.toMutableMap() + } + + fun path(path: String) = path(JsonField.of(path)) + + /** + * Sets [Builder.path] to an arbitrary JSON value. + * + * You should usually call [Builder.path] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun path(path: JsonField) = apply { this.path = path } + + fun content(content: String) = content(JsonField.of(content)) + + /** + * Sets [Builder.content] to an arbitrary JSON value. + * + * You should usually call [Builder.content] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun content(content: JsonField) = apply { this.content = content } + + fun ref(ref: String) = ref(JsonField.of(ref)) + + /** + * Sets [Builder.ref] to an arbitrary JSON value. + * + * You should usually call [Builder.ref] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun ref(ref: JsonField) = apply { this.ref = ref } + + fun baseToken(baseToken: String) = baseToken(JsonField.of(baseToken)) + + /** + * Sets [Builder.baseToken] to an arbitrary JSON value. + * + * You should usually call [Builder.baseToken] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun baseToken(baseToken: JsonField) = apply { this.baseToken = baseToken } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ScalarDocListProjectConfigResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .path() + * .content() + * .ref() + * .baseToken() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ScalarDocListProjectConfigResponse = + ScalarDocListProjectConfigResponse( + checkRequired("path", path), + checkRequired("content", content), + checkRequired("ref", ref), + checkRequired("baseToken", baseToken), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): ScalarDocListProjectConfigResponse = apply { + if (validated) { + return@apply + } + + path() + content() + ref() + baseToken() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (path.asKnown().isPresent) 1 else 0) + + (if (content.asKnown().isPresent) 1 else 0) + + (if (ref.asKnown().isPresent) 1 else 0) + + (if (baseToken.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ScalarDocListProjectConfigResponse && + path == other.path && + content == other.content && + ref == other.ref && + baseToken == other.baseToken && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(path, content, ref, baseToken, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ScalarDocListProjectConfigResponse{path=$path, content=$content, ref=$ref, baseToken=$baseToken, additionalProperties=$additionalProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectDomainParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectDomainParams.kt new file mode 100644 index 0000000..048983a --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectDomainParams.kt @@ -0,0 +1,198 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.scalarDocs + +import com.scalar.core.Params +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** The domains the project serves on — the Scalar-hosted one and the custom one, when set. */ +class ScalarDocListProjectDomainParams +private constructor( + private val slug: String?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun slug(): Optional = Optional.ofNullable(slug) + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): ScalarDocListProjectDomainParams = builder().build() + + /** + * Returns a mutable builder for constructing an instance of + * [ScalarDocListProjectDomainParams]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ScalarDocListProjectDomainParams]. */ + class Builder internal constructor() { + + private var slug: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(scalarDocListProjectDomainParams: ScalarDocListProjectDomainParams) = + apply { + slug = scalarDocListProjectDomainParams.slug + additionalHeaders = scalarDocListProjectDomainParams.additionalHeaders.toBuilder() + additionalQueryParams = + scalarDocListProjectDomainParams.additionalQueryParams.toBuilder() + } + + fun slug(slug: String?) = apply { this.slug = slug } + + /** Alias for calling [Builder.slug] with `slug.orElse(null)`. */ + fun slug(slug: Optional) = slug(slug.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [ScalarDocListProjectDomainParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ScalarDocListProjectDomainParams = + ScalarDocListProjectDomainParams( + slug, + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _pathParam(index: Int): String = + when (index) { + 0 -> slug ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ScalarDocListProjectDomainParams && + slug == other.slug && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = Objects.hash(slug, additionalHeaders, additionalQueryParams) + + override fun toString() = + "ScalarDocListProjectDomainParams{slug=$slug, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectDomainResponse.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectDomainResponse.kt new file mode 100644 index 0000000..82ca2e1 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectDomainResponse.kt @@ -0,0 +1,240 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.scalarDocs + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.checkRequired +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class ScalarDocListProjectDomainResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val scalarDomain: JsonField, + private val customDomain: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("scalarDomain") + @ExcludeMissing + scalarDomain: JsonField = JsonMissing.of(), + @JsonProperty("customDomain") + @ExcludeMissing + customDomain: JsonField = JsonMissing.of(), + ) : this(scalarDomain, customDomain, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun scalarDomain(): Optional = scalarDomain.getOptional("scalarDomain") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun customDomain(): Optional = customDomain.getOptional("customDomain") + + /** + * Returns the raw JSON value of [scalarDomain]. + * + * Unlike [scalarDomain], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("scalarDomain") + @ExcludeMissing + fun _scalarDomain(): JsonField = scalarDomain + + /** + * Returns the raw JSON value of [customDomain]. + * + * Unlike [customDomain], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("customDomain") + @ExcludeMissing + fun _customDomain(): JsonField = customDomain + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [ScalarDocListProjectDomainResponse]. + * + * The following fields are required: + * ```kotlin + * .scalarDomain() + * .customDomain() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ScalarDocListProjectDomainResponse]. */ + class Builder internal constructor() { + + private var scalarDomain: JsonField? = null + private var customDomain: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(scalarDocListProjectDomainResponse: ScalarDocListProjectDomainResponse) = + apply { + scalarDomain = scalarDocListProjectDomainResponse.scalarDomain + customDomain = scalarDocListProjectDomainResponse.customDomain + additionalProperties = + scalarDocListProjectDomainResponse.additionalProperties.toMutableMap() + } + + fun scalarDomain(scalarDomain: String?) = scalarDomain(JsonField.ofNullable(scalarDomain)) + + /** Alias for calling [Builder.scalarDomain] with `scalarDomain.orElse(null)`. */ + fun scalarDomain(scalarDomain: Optional) = scalarDomain(scalarDomain.getOrNull()) + + /** + * Sets [Builder.scalarDomain] to an arbitrary JSON value. + * + * You should usually call [Builder.scalarDomain] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun scalarDomain(scalarDomain: JsonField) = apply { + this.scalarDomain = scalarDomain + } + + fun customDomain(customDomain: String?) = customDomain(JsonField.ofNullable(customDomain)) + + /** Alias for calling [Builder.customDomain] with `customDomain.orElse(null)`. */ + fun customDomain(customDomain: Optional) = customDomain(customDomain.getOrNull()) + + /** + * Sets [Builder.customDomain] to an arbitrary JSON value. + * + * You should usually call [Builder.customDomain] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun customDomain(customDomain: JsonField) = apply { + this.customDomain = customDomain + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ScalarDocListProjectDomainResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .scalarDomain() + * .customDomain() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ScalarDocListProjectDomainResponse = + ScalarDocListProjectDomainResponse( + checkRequired("scalarDomain", scalarDomain), + checkRequired("customDomain", customDomain), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): ScalarDocListProjectDomainResponse = apply { + if (validated) { + return@apply + } + + scalarDomain() + customDomain() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (scalarDomain.asKnown().isPresent) 1 else 0) + + (if (customDomain.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ScalarDocListProjectDomainResponse && + scalarDomain == other.scalarDomain && + customDomain == other.customDomain && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(scalarDomain, customDomain, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ScalarDocListProjectDomainResponse{scalarDomain=$scalarDomain, customDomain=$customDomain, additionalProperties=$additionalProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectDomainStatusParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectDomainStatusParams.kt new file mode 100644 index 0000000..0588a8f --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectDomainStatusParams.kt @@ -0,0 +1,203 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.scalarDocs + +import com.scalar.core.Params +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * Whether the project custom domain points at Scalar yet. `expected` is the CNAME record to create; + * `found` is what resolves today. A project with no custom domain reports `verified` with no + * expected record, because Scalar serves its own subdomain directly. + */ +class ScalarDocListProjectDomainStatusParams +private constructor( + private val slug: String?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun slug(): Optional = Optional.ofNullable(slug) + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): ScalarDocListProjectDomainStatusParams = builder().build() + + /** + * Returns a mutable builder for constructing an instance of + * [ScalarDocListProjectDomainStatusParams]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ScalarDocListProjectDomainStatusParams]. */ + class Builder internal constructor() { + + private var slug: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from( + scalarDocListProjectDomainStatusParams: ScalarDocListProjectDomainStatusParams + ) = apply { + slug = scalarDocListProjectDomainStatusParams.slug + additionalHeaders = scalarDocListProjectDomainStatusParams.additionalHeaders.toBuilder() + additionalQueryParams = + scalarDocListProjectDomainStatusParams.additionalQueryParams.toBuilder() + } + + fun slug(slug: String?) = apply { this.slug = slug } + + /** Alias for calling [Builder.slug] with `slug.orElse(null)`. */ + fun slug(slug: Optional) = slug(slug.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [ScalarDocListProjectDomainStatusParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ScalarDocListProjectDomainStatusParams = + ScalarDocListProjectDomainStatusParams( + slug, + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _pathParam(index: Int): String = + when (index) { + 0 -> slug ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ScalarDocListProjectDomainStatusParams && + slug == other.slug && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = Objects.hash(slug, additionalHeaders, additionalQueryParams) + + override fun toString() = + "ScalarDocListProjectDomainStatusParams{slug=$slug, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectDomainStatusResponse.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectDomainStatusResponse.kt new file mode 100644 index 0000000..17bc777 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectDomainStatusResponse.kt @@ -0,0 +1,652 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.scalarDocs + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.Enum +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.checkKnown +import com.scalar.core.checkRequired +import com.scalar.core.toImmutable +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class ScalarDocListProjectDomainStatusResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val domain: JsonField, + private val status: JsonField, + private val expected: JsonField, + private val found: JsonField>, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("domain") @ExcludeMissing domain: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + @JsonProperty("expected") @ExcludeMissing expected: JsonField = JsonMissing.of(), + @JsonProperty("found") @ExcludeMissing found: JsonField> = JsonMissing.of(), + ) : this(domain, status, expected, found, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun domain(): Optional = domain.getOptional("domain") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun status(): Status = status.getRequired("status") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun expected(): Optional = expected.getOptional("expected") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun found(): List = found.getRequired("found") + + /** + * Returns the raw JSON value of [domain]. + * + * Unlike [domain], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("domain") @ExcludeMissing fun _domain(): JsonField = domain + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + /** + * Returns the raw JSON value of [expected]. + * + * Unlike [expected], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("expected") @ExcludeMissing fun _expected(): JsonField = expected + + /** + * Returns the raw JSON value of [found]. + * + * Unlike [found], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("found") @ExcludeMissing fun _found(): JsonField> = found + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [ScalarDocListProjectDomainStatusResponse]. + * + * The following fields are required: + * ```kotlin + * .domain() + * .status() + * .expected() + * .found() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ScalarDocListProjectDomainStatusResponse]. */ + class Builder internal constructor() { + + private var domain: JsonField? = null + private var status: JsonField? = null + private var expected: JsonField? = null + private var found: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + scalarDocListProjectDomainStatusResponse: ScalarDocListProjectDomainStatusResponse + ) = apply { + domain = scalarDocListProjectDomainStatusResponse.domain + status = scalarDocListProjectDomainStatusResponse.status + expected = scalarDocListProjectDomainStatusResponse.expected + found = scalarDocListProjectDomainStatusResponse.found.map { it.toMutableList() } + additionalProperties = + scalarDocListProjectDomainStatusResponse.additionalProperties.toMutableMap() + } + + fun domain(domain: String?) = domain(JsonField.ofNullable(domain)) + + /** Alias for calling [Builder.domain] with `domain.orElse(null)`. */ + fun domain(domain: Optional) = domain(domain.getOrNull()) + + /** + * Sets [Builder.domain] to an arbitrary JSON value. + * + * You should usually call [Builder.domain] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun domain(domain: JsonField) = apply { this.domain = domain } + + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + fun expected(expected: Expected?) = expected(JsonField.ofNullable(expected)) + + /** Alias for calling [Builder.expected] with `expected.orElse(null)`. */ + fun expected(expected: Optional) = expected(expected.getOrNull()) + + /** + * Sets [Builder.expected] to an arbitrary JSON value. + * + * You should usually call [Builder.expected] with a well-typed [Expected] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun expected(expected: JsonField) = apply { this.expected = expected } + + fun found(found: List) = found(JsonField.of(found)) + + /** + * Sets [Builder.found] to an arbitrary JSON value. + * + * You should usually call [Builder.found] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun found(found: JsonField>) = apply { + this.found = found.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [Builder.found]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addFound(found: String) = apply { + this.found = + (this.found ?: JsonField.of(mutableListOf())).also { + checkKnown("found", it).add(found) + } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ScalarDocListProjectDomainStatusResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .domain() + * .status() + * .expected() + * .found() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ScalarDocListProjectDomainStatusResponse = + ScalarDocListProjectDomainStatusResponse( + checkRequired("domain", domain), + checkRequired("status", status), + checkRequired("expected", expected), + checkRequired("found", found).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): ScalarDocListProjectDomainStatusResponse = apply { + if (validated) { + return@apply + } + + domain() + status().validate() + expected().ifPresent { it.validate() } + found() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (domain.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (expected.asKnown().getOrNull()?.validity() ?: 0) + + (found.asKnown().getOrNull()?.size ?: 0) + + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val VERIFIED = of("verified") + + @JvmField val PENDING = of("pending") + + @JvmField val MISCONFIGURED = of("misconfigured") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + VERIFIED, + PENDING, + MISCONFIGURED, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + VERIFIED, + PENDING, + MISCONFIGURED, + /** An enum member indicating that [Status] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + VERIFIED -> Value.VERIFIED + PENDING -> Value.PENDING + MISCONFIGURED -> Value.MISCONFIGURED + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws ScalarInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + VERIFIED -> Known.VERIFIED + PENDING -> Known.PENDING + MISCONFIGURED -> Known.MISCONFIGURED + else -> throw ScalarInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws ScalarInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { ScalarInvalidDataException("Value is not a String") } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class Expected + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonValue, + private val target: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), + @JsonProperty("target") @ExcludeMissing target: JsonField = JsonMissing.of(), + ) : this(type, target, mutableMapOf()) + + /** + * Expected to always return the following: + * ```kotlin + * JsonValue.from("CNAME") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun target(): String = target.getRequired("target") + + /** + * Returns the raw JSON value of [target]. + * + * Unlike [target], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("target") @ExcludeMissing fun _target(): JsonField = target + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Expected]. + * + * The following fields are required: + * ```kotlin + * .target() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Expected]. */ + class Builder internal constructor() { + + private var type: JsonValue = JsonValue.from("CNAME") + private var target: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(expected: Expected) = apply { + type = expected.type + target = expected.target + additionalProperties = expected.additionalProperties.toMutableMap() + } + + /** + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```kotlin + * JsonValue.from("CNAME") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun type(type: JsonValue) = apply { this.type = type } + + fun target(target: String) = target(JsonField.of(target)) + + /** + * Sets [Builder.target] to an arbitrary JSON value. + * + * You should usually call [Builder.target] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun target(target: JsonField) = apply { this.target = target } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Expected]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .target() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Expected = + Expected(type, checkRequired("target", target), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Expected = apply { + if (validated) { + return@apply + } + + _type().let { + if (it != JsonValue.from("CNAME")) { + throw ScalarInvalidDataException("'type' is invalid, received $it") + } + } + target() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + type.let { if (it == JsonValue.from("CNAME")) 1 else 0 } + + (if (target.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Expected && + type == other.type && + target == other.target && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(type, target, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Expected{type=$type, target=$target, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ScalarDocListProjectDomainStatusResponse && + domain == other.domain && + status == other.status && + expected == other.expected && + found == other.found && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(domain, status, expected, found, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ScalarDocListProjectDomainStatusResponse{domain=$domain, status=$status, expected=$expected, found=$found, additionalProperties=$additionalProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectsParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectsParams.kt new file mode 100644 index 0000000..59d4973 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectsParams.kt @@ -0,0 +1,202 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.scalarDocs + +import com.scalar.core.Params +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** List every docs project on the team. */ +class ScalarDocListProjectsParams +private constructor( + private val limit: Long?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun limit(): Optional = Optional.ofNullable(limit) + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): ScalarDocListProjectsParams = builder().build() + + /** + * Returns a mutable builder for constructing an instance of [ScalarDocListProjectsParams]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ScalarDocListProjectsParams]. */ + class Builder internal constructor() { + + private var limit: Long? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(scalarDocListProjectsParams: ScalarDocListProjectsParams) = apply { + limit = scalarDocListProjectsParams.limit + additionalHeaders = scalarDocListProjectsParams.additionalHeaders.toBuilder() + additionalQueryParams = scalarDocListProjectsParams.additionalQueryParams.toBuilder() + } + + fun limit(limit: Long?) = apply { this.limit = limit } + + /** + * Alias for [Builder.limit]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun limit(limit: Long) = limit(limit as Long?) + + /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ + fun limit(limit: Optional) = limit(limit.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [ScalarDocListProjectsParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ScalarDocListProjectsParams = + ScalarDocListProjectsParams( + limit, + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + limit?.let { put("limit", it.toString()) } + putAll(additionalQueryParams) + } + .build() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ScalarDocListProjectsParams && + limit == other.limit && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = Objects.hash(limit, additionalHeaders, additionalQueryParams) + + override fun toString() = + "ScalarDocListProjectsParams{limit=$limit, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectsResponse.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectsResponse.kt new file mode 100644 index 0000000..93e46a7 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListProjectsResponse.kt @@ -0,0 +1,232 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.scalarDocs + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.checkKnown +import com.scalar.core.checkRequired +import com.scalar.core.toImmutable +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import kotlin.jvm.optionals.getOrNull + +class ScalarDocListProjectsResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val data: JsonField>, + private val hasMore: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("data") @ExcludeMissing data: JsonField> = JsonMissing.of(), + @JsonProperty("hasMore") @ExcludeMissing hasMore: JsonField = JsonMissing.of(), + ) : this(data, hasMore, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun data(): List = data.getRequired("data") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun hasMore(): Boolean = hasMore.getRequired("hasMore") + + /** + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("data") @ExcludeMissing fun _data(): JsonField> = data + + /** + * Returns the raw JSON value of [hasMore]. + * + * Unlike [hasMore], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("hasMore") @ExcludeMissing fun _hasMore(): JsonField = hasMore + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [ScalarDocListProjectsResponse]. + * + * The following fields are required: + * ```kotlin + * .data() + * .hasMore() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ScalarDocListProjectsResponse]. */ + class Builder internal constructor() { + + private var data: JsonField>? = null + private var hasMore: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(scalarDocListProjectsResponse: ScalarDocListProjectsResponse) = apply { + data = scalarDocListProjectsResponse.data.map { it.toMutableList() } + hasMore = scalarDocListProjectsResponse.hasMore + additionalProperties = scalarDocListProjectsResponse.additionalProperties.toMutableMap() + } + + fun data(data: List) = data(JsonField.of(data)) + + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun data(data: JsonField>) = apply { + this.data = data.map { it.toMutableList() } + } + + /** + * Adds a single [DocsProject] to [Builder.data]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addData(data: DocsProject) = apply { + this.data = + (this.data ?: JsonField.of(mutableListOf())).also { + checkKnown("data", it).add(data) + } + } + + fun hasMore(hasMore: Boolean) = hasMore(JsonField.of(hasMore)) + + /** + * Sets [Builder.hasMore] to an arbitrary JSON value. + * + * You should usually call [Builder.hasMore] with a well-typed [Boolean] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun hasMore(hasMore: JsonField) = apply { this.hasMore = hasMore } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ScalarDocListProjectsResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .data() + * .hasMore() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ScalarDocListProjectsResponse = + ScalarDocListProjectsResponse( + checkRequired("data", data).map { it.toImmutable() }, + checkRequired("hasMore", hasMore), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): ScalarDocListProjectsResponse = apply { + if (validated) { + return@apply + } + + data().forEach { it.validate() } + hasMore() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (data.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (hasMore.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ScalarDocListProjectsResponse && + data == other.data && + hasMore == other.hasMore && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(data, hasMore, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ScalarDocListProjectsResponse{data=$data, hasMore=$hasMore, additionalProperties=$additionalProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocPublishProjectParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocPublishProjectParams.kt new file mode 100644 index 0000000..fd904c3 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocPublishProjectParams.kt @@ -0,0 +1,537 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.scalarDocs + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.Params +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Start a build and deploy. The returned `publishUid` identifies the publish record. */ +class ScalarDocPublishProjectParams +private constructor( + private val slug: String?, + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun commitSha(): Optional = body.commitSha() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun preview(): Optional = body.preview() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun configPath(): Optional = body.configPath() + + fun slug(): Optional = Optional.ofNullable(slug) + + /** + * Returns the raw JSON value of [commitSha]. + * + * Unlike [commitSha], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _commitSha(): JsonField = body._commitSha() + + /** + * Returns the raw JSON value of [preview]. + * + * Unlike [preview], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _preview(): JsonField = body._preview() + + /** + * Returns the raw JSON value of [configPath]. + * + * Unlike [configPath], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _configPath(): JsonField = body._configPath() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): ScalarDocPublishProjectParams = builder().build() + + /** + * Returns a mutable builder for constructing an instance of + * [ScalarDocPublishProjectParams]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ScalarDocPublishProjectParams]. */ + class Builder internal constructor() { + + private var slug: String? = null + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(scalarDocPublishProjectParams: ScalarDocPublishProjectParams) = apply { + slug = scalarDocPublishProjectParams.slug + body = scalarDocPublishProjectParams.body.toBuilder() + additionalHeaders = scalarDocPublishProjectParams.additionalHeaders.toBuilder() + additionalQueryParams = scalarDocPublishProjectParams.additionalQueryParams.toBuilder() + } + + fun slug(slug: String?) = apply { this.slug = slug } + + /** Alias for calling [Builder.slug] with `slug.orElse(null)`. */ + fun slug(slug: Optional) = slug(slug.getOrNull()) + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [commitSha] + * - [preview] + * - [configPath] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + fun commitSha(commitSha: String) = apply { body.commitSha(commitSha) } + + /** + * Sets [Builder.commitSha] to an arbitrary JSON value. + * + * You should usually call [Builder.commitSha] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun commitSha(commitSha: JsonField) = apply { body.commitSha(commitSha) } + + fun preview(preview: Boolean) = apply { body.preview(preview) } + + /** + * Sets [Builder.preview] to an arbitrary JSON value. + * + * You should usually call [Builder.preview] with a well-typed [Boolean] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun preview(preview: JsonField) = apply { body.preview(preview) } + + fun configPath(configPath: String) = apply { body.configPath(configPath) } + + /** + * Sets [Builder.configPath] to an arbitrary JSON value. + * + * You should usually call [Builder.configPath] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun configPath(configPath: JsonField) = apply { body.configPath(configPath) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [ScalarDocPublishProjectParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ScalarDocPublishProjectParams = + ScalarDocPublishProjectParams( + slug, + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> slug ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val commitSha: JsonField, + private val preview: JsonField, + private val configPath: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("commitSha") + @ExcludeMissing + commitSha: JsonField = JsonMissing.of(), + @JsonProperty("preview") @ExcludeMissing preview: JsonField = JsonMissing.of(), + @JsonProperty("configPath") + @ExcludeMissing + configPath: JsonField = JsonMissing.of(), + ) : this(commitSha, preview, configPath, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun commitSha(): Optional = commitSha.getOptional("commitSha") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun preview(): Optional = preview.getOptional("preview") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun configPath(): Optional = configPath.getOptional("configPath") + + /** + * Returns the raw JSON value of [commitSha]. + * + * Unlike [commitSha], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("commitSha") @ExcludeMissing fun _commitSha(): JsonField = commitSha + + /** + * Returns the raw JSON value of [preview]. + * + * Unlike [preview], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("preview") @ExcludeMissing fun _preview(): JsonField = preview + + /** + * Returns the raw JSON value of [configPath]. + * + * Unlike [configPath], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("configPath") + @ExcludeMissing + fun _configPath(): JsonField = configPath + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Body]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var commitSha: JsonField = JsonMissing.of() + private var preview: JsonField = JsonMissing.of() + private var configPath: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + commitSha = body.commitSha + preview = body.preview + configPath = body.configPath + additionalProperties = body.additionalProperties.toMutableMap() + } + + fun commitSha(commitSha: String) = commitSha(JsonField.of(commitSha)) + + /** + * Sets [Builder.commitSha] to an arbitrary JSON value. + * + * You should usually call [Builder.commitSha] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun commitSha(commitSha: JsonField) = apply { this.commitSha = commitSha } + + fun preview(preview: Boolean) = preview(JsonField.of(preview)) + + /** + * Sets [Builder.preview] to an arbitrary JSON value. + * + * You should usually call [Builder.preview] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun preview(preview: JsonField) = apply { this.preview = preview } + + fun configPath(configPath: String) = configPath(JsonField.of(configPath)) + + /** + * Sets [Builder.configPath] to an arbitrary JSON value. + * + * You should usually call [Builder.configPath] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun configPath(configPath: JsonField) = apply { this.configPath = configPath } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Body = + Body(commitSha, preview, configPath, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Body = apply { + if (validated) { + return@apply + } + + commitSha() + preview() + configPath() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (commitSha.asKnown().isPresent) 1 else 0) + + (if (preview.asKnown().isPresent) 1 else 0) + + (if (configPath.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + commitSha == other.commitSha && + preview == other.preview && + configPath == other.configPath && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(commitSha, preview, configPath, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{commitSha=$commitSha, preview=$preview, configPath=$configPath, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ScalarDocPublishProjectParams && + slug == other.slug && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash(slug, body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "ScalarDocPublishProjectParams{slug=$slug, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocPublishProjectResponse.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocPublishProjectResponse.kt new file mode 100644 index 0000000..2f4f92b --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocPublishProjectResponse.kt @@ -0,0 +1,182 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.scalarDocs + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.checkRequired +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects + +class ScalarDocPublishProjectResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val publishUid: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("publishUid") @ExcludeMissing publishUid: JsonField = JsonMissing.of() + ) : this(publishUid, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun publishUid(): String = publishUid.getRequired("publishUid") + + /** + * Returns the raw JSON value of [publishUid]. + * + * Unlike [publishUid], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("publishUid") @ExcludeMissing fun _publishUid(): JsonField = publishUid + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [ScalarDocPublishProjectResponse]. + * + * The following fields are required: + * ```kotlin + * .publishUid() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ScalarDocPublishProjectResponse]. */ + class Builder internal constructor() { + + private var publishUid: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(scalarDocPublishProjectResponse: ScalarDocPublishProjectResponse) = + apply { + publishUid = scalarDocPublishProjectResponse.publishUid + additionalProperties = + scalarDocPublishProjectResponse.additionalProperties.toMutableMap() + } + + fun publishUid(publishUid: String) = publishUid(JsonField.of(publishUid)) + + /** + * Sets [Builder.publishUid] to an arbitrary JSON value. + * + * You should usually call [Builder.publishUid] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun publishUid(publishUid: JsonField) = apply { this.publishUid = publishUid } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ScalarDocPublishProjectResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .publishUid() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ScalarDocPublishProjectResponse = + ScalarDocPublishProjectResponse( + checkRequired("publishUid", publishUid), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): ScalarDocPublishProjectResponse = apply { + if (validated) { + return@apply + } + + publishUid() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (if (publishUid.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ScalarDocPublishProjectResponse && + publishUid == other.publishUid && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(publishUid, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ScalarDocPublishProjectResponse{publishUid=$publishUid, additionalProperties=$additionalProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocRetrieveProjectParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocRetrieveProjectParams.kt new file mode 100644 index 0000000..31e8b68 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocRetrieveProjectParams.kt @@ -0,0 +1,196 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.scalarDocs + +import com.scalar.core.Params +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Get a single docs project by its slug. */ +class ScalarDocRetrieveProjectParams +private constructor( + private val slug: String?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun slug(): Optional = Optional.ofNullable(slug) + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): ScalarDocRetrieveProjectParams = builder().build() + + /** + * Returns a mutable builder for constructing an instance of + * [ScalarDocRetrieveProjectParams]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ScalarDocRetrieveProjectParams]. */ + class Builder internal constructor() { + + private var slug: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(scalarDocRetrieveProjectParams: ScalarDocRetrieveProjectParams) = apply { + slug = scalarDocRetrieveProjectParams.slug + additionalHeaders = scalarDocRetrieveProjectParams.additionalHeaders.toBuilder() + additionalQueryParams = scalarDocRetrieveProjectParams.additionalQueryParams.toBuilder() + } + + fun slug(slug: String?) = apply { this.slug = slug } + + /** Alias for calling [Builder.slug] with `slug.orElse(null)`. */ + fun slug(slug: Optional) = slug(slug.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [ScalarDocRetrieveProjectParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ScalarDocRetrieveProjectParams = + ScalarDocRetrieveProjectParams( + slug, + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _pathParam(index: Int): String = + when (index) { + 0 -> slug ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ScalarDocRetrieveProjectParams && + slug == other.slug && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = Objects.hash(slug, additionalHeaders, additionalQueryParams) + + override fun toString() = + "ScalarDocRetrieveProjectParams{slug=$slug, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocUpdateProjectConfigParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocUpdateProjectConfigParams.kt new file mode 100644 index 0000000..6ce2e6d --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocUpdateProjectConfigParams.kt @@ -0,0 +1,679 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.scalarDocs + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.Params +import com.scalar.core.checkRequired +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * Commit `scalar.config.json` straight to the project repository. Pass the `baseToken` from the + * read this edit was based on; a conflict means the file moved underneath it. + */ +class ScalarDocUpdateProjectConfigParams +private constructor( + private val slug: String?, + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun content(): String = body.content() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun ref(): Optional = body.ref() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun baseToken(): Optional = body.baseToken() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun message(): Optional = body.message() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun path(): Optional = body.path() + + fun slug(): Optional = Optional.ofNullable(slug) + + /** + * Returns the raw JSON value of [content]. + * + * Unlike [content], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _content(): JsonField = body._content() + + /** + * Returns the raw JSON value of [ref]. + * + * Unlike [ref], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _ref(): JsonField = body._ref() + + /** + * Returns the raw JSON value of [baseToken]. + * + * Unlike [baseToken], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _baseToken(): JsonField = body._baseToken() + + /** + * Returns the raw JSON value of [message]. + * + * Unlike [message], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _message(): JsonField = body._message() + + /** + * Returns the raw JSON value of [path]. + * + * Unlike [path], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _path(): JsonField = body._path() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [ScalarDocUpdateProjectConfigParams]. + * + * The following fields are required: + * ```kotlin + * .content() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ScalarDocUpdateProjectConfigParams]. */ + class Builder internal constructor() { + + private var slug: String? = null + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(scalarDocUpdateProjectConfigParams: ScalarDocUpdateProjectConfigParams) = + apply { + slug = scalarDocUpdateProjectConfigParams.slug + body = scalarDocUpdateProjectConfigParams.body.toBuilder() + additionalHeaders = scalarDocUpdateProjectConfigParams.additionalHeaders.toBuilder() + additionalQueryParams = + scalarDocUpdateProjectConfigParams.additionalQueryParams.toBuilder() + } + + fun slug(slug: String?) = apply { this.slug = slug } + + /** Alias for calling [Builder.slug] with `slug.orElse(null)`. */ + fun slug(slug: Optional) = slug(slug.getOrNull()) + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [content] + * - [ref] + * - [baseToken] + * - [message] + * - [path] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + fun content(content: String) = apply { body.content(content) } + + /** + * Sets [Builder.content] to an arbitrary JSON value. + * + * You should usually call [Builder.content] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun content(content: JsonField) = apply { body.content(content) } + + fun ref(ref: String) = apply { body.ref(ref) } + + /** + * Sets [Builder.ref] to an arbitrary JSON value. + * + * You should usually call [Builder.ref] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun ref(ref: JsonField) = apply { body.ref(ref) } + + fun baseToken(baseToken: String) = apply { body.baseToken(baseToken) } + + /** + * Sets [Builder.baseToken] to an arbitrary JSON value. + * + * You should usually call [Builder.baseToken] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun baseToken(baseToken: JsonField) = apply { body.baseToken(baseToken) } + + fun message(message: String) = apply { body.message(message) } + + /** + * Sets [Builder.message] to an arbitrary JSON value. + * + * You should usually call [Builder.message] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun message(message: JsonField) = apply { body.message(message) } + + fun path(path: String) = apply { body.path(path) } + + /** + * Sets [Builder.path] to an arbitrary JSON value. + * + * You should usually call [Builder.path] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun path(path: JsonField) = apply { body.path(path) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [ScalarDocUpdateProjectConfigParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .content() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ScalarDocUpdateProjectConfigParams = + ScalarDocUpdateProjectConfigParams( + slug, + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> slug ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val content: JsonField, + private val ref: JsonField, + private val baseToken: JsonField, + private val message: JsonField, + private val path: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("content") @ExcludeMissing content: JsonField = JsonMissing.of(), + @JsonProperty("ref") @ExcludeMissing ref: JsonField = JsonMissing.of(), + @JsonProperty("baseToken") + @ExcludeMissing + baseToken: JsonField = JsonMissing.of(), + @JsonProperty("message") @ExcludeMissing message: JsonField = JsonMissing.of(), + @JsonProperty("path") @ExcludeMissing path: JsonField = JsonMissing.of(), + ) : this(content, ref, baseToken, message, path, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun content(): String = content.getRequired("content") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun ref(): Optional = ref.getOptional("ref") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun baseToken(): Optional = baseToken.getOptional("baseToken") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun message(): Optional = message.getOptional("message") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun path(): Optional = path.getOptional("path") + + /** + * Returns the raw JSON value of [content]. + * + * Unlike [content], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("content") @ExcludeMissing fun _content(): JsonField = content + + /** + * Returns the raw JSON value of [ref]. + * + * Unlike [ref], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ref") @ExcludeMissing fun _ref(): JsonField = ref + + /** + * Returns the raw JSON value of [baseToken]. + * + * Unlike [baseToken], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("baseToken") @ExcludeMissing fun _baseToken(): JsonField = baseToken + + /** + * Returns the raw JSON value of [message]. + * + * Unlike [message], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("message") @ExcludeMissing fun _message(): JsonField = message + + /** + * Returns the raw JSON value of [path]. + * + * Unlike [path], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("path") @ExcludeMissing fun _path(): JsonField = path + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```kotlin + * .content() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var content: JsonField? = null + private var ref: JsonField = JsonMissing.of() + private var baseToken: JsonField = JsonMissing.of() + private var message: JsonField = JsonMissing.of() + private var path: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + content = body.content + ref = body.ref + baseToken = body.baseToken + message = body.message + path = body.path + additionalProperties = body.additionalProperties.toMutableMap() + } + + fun content(content: String) = content(JsonField.of(content)) + + /** + * Sets [Builder.content] to an arbitrary JSON value. + * + * You should usually call [Builder.content] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun content(content: JsonField) = apply { this.content = content } + + fun ref(ref: String) = ref(JsonField.of(ref)) + + /** + * Sets [Builder.ref] to an arbitrary JSON value. + * + * You should usually call [Builder.ref] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun ref(ref: JsonField) = apply { this.ref = ref } + + fun baseToken(baseToken: String) = baseToken(JsonField.of(baseToken)) + + /** + * Sets [Builder.baseToken] to an arbitrary JSON value. + * + * You should usually call [Builder.baseToken] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun baseToken(baseToken: JsonField) = apply { this.baseToken = baseToken } + + fun message(message: String) = message(JsonField.of(message)) + + /** + * Sets [Builder.message] to an arbitrary JSON value. + * + * You should usually call [Builder.message] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun message(message: JsonField) = apply { this.message = message } + + fun path(path: String) = path(JsonField.of(path)) + + /** + * Sets [Builder.path] to an arbitrary JSON value. + * + * You should usually call [Builder.path] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun path(path: JsonField) = apply { this.path = path } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .content() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Body = + Body( + checkRequired("content", content), + ref, + baseToken, + message, + path, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Body = apply { + if (validated) { + return@apply + } + + content() + ref() + baseToken() + message() + path() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (content.asKnown().isPresent) 1 else 0) + + (if (ref.asKnown().isPresent) 1 else 0) + + (if (baseToken.asKnown().isPresent) 1 else 0) + + (if (message.asKnown().isPresent) 1 else 0) + + (if (path.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + content == other.content && + ref == other.ref && + baseToken == other.baseToken && + message == other.message && + path == other.path && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(content, ref, baseToken, message, path, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{content=$content, ref=$ref, baseToken=$baseToken, message=$message, path=$path, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ScalarDocUpdateProjectConfigParams && + slug == other.slug && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash(slug, body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "ScalarDocUpdateProjectConfigParams{slug=$slug, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocUpdateProjectConfigResponse.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocUpdateProjectConfigResponse.kt new file mode 100644 index 0000000..42eaff9 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocUpdateProjectConfigResponse.kt @@ -0,0 +1,259 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.scalarDocs + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.checkRequired +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class ScalarDocUpdateProjectConfigResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val commitSha: JsonField, + private val ref: JsonField, + private val baseToken: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("commitSha") @ExcludeMissing commitSha: JsonField = JsonMissing.of(), + @JsonProperty("ref") @ExcludeMissing ref: JsonField = JsonMissing.of(), + @JsonProperty("baseToken") @ExcludeMissing baseToken: JsonField = JsonMissing.of(), + ) : this(commitSha, ref, baseToken, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun commitSha(): Optional = commitSha.getOptional("commitSha") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun ref(): String = ref.getRequired("ref") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun baseToken(): String = baseToken.getRequired("baseToken") + + /** + * Returns the raw JSON value of [commitSha]. + * + * Unlike [commitSha], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("commitSha") @ExcludeMissing fun _commitSha(): JsonField = commitSha + + /** + * Returns the raw JSON value of [ref]. + * + * Unlike [ref], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ref") @ExcludeMissing fun _ref(): JsonField = ref + + /** + * Returns the raw JSON value of [baseToken]. + * + * Unlike [baseToken], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("baseToken") @ExcludeMissing fun _baseToken(): JsonField = baseToken + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [ScalarDocUpdateProjectConfigResponse]. + * + * The following fields are required: + * ```kotlin + * .commitSha() + * .ref() + * .baseToken() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ScalarDocUpdateProjectConfigResponse]. */ + class Builder internal constructor() { + + private var commitSha: JsonField? = null + private var ref: JsonField? = null + private var baseToken: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + scalarDocUpdateProjectConfigResponse: ScalarDocUpdateProjectConfigResponse + ) = apply { + commitSha = scalarDocUpdateProjectConfigResponse.commitSha + ref = scalarDocUpdateProjectConfigResponse.ref + baseToken = scalarDocUpdateProjectConfigResponse.baseToken + additionalProperties = + scalarDocUpdateProjectConfigResponse.additionalProperties.toMutableMap() + } + + fun commitSha(commitSha: String?) = commitSha(JsonField.ofNullable(commitSha)) + + /** Alias for calling [Builder.commitSha] with `commitSha.orElse(null)`. */ + fun commitSha(commitSha: Optional) = commitSha(commitSha.getOrNull()) + + /** + * Sets [Builder.commitSha] to an arbitrary JSON value. + * + * You should usually call [Builder.commitSha] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun commitSha(commitSha: JsonField) = apply { this.commitSha = commitSha } + + fun ref(ref: String) = ref(JsonField.of(ref)) + + /** + * Sets [Builder.ref] to an arbitrary JSON value. + * + * You should usually call [Builder.ref] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun ref(ref: JsonField) = apply { this.ref = ref } + + fun baseToken(baseToken: String) = baseToken(JsonField.of(baseToken)) + + /** + * Sets [Builder.baseToken] to an arbitrary JSON value. + * + * You should usually call [Builder.baseToken] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun baseToken(baseToken: JsonField) = apply { this.baseToken = baseToken } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ScalarDocUpdateProjectConfigResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .commitSha() + * .ref() + * .baseToken() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ScalarDocUpdateProjectConfigResponse = + ScalarDocUpdateProjectConfigResponse( + checkRequired("commitSha", commitSha), + checkRequired("ref", ref), + checkRequired("baseToken", baseToken), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): ScalarDocUpdateProjectConfigResponse = apply { + if (validated) { + return@apply + } + + commitSha() + ref() + baseToken() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (commitSha.asKnown().isPresent) 1 else 0) + + (if (ref.asKnown().isPresent) 1 else 0) + + (if (baseToken.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ScalarDocUpdateProjectConfigResponse && + commitSha == other.commitSha && + ref == other.ref && + baseToken == other.baseToken && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(commitSha, ref, baseToken, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ScalarDocUpdateProjectConfigResponse{commitSha=$commitSha, ref=$ref, baseToken=$baseToken, additionalProperties=$additionalProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocUpdateProjectParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocUpdateProjectParams.kt new file mode 100644 index 0000000..d163745 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocUpdateProjectParams.kt @@ -0,0 +1,1083 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.scalarDocs + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.scalar.core.BaseDeserializer +import com.scalar.core.BaseSerializer +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.Params +import com.scalar.core.allMaxBy +import com.scalar.core.checkKnown +import com.scalar.core.getOrThrow +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import com.scalar.core.toImmutable +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Update project settings. Set `isPrivate` with `accessGroups` to put the site behind a login. */ +class ScalarDocUpdateProjectParams +private constructor( + private val slug: String?, + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun name(): Optional = body.name() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun isPrivate(): Optional = body.isPrivate() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun accessGroups(): Optional> = body.accessGroups() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun loginPortalUid(): Optional = body.loginPortalUid() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun activeThemeId(): Optional = body.activeThemeId() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun agentEnabled(): Optional = body.agentEnabled() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun analyticsEnabled(): Optional = body.analyticsEnabled() + + fun slug(): Optional = Optional.ofNullable(slug) + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _name(): JsonField = body._name() + + /** + * Returns the raw JSON value of [isPrivate]. + * + * Unlike [isPrivate], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _isPrivate(): JsonField = body._isPrivate() + + /** + * Returns the raw JSON value of [accessGroups]. + * + * Unlike [accessGroups], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _accessGroups(): JsonField> = body._accessGroups() + + /** + * Returns the raw JSON value of [loginPortalUid]. + * + * Unlike [loginPortalUid], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _loginPortalUid(): JsonField = body._loginPortalUid() + + /** + * Returns the raw JSON value of [activeThemeId]. + * + * Unlike [activeThemeId], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _activeThemeId(): JsonField = body._activeThemeId() + + /** + * Returns the raw JSON value of [agentEnabled]. + * + * Unlike [agentEnabled], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _agentEnabled(): JsonField = body._agentEnabled() + + /** + * Returns the raw JSON value of [analyticsEnabled]. + * + * Unlike [analyticsEnabled], this method doesn't throw if the JSON field has an unexpected + * type. + */ + fun _analyticsEnabled(): JsonField = body._analyticsEnabled() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): ScalarDocUpdateProjectParams = builder().build() + + /** + * Returns a mutable builder for constructing an instance of [ScalarDocUpdateProjectParams]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ScalarDocUpdateProjectParams]. */ + class Builder internal constructor() { + + private var slug: String? = null + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(scalarDocUpdateProjectParams: ScalarDocUpdateProjectParams) = apply { + slug = scalarDocUpdateProjectParams.slug + body = scalarDocUpdateProjectParams.body.toBuilder() + additionalHeaders = scalarDocUpdateProjectParams.additionalHeaders.toBuilder() + additionalQueryParams = scalarDocUpdateProjectParams.additionalQueryParams.toBuilder() + } + + fun slug(slug: String?) = apply { this.slug = slug } + + /** Alias for calling [Builder.slug] with `slug.orElse(null)`. */ + fun slug(slug: Optional) = slug(slug.getOrNull()) + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [name] + * - [isPrivate] + * - [accessGroups] + * - [loginPortalUid] + * - [activeThemeId] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + fun name(name: String) = apply { body.name(name) } + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { body.name(name) } + + fun isPrivate(isPrivate: Boolean) = apply { body.isPrivate(isPrivate) } + + /** + * Sets [Builder.isPrivate] to an arbitrary JSON value. + * + * You should usually call [Builder.isPrivate] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun isPrivate(isPrivate: JsonField) = apply { body.isPrivate(isPrivate) } + + fun accessGroups(accessGroups: List) = apply { body.accessGroups(accessGroups) } + + /** + * Sets [Builder.accessGroups] to an arbitrary JSON value. + * + * You should usually call [Builder.accessGroups] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun accessGroups(accessGroups: JsonField>) = apply { + body.accessGroups(accessGroups) + } + + /** + * Adds a single [String] to [accessGroups]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addAccessGroup(accessGroup: String) = apply { body.addAccessGroup(accessGroup) } + + fun loginPortalUid(loginPortalUid: LoginPortalUid) = apply { + body.loginPortalUid(loginPortalUid) + } + + /** + * Sets [Builder.loginPortalUid] to an arbitrary JSON value. + * + * You should usually call [Builder.loginPortalUid] with a well-typed [LoginPortalUid] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun loginPortalUid(loginPortalUid: JsonField) = apply { + body.loginPortalUid(loginPortalUid) + } + + /** Alias for calling [loginPortalUid] with `LoginPortalUid.ofNanoid(nanoid)`. */ + fun loginPortalUid(nanoid: String) = apply { body.loginPortalUid(nanoid) } + + fun activeThemeId(activeThemeId: String) = apply { body.activeThemeId(activeThemeId) } + + /** + * Sets [Builder.activeThemeId] to an arbitrary JSON value. + * + * You should usually call [Builder.activeThemeId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun activeThemeId(activeThemeId: JsonField) = apply { + body.activeThemeId(activeThemeId) + } + + fun agentEnabled(agentEnabled: Boolean) = apply { body.agentEnabled(agentEnabled) } + + /** + * Sets [Builder.agentEnabled] to an arbitrary JSON value. + * + * You should usually call [Builder.agentEnabled] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun agentEnabled(agentEnabled: JsonField) = apply { + body.agentEnabled(agentEnabled) + } + + fun analyticsEnabled(analyticsEnabled: Boolean) = apply { + body.analyticsEnabled(analyticsEnabled) + } + + /** + * Sets [Builder.analyticsEnabled] to an arbitrary JSON value. + * + * You should usually call [Builder.analyticsEnabled] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun analyticsEnabled(analyticsEnabled: JsonField) = apply { + body.analyticsEnabled(analyticsEnabled) + } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [ScalarDocUpdateProjectParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ScalarDocUpdateProjectParams = + ScalarDocUpdateProjectParams( + slug, + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> slug ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val name: JsonField, + private val isPrivate: JsonField, + private val accessGroups: JsonField>, + private val loginPortalUid: JsonField, + private val activeThemeId: JsonField, + private val agentEnabled: JsonField, + private val analyticsEnabled: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("isPrivate") + @ExcludeMissing + isPrivate: JsonField = JsonMissing.of(), + @JsonProperty("accessGroups") + @ExcludeMissing + accessGroups: JsonField> = JsonMissing.of(), + @JsonProperty("loginPortalUid") + @ExcludeMissing + loginPortalUid: JsonField = JsonMissing.of(), + @JsonProperty("activeThemeId") + @ExcludeMissing + activeThemeId: JsonField = JsonMissing.of(), + @JsonProperty("agentEnabled") + @ExcludeMissing + agentEnabled: JsonField = JsonMissing.of(), + @JsonProperty("analyticsEnabled") + @ExcludeMissing + analyticsEnabled: JsonField = JsonMissing.of(), + ) : this( + name, + isPrivate, + accessGroups, + loginPortalUid, + activeThemeId, + agentEnabled, + analyticsEnabled, + mutableMapOf(), + ) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun name(): Optional = name.getOptional("name") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun isPrivate(): Optional = isPrivate.getOptional("isPrivate") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun accessGroups(): Optional> = accessGroups.getOptional("accessGroups") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun loginPortalUid(): Optional = + loginPortalUid.getOptional("loginPortalUid") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun activeThemeId(): Optional = activeThemeId.getOptional("activeThemeId") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun agentEnabled(): Optional = agentEnabled.getOptional("agentEnabled") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun analyticsEnabled(): Optional = analyticsEnabled.getOptional("analyticsEnabled") + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [isPrivate]. + * + * Unlike [isPrivate], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("isPrivate") @ExcludeMissing fun _isPrivate(): JsonField = isPrivate + + /** + * Returns the raw JSON value of [accessGroups]. + * + * Unlike [accessGroups], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("accessGroups") + @ExcludeMissing + fun _accessGroups(): JsonField> = accessGroups + + /** + * Returns the raw JSON value of [loginPortalUid]. + * + * Unlike [loginPortalUid], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("loginPortalUid") + @ExcludeMissing + fun _loginPortalUid(): JsonField = loginPortalUid + + /** + * Returns the raw JSON value of [activeThemeId]. + * + * Unlike [activeThemeId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("activeThemeId") + @ExcludeMissing + fun _activeThemeId(): JsonField = activeThemeId + + /** + * Returns the raw JSON value of [agentEnabled]. + * + * Unlike [agentEnabled], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("agentEnabled") + @ExcludeMissing + fun _agentEnabled(): JsonField = agentEnabled + + /** + * Returns the raw JSON value of [analyticsEnabled]. + * + * Unlike [analyticsEnabled], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("analyticsEnabled") + @ExcludeMissing + fun _analyticsEnabled(): JsonField = analyticsEnabled + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Body]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var name: JsonField = JsonMissing.of() + private var isPrivate: JsonField = JsonMissing.of() + private var accessGroups: JsonField>? = null + private var loginPortalUid: JsonField = JsonMissing.of() + private var activeThemeId: JsonField = JsonMissing.of() + private var agentEnabled: JsonField = JsonMissing.of() + private var analyticsEnabled: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + name = body.name + isPrivate = body.isPrivate + accessGroups = body.accessGroups.map { it.toMutableList() } + loginPortalUid = body.loginPortalUid + activeThemeId = body.activeThemeId + agentEnabled = body.agentEnabled + analyticsEnabled = body.analyticsEnabled + additionalProperties = body.additionalProperties.toMutableMap() + } + + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + fun isPrivate(isPrivate: Boolean) = isPrivate(JsonField.of(isPrivate)) + + /** + * Sets [Builder.isPrivate] to an arbitrary JSON value. + * + * You should usually call [Builder.isPrivate] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun isPrivate(isPrivate: JsonField) = apply { this.isPrivate = isPrivate } + + fun accessGroups(accessGroups: List) = accessGroups(JsonField.of(accessGroups)) + + /** + * Sets [Builder.accessGroups] to an arbitrary JSON value. + * + * You should usually call [Builder.accessGroups] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun accessGroups(accessGroups: JsonField>) = apply { + this.accessGroups = accessGroups.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [accessGroups]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addAccessGroup(accessGroup: String) = apply { + accessGroups = + (accessGroups ?: JsonField.of(mutableListOf())).also { + checkKnown("accessGroups", it).add(accessGroup) + } + } + + fun loginPortalUid(loginPortalUid: LoginPortalUid) = + loginPortalUid(JsonField.of(loginPortalUid)) + + /** + * Sets [Builder.loginPortalUid] to an arbitrary JSON value. + * + * You should usually call [Builder.loginPortalUid] with a well-typed [LoginPortalUid] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun loginPortalUid(loginPortalUid: JsonField) = apply { + this.loginPortalUid = loginPortalUid + } + + /** Alias for calling [loginPortalUid] with `LoginPortalUid.ofNanoid(nanoid)`. */ + fun loginPortalUid(nanoid: String) = loginPortalUid(LoginPortalUid.ofNanoid(nanoid)) + + fun activeThemeId(activeThemeId: String) = activeThemeId(JsonField.of(activeThemeId)) + + /** + * Sets [Builder.activeThemeId] to an arbitrary JSON value. + * + * You should usually call [Builder.activeThemeId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun activeThemeId(activeThemeId: JsonField) = apply { + this.activeThemeId = activeThemeId + } + + fun agentEnabled(agentEnabled: Boolean) = agentEnabled(JsonField.of(agentEnabled)) + + /** + * Sets [Builder.agentEnabled] to an arbitrary JSON value. + * + * You should usually call [Builder.agentEnabled] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun agentEnabled(agentEnabled: JsonField) = apply { + this.agentEnabled = agentEnabled + } + + fun analyticsEnabled(analyticsEnabled: Boolean) = + analyticsEnabled(JsonField.of(analyticsEnabled)) + + /** + * Sets [Builder.analyticsEnabled] to an arbitrary JSON value. + * + * You should usually call [Builder.analyticsEnabled] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun analyticsEnabled(analyticsEnabled: JsonField) = apply { + this.analyticsEnabled = analyticsEnabled + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Body = + Body( + name, + isPrivate, + (accessGroups ?: JsonMissing.of()).map { it.toImmutable() }, + loginPortalUid, + activeThemeId, + agentEnabled, + analyticsEnabled, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Body = apply { + if (validated) { + return@apply + } + + name() + isPrivate() + accessGroups() + loginPortalUid().ifPresent { it.validate() } + activeThemeId() + agentEnabled() + analyticsEnabled() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (name.asKnown().isPresent) 1 else 0) + + (if (isPrivate.asKnown().isPresent) 1 else 0) + + (accessGroups.asKnown().getOrNull()?.size ?: 0) + + (loginPortalUid.asKnown().getOrNull()?.validity() ?: 0) + + (if (activeThemeId.asKnown().isPresent) 1 else 0) + + (if (agentEnabled.asKnown().isPresent) 1 else 0) + + (if (analyticsEnabled.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + name == other.name && + isPrivate == other.isPrivate && + accessGroups == other.accessGroups && + loginPortalUid == other.loginPortalUid && + activeThemeId == other.activeThemeId && + agentEnabled == other.agentEnabled && + analyticsEnabled == other.analyticsEnabled && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + name, + isPrivate, + accessGroups, + loginPortalUid, + activeThemeId, + agentEnabled, + analyticsEnabled, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{name=$name, isPrivate=$isPrivate, accessGroups=$accessGroups, loginPortalUid=$loginPortalUid, activeThemeId=$activeThemeId, agentEnabled=$agentEnabled, analyticsEnabled=$analyticsEnabled, additionalProperties=$additionalProperties}" + } + + @JsonDeserialize(using = LoginPortalUid.Deserializer::class) + @JsonSerialize(using = LoginPortalUid.Serializer::class) + class LoginPortalUid + private constructor( + private val nanoid: String? = null, + private val string: String? = null, + private val _json: JsonValue? = null, + ) { + + fun nanoid(): Optional = Optional.ofNullable(nanoid) + + fun string(): Optional = Optional.ofNullable(string) + + fun isNanoid(): Boolean = nanoid != null + + fun isString(): Boolean = string != null + + fun asNanoid(): String = nanoid.getOrThrow("nanoid") + + fun asString(): String = string.getOrThrow("string") + + fun _json(): Optional = Optional.ofNullable(_json) + + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.scalar.core.JsonValue; + * import java.util.Optional; + * + * Optional result = + * loginPortalUid.accept( + * new LoginPortalUid.Visitor>() { + * @Override + * public Optional visitNanoid(String nanoid) { + * return Optional.of(nanoid.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ScalarInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ + fun accept(visitor: Visitor): T = + when { + nanoid != null -> visitor.visitNanoid(nanoid) + string != null -> visitor.visitString(string) + else -> visitor.unknown(_json) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): LoginPortalUid = apply { + if (validated) { + return@apply + } + + accept( + object : Visitor { + override fun visitNanoid(nanoid: String) {} + + override fun visitString(string: String) {} + } + ) + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + accept( + object : Visitor { + override fun visitNanoid(nanoid: String) = 1 + + override fun visitString(string: String) = 1 + + override fun unknown(json: JsonValue?) = 0 + } + ) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is LoginPortalUid && nanoid == other.nanoid && string == other.string + } + + override fun hashCode(): Int = Objects.hash(nanoid, string) + + override fun toString(): String = + when { + nanoid != null -> "LoginPortalUid{nanoid=$nanoid}" + string != null -> "LoginPortalUid{string=$string}" + _json != null -> "LoginPortalUid{_unknown=$_json}" + else -> throw IllegalStateException("Invalid LoginPortalUid") + } + + companion object { + + @JvmStatic fun ofNanoid(nanoid: String) = LoginPortalUid(nanoid = nanoid) + + @JvmStatic fun ofString(string: String) = LoginPortalUid(string = string) + } + + /** + * An interface that defines how to map each variant of [LoginPortalUid] to a value of type + * [T]. + */ + interface Visitor { + + fun visitNanoid(nanoid: String): T + + fun visitString(string: String): T + + /** + * Maps an unknown variant of [LoginPortalUid] to a value of type [T]. + * + * An instance of [LoginPortalUid] can contain an unknown variant if it was deserialized + * from data that doesn't match any known variant. For example, if the SDK is on an + * older version than the API, then the API may respond with new variants that the SDK + * is unaware of. + * + * @throws ScalarInvalidDataException in the default implementation. + */ + fun unknown(json: JsonValue?): T { + throw ScalarInvalidDataException("Unknown LoginPortalUid: $json") + } + } + + internal class Deserializer : BaseDeserializer(LoginPortalUid::class) { + + override fun ObjectCodec.deserialize(node: JsonNode): LoginPortalUid { + val json = JsonValue.fromJsonNode(node) + + val bestMatches = + sequenceOf( + tryDeserialize(node, jacksonTypeRef())?.let { + LoginPortalUid(nanoid = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + LoginPortalUid(string = it, _json = json) + }, + ) + .filterNotNull() + .allMaxBy { it.validity() } + .toList() + return when (bestMatches.size) { + // This can happen if what we're deserializing is completely incompatible with + // all the possible variants (e.g. deserializing from boolean). + 0 -> LoginPortalUid(_json = json) + 1 -> bestMatches.single() + // If there's more than one match with the highest validity, then use the first + // completely valid match, or simply the first match if none are completely + // valid. + else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first() + } + } + } + + internal class Serializer : BaseSerializer(LoginPortalUid::class) { + + override fun serialize( + value: LoginPortalUid, + generator: JsonGenerator, + provider: SerializerProvider, + ) { + when { + value.nanoid != null -> generator.writeObject(value.nanoid) + value.string != null -> generator.writeObject(value.string) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid LoginPortalUid") + } + } + } + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ScalarDocUpdateProjectParams && + slug == other.slug && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash(slug, body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "ScalarDocUpdateProjectParams{slug=$slug, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/schemas/ManagedSchemaVersion.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/schemas/ManagedSchemaVersion.kt new file mode 100644 index 0000000..5d01046 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/schemas/ManagedSchemaVersion.kt @@ -0,0 +1,344 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.schemas + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.checkRequired +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional + +class ManagedSchemaVersion +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val uid: JsonField, + private val createdAt: JsonField, + private val updatedAt: JsonField, + private val version: JsonField, + private val yamlSha: JsonField, + private val jsonSha: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("uid") @ExcludeMissing uid: JsonField = JsonMissing.of(), + @JsonProperty("createdAt") @ExcludeMissing createdAt: JsonField = JsonMissing.of(), + @JsonProperty("updatedAt") @ExcludeMissing updatedAt: JsonField = JsonMissing.of(), + @JsonProperty("version") @ExcludeMissing version: JsonField = JsonMissing.of(), + @JsonProperty("yamlSha") @ExcludeMissing yamlSha: JsonField = JsonMissing.of(), + @JsonProperty("jsonSha") @ExcludeMissing jsonSha: JsonField = JsonMissing.of(), + ) : this(uid, createdAt, updatedAt, version, yamlSha, jsonSha, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun uid(): String = uid.getRequired("uid") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun createdAt(): Long = createdAt.getRequired("createdAt") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun updatedAt(): Long = updatedAt.getRequired("updatedAt") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun version(): String = version.getRequired("version") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun yamlSha(): Optional = yamlSha.getOptional("yamlSha") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun jsonSha(): Optional = jsonSha.getOptional("jsonSha") + + /** + * Returns the raw JSON value of [uid]. + * + * Unlike [uid], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("uid") @ExcludeMissing fun _uid(): JsonField = uid + + /** + * Returns the raw JSON value of [createdAt]. + * + * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("createdAt") @ExcludeMissing fun _createdAt(): JsonField = createdAt + + /** + * Returns the raw JSON value of [updatedAt]. + * + * Unlike [updatedAt], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("updatedAt") @ExcludeMissing fun _updatedAt(): JsonField = updatedAt + + /** + * Returns the raw JSON value of [version]. + * + * Unlike [version], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("version") @ExcludeMissing fun _version(): JsonField = version + + /** + * Returns the raw JSON value of [yamlSha]. + * + * Unlike [yamlSha], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("yamlSha") @ExcludeMissing fun _yamlSha(): JsonField = yamlSha + + /** + * Returns the raw JSON value of [jsonSha]. + * + * Unlike [jsonSha], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("jsonSha") @ExcludeMissing fun _jsonSha(): JsonField = jsonSha + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [ManagedSchemaVersion]. + * + * The following fields are required: + * ```kotlin + * .uid() + * .createdAt() + * .updatedAt() + * .version() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ManagedSchemaVersion]. */ + class Builder internal constructor() { + + private var uid: JsonField? = null + private var createdAt: JsonField? = null + private var updatedAt: JsonField? = null + private var version: JsonField? = null + private var yamlSha: JsonField = JsonMissing.of() + private var jsonSha: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(managedSchemaVersion: ManagedSchemaVersion) = apply { + uid = managedSchemaVersion.uid + createdAt = managedSchemaVersion.createdAt + updatedAt = managedSchemaVersion.updatedAt + version = managedSchemaVersion.version + yamlSha = managedSchemaVersion.yamlSha + jsonSha = managedSchemaVersion.jsonSha + additionalProperties = managedSchemaVersion.additionalProperties.toMutableMap() + } + + fun uid(uid: String) = uid(JsonField.of(uid)) + + /** + * Sets [Builder.uid] to an arbitrary JSON value. + * + * You should usually call [Builder.uid] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun uid(uid: JsonField) = apply { this.uid = uid } + + fun createdAt(createdAt: Long) = createdAt(JsonField.of(createdAt)) + + /** + * Sets [Builder.createdAt] to an arbitrary JSON value. + * + * You should usually call [Builder.createdAt] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } + + fun updatedAt(updatedAt: Long) = updatedAt(JsonField.of(updatedAt)) + + /** + * Sets [Builder.updatedAt] to an arbitrary JSON value. + * + * You should usually call [Builder.updatedAt] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun updatedAt(updatedAt: JsonField) = apply { this.updatedAt = updatedAt } + + fun version(version: String) = version(JsonField.of(version)) + + /** + * Sets [Builder.version] to an arbitrary JSON value. + * + * You should usually call [Builder.version] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun version(version: JsonField) = apply { this.version = version } + + fun yamlSha(yamlSha: String) = yamlSha(JsonField.of(yamlSha)) + + /** + * Sets [Builder.yamlSha] to an arbitrary JSON value. + * + * You should usually call [Builder.yamlSha] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun yamlSha(yamlSha: JsonField) = apply { this.yamlSha = yamlSha } + + fun jsonSha(jsonSha: String) = jsonSha(JsonField.of(jsonSha)) + + /** + * Sets [Builder.jsonSha] to an arbitrary JSON value. + * + * You should usually call [Builder.jsonSha] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun jsonSha(jsonSha: JsonField) = apply { this.jsonSha = jsonSha } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ManagedSchemaVersion]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .uid() + * .createdAt() + * .updatedAt() + * .version() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ManagedSchemaVersion = + ManagedSchemaVersion( + checkRequired("uid", uid), + checkRequired("createdAt", createdAt), + checkRequired("updatedAt", updatedAt), + checkRequired("version", version), + yamlSha, + jsonSha, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): ManagedSchemaVersion = apply { + if (validated) { + return@apply + } + + uid() + createdAt() + updatedAt() + version() + yamlSha() + jsonSha() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (uid.asKnown().isPresent) 1 else 0) + + (if (createdAt.asKnown().isPresent) 1 else 0) + + (if (updatedAt.asKnown().isPresent) 1 else 0) + + (if (version.asKnown().isPresent) 1 else 0) + + (if (yamlSha.asKnown().isPresent) 1 else 0) + + (if (jsonSha.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ManagedSchemaVersion && + uid == other.uid && + createdAt == other.createdAt && + updatedAt == other.updatedAt && + version == other.version && + yamlSha == other.yamlSha && + jsonSha == other.jsonSha && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(uid, createdAt, updatedAt, version, yamlSha, jsonSha, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ManagedSchemaVersion{uid=$uid, createdAt=$createdAt, updatedAt=$updatedAt, version=$version, yamlSha=$yamlSha, jsonSha=$jsonSha, additionalProperties=$additionalProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/registry/RegistryListAllApiDocumentsResponse.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/schemas/Schema.kt similarity index 72% rename from scalar-java-core/src/main/kotlin/com/scalar/models/registry/RegistryListAllApiDocumentsResponse.kt rename to scalar-java-core/src/main/kotlin/com/scalar/models/schemas/Schema.kt index fd913cc..00a84a7 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/models/registry/RegistryListAllApiDocumentsResponse.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/schemas/Schema.kt @@ -1,6 +1,6 @@ // File generated by Scalar SDK Generator. DO NOT EDIT. -package com.scalar.models.registry +package com.scalar.models.schemas import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter @@ -14,54 +14,37 @@ import com.scalar.core.checkKnown import com.scalar.core.checkRequired import com.scalar.core.toImmutable import com.scalar.errors.ScalarInvalidDataException -import com.scalar.models.ManagedDocVersion import java.util.Collections import java.util.Objects -import java.util.Optional import kotlin.jvm.optionals.getOrNull -class RegistryListAllApiDocumentsResponse +class Schema @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val uid: JsonField, - private val version: JsonField, private val title: JsonField, - private val slug: JsonField, private val description: JsonField, + private val slug: JsonField, private val namespace: JsonField, private val isPrivate: JsonField, - private val tags: JsonField, - private val versions: JsonField>, + private val versions: JsonField>, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( @JsonProperty("uid") @ExcludeMissing uid: JsonField = JsonMissing.of(), - @JsonProperty("version") @ExcludeMissing version: JsonField = JsonMissing.of(), @JsonProperty("title") @ExcludeMissing title: JsonField = JsonMissing.of(), - @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing description: JsonField = JsonMissing.of(), + @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), @JsonProperty("namespace") @ExcludeMissing namespace: JsonField = JsonMissing.of(), @JsonProperty("isPrivate") @ExcludeMissing isPrivate: JsonField = JsonMissing.of(), - @JsonProperty("tags") @ExcludeMissing tags: JsonField = JsonMissing.of(), @JsonProperty("versions") @ExcludeMissing - versions: JsonField> = JsonMissing.of(), - ) : this( - uid, - version, - title, - slug, - description, - namespace, - isPrivate, - tags, - versions, - mutableMapOf(), - ) + versions: JsonField> = JsonMissing.of(), + ) : this(uid, title, description, slug, namespace, isPrivate, versions, mutableMapOf()) /** * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is @@ -69,12 +52,6 @@ private constructor( */ fun uid(): String = uid.getRequired("uid") - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun version(): String = version.getRequired("version") - /** * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -85,13 +62,13 @@ private constructor( * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun slug(): String = slug.getRequired("slug") + fun description(): String = description.getRequired("description") /** * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun description(): String = description.getRequired("description") + fun slug(): String = slug.getRequired("slug") /** * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is @@ -105,17 +82,11 @@ private constructor( */ fun isPrivate(): Boolean = isPrivate.getRequired("isPrivate") - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun tags(): Optional = tags.getOptional("tags") - /** * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun versions(): List = versions.getRequired("versions") + fun versions(): List = versions.getRequired("versions") /** * Returns the raw JSON value of [uid]. @@ -124,13 +95,6 @@ private constructor( */ @JsonProperty("uid") @ExcludeMissing fun _uid(): JsonField = uid - /** - * Returns the raw JSON value of [version]. - * - * Unlike [version], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("version") @ExcludeMissing fun _version(): JsonField = version - /** * Returns the raw JSON value of [title]. * @@ -139,18 +103,18 @@ private constructor( @JsonProperty("title") @ExcludeMissing fun _title(): JsonField = title /** - * Returns the raw JSON value of [slug]. + * Returns the raw JSON value of [description]. * - * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug + @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description /** - * Returns the raw JSON value of [description]. + * Returns the raw JSON value of [slug]. * - * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description + @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug /** * Returns the raw JSON value of [namespace]. @@ -166,13 +130,6 @@ private constructor( */ @JsonProperty("isPrivate") @ExcludeMissing fun _isPrivate(): JsonField = isPrivate - /** - * Returns the raw JSON value of [tags]. - * - * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("tags") @ExcludeMissing fun _tags(): JsonField = tags - /** * Returns the raw JSON value of [versions]. * @@ -180,7 +137,7 @@ private constructor( */ @JsonProperty("versions") @ExcludeMissing - fun _versions(): JsonField> = versions + fun _versions(): JsonField> = versions @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -197,54 +154,44 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [RegistryListAllApiDocumentsResponse]. + * Returns a mutable builder for constructing an instance of [Schema]. * * The following fields are required: * ```kotlin * .uid() - * .version() * .title() - * .slug() * .description() + * .slug() * .namespace() * .isPrivate() - * .tags() * .versions() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [RegistryListAllApiDocumentsResponse]. */ + /** A builder for [Schema]. */ class Builder internal constructor() { private var uid: JsonField? = null - private var version: JsonField? = null private var title: JsonField? = null - private var slug: JsonField? = null private var description: JsonField? = null + private var slug: JsonField? = null private var namespace: JsonField? = null private var isPrivate: JsonField? = null - private var tags: JsonField? = null - private var versions: JsonField>? = null + private var versions: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - registryListAllApiDocumentsResponse: RegistryListAllApiDocumentsResponse - ) = apply { - uid = registryListAllApiDocumentsResponse.uid - version = registryListAllApiDocumentsResponse.version - title = registryListAllApiDocumentsResponse.title - slug = registryListAllApiDocumentsResponse.slug - description = registryListAllApiDocumentsResponse.description - namespace = registryListAllApiDocumentsResponse.namespace - isPrivate = registryListAllApiDocumentsResponse.isPrivate - tags = registryListAllApiDocumentsResponse.tags - versions = registryListAllApiDocumentsResponse.versions.map { it.toMutableList() } - additionalProperties = - registryListAllApiDocumentsResponse.additionalProperties.toMutableMap() + internal fun from(schema: Schema) = apply { + uid = schema.uid + title = schema.title + description = schema.description + slug = schema.slug + namespace = schema.namespace + isPrivate = schema.isPrivate + versions = schema.versions.map { it.toMutableList() } + additionalProperties = schema.additionalProperties.toMutableMap() } fun uid(uid: String) = uid(JsonField.of(uid)) @@ -257,16 +204,6 @@ private constructor( */ fun uid(uid: JsonField) = apply { this.uid = uid } - fun version(version: String) = version(JsonField.of(version)) - - /** - * Sets [Builder.version] to an arbitrary JSON value. - * - * You should usually call [Builder.version] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun version(version: JsonField) = apply { this.version = version } - fun title(title: String) = title(JsonField.of(title)) /** @@ -277,16 +214,6 @@ private constructor( */ fun title(title: JsonField) = apply { this.title = title } - fun slug(slug: String) = slug(JsonField.of(slug)) - - /** - * Sets [Builder.slug] to an arbitrary JSON value. - * - * You should usually call [Builder.slug] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun slug(slug: JsonField) = apply { this.slug = slug } - fun description(description: String) = description(JsonField.of(description)) /** @@ -298,6 +225,16 @@ private constructor( */ fun description(description: JsonField) = apply { this.description = description } + fun slug(slug: String) = slug(JsonField.of(slug)) + + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun slug(slug: JsonField) = apply { this.slug = slug } + fun namespace(namespace: String) = namespace(JsonField.of(namespace)) /** @@ -320,38 +257,25 @@ private constructor( */ fun isPrivate(isPrivate: JsonField) = apply { this.isPrivate = isPrivate } - fun tags(tags: Any?) = tags(JsonField.ofNullable(tags)) - - /** Alias for calling [Builder.tags] with `tags.orElse(null)`. */ - fun tags(tags: Optional) = tags(tags.getOrNull()) - - /** - * Sets [Builder.tags] to an arbitrary JSON value. - * - * You should usually call [Builder.tags] with a well-typed [Any] value instead. This method - * is primarily for setting the field to an undocumented or not yet supported value. - */ - fun tags(tags: JsonField) = apply { this.tags = tags } - - fun versions(versions: List) = versions(JsonField.of(versions)) + fun versions(versions: List) = versions(JsonField.of(versions)) /** * Sets [Builder.versions] to an arbitrary JSON value. * - * You should usually call [Builder.versions] with a well-typed `List` + * You should usually call [Builder.versions] with a well-typed `List` * value instead. This method is primarily for setting the field to an undocumented or not * yet supported value. */ - fun versions(versions: JsonField>) = apply { + fun versions(versions: JsonField>) = apply { this.versions = versions.map { it.toMutableList() } } /** - * Adds a single [ManagedDocVersion] to [versions]. + * Adds a single [ManagedSchemaVersion] to [versions]. * * @throws IllegalStateException if the field was previously set to a non-list. */ - fun addVersion(version: ManagedDocVersion) = apply { + fun addVersion(version: ManagedSchemaVersion) = apply { versions = (versions ?: JsonField.of(mutableListOf())).also { checkKnown("versions", it).add(version) @@ -378,35 +302,31 @@ private constructor( } /** - * Returns an immutable instance of [RegistryListAllApiDocumentsResponse]. + * Returns an immutable instance of [Schema]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```kotlin * .uid() - * .version() * .title() - * .slug() * .description() + * .slug() * .namespace() * .isPrivate() - * .tags() * .versions() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): RegistryListAllApiDocumentsResponse = - RegistryListAllApiDocumentsResponse( + fun build(): Schema = + Schema( checkRequired("uid", uid), - checkRequired("version", version), checkRequired("title", title), - checkRequired("slug", slug), checkRequired("description", description), + checkRequired("slug", slug), checkRequired("namespace", namespace), checkRequired("isPrivate", isPrivate), - checkRequired("tags", tags), checkRequired("versions", versions).map { it.toImmutable() }, additionalProperties.toMutableMap(), ) @@ -422,19 +342,17 @@ private constructor( * @throws ScalarInvalidDataException if any value type in this object doesn't match its * expected type. */ - fun validate(): RegistryListAllApiDocumentsResponse = apply { + fun validate(): Schema = apply { if (validated) { return@apply } uid() - version() title() - slug() description() + slug() namespace() isPrivate() - tags() versions().forEach { it.validate() } validated = true } @@ -455,13 +373,11 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (uid.asKnown().isPresent) 1 else 0) + - (if (version.asKnown().isPresent) 1 else 0) + (if (title.asKnown().isPresent) 1 else 0) + - (if (slug.asKnown().isPresent) 1 else 0) + (if (description.asKnown().isPresent) 1 else 0) + + (if (slug.asKnown().isPresent) 1 else 0) + (if (namespace.asKnown().isPresent) 1 else 0) + (if (isPrivate.asKnown().isPresent) 1 else 0) + - (if (tags.asKnown().isPresent) 1 else 0) + (versions.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) override fun equals(other: Any?): Boolean { @@ -469,15 +385,13 @@ private constructor( return true } - return other is RegistryListAllApiDocumentsResponse && + return other is Schema && uid == other.uid && - version == other.version && title == other.title && - slug == other.slug && description == other.description && + slug == other.slug && namespace == other.namespace && isPrivate == other.isPrivate && - tags == other.tags && versions == other.versions && additionalProperties == other.additionalProperties } @@ -485,13 +399,11 @@ private constructor( private val hashCode: Int by lazy { Objects.hash( uid, - version, title, - slug, description, + slug, namespace, isPrivate, - tags, versions, additionalProperties, ) @@ -500,5 +412,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "RegistryListAllApiDocumentsResponse{uid=$uid, version=$version, title=$title, slug=$slug, description=$description, namespace=$namespace, isPrivate=$isPrivate, tags=$tags, versions=$versions, additionalProperties=$additionalProperties}" + "Schema{uid=$uid, title=$title, description=$description, slug=$slug, namespace=$namespace, isPrivate=$isPrivate, versions=$versions, additionalProperties=$additionalProperties}" } diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/schemas/SchemaListResponse.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/schemas/SchemaListResponse.kt deleted file mode 100644 index 273f44e..0000000 --- a/scalar-java-core/src/main/kotlin/com/scalar/models/schemas/SchemaListResponse.kt +++ /dev/null @@ -1,762 +0,0 @@ -// File generated by Scalar SDK Generator. DO NOT EDIT. - -package com.scalar.models.schemas - -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import com.scalar.core.ExcludeMissing -import com.scalar.core.JsonField -import com.scalar.core.JsonMissing -import com.scalar.core.JsonValue -import com.scalar.core.checkKnown -import com.scalar.core.checkRequired -import com.scalar.core.toImmutable -import com.scalar.errors.ScalarInvalidDataException -import java.util.Collections -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -class SchemaListResponse -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val uid: JsonField, - private val title: JsonField, - private val description: JsonField, - private val slug: JsonField, - private val namespace: JsonField, - private val isPrivate: JsonField, - private val versions: JsonField>, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("uid") @ExcludeMissing uid: JsonField = JsonMissing.of(), - @JsonProperty("title") @ExcludeMissing title: JsonField = JsonMissing.of(), - @JsonProperty("description") - @ExcludeMissing - description: JsonField = JsonMissing.of(), - @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), - @JsonProperty("namespace") @ExcludeMissing namespace: JsonField = JsonMissing.of(), - @JsonProperty("isPrivate") @ExcludeMissing isPrivate: JsonField = JsonMissing.of(), - @JsonProperty("versions") - @ExcludeMissing - versions: JsonField> = JsonMissing.of(), - ) : this(uid, title, description, slug, namespace, isPrivate, versions, mutableMapOf()) - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun uid(): String = uid.getRequired("uid") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun title(): String = title.getRequired("title") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun description(): String = description.getRequired("description") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun slug(): String = slug.getRequired("slug") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun namespace(): String = namespace.getRequired("namespace") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun isPrivate(): Boolean = isPrivate.getRequired("isPrivate") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun versions(): List = versions.getRequired("versions") - - /** - * Returns the raw JSON value of [uid]. - * - * Unlike [uid], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("uid") @ExcludeMissing fun _uid(): JsonField = uid - - /** - * Returns the raw JSON value of [title]. - * - * Unlike [title], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("title") @ExcludeMissing fun _title(): JsonField = title - - /** - * Returns the raw JSON value of [description]. - * - * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description - - /** - * Returns the raw JSON value of [slug]. - * - * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug - - /** - * Returns the raw JSON value of [namespace]. - * - * Unlike [namespace], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("namespace") @ExcludeMissing fun _namespace(): JsonField = namespace - - /** - * Returns the raw JSON value of [isPrivate]. - * - * Unlike [isPrivate], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("isPrivate") @ExcludeMissing fun _isPrivate(): JsonField = isPrivate - - /** - * Returns the raw JSON value of [versions]. - * - * Unlike [versions], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("versions") @ExcludeMissing fun _versions(): JsonField> = versions - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [SchemaListResponse]. - * - * The following fields are required: - * ```kotlin - * .uid() - * .title() - * .description() - * .slug() - * .namespace() - * .isPrivate() - * .versions() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [SchemaListResponse]. */ - class Builder internal constructor() { - - private var uid: JsonField? = null - private var title: JsonField? = null - private var description: JsonField? = null - private var slug: JsonField? = null - private var namespace: JsonField? = null - private var isPrivate: JsonField? = null - private var versions: JsonField>? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(schemaListResponse: SchemaListResponse) = apply { - uid = schemaListResponse.uid - title = schemaListResponse.title - description = schemaListResponse.description - slug = schemaListResponse.slug - namespace = schemaListResponse.namespace - isPrivate = schemaListResponse.isPrivate - versions = schemaListResponse.versions.map { it.toMutableList() } - additionalProperties = schemaListResponse.additionalProperties.toMutableMap() - } - - fun uid(uid: String) = uid(JsonField.of(uid)) - - /** - * Sets [Builder.uid] to an arbitrary JSON value. - * - * You should usually call [Builder.uid] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun uid(uid: JsonField) = apply { this.uid = uid } - - fun title(title: String) = title(JsonField.of(title)) - - /** - * Sets [Builder.title] to an arbitrary JSON value. - * - * You should usually call [Builder.title] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun title(title: JsonField) = apply { this.title = title } - - fun description(description: String) = description(JsonField.of(description)) - - /** - * Sets [Builder.description] to an arbitrary JSON value. - * - * You should usually call [Builder.description] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun description(description: JsonField) = apply { this.description = description } - - fun slug(slug: String) = slug(JsonField.of(slug)) - - /** - * Sets [Builder.slug] to an arbitrary JSON value. - * - * You should usually call [Builder.slug] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun slug(slug: JsonField) = apply { this.slug = slug } - - fun namespace(namespace: String) = namespace(JsonField.of(namespace)) - - /** - * Sets [Builder.namespace] to an arbitrary JSON value. - * - * You should usually call [Builder.namespace] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun namespace(namespace: JsonField) = apply { this.namespace = namespace } - - fun isPrivate(isPrivate: Boolean) = isPrivate(JsonField.of(isPrivate)) - - /** - * Sets [Builder.isPrivate] to an arbitrary JSON value. - * - * You should usually call [Builder.isPrivate] with a well-typed [Boolean] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun isPrivate(isPrivate: JsonField) = apply { this.isPrivate = isPrivate } - - fun versions(versions: List) = versions(JsonField.of(versions)) - - /** - * Sets [Builder.versions] to an arbitrary JSON value. - * - * You should usually call [Builder.versions] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun versions(versions: JsonField>) = apply { - this.versions = versions.map { it.toMutableList() } - } - - /** - * Adds a single [Version] to [versions]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addVersion(version: Version) = apply { - versions = - (versions ?: JsonField.of(mutableListOf())).also { - checkKnown("versions", it).add(version) - } - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [SchemaListResponse]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```kotlin - * .uid() - * .title() - * .description() - * .slug() - * .namespace() - * .isPrivate() - * .versions() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): SchemaListResponse = - SchemaListResponse( - checkRequired("uid", uid), - checkRequired("title", title), - checkRequired("description", description), - checkRequired("slug", slug), - checkRequired("namespace", namespace), - checkRequired("isPrivate", isPrivate), - checkRequired("versions", versions).map { it.toImmutable() }, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws ScalarInvalidDataException if any value type in this object doesn't match its - * expected type. - */ - fun validate(): SchemaListResponse = apply { - if (validated) { - return@apply - } - - uid() - title() - description() - slug() - namespace() - isPrivate() - versions().forEach { it.validate() } - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ScalarInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (uid.asKnown().isPresent) 1 else 0) + - (if (title.asKnown().isPresent) 1 else 0) + - (if (description.asKnown().isPresent) 1 else 0) + - (if (slug.asKnown().isPresent) 1 else 0) + - (if (namespace.asKnown().isPresent) 1 else 0) + - (if (isPrivate.asKnown().isPresent) 1 else 0) + - (versions.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) - - class Version - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val uid: JsonField, - private val createdAt: JsonField, - private val updatedAt: JsonField, - private val version: JsonField, - private val yamlSha: JsonField, - private val jsonSha: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("uid") @ExcludeMissing uid: JsonField = JsonMissing.of(), - @JsonProperty("createdAt") - @ExcludeMissing - createdAt: JsonField = JsonMissing.of(), - @JsonProperty("updatedAt") - @ExcludeMissing - updatedAt: JsonField = JsonMissing.of(), - @JsonProperty("version") @ExcludeMissing version: JsonField = JsonMissing.of(), - @JsonProperty("yamlSha") @ExcludeMissing yamlSha: JsonField = JsonMissing.of(), - @JsonProperty("jsonSha") @ExcludeMissing jsonSha: JsonField = JsonMissing.of(), - ) : this(uid, createdAt, updatedAt, version, yamlSha, jsonSha, mutableMapOf()) - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun uid(): String = uid.getRequired("uid") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun createdAt(): Long = createdAt.getRequired("createdAt") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun updatedAt(): Long = updatedAt.getRequired("updatedAt") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun version(): String = version.getRequired("version") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun yamlSha(): Optional = yamlSha.getOptional("yamlSha") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun jsonSha(): Optional = jsonSha.getOptional("jsonSha") - - /** - * Returns the raw JSON value of [uid]. - * - * Unlike [uid], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("uid") @ExcludeMissing fun _uid(): JsonField = uid - - /** - * Returns the raw JSON value of [createdAt]. - * - * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("createdAt") @ExcludeMissing fun _createdAt(): JsonField = createdAt - - /** - * Returns the raw JSON value of [updatedAt]. - * - * Unlike [updatedAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("updatedAt") @ExcludeMissing fun _updatedAt(): JsonField = updatedAt - - /** - * Returns the raw JSON value of [version]. - * - * Unlike [version], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("version") @ExcludeMissing fun _version(): JsonField = version - - /** - * Returns the raw JSON value of [yamlSha]. - * - * Unlike [yamlSha], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("yamlSha") @ExcludeMissing fun _yamlSha(): JsonField = yamlSha - - /** - * Returns the raw JSON value of [jsonSha]. - * - * Unlike [jsonSha], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("jsonSha") @ExcludeMissing fun _jsonSha(): JsonField = jsonSha - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [Version]. - * - * The following fields are required: - * ```kotlin - * .uid() - * .createdAt() - * .updatedAt() - * .version() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Version]. */ - class Builder internal constructor() { - - private var uid: JsonField? = null - private var createdAt: JsonField? = null - private var updatedAt: JsonField? = null - private var version: JsonField? = null - private var yamlSha: JsonField = JsonMissing.of() - private var jsonSha: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(version: Version) = apply { - uid = version.uid - createdAt = version.createdAt - updatedAt = version.updatedAt - this.version = version.version - yamlSha = version.yamlSha - jsonSha = version.jsonSha - additionalProperties = version.additionalProperties.toMutableMap() - } - - fun uid(uid: String) = uid(JsonField.of(uid)) - - /** - * Sets [Builder.uid] to an arbitrary JSON value. - * - * You should usually call [Builder.uid] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun uid(uid: JsonField) = apply { this.uid = uid } - - fun createdAt(createdAt: Long) = createdAt(JsonField.of(createdAt)) - - /** - * Sets [Builder.createdAt] to an arbitrary JSON value. - * - * You should usually call [Builder.createdAt] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } - - fun updatedAt(updatedAt: Long) = updatedAt(JsonField.of(updatedAt)) - - /** - * Sets [Builder.updatedAt] to an arbitrary JSON value. - * - * You should usually call [Builder.updatedAt] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun updatedAt(updatedAt: JsonField) = apply { this.updatedAt = updatedAt } - - fun version(version: String) = version(JsonField.of(version)) - - /** - * Sets [Builder.version] to an arbitrary JSON value. - * - * You should usually call [Builder.version] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun version(version: JsonField) = apply { this.version = version } - - fun yamlSha(yamlSha: String) = yamlSha(JsonField.of(yamlSha)) - - /** - * Sets [Builder.yamlSha] to an arbitrary JSON value. - * - * You should usually call [Builder.yamlSha] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun yamlSha(yamlSha: JsonField) = apply { this.yamlSha = yamlSha } - - fun jsonSha(jsonSha: String) = jsonSha(JsonField.of(jsonSha)) - - /** - * Sets [Builder.jsonSha] to an arbitrary JSON value. - * - * You should usually call [Builder.jsonSha] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun jsonSha(jsonSha: JsonField) = apply { this.jsonSha = jsonSha } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Version]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```kotlin - * .uid() - * .createdAt() - * .updatedAt() - * .version() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Version = - Version( - checkRequired("uid", uid), - checkRequired("createdAt", createdAt), - checkRequired("updatedAt", updatedAt), - checkRequired("version", version), - yamlSha, - jsonSha, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws ScalarInvalidDataException if any value type in this object doesn't match its - * expected type. - */ - fun validate(): Version = apply { - if (validated) { - return@apply - } - - uid() - createdAt() - updatedAt() - version() - yamlSha() - jsonSha() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ScalarInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (uid.asKnown().isPresent) 1 else 0) + - (if (createdAt.asKnown().isPresent) 1 else 0) + - (if (updatedAt.asKnown().isPresent) 1 else 0) + - (if (version.asKnown().isPresent) 1 else 0) + - (if (yamlSha.asKnown().isPresent) 1 else 0) + - (if (jsonSha.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Version && - uid == other.uid && - createdAt == other.createdAt && - updatedAt == other.updatedAt && - version == other.version && - yamlSha == other.yamlSha && - jsonSha == other.jsonSha && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - uid, - createdAt, - updatedAt, - version, - yamlSha, - jsonSha, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Version{uid=$uid, createdAt=$createdAt, updatedAt=$updatedAt, version=$version, yamlSha=$yamlSha, jsonSha=$jsonSha, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is SchemaListResponse && - uid == other.uid && - title == other.title && - description == other.description && - slug == other.slug && - namespace == other.namespace && - isPrivate == other.isPrivate && - versions == other.versions && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - uid, - title, - description, - slug, - namespace, - isPrivate, - versions, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "SchemaListResponse{uid=$uid, title=$title, description=$description, slug=$slug, namespace=$namespace, isPrivate=$isPrivate, versions=$versions, additionalProperties=$additionalProperties}" -} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/Sdk.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/Sdk.kt new file mode 100644 index 0000000..a72d3ed --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/Sdk.kt @@ -0,0 +1,599 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.sdks + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.checkKnown +import com.scalar.core.checkRequired +import com.scalar.core.toImmutable +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class Sdk +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val uid: JsonField, + private val title: JsonField, + private val slug: JsonField, + private val namespace: JsonField, + private val description: JsonField, + private val isPrivate: JsonField, + private val apiUid: JsonField, + private val apiVersion: JsonField, + private val currentVersion: JsonField, + private val targets: JsonField>, + private val versions: JsonField>, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("uid") @ExcludeMissing uid: JsonField = JsonMissing.of(), + @JsonProperty("title") @ExcludeMissing title: JsonField = JsonMissing.of(), + @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), + @JsonProperty("namespace") @ExcludeMissing namespace: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("isPrivate") @ExcludeMissing isPrivate: JsonField = JsonMissing.of(), + @JsonProperty("apiUid") @ExcludeMissing apiUid: JsonField = JsonMissing.of(), + @JsonProperty("apiVersion") + @ExcludeMissing + apiVersion: JsonField = JsonMissing.of(), + @JsonProperty("currentVersion") + @ExcludeMissing + currentVersion: JsonField = JsonMissing.of(), + @JsonProperty("targets") + @ExcludeMissing + targets: JsonField> = JsonMissing.of(), + @JsonProperty("versions") + @ExcludeMissing + versions: JsonField> = JsonMissing.of(), + ) : this( + uid, + title, + slug, + namespace, + description, + isPrivate, + apiUid, + apiVersion, + currentVersion, + targets, + versions, + mutableMapOf(), + ) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun uid(): String = uid.getRequired("uid") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun title(): String = title.getRequired("title") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun slug(): String = slug.getRequired("slug") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun namespace(): String = namespace.getRequired("namespace") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun description(): String = description.getRequired("description") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun isPrivate(): Boolean = isPrivate.getRequired("isPrivate") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun apiUid(): Optional = apiUid.getOptional("apiUid") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun apiVersion(): Optional = apiVersion.getOptional("apiVersion") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun currentVersion(): String = currentVersion.getRequired("currentVersion") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun targets(): List = targets.getRequired("targets") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun versions(): List = versions.getRequired("versions") + + /** + * Returns the raw JSON value of [uid]. + * + * Unlike [uid], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("uid") @ExcludeMissing fun _uid(): JsonField = uid + + /** + * Returns the raw JSON value of [title]. + * + * Unlike [title], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("title") @ExcludeMissing fun _title(): JsonField = title + + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug + + /** + * Returns the raw JSON value of [namespace]. + * + * Unlike [namespace], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("namespace") @ExcludeMissing fun _namespace(): JsonField = namespace + + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description + + /** + * Returns the raw JSON value of [isPrivate]. + * + * Unlike [isPrivate], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("isPrivate") @ExcludeMissing fun _isPrivate(): JsonField = isPrivate + + /** + * Returns the raw JSON value of [apiUid]. + * + * Unlike [apiUid], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("apiUid") @ExcludeMissing fun _apiUid(): JsonField = apiUid + + /** + * Returns the raw JSON value of [apiVersion]. + * + * Unlike [apiVersion], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("apiVersion") @ExcludeMissing fun _apiVersion(): JsonField = apiVersion + + /** + * Returns the raw JSON value of [currentVersion]. + * + * Unlike [currentVersion], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("currentVersion") + @ExcludeMissing + fun _currentVersion(): JsonField = currentVersion + + /** + * Returns the raw JSON value of [targets]. + * + * Unlike [targets], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("targets") + @ExcludeMissing + fun _targets(): JsonField> = targets + + /** + * Returns the raw JSON value of [versions]. + * + * Unlike [versions], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("versions") + @ExcludeMissing + fun _versions(): JsonField> = versions + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Sdk]. + * + * The following fields are required: + * ```kotlin + * .uid() + * .title() + * .slug() + * .namespace() + * .description() + * .isPrivate() + * .apiUid() + * .currentVersion() + * .targets() + * .versions() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Sdk]. */ + class Builder internal constructor() { + + private var uid: JsonField? = null + private var title: JsonField? = null + private var slug: JsonField? = null + private var namespace: JsonField? = null + private var description: JsonField? = null + private var isPrivate: JsonField? = null + private var apiUid: JsonField? = null + private var apiVersion: JsonField = JsonMissing.of() + private var currentVersion: JsonField? = null + private var targets: JsonField>? = null + private var versions: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(sdk: Sdk) = apply { + uid = sdk.uid + title = sdk.title + slug = sdk.slug + namespace = sdk.namespace + description = sdk.description + isPrivate = sdk.isPrivate + apiUid = sdk.apiUid + apiVersion = sdk.apiVersion + currentVersion = sdk.currentVersion + targets = sdk.targets.map { it.toMutableList() } + versions = sdk.versions.map { it.toMutableList() } + additionalProperties = sdk.additionalProperties.toMutableMap() + } + + fun uid(uid: String) = uid(JsonField.of(uid)) + + /** + * Sets [Builder.uid] to an arbitrary JSON value. + * + * You should usually call [Builder.uid] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun uid(uid: JsonField) = apply { this.uid = uid } + + fun title(title: String) = title(JsonField.of(title)) + + /** + * Sets [Builder.title] to an arbitrary JSON value. + * + * You should usually call [Builder.title] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun title(title: JsonField) = apply { this.title = title } + + fun slug(slug: String) = slug(JsonField.of(slug)) + + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun slug(slug: JsonField) = apply { this.slug = slug } + + fun namespace(namespace: String) = namespace(JsonField.of(namespace)) + + /** + * Sets [Builder.namespace] to an arbitrary JSON value. + * + * You should usually call [Builder.namespace] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun namespace(namespace: JsonField) = apply { this.namespace = namespace } + + fun description(description: String) = description(JsonField.of(description)) + + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun description(description: JsonField) = apply { this.description = description } + + fun isPrivate(isPrivate: Boolean) = isPrivate(JsonField.of(isPrivate)) + + /** + * Sets [Builder.isPrivate] to an arbitrary JSON value. + * + * You should usually call [Builder.isPrivate] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun isPrivate(isPrivate: JsonField) = apply { this.isPrivate = isPrivate } + + fun apiUid(apiUid: String?) = apiUid(JsonField.ofNullable(apiUid)) + + /** Alias for calling [Builder.apiUid] with `apiUid.orElse(null)`. */ + fun apiUid(apiUid: Optional) = apiUid(apiUid.getOrNull()) + + /** + * Sets [Builder.apiUid] to an arbitrary JSON value. + * + * You should usually call [Builder.apiUid] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun apiUid(apiUid: JsonField) = apply { this.apiUid = apiUid } + + fun apiVersion(apiVersion: String?) = apiVersion(JsonField.ofNullable(apiVersion)) + + /** Alias for calling [Builder.apiVersion] with `apiVersion.orElse(null)`. */ + fun apiVersion(apiVersion: Optional) = apiVersion(apiVersion.getOrNull()) + + /** + * Sets [Builder.apiVersion] to an arbitrary JSON value. + * + * You should usually call [Builder.apiVersion] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun apiVersion(apiVersion: JsonField) = apply { this.apiVersion = apiVersion } + + fun currentVersion(currentVersion: String) = currentVersion(JsonField.of(currentVersion)) + + /** + * Sets [Builder.currentVersion] to an arbitrary JSON value. + * + * You should usually call [Builder.currentVersion] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun currentVersion(currentVersion: JsonField) = apply { + this.currentVersion = currentVersion + } + + fun targets(targets: List) = targets(JsonField.of(targets)) + + /** + * Sets [Builder.targets] to an arbitrary JSON value. + * + * You should usually call [Builder.targets] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun targets(targets: JsonField>) = apply { + this.targets = targets.map { it.toMutableList() } + } + + /** + * Adds a single [SdkTargetSummary] to [targets]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addTarget(target: SdkTargetSummary) = apply { + targets = + (targets ?: JsonField.of(mutableListOf())).also { + checkKnown("targets", it).add(target) + } + } + + fun versions(versions: List) = versions(JsonField.of(versions)) + + /** + * Sets [Builder.versions] to an arbitrary JSON value. + * + * You should usually call [Builder.versions] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun versions(versions: JsonField>) = apply { + this.versions = versions.map { it.toMutableList() } + } + + /** + * Adds a single [SdkVersion] to [versions]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addVersion(version: SdkVersion) = apply { + versions = + (versions ?: JsonField.of(mutableListOf())).also { + checkKnown("versions", it).add(version) + } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Sdk]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .uid() + * .title() + * .slug() + * .namespace() + * .description() + * .isPrivate() + * .apiUid() + * .currentVersion() + * .targets() + * .versions() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Sdk = + Sdk( + checkRequired("uid", uid), + checkRequired("title", title), + checkRequired("slug", slug), + checkRequired("namespace", namespace), + checkRequired("description", description), + checkRequired("isPrivate", isPrivate), + checkRequired("apiUid", apiUid), + apiVersion, + checkRequired("currentVersion", currentVersion), + checkRequired("targets", targets).map { it.toImmutable() }, + checkRequired("versions", versions).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Sdk = apply { + if (validated) { + return@apply + } + + uid() + title() + slug() + namespace() + description() + isPrivate() + apiUid() + apiVersion() + currentVersion() + targets().forEach { it.validate() } + versions().forEach { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (uid.asKnown().isPresent) 1 else 0) + + (if (title.asKnown().isPresent) 1 else 0) + + (if (slug.asKnown().isPresent) 1 else 0) + + (if (namespace.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (if (isPrivate.asKnown().isPresent) 1 else 0) + + (if (apiUid.asKnown().isPresent) 1 else 0) + + (if (apiVersion.asKnown().isPresent) 1 else 0) + + (if (currentVersion.asKnown().isPresent) 1 else 0) + + (targets.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (versions.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Sdk && + uid == other.uid && + title == other.title && + slug == other.slug && + namespace == other.namespace && + description == other.description && + isPrivate == other.isPrivate && + apiUid == other.apiUid && + apiVersion == other.apiVersion && + currentVersion == other.currentVersion && + targets == other.targets && + versions == other.versions && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + uid, + title, + slug, + namespace, + description, + isPrivate, + apiUid, + apiVersion, + currentVersion, + targets, + versions, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Sdk{uid=$uid, title=$title, slug=$slug, namespace=$namespace, description=$description, isPrivate=$isPrivate, apiUid=$apiUid, apiVersion=$apiVersion, currentVersion=$currentVersion, targets=$targets, versions=$versions, additionalProperties=$additionalProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkBuildParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkBuildParams.kt new file mode 100644 index 0000000..15fa79e --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkBuildParams.kt @@ -0,0 +1,704 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.sdks + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.Enum +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.Params +import com.scalar.core.checkKnown +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import com.scalar.core.toImmutable +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * Start a build. Omit `version` to build the current work — the open draft, else the latest version + * — and the resolved version comes back in the response. + */ +class SdkBuildParams +private constructor( + private val uid: String?, + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun version(): Optional = body.version() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun languages(): Optional> = body.languages() + + fun uid(): Optional = Optional.ofNullable(uid) + + /** + * Returns the raw JSON value of [version]. + * + * Unlike [version], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _version(): JsonField = body._version() + + /** + * Returns the raw JSON value of [languages]. + * + * Unlike [languages], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _languages(): JsonField> = body._languages() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): SdkBuildParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [SdkBuildParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SdkBuildParams]. */ + class Builder internal constructor() { + + private var uid: String? = null + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(sdkBuildParams: SdkBuildParams) = apply { + uid = sdkBuildParams.uid + body = sdkBuildParams.body.toBuilder() + additionalHeaders = sdkBuildParams.additionalHeaders.toBuilder() + additionalQueryParams = sdkBuildParams.additionalQueryParams.toBuilder() + } + + fun uid(uid: String?) = apply { this.uid = uid } + + /** Alias for calling [Builder.uid] with `uid.orElse(null)`. */ + fun uid(uid: Optional) = uid(uid.getOrNull()) + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [version] + * - [languages] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + fun version(version: String) = apply { body.version(version) } + + /** + * Sets [Builder.version] to an arbitrary JSON value. + * + * You should usually call [Builder.version] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun version(version: JsonField) = apply { body.version(version) } + + fun languages(languages: List) = apply { body.languages(languages) } + + /** + * Sets [Builder.languages] to an arbitrary JSON value. + * + * You should usually call [Builder.languages] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun languages(languages: JsonField>) = apply { body.languages(languages) } + + /** + * Adds a single [Language] to [languages]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addLanguage(language: Language) = apply { body.addLanguage(language) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [SdkBuildParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): SdkBuildParams = + SdkBuildParams( + uid, + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> uid ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val version: JsonField, + private val languages: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("version") @ExcludeMissing version: JsonField = JsonMissing.of(), + @JsonProperty("languages") + @ExcludeMissing + languages: JsonField> = JsonMissing.of(), + ) : this(version, languages, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun version(): Optional = version.getOptional("version") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun languages(): Optional> = languages.getOptional("languages") + + /** + * Returns the raw JSON value of [version]. + * + * Unlike [version], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("version") @ExcludeMissing fun _version(): JsonField = version + + /** + * Returns the raw JSON value of [languages]. + * + * Unlike [languages], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("languages") + @ExcludeMissing + fun _languages(): JsonField> = languages + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Body]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var version: JsonField = JsonMissing.of() + private var languages: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + version = body.version + languages = body.languages.map { it.toMutableList() } + additionalProperties = body.additionalProperties.toMutableMap() + } + + fun version(version: String) = version(JsonField.of(version)) + + /** + * Sets [Builder.version] to an arbitrary JSON value. + * + * You should usually call [Builder.version] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun version(version: JsonField) = apply { this.version = version } + + fun languages(languages: List) = languages(JsonField.of(languages)) + + /** + * Sets [Builder.languages] to an arbitrary JSON value. + * + * You should usually call [Builder.languages] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun languages(languages: JsonField>) = apply { + this.languages = languages.map { it.toMutableList() } + } + + /** + * Adds a single [Language] to [languages]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addLanguage(language: Language) = apply { + languages = + (languages ?: JsonField.of(mutableListOf())).also { + checkKnown("languages", it).add(language) + } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Body = + Body( + version, + (languages ?: JsonMissing.of()).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Body = apply { + if (validated) { + return@apply + } + + version() + languages().ifPresent { it.forEach { it.validate() } } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (version.asKnown().isPresent) 1 else 0) + + (languages.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + version == other.version && + languages == other.languages && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(version, languages, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{version=$version, languages=$languages, additionalProperties=$additionalProperties}" + } + + class Language @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val TYPESCRIPT = of("typescript") + + @JvmField val PYTHON = of("python") + + @JvmField val CLI = of("cli") + + @JvmField val CSHARP = of("csharp") + + @JvmField val JAVA = of("java") + + @JvmField val RUBY = of("ruby") + + @JvmField val PHP = of("php") + + @JvmField val GO = of("go") + + @JvmField val RUST = of("rust") + + @JvmField val KOTLIN = of("kotlin") + + @JvmField val SWIFT = of("swift") + + @JvmField val CPP = of("cpp") + + @JvmField val DART = of("dart") + + @JvmStatic fun of(value: String) = Language(JsonField.of(value)) + } + + /** An enum containing [Language]'s known values. */ + enum class Known { + TYPESCRIPT, + PYTHON, + CLI, + CSHARP, + JAVA, + RUBY, + PHP, + GO, + RUST, + KOTLIN, + SWIFT, + CPP, + DART, + } + + /** + * An enum containing [Language]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Language] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + TYPESCRIPT, + PYTHON, + CLI, + CSHARP, + JAVA, + RUBY, + PHP, + GO, + RUST, + KOTLIN, + SWIFT, + CPP, + DART, + /** An enum member indicating that [Language] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + TYPESCRIPT -> Value.TYPESCRIPT + PYTHON -> Value.PYTHON + CLI -> Value.CLI + CSHARP -> Value.CSHARP + JAVA -> Value.JAVA + RUBY -> Value.RUBY + PHP -> Value.PHP + GO -> Value.GO + RUST -> Value.RUST + KOTLIN -> Value.KOTLIN + SWIFT -> Value.SWIFT + CPP -> Value.CPP + DART -> Value.DART + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws ScalarInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + TYPESCRIPT -> Known.TYPESCRIPT + PYTHON -> Known.PYTHON + CLI -> Known.CLI + CSHARP -> Known.CSHARP + JAVA -> Known.JAVA + RUBY -> Known.RUBY + PHP -> Known.PHP + GO -> Known.GO + RUST -> Known.RUST + KOTLIN -> Known.KOTLIN + SWIFT -> Known.SWIFT + CPP -> Known.CPP + DART -> Known.DART + else -> throw ScalarInvalidDataException("Unknown Language: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws ScalarInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { ScalarInvalidDataException("Value is not a String") } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Language = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Language && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SdkBuildParams && + uid == other.uid && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = Objects.hash(uid, body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "SdkBuildParams{uid=$uid, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkBuildResponse.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkBuildResponse.kt new file mode 100644 index 0000000..968a2c4 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkBuildResponse.kt @@ -0,0 +1,175 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.sdks + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.checkRequired +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects + +class SdkBuildResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val version: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("version") @ExcludeMissing version: JsonField = JsonMissing.of() + ) : this(version, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun version(): String = version.getRequired("version") + + /** + * Returns the raw JSON value of [version]. + * + * Unlike [version], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("version") @ExcludeMissing fun _version(): JsonField = version + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [SdkBuildResponse]. + * + * The following fields are required: + * ```kotlin + * .version() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SdkBuildResponse]. */ + class Builder internal constructor() { + + private var version: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(sdkBuildResponse: SdkBuildResponse) = apply { + version = sdkBuildResponse.version + additionalProperties = sdkBuildResponse.additionalProperties.toMutableMap() + } + + fun version(version: String) = version(JsonField.of(version)) + + /** + * Sets [Builder.version] to an arbitrary JSON value. + * + * You should usually call [Builder.version] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun version(version: JsonField) = apply { this.version = version } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [SdkBuildResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .version() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SdkBuildResponse = + SdkBuildResponse(checkRequired("version", version), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): SdkBuildResponse = apply { + if (validated) { + return@apply + } + + version() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (if (version.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SdkBuildResponse && + version == other.version && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(version, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "SdkBuildResponse{version=$version, additionalProperties=$additionalProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkCreateParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkCreateParams.kt new file mode 100644 index 0000000..2dab1cc --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkCreateParams.kt @@ -0,0 +1,947 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.sdks + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.Enum +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.Params +import com.scalar.core.checkKnown +import com.scalar.core.checkRequired +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import com.scalar.core.toImmutable +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Create an SDK from an API document, targeting one or more languages. */ +class SdkCreateParams +private constructor( + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun apiUid(): String = body.apiUid() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun languages(): List = body.languages() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun title(): Optional = body.title() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun slug(): Optional = body.slug() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun className(): Optional = body.className() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun config(): Optional = body.config() + + /** + * Returns the raw JSON value of [apiUid]. + * + * Unlike [apiUid], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _apiUid(): JsonField = body._apiUid() + + /** + * Returns the raw JSON value of [languages]. + * + * Unlike [languages], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _languages(): JsonField> = body._languages() + + /** + * Returns the raw JSON value of [title]. + * + * Unlike [title], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _title(): JsonField = body._title() + + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _slug(): JsonField = body._slug() + + /** + * Returns the raw JSON value of [className]. + * + * Unlike [className], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _className(): JsonField = body._className() + + /** + * Returns the raw JSON value of [config]. + * + * Unlike [config], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _config(): JsonField = body._config() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [SdkCreateParams]. + * + * The following fields are required: + * ```kotlin + * .apiUid() + * .languages() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SdkCreateParams]. */ + class Builder internal constructor() { + + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(sdkCreateParams: SdkCreateParams) = apply { + body = sdkCreateParams.body.toBuilder() + additionalHeaders = sdkCreateParams.additionalHeaders.toBuilder() + additionalQueryParams = sdkCreateParams.additionalQueryParams.toBuilder() + } + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [apiUid] + * - [languages] + * - [title] + * - [slug] + * - [className] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + fun apiUid(apiUid: String) = apply { body.apiUid(apiUid) } + + /** + * Sets [Builder.apiUid] to an arbitrary JSON value. + * + * You should usually call [Builder.apiUid] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun apiUid(apiUid: JsonField) = apply { body.apiUid(apiUid) } + + fun languages(languages: List) = apply { body.languages(languages) } + + /** + * Sets [Builder.languages] to an arbitrary JSON value. + * + * You should usually call [Builder.languages] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun languages(languages: JsonField>) = apply { body.languages(languages) } + + /** + * Adds a single [Language] to [languages]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addLanguage(language: Language) = apply { body.addLanguage(language) } + + fun title(title: String) = apply { body.title(title) } + + /** + * Sets [Builder.title] to an arbitrary JSON value. + * + * You should usually call [Builder.title] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun title(title: JsonField) = apply { body.title(title) } + + fun slug(slug: String) = apply { body.slug(slug) } + + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun slug(slug: JsonField) = apply { body.slug(slug) } + + fun className(className: String) = apply { body.className(className) } + + /** + * Sets [Builder.className] to an arbitrary JSON value. + * + * You should usually call [Builder.className] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun className(className: JsonField) = apply { body.className(className) } + + fun config(config: String) = apply { body.config(config) } + + /** + * Sets [Builder.config] to an arbitrary JSON value. + * + * You should usually call [Builder.config] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun config(config: JsonField) = apply { body.config(config) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [SdkCreateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .apiUid() + * .languages() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SdkCreateParams = + SdkCreateParams(body.build(), additionalHeaders.build(), additionalQueryParams.build()) + } + + fun _body(): Body = body + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val apiUid: JsonField, + private val languages: JsonField>, + private val title: JsonField, + private val slug: JsonField, + private val className: JsonField, + private val config: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("apiUid") @ExcludeMissing apiUid: JsonField = JsonMissing.of(), + @JsonProperty("languages") + @ExcludeMissing + languages: JsonField> = JsonMissing.of(), + @JsonProperty("title") @ExcludeMissing title: JsonField = JsonMissing.of(), + @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), + @JsonProperty("className") + @ExcludeMissing + className: JsonField = JsonMissing.of(), + @JsonProperty("config") @ExcludeMissing config: JsonField = JsonMissing.of(), + ) : this(apiUid, languages, title, slug, className, config, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun apiUid(): String = apiUid.getRequired("apiUid") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun languages(): List = languages.getRequired("languages") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun title(): Optional = title.getOptional("title") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun slug(): Optional = slug.getOptional("slug") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun className(): Optional = className.getOptional("className") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun config(): Optional = config.getOptional("config") + + /** + * Returns the raw JSON value of [apiUid]. + * + * Unlike [apiUid], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("apiUid") @ExcludeMissing fun _apiUid(): JsonField = apiUid + + /** + * Returns the raw JSON value of [languages]. + * + * Unlike [languages], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("languages") + @ExcludeMissing + fun _languages(): JsonField> = languages + + /** + * Returns the raw JSON value of [title]. + * + * Unlike [title], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("title") @ExcludeMissing fun _title(): JsonField = title + + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug + + /** + * Returns the raw JSON value of [className]. + * + * Unlike [className], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("className") @ExcludeMissing fun _className(): JsonField = className + + /** + * Returns the raw JSON value of [config]. + * + * Unlike [config], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("config") @ExcludeMissing fun _config(): JsonField = config + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```kotlin + * .apiUid() + * .languages() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var apiUid: JsonField? = null + private var languages: JsonField>? = null + private var title: JsonField = JsonMissing.of() + private var slug: JsonField = JsonMissing.of() + private var className: JsonField = JsonMissing.of() + private var config: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + apiUid = body.apiUid + languages = body.languages.map { it.toMutableList() } + title = body.title + slug = body.slug + className = body.className + config = body.config + additionalProperties = body.additionalProperties.toMutableMap() + } + + fun apiUid(apiUid: String) = apiUid(JsonField.of(apiUid)) + + /** + * Sets [Builder.apiUid] to an arbitrary JSON value. + * + * You should usually call [Builder.apiUid] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun apiUid(apiUid: JsonField) = apply { this.apiUid = apiUid } + + fun languages(languages: List) = languages(JsonField.of(languages)) + + /** + * Sets [Builder.languages] to an arbitrary JSON value. + * + * You should usually call [Builder.languages] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun languages(languages: JsonField>) = apply { + this.languages = languages.map { it.toMutableList() } + } + + /** + * Adds a single [Language] to [languages]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addLanguage(language: Language) = apply { + languages = + (languages ?: JsonField.of(mutableListOf())).also { + checkKnown("languages", it).add(language) + } + } + + fun title(title: String) = title(JsonField.of(title)) + + /** + * Sets [Builder.title] to an arbitrary JSON value. + * + * You should usually call [Builder.title] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun title(title: JsonField) = apply { this.title = title } + + fun slug(slug: String) = slug(JsonField.of(slug)) + + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun slug(slug: JsonField) = apply { this.slug = slug } + + fun className(className: String) = className(JsonField.of(className)) + + /** + * Sets [Builder.className] to an arbitrary JSON value. + * + * You should usually call [Builder.className] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun className(className: JsonField) = apply { this.className = className } + + fun config(config: String) = config(JsonField.of(config)) + + /** + * Sets [Builder.config] to an arbitrary JSON value. + * + * You should usually call [Builder.config] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun config(config: JsonField) = apply { this.config = config } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .apiUid() + * .languages() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Body = + Body( + checkRequired("apiUid", apiUid), + checkRequired("languages", languages).map { it.toImmutable() }, + title, + slug, + className, + config, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Body = apply { + if (validated) { + return@apply + } + + apiUid() + languages().forEach { it.validate() } + title() + slug() + className() + config() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (apiUid.asKnown().isPresent) 1 else 0) + + (languages.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (title.asKnown().isPresent) 1 else 0) + + (if (slug.asKnown().isPresent) 1 else 0) + + (if (className.asKnown().isPresent) 1 else 0) + + (if (config.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + apiUid == other.apiUid && + languages == other.languages && + title == other.title && + slug == other.slug && + className == other.className && + config == other.config && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + apiUid, + languages, + title, + slug, + className, + config, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{apiUid=$apiUid, languages=$languages, title=$title, slug=$slug, className=$className, config=$config, additionalProperties=$additionalProperties}" + } + + class Language @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val TYPESCRIPT = of("typescript") + + @JvmField val PYTHON = of("python") + + @JvmField val CLI = of("cli") + + @JvmField val CSHARP = of("csharp") + + @JvmField val JAVA = of("java") + + @JvmField val RUBY = of("ruby") + + @JvmField val PHP = of("php") + + @JvmField val GO = of("go") + + @JvmField val RUST = of("rust") + + @JvmField val KOTLIN = of("kotlin") + + @JvmField val SWIFT = of("swift") + + @JvmField val CPP = of("cpp") + + @JvmField val DART = of("dart") + + @JvmStatic fun of(value: String) = Language(JsonField.of(value)) + } + + /** An enum containing [Language]'s known values. */ + enum class Known { + TYPESCRIPT, + PYTHON, + CLI, + CSHARP, + JAVA, + RUBY, + PHP, + GO, + RUST, + KOTLIN, + SWIFT, + CPP, + DART, + } + + /** + * An enum containing [Language]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Language] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + TYPESCRIPT, + PYTHON, + CLI, + CSHARP, + JAVA, + RUBY, + PHP, + GO, + RUST, + KOTLIN, + SWIFT, + CPP, + DART, + /** An enum member indicating that [Language] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + TYPESCRIPT -> Value.TYPESCRIPT + PYTHON -> Value.PYTHON + CLI -> Value.CLI + CSHARP -> Value.CSHARP + JAVA -> Value.JAVA + RUBY -> Value.RUBY + PHP -> Value.PHP + GO -> Value.GO + RUST -> Value.RUST + KOTLIN -> Value.KOTLIN + SWIFT -> Value.SWIFT + CPP -> Value.CPP + DART -> Value.DART + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws ScalarInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + TYPESCRIPT -> Known.TYPESCRIPT + PYTHON -> Known.PYTHON + CLI -> Known.CLI + CSHARP -> Known.CSHARP + JAVA -> Known.JAVA + RUBY -> Known.RUBY + PHP -> Known.PHP + GO -> Known.GO + RUST -> Known.RUST + KOTLIN -> Known.KOTLIN + SWIFT -> Known.SWIFT + CPP -> Known.CPP + DART -> Known.DART + else -> throw ScalarInvalidDataException("Unknown Language: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws ScalarInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { ScalarInvalidDataException("Value is not a String") } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Language = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Language && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SdkCreateParams && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = Objects.hash(body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "SdkCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkDeleteParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkDeleteParams.kt new file mode 100644 index 0000000..25613f9 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkDeleteParams.kt @@ -0,0 +1,229 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.sdks + +import com.scalar.core.JsonValue +import com.scalar.core.Params +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import com.scalar.core.toImmutable +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Delete an SDK and every version it holds. */ +class SdkDeleteParams +private constructor( + private val uid: String?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, + private val additionalBodyProperties: Map, +) : Params { + + fun uid(): Optional = Optional.ofNullable(uid) + + /** Additional body properties to send with the request. */ + fun _additionalBodyProperties(): Map = additionalBodyProperties + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): SdkDeleteParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [SdkDeleteParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SdkDeleteParams]. */ + class Builder internal constructor() { + + private var uid: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(sdkDeleteParams: SdkDeleteParams) = apply { + uid = sdkDeleteParams.uid + additionalHeaders = sdkDeleteParams.additionalHeaders.toBuilder() + additionalQueryParams = sdkDeleteParams.additionalQueryParams.toBuilder() + additionalBodyProperties = sdkDeleteParams.additionalBodyProperties.toMutableMap() + } + + fun uid(uid: String?) = apply { this.uid = uid } + + /** Alias for calling [Builder.uid] with `uid.orElse(null)`. */ + fun uid(uid: Optional) = uid(uid.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + putAllAdditionalBodyProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { + additionalBodyProperties.remove(key) + } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalBodyProperty) + } + + /** + * Returns an immutable instance of [SdkDeleteParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): SdkDeleteParams = + SdkDeleteParams( + uid, + additionalHeaders.build(), + additionalQueryParams.build(), + additionalBodyProperties.toImmutable(), + ) + } + + fun _body(): Optional> = + Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) + + fun _pathParam(index: Int): String = + when (index) { + 0 -> uid ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SdkDeleteParams && + uid == other.uid && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams && + additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int = + Objects.hash(uid, additionalHeaders, additionalQueryParams, additionalBodyProperties) + + override fun toString() = + "SdkDeleteParams{uid=$uid, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkListParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkListParams.kt new file mode 100644 index 0000000..19e7482 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkListParams.kt @@ -0,0 +1,196 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.sdks + +import com.scalar.core.Params +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** List every SDK on the team. */ +class SdkListParams +private constructor( + private val limit: Long?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun limit(): Optional = Optional.ofNullable(limit) + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): SdkListParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [SdkListParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SdkListParams]. */ + class Builder internal constructor() { + + private var limit: Long? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(sdkListParams: SdkListParams) = apply { + limit = sdkListParams.limit + additionalHeaders = sdkListParams.additionalHeaders.toBuilder() + additionalQueryParams = sdkListParams.additionalQueryParams.toBuilder() + } + + fun limit(limit: Long?) = apply { this.limit = limit } + + /** + * Alias for [Builder.limit]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun limit(limit: Long) = limit(limit as Long?) + + /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ + fun limit(limit: Optional) = limit(limit.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [SdkListParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): SdkListParams = + SdkListParams(limit, additionalHeaders.build(), additionalQueryParams.build()) + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + limit?.let { put("limit", it.toString()) } + putAll(additionalQueryParams) + } + .build() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SdkListParams && + limit == other.limit && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = Objects.hash(limit, additionalHeaders, additionalQueryParams) + + override fun toString() = + "SdkListParams{limit=$limit, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkListResponse.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkListResponse.kt new file mode 100644 index 0000000..9ab8571 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkListResponse.kt @@ -0,0 +1,228 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.sdks + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.checkKnown +import com.scalar.core.checkRequired +import com.scalar.core.toImmutable +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import kotlin.jvm.optionals.getOrNull + +class SdkListResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val data: JsonField>, + private val hasMore: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("data") @ExcludeMissing data: JsonField> = JsonMissing.of(), + @JsonProperty("hasMore") @ExcludeMissing hasMore: JsonField = JsonMissing.of(), + ) : this(data, hasMore, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun data(): List = data.getRequired("data") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun hasMore(): Boolean = hasMore.getRequired("hasMore") + + /** + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("data") @ExcludeMissing fun _data(): JsonField> = data + + /** + * Returns the raw JSON value of [hasMore]. + * + * Unlike [hasMore], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("hasMore") @ExcludeMissing fun _hasMore(): JsonField = hasMore + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [SdkListResponse]. + * + * The following fields are required: + * ```kotlin + * .data() + * .hasMore() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SdkListResponse]. */ + class Builder internal constructor() { + + private var data: JsonField>? = null + private var hasMore: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(sdkListResponse: SdkListResponse) = apply { + data = sdkListResponse.data.map { it.toMutableList() } + hasMore = sdkListResponse.hasMore + additionalProperties = sdkListResponse.additionalProperties.toMutableMap() + } + + fun data(data: List) = data(JsonField.of(data)) + + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed `List` value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun data(data: JsonField>) = apply { this.data = data.map { it.toMutableList() } } + + /** + * Adds a single [Sdk] to [Builder.data]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addData(data: Sdk) = apply { + this.data = + (this.data ?: JsonField.of(mutableListOf())).also { + checkKnown("data", it).add(data) + } + } + + fun hasMore(hasMore: Boolean) = hasMore(JsonField.of(hasMore)) + + /** + * Sets [Builder.hasMore] to an arbitrary JSON value. + * + * You should usually call [Builder.hasMore] with a well-typed [Boolean] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun hasMore(hasMore: JsonField) = apply { this.hasMore = hasMore } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [SdkListResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .data() + * .hasMore() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SdkListResponse = + SdkListResponse( + checkRequired("data", data).map { it.toImmutable() }, + checkRequired("hasMore", hasMore), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): SdkListResponse = apply { + if (validated) { + return@apply + } + + data().forEach { it.validate() } + hasMore() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (data.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (hasMore.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SdkListResponse && + data == other.data && + hasMore == other.hasMore && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(data, hasMore, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "SdkListResponse{data=$data, hasMore=$hasMore, additionalProperties=$additionalProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkRetrieveParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkRetrieveParams.kt new file mode 100644 index 0000000..61415c2 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkRetrieveParams.kt @@ -0,0 +1,189 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.sdks + +import com.scalar.core.Params +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Get a single SDK by its uid. */ +class SdkRetrieveParams +private constructor( + private val uid: String?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun uid(): Optional = Optional.ofNullable(uid) + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): SdkRetrieveParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [SdkRetrieveParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SdkRetrieveParams]. */ + class Builder internal constructor() { + + private var uid: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(sdkRetrieveParams: SdkRetrieveParams) = apply { + uid = sdkRetrieveParams.uid + additionalHeaders = sdkRetrieveParams.additionalHeaders.toBuilder() + additionalQueryParams = sdkRetrieveParams.additionalQueryParams.toBuilder() + } + + fun uid(uid: String?) = apply { this.uid = uid } + + /** Alias for calling [Builder.uid] with `uid.orElse(null)`. */ + fun uid(uid: Optional) = uid(uid.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [SdkRetrieveParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): SdkRetrieveParams = + SdkRetrieveParams(uid, additionalHeaders.build(), additionalQueryParams.build()) + } + + fun _pathParam(index: Int): String = + when (index) { + 0 -> uid ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SdkRetrieveParams && + uid == other.uid && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = Objects.hash(uid, additionalHeaders, additionalQueryParams) + + override fun toString() = + "SdkRetrieveParams{uid=$uid, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkTargetSummary.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkTargetSummary.kt new file mode 100644 index 0000000..779645e --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkTargetSummary.kt @@ -0,0 +1,415 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.sdks + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.Enum +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.checkRequired +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import kotlin.jvm.optionals.getOrNull + +class SdkTargetSummary +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val language: JsonField, + private val slug: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("language") @ExcludeMissing language: JsonField = JsonMissing.of(), + @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), + ) : this(language, slug, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun language(): Language = language.getRequired("language") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun slug(): String = slug.getRequired("slug") + + /** + * Returns the raw JSON value of [language]. + * + * Unlike [language], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("language") @ExcludeMissing fun _language(): JsonField = language + + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [SdkTargetSummary]. + * + * The following fields are required: + * ```kotlin + * .language() + * .slug() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SdkTargetSummary]. */ + class Builder internal constructor() { + + private var language: JsonField? = null + private var slug: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(sdkTargetSummary: SdkTargetSummary) = apply { + language = sdkTargetSummary.language + slug = sdkTargetSummary.slug + additionalProperties = sdkTargetSummary.additionalProperties.toMutableMap() + } + + fun language(language: Language) = language(JsonField.of(language)) + + /** + * Sets [Builder.language] to an arbitrary JSON value. + * + * You should usually call [Builder.language] with a well-typed [Language] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun language(language: JsonField) = apply { this.language = language } + + fun slug(slug: String) = slug(JsonField.of(slug)) + + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun slug(slug: JsonField) = apply { this.slug = slug } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [SdkTargetSummary]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .language() + * .slug() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SdkTargetSummary = + SdkTargetSummary( + checkRequired("language", language), + checkRequired("slug", slug), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): SdkTargetSummary = apply { + if (validated) { + return@apply + } + + language().validate() + slug() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (language.asKnown().getOrNull()?.validity() ?: 0) + (if (slug.asKnown().isPresent) 1 else 0) + + class Language @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val TYPESCRIPT = of("typescript") + + @JvmField val PYTHON = of("python") + + @JvmField val CLI = of("cli") + + @JvmField val CSHARP = of("csharp") + + @JvmField val JAVA = of("java") + + @JvmField val RUBY = of("ruby") + + @JvmField val PHP = of("php") + + @JvmField val GO = of("go") + + @JvmField val RUST = of("rust") + + @JvmField val KOTLIN = of("kotlin") + + @JvmField val SWIFT = of("swift") + + @JvmField val CPP = of("cpp") + + @JvmField val DART = of("dart") + + @JvmStatic fun of(value: String) = Language(JsonField.of(value)) + } + + /** An enum containing [Language]'s known values. */ + enum class Known { + TYPESCRIPT, + PYTHON, + CLI, + CSHARP, + JAVA, + RUBY, + PHP, + GO, + RUST, + KOTLIN, + SWIFT, + CPP, + DART, + } + + /** + * An enum containing [Language]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Language] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + TYPESCRIPT, + PYTHON, + CLI, + CSHARP, + JAVA, + RUBY, + PHP, + GO, + RUST, + KOTLIN, + SWIFT, + CPP, + DART, + /** An enum member indicating that [Language] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + TYPESCRIPT -> Value.TYPESCRIPT + PYTHON -> Value.PYTHON + CLI -> Value.CLI + CSHARP -> Value.CSHARP + JAVA -> Value.JAVA + RUBY -> Value.RUBY + PHP -> Value.PHP + GO -> Value.GO + RUST -> Value.RUST + KOTLIN -> Value.KOTLIN + SWIFT -> Value.SWIFT + CPP -> Value.CPP + DART -> Value.DART + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws ScalarInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + TYPESCRIPT -> Known.TYPESCRIPT + PYTHON -> Known.PYTHON + CLI -> Known.CLI + CSHARP -> Known.CSHARP + JAVA -> Known.JAVA + RUBY -> Known.RUBY + PHP -> Known.PHP + GO -> Known.GO + RUST -> Known.RUST + KOTLIN -> Known.KOTLIN + SWIFT -> Known.SWIFT + CPP -> Known.CPP + DART -> Known.DART + else -> throw ScalarInvalidDataException("Unknown Language: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws ScalarInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { ScalarInvalidDataException("Value is not a String") } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Language = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Language && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SdkTargetSummary && + language == other.language && + slug == other.slug && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(language, slug, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "SdkTargetSummary{language=$language, slug=$slug, additionalProperties=$additionalProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkUpdateParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkUpdateParams.kt new file mode 100644 index 0000000..d6b24dc --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkUpdateParams.kt @@ -0,0 +1,728 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.sdks + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.Params +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Update SDK metadata, its linked API, or its config. */ +class SdkUpdateParams +private constructor( + private val uid: String?, + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun title(): Optional = body.title() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun slug(): Optional = body.slug() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun isPrivate(): Optional = body.isPrivate() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun config(): Optional = body.config() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun apiUid(): Optional = body.apiUid() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun apiVersion(): Optional = body.apiVersion() + + fun uid(): Optional = Optional.ofNullable(uid) + + /** + * Returns the raw JSON value of [title]. + * + * Unlike [title], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _title(): JsonField = body._title() + + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _slug(): JsonField = body._slug() + + /** + * Returns the raw JSON value of [isPrivate]. + * + * Unlike [isPrivate], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _isPrivate(): JsonField = body._isPrivate() + + /** + * Returns the raw JSON value of [config]. + * + * Unlike [config], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _config(): JsonField = body._config() + + /** + * Returns the raw JSON value of [apiUid]. + * + * Unlike [apiUid], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _apiUid(): JsonField = body._apiUid() + + /** + * Returns the raw JSON value of [apiVersion]. + * + * Unlike [apiVersion], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _apiVersion(): JsonField = body._apiVersion() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): SdkUpdateParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [SdkUpdateParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SdkUpdateParams]. */ + class Builder internal constructor() { + + private var uid: String? = null + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(sdkUpdateParams: SdkUpdateParams) = apply { + uid = sdkUpdateParams.uid + body = sdkUpdateParams.body.toBuilder() + additionalHeaders = sdkUpdateParams.additionalHeaders.toBuilder() + additionalQueryParams = sdkUpdateParams.additionalQueryParams.toBuilder() + } + + fun uid(uid: String?) = apply { this.uid = uid } + + /** Alias for calling [Builder.uid] with `uid.orElse(null)`. */ + fun uid(uid: Optional) = uid(uid.getOrNull()) + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [title] + * - [slug] + * - [isPrivate] + * - [config] + * - [apiUid] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + fun title(title: String) = apply { body.title(title) } + + /** + * Sets [Builder.title] to an arbitrary JSON value. + * + * You should usually call [Builder.title] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun title(title: JsonField) = apply { body.title(title) } + + fun slug(slug: String) = apply { body.slug(slug) } + + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun slug(slug: JsonField) = apply { body.slug(slug) } + + fun isPrivate(isPrivate: Boolean) = apply { body.isPrivate(isPrivate) } + + /** + * Sets [Builder.isPrivate] to an arbitrary JSON value. + * + * You should usually call [Builder.isPrivate] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun isPrivate(isPrivate: JsonField) = apply { body.isPrivate(isPrivate) } + + fun config(config: String) = apply { body.config(config) } + + /** + * Sets [Builder.config] to an arbitrary JSON value. + * + * You should usually call [Builder.config] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun config(config: JsonField) = apply { body.config(config) } + + fun apiUid(apiUid: String?) = apply { body.apiUid(apiUid) } + + /** Alias for calling [Builder.apiUid] with `apiUid.orElse(null)`. */ + fun apiUid(apiUid: Optional) = apply { body.apiUid(apiUid.getOrNull()) } + + /** + * Sets [Builder.apiUid] to an arbitrary JSON value. + * + * You should usually call [Builder.apiUid] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun apiUid(apiUid: JsonField) = apply { body.apiUid(apiUid) } + + fun apiVersion(apiVersion: String?) = apply { body.apiVersion(apiVersion) } + + /** Alias for calling [Builder.apiVersion] with `apiVersion.orElse(null)`. */ + fun apiVersion(apiVersion: Optional) = apply { + body.apiVersion(apiVersion.getOrNull()) + } + + /** + * Sets [Builder.apiVersion] to an arbitrary JSON value. + * + * You should usually call [Builder.apiVersion] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun apiVersion(apiVersion: JsonField) = apply { body.apiVersion(apiVersion) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [SdkUpdateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): SdkUpdateParams = + SdkUpdateParams( + uid, + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> uid ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val title: JsonField, + private val slug: JsonField, + private val isPrivate: JsonField, + private val config: JsonField, + private val apiUid: JsonField, + private val apiVersion: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("title") @ExcludeMissing title: JsonField = JsonMissing.of(), + @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), + @JsonProperty("isPrivate") + @ExcludeMissing + isPrivate: JsonField = JsonMissing.of(), + @JsonProperty("config") @ExcludeMissing config: JsonField = JsonMissing.of(), + @JsonProperty("apiUid") @ExcludeMissing apiUid: JsonField = JsonMissing.of(), + @JsonProperty("apiVersion") + @ExcludeMissing + apiVersion: JsonField = JsonMissing.of(), + ) : this(title, slug, isPrivate, config, apiUid, apiVersion, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun title(): Optional = title.getOptional("title") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun slug(): Optional = slug.getOptional("slug") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun isPrivate(): Optional = isPrivate.getOptional("isPrivate") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun config(): Optional = config.getOptional("config") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun apiUid(): Optional = apiUid.getOptional("apiUid") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun apiVersion(): Optional = apiVersion.getOptional("apiVersion") + + /** + * Returns the raw JSON value of [title]. + * + * Unlike [title], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("title") @ExcludeMissing fun _title(): JsonField = title + + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug + + /** + * Returns the raw JSON value of [isPrivate]. + * + * Unlike [isPrivate], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("isPrivate") @ExcludeMissing fun _isPrivate(): JsonField = isPrivate + + /** + * Returns the raw JSON value of [config]. + * + * Unlike [config], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("config") @ExcludeMissing fun _config(): JsonField = config + + /** + * Returns the raw JSON value of [apiUid]. + * + * Unlike [apiUid], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("apiUid") @ExcludeMissing fun _apiUid(): JsonField = apiUid + + /** + * Returns the raw JSON value of [apiVersion]. + * + * Unlike [apiVersion], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("apiVersion") + @ExcludeMissing + fun _apiVersion(): JsonField = apiVersion + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Body]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var title: JsonField = JsonMissing.of() + private var slug: JsonField = JsonMissing.of() + private var isPrivate: JsonField = JsonMissing.of() + private var config: JsonField = JsonMissing.of() + private var apiUid: JsonField = JsonMissing.of() + private var apiVersion: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + title = body.title + slug = body.slug + isPrivate = body.isPrivate + config = body.config + apiUid = body.apiUid + apiVersion = body.apiVersion + additionalProperties = body.additionalProperties.toMutableMap() + } + + fun title(title: String) = title(JsonField.of(title)) + + /** + * Sets [Builder.title] to an arbitrary JSON value. + * + * You should usually call [Builder.title] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun title(title: JsonField) = apply { this.title = title } + + fun slug(slug: String) = slug(JsonField.of(slug)) + + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun slug(slug: JsonField) = apply { this.slug = slug } + + fun isPrivate(isPrivate: Boolean) = isPrivate(JsonField.of(isPrivate)) + + /** + * Sets [Builder.isPrivate] to an arbitrary JSON value. + * + * You should usually call [Builder.isPrivate] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun isPrivate(isPrivate: JsonField) = apply { this.isPrivate = isPrivate } + + fun config(config: String) = config(JsonField.of(config)) + + /** + * Sets [Builder.config] to an arbitrary JSON value. + * + * You should usually call [Builder.config] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun config(config: JsonField) = apply { this.config = config } + + fun apiUid(apiUid: String?) = apiUid(JsonField.ofNullable(apiUid)) + + /** Alias for calling [Builder.apiUid] with `apiUid.orElse(null)`. */ + fun apiUid(apiUid: Optional) = apiUid(apiUid.getOrNull()) + + /** + * Sets [Builder.apiUid] to an arbitrary JSON value. + * + * You should usually call [Builder.apiUid] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun apiUid(apiUid: JsonField) = apply { this.apiUid = apiUid } + + fun apiVersion(apiVersion: String?) = apiVersion(JsonField.ofNullable(apiVersion)) + + /** Alias for calling [Builder.apiVersion] with `apiVersion.orElse(null)`. */ + fun apiVersion(apiVersion: Optional) = apiVersion(apiVersion.getOrNull()) + + /** + * Sets [Builder.apiVersion] to an arbitrary JSON value. + * + * You should usually call [Builder.apiVersion] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun apiVersion(apiVersion: JsonField) = apply { this.apiVersion = apiVersion } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Body = + Body( + title, + slug, + isPrivate, + config, + apiUid, + apiVersion, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Body = apply { + if (validated) { + return@apply + } + + title() + slug() + isPrivate() + config() + apiUid() + apiVersion() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (title.asKnown().isPresent) 1 else 0) + + (if (slug.asKnown().isPresent) 1 else 0) + + (if (isPrivate.asKnown().isPresent) 1 else 0) + + (if (config.asKnown().isPresent) 1 else 0) + + (if (apiUid.asKnown().isPresent) 1 else 0) + + (if (apiVersion.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + title == other.title && + slug == other.slug && + isPrivate == other.isPrivate && + config == other.config && + apiUid == other.apiUid && + apiVersion == other.apiVersion && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + title, + slug, + isPrivate, + config, + apiUid, + apiVersion, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{title=$title, slug=$slug, isPrivate=$isPrivate, config=$config, apiUid=$apiUid, apiVersion=$apiVersion, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SdkUpdateParams && + uid == other.uid && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = Objects.hash(uid, body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "SdkUpdateParams{uid=$uid, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkVersion.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkVersion.kt new file mode 100644 index 0000000..07d6b7b --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/SdkVersion.kt @@ -0,0 +1,715 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.sdks + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.Enum +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.checkKnown +import com.scalar.core.checkRequired +import com.scalar.core.toImmutable +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class SdkVersion +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val version: JsonField, + private val apiVersion: JsonField, + private val status: JsonField, + private val languages: JsonField>, + private val publishedAt: JsonField, + private val createdAt: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("version") @ExcludeMissing version: JsonField = JsonMissing.of(), + @JsonProperty("apiVersion") + @ExcludeMissing + apiVersion: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + @JsonProperty("languages") + @ExcludeMissing + languages: JsonField> = JsonMissing.of(), + @JsonProperty("publishedAt") + @ExcludeMissing + publishedAt: JsonField = JsonMissing.of(), + @JsonProperty("createdAt") @ExcludeMissing createdAt: JsonField = JsonMissing.of(), + ) : this(version, apiVersion, status, languages, publishedAt, createdAt, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun version(): String = version.getRequired("version") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun apiVersion(): String = apiVersion.getRequired("apiVersion") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun status(): Status = status.getRequired("status") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun languages(): List = languages.getRequired("languages") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun publishedAt(): Optional = publishedAt.getOptional("publishedAt") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun createdAt(): Optional = createdAt.getOptional("createdAt") + + /** + * Returns the raw JSON value of [version]. + * + * Unlike [version], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("version") @ExcludeMissing fun _version(): JsonField = version + + /** + * Returns the raw JSON value of [apiVersion]. + * + * Unlike [apiVersion], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("apiVersion") @ExcludeMissing fun _apiVersion(): JsonField = apiVersion + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + /** + * Returns the raw JSON value of [languages]. + * + * Unlike [languages], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("languages") + @ExcludeMissing + fun _languages(): JsonField> = languages + + /** + * Returns the raw JSON value of [publishedAt]. + * + * Unlike [publishedAt], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("publishedAt") @ExcludeMissing fun _publishedAt(): JsonField = publishedAt + + /** + * Returns the raw JSON value of [createdAt]. + * + * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("createdAt") @ExcludeMissing fun _createdAt(): JsonField = createdAt + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [SdkVersion]. + * + * The following fields are required: + * ```kotlin + * .version() + * .apiVersion() + * .status() + * .languages() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SdkVersion]. */ + class Builder internal constructor() { + + private var version: JsonField? = null + private var apiVersion: JsonField? = null + private var status: JsonField? = null + private var languages: JsonField>? = null + private var publishedAt: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(sdkVersion: SdkVersion) = apply { + version = sdkVersion.version + apiVersion = sdkVersion.apiVersion + status = sdkVersion.status + languages = sdkVersion.languages.map { it.toMutableList() } + publishedAt = sdkVersion.publishedAt + createdAt = sdkVersion.createdAt + additionalProperties = sdkVersion.additionalProperties.toMutableMap() + } + + fun version(version: String) = version(JsonField.of(version)) + + /** + * Sets [Builder.version] to an arbitrary JSON value. + * + * You should usually call [Builder.version] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun version(version: JsonField) = apply { this.version = version } + + fun apiVersion(apiVersion: String) = apiVersion(JsonField.of(apiVersion)) + + /** + * Sets [Builder.apiVersion] to an arbitrary JSON value. + * + * You should usually call [Builder.apiVersion] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun apiVersion(apiVersion: JsonField) = apply { this.apiVersion = apiVersion } + + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + fun languages(languages: List) = languages(JsonField.of(languages)) + + /** + * Sets [Builder.languages] to an arbitrary JSON value. + * + * You should usually call [Builder.languages] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun languages(languages: JsonField>) = apply { + this.languages = languages.map { it.toMutableList() } + } + + /** + * Adds a single [Language] to [languages]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addLanguage(language: Language) = apply { + languages = + (languages ?: JsonField.of(mutableListOf())).also { + checkKnown("languages", it).add(language) + } + } + + fun publishedAt(publishedAt: Long) = publishedAt(JsonField.of(publishedAt)) + + /** + * Sets [Builder.publishedAt] to an arbitrary JSON value. + * + * You should usually call [Builder.publishedAt] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun publishedAt(publishedAt: JsonField) = apply { this.publishedAt = publishedAt } + + fun createdAt(createdAt: Long) = createdAt(JsonField.of(createdAt)) + + /** + * Sets [Builder.createdAt] to an arbitrary JSON value. + * + * You should usually call [Builder.createdAt] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [SdkVersion]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .version() + * .apiVersion() + * .status() + * .languages() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SdkVersion = + SdkVersion( + checkRequired("version", version), + checkRequired("apiVersion", apiVersion), + checkRequired("status", status), + checkRequired("languages", languages).map { it.toImmutable() }, + publishedAt, + createdAt, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): SdkVersion = apply { + if (validated) { + return@apply + } + + version() + apiVersion() + status().validate() + languages().forEach { it.validate() } + publishedAt() + createdAt() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (version.asKnown().isPresent) 1 else 0) + + (if (apiVersion.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (languages.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (publishedAt.asKnown().isPresent) 1 else 0) + + (if (createdAt.asKnown().isPresent) 1 else 0) + + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val DRAFT = of("draft") + + @JvmField val PUBLISHED = of("published") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + DRAFT, + PUBLISHED, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DRAFT, + PUBLISHED, + /** An enum member indicating that [Status] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DRAFT -> Value.DRAFT + PUBLISHED -> Value.PUBLISHED + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws ScalarInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + DRAFT -> Known.DRAFT + PUBLISHED -> Known.PUBLISHED + else -> throw ScalarInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws ScalarInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { ScalarInvalidDataException("Value is not a String") } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class Language @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val TYPESCRIPT = of("typescript") + + @JvmField val PYTHON = of("python") + + @JvmField val CLI = of("cli") + + @JvmField val CSHARP = of("csharp") + + @JvmField val JAVA = of("java") + + @JvmField val RUBY = of("ruby") + + @JvmField val PHP = of("php") + + @JvmField val GO = of("go") + + @JvmField val RUST = of("rust") + + @JvmField val KOTLIN = of("kotlin") + + @JvmField val SWIFT = of("swift") + + @JvmField val CPP = of("cpp") + + @JvmField val DART = of("dart") + + @JvmStatic fun of(value: String) = Language(JsonField.of(value)) + } + + /** An enum containing [Language]'s known values. */ + enum class Known { + TYPESCRIPT, + PYTHON, + CLI, + CSHARP, + JAVA, + RUBY, + PHP, + GO, + RUST, + KOTLIN, + SWIFT, + CPP, + DART, + } + + /** + * An enum containing [Language]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Language] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + TYPESCRIPT, + PYTHON, + CLI, + CSHARP, + JAVA, + RUBY, + PHP, + GO, + RUST, + KOTLIN, + SWIFT, + CPP, + DART, + /** An enum member indicating that [Language] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + TYPESCRIPT -> Value.TYPESCRIPT + PYTHON -> Value.PYTHON + CLI -> Value.CLI + CSHARP -> Value.CSHARP + JAVA -> Value.JAVA + RUBY -> Value.RUBY + PHP -> Value.PHP + GO -> Value.GO + RUST -> Value.RUST + KOTLIN -> Value.KOTLIN + SWIFT -> Value.SWIFT + CPP -> Value.CPP + DART -> Value.DART + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws ScalarInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + TYPESCRIPT -> Known.TYPESCRIPT + PYTHON -> Known.PYTHON + CLI -> Known.CLI + CSHARP -> Known.CSHARP + JAVA -> Known.JAVA + RUBY -> Known.RUBY + PHP -> Known.PHP + GO -> Known.GO + RUST -> Known.RUST + KOTLIN -> Known.KOTLIN + SWIFT -> Known.SWIFT + CPP -> Known.CPP + DART -> Known.DART + else -> throw ScalarInvalidDataException("Unknown Language: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws ScalarInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { ScalarInvalidDataException("Value is not a String") } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Language = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Language && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SdkVersion && + version == other.version && + apiVersion == other.apiVersion && + status == other.status && + languages == other.languages && + publishedAt == other.publishedAt && + createdAt == other.createdAt && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + version, + apiVersion, + status, + languages, + publishedAt, + createdAt, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "SdkVersion{version=$version, apiVersion=$apiVersion, status=$status, languages=$languages, publishedAt=$publishedAt, createdAt=$createdAt, additionalProperties=$additionalProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/repositories/RepositoryLinkParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/repositories/RepositoryLinkParams.kt new file mode 100644 index 0000000..571b634 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/repositories/RepositoryLinkParams.kt @@ -0,0 +1,855 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.sdks.repositories + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.Enum +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.Params +import com.scalar.core.checkRequired +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Link one language target to a GitHub repository, so builds sync there. */ +class RepositoryLinkParams +private constructor( + private val uid: String?, + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun language(): Language = body.language() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun repositoryId(): Long = body.repositoryId() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun baseBranch(): String = body.baseBranch() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun prereleaseType(): Optional = body.prereleaseType() + + fun uid(): Optional = Optional.ofNullable(uid) + + /** + * Returns the raw JSON value of [language]. + * + * Unlike [language], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _language(): JsonField = body._language() + + /** + * Returns the raw JSON value of [repositoryId]. + * + * Unlike [repositoryId], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _repositoryId(): JsonField = body._repositoryId() + + /** + * Returns the raw JSON value of [baseBranch]. + * + * Unlike [baseBranch], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _baseBranch(): JsonField = body._baseBranch() + + /** + * Returns the raw JSON value of [prereleaseType]. + * + * Unlike [prereleaseType], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _prereleaseType(): JsonField = body._prereleaseType() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [RepositoryLinkParams]. + * + * The following fields are required: + * ```kotlin + * .language() + * .repositoryId() + * .baseBranch() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RepositoryLinkParams]. */ + class Builder internal constructor() { + + private var uid: String? = null + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(repositoryLinkParams: RepositoryLinkParams) = apply { + uid = repositoryLinkParams.uid + body = repositoryLinkParams.body.toBuilder() + additionalHeaders = repositoryLinkParams.additionalHeaders.toBuilder() + additionalQueryParams = repositoryLinkParams.additionalQueryParams.toBuilder() + } + + fun uid(uid: String?) = apply { this.uid = uid } + + /** Alias for calling [Builder.uid] with `uid.orElse(null)`. */ + fun uid(uid: Optional) = uid(uid.getOrNull()) + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [language] + * - [repositoryId] + * - [baseBranch] + * - [prereleaseType] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + fun language(language: Language) = apply { body.language(language) } + + /** + * Sets [Builder.language] to an arbitrary JSON value. + * + * You should usually call [Builder.language] with a well-typed [Language] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun language(language: JsonField) = apply { body.language(language) } + + fun repositoryId(repositoryId: Long) = apply { body.repositoryId(repositoryId) } + + /** + * Sets [Builder.repositoryId] to an arbitrary JSON value. + * + * You should usually call [Builder.repositoryId] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun repositoryId(repositoryId: JsonField) = apply { body.repositoryId(repositoryId) } + + fun baseBranch(baseBranch: String) = apply { body.baseBranch(baseBranch) } + + /** + * Sets [Builder.baseBranch] to an arbitrary JSON value. + * + * You should usually call [Builder.baseBranch] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun baseBranch(baseBranch: JsonField) = apply { body.baseBranch(baseBranch) } + + fun prereleaseType(prereleaseType: String) = apply { body.prereleaseType(prereleaseType) } + + /** + * Sets [Builder.prereleaseType] to an arbitrary JSON value. + * + * You should usually call [Builder.prereleaseType] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun prereleaseType(prereleaseType: JsonField) = apply { + body.prereleaseType(prereleaseType) + } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [RepositoryLinkParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .language() + * .repositoryId() + * .baseBranch() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): RepositoryLinkParams = + RepositoryLinkParams( + uid, + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> uid ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val language: JsonField, + private val repositoryId: JsonField, + private val baseBranch: JsonField, + private val prereleaseType: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("language") + @ExcludeMissing + language: JsonField = JsonMissing.of(), + @JsonProperty("repositoryId") + @ExcludeMissing + repositoryId: JsonField = JsonMissing.of(), + @JsonProperty("baseBranch") + @ExcludeMissing + baseBranch: JsonField = JsonMissing.of(), + @JsonProperty("prereleaseType") + @ExcludeMissing + prereleaseType: JsonField = JsonMissing.of(), + ) : this(language, repositoryId, baseBranch, prereleaseType, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun language(): Language = language.getRequired("language") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun repositoryId(): Long = repositoryId.getRequired("repositoryId") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun baseBranch(): String = baseBranch.getRequired("baseBranch") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun prereleaseType(): Optional = prereleaseType.getOptional("prereleaseType") + + /** + * Returns the raw JSON value of [language]. + * + * Unlike [language], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("language") @ExcludeMissing fun _language(): JsonField = language + + /** + * Returns the raw JSON value of [repositoryId]. + * + * Unlike [repositoryId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("repositoryId") + @ExcludeMissing + fun _repositoryId(): JsonField = repositoryId + + /** + * Returns the raw JSON value of [baseBranch]. + * + * Unlike [baseBranch], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("baseBranch") + @ExcludeMissing + fun _baseBranch(): JsonField = baseBranch + + /** + * Returns the raw JSON value of [prereleaseType]. + * + * Unlike [prereleaseType], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("prereleaseType") + @ExcludeMissing + fun _prereleaseType(): JsonField = prereleaseType + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```kotlin + * .language() + * .repositoryId() + * .baseBranch() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var language: JsonField? = null + private var repositoryId: JsonField? = null + private var baseBranch: JsonField? = null + private var prereleaseType: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + language = body.language + repositoryId = body.repositoryId + baseBranch = body.baseBranch + prereleaseType = body.prereleaseType + additionalProperties = body.additionalProperties.toMutableMap() + } + + fun language(language: Language) = language(JsonField.of(language)) + + /** + * Sets [Builder.language] to an arbitrary JSON value. + * + * You should usually call [Builder.language] with a well-typed [Language] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun language(language: JsonField) = apply { this.language = language } + + fun repositoryId(repositoryId: Long) = repositoryId(JsonField.of(repositoryId)) + + /** + * Sets [Builder.repositoryId] to an arbitrary JSON value. + * + * You should usually call [Builder.repositoryId] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun repositoryId(repositoryId: JsonField) = apply { + this.repositoryId = repositoryId + } + + fun baseBranch(baseBranch: String) = baseBranch(JsonField.of(baseBranch)) + + /** + * Sets [Builder.baseBranch] to an arbitrary JSON value. + * + * You should usually call [Builder.baseBranch] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun baseBranch(baseBranch: JsonField) = apply { this.baseBranch = baseBranch } + + fun prereleaseType(prereleaseType: String) = + prereleaseType(JsonField.of(prereleaseType)) + + /** + * Sets [Builder.prereleaseType] to an arbitrary JSON value. + * + * You should usually call [Builder.prereleaseType] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun prereleaseType(prereleaseType: JsonField) = apply { + this.prereleaseType = prereleaseType + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .language() + * .repositoryId() + * .baseBranch() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Body = + Body( + checkRequired("language", language), + checkRequired("repositoryId", repositoryId), + checkRequired("baseBranch", baseBranch), + prereleaseType, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Body = apply { + if (validated) { + return@apply + } + + language().validate() + repositoryId() + baseBranch() + prereleaseType() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (language.asKnown().getOrNull()?.validity() ?: 0) + + (if (repositoryId.asKnown().isPresent) 1 else 0) + + (if (baseBranch.asKnown().isPresent) 1 else 0) + + (if (prereleaseType.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + language == other.language && + repositoryId == other.repositoryId && + baseBranch == other.baseBranch && + prereleaseType == other.prereleaseType && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + language, + repositoryId, + baseBranch, + prereleaseType, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{language=$language, repositoryId=$repositoryId, baseBranch=$baseBranch, prereleaseType=$prereleaseType, additionalProperties=$additionalProperties}" + } + + class Language @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val TYPESCRIPT = of("typescript") + + @JvmField val PYTHON = of("python") + + @JvmField val CLI = of("cli") + + @JvmField val CSHARP = of("csharp") + + @JvmField val JAVA = of("java") + + @JvmField val RUBY = of("ruby") + + @JvmField val PHP = of("php") + + @JvmField val GO = of("go") + + @JvmField val RUST = of("rust") + + @JvmField val KOTLIN = of("kotlin") + + @JvmField val SWIFT = of("swift") + + @JvmField val CPP = of("cpp") + + @JvmField val DART = of("dart") + + @JvmStatic fun of(value: String) = Language(JsonField.of(value)) + } + + /** An enum containing [Language]'s known values. */ + enum class Known { + TYPESCRIPT, + PYTHON, + CLI, + CSHARP, + JAVA, + RUBY, + PHP, + GO, + RUST, + KOTLIN, + SWIFT, + CPP, + DART, + } + + /** + * An enum containing [Language]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Language] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + TYPESCRIPT, + PYTHON, + CLI, + CSHARP, + JAVA, + RUBY, + PHP, + GO, + RUST, + KOTLIN, + SWIFT, + CPP, + DART, + /** An enum member indicating that [Language] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + TYPESCRIPT -> Value.TYPESCRIPT + PYTHON -> Value.PYTHON + CLI -> Value.CLI + CSHARP -> Value.CSHARP + JAVA -> Value.JAVA + RUBY -> Value.RUBY + PHP -> Value.PHP + GO -> Value.GO + RUST -> Value.RUST + KOTLIN -> Value.KOTLIN + SWIFT -> Value.SWIFT + CPP -> Value.CPP + DART -> Value.DART + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws ScalarInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + TYPESCRIPT -> Known.TYPESCRIPT + PYTHON -> Known.PYTHON + CLI -> Known.CLI + CSHARP -> Known.CSHARP + JAVA -> Known.JAVA + RUBY -> Known.RUBY + PHP -> Known.PHP + GO -> Known.GO + RUST -> Known.RUST + KOTLIN -> Known.KOTLIN + SWIFT -> Known.SWIFT + CPP -> Known.CPP + DART -> Known.DART + else -> throw ScalarInvalidDataException("Unknown Language: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws ScalarInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { ScalarInvalidDataException("Value is not a String") } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Language = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Language && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RepositoryLinkParams && + uid == other.uid && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = Objects.hash(uid, body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "RepositoryLinkParams{uid=$uid, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/repositories/RepositoryLinkResponse.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/repositories/RepositoryLinkResponse.kt new file mode 100644 index 0000000..30fad7f --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/repositories/RepositoryLinkResponse.kt @@ -0,0 +1,212 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.sdks.repositories + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.checkRequired +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects + +class RepositoryLinkResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val repo: JsonField, + private val branch: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("repo") @ExcludeMissing repo: JsonField = JsonMissing.of(), + @JsonProperty("branch") @ExcludeMissing branch: JsonField = JsonMissing.of(), + ) : this(repo, branch, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun repo(): String = repo.getRequired("repo") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun branch(): String = branch.getRequired("branch") + + /** + * Returns the raw JSON value of [repo]. + * + * Unlike [repo], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("repo") @ExcludeMissing fun _repo(): JsonField = repo + + /** + * Returns the raw JSON value of [branch]. + * + * Unlike [branch], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("branch") @ExcludeMissing fun _branch(): JsonField = branch + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [RepositoryLinkResponse]. + * + * The following fields are required: + * ```kotlin + * .repo() + * .branch() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RepositoryLinkResponse]. */ + class Builder internal constructor() { + + private var repo: JsonField? = null + private var branch: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(repositoryLinkResponse: RepositoryLinkResponse) = apply { + repo = repositoryLinkResponse.repo + branch = repositoryLinkResponse.branch + additionalProperties = repositoryLinkResponse.additionalProperties.toMutableMap() + } + + fun repo(repo: String) = repo(JsonField.of(repo)) + + /** + * Sets [Builder.repo] to an arbitrary JSON value. + * + * You should usually call [Builder.repo] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun repo(repo: JsonField) = apply { this.repo = repo } + + fun branch(branch: String) = branch(JsonField.of(branch)) + + /** + * Sets [Builder.branch] to an arbitrary JSON value. + * + * You should usually call [Builder.branch] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun branch(branch: JsonField) = apply { this.branch = branch } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [RepositoryLinkResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .repo() + * .branch() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): RepositoryLinkResponse = + RepositoryLinkResponse( + checkRequired("repo", repo), + checkRequired("branch", branch), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): RepositoryLinkResponse = apply { + if (validated) { + return@apply + } + + repo() + branch() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (repo.asKnown().isPresent) 1 else 0) + (if (branch.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RepositoryLinkResponse && + repo == other.repo && + branch == other.branch && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(repo, branch, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "RepositoryLinkResponse{repo=$repo, branch=$branch, additionalProperties=$additionalProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/repositories/RepositoryUnlinkParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/repositories/RepositoryUnlinkParams.kt new file mode 100644 index 0000000..12dc770 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/repositories/RepositoryUnlinkParams.kt @@ -0,0 +1,463 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.sdks.repositories + +import com.fasterxml.jackson.annotation.JsonCreator +import com.scalar.core.Enum +import com.scalar.core.JsonField +import com.scalar.core.JsonValue +import com.scalar.core.Params +import com.scalar.core.checkRequired +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import com.scalar.core.toImmutable +import com.scalar.errors.ScalarInvalidDataException +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Unlink one language target from its repository. */ +class RepositoryUnlinkParams +private constructor( + private val uid: String, + private val language: Language?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, + private val additionalBodyProperties: Map, +) : Params { + + fun uid(): String = uid + + fun language(): Optional = Optional.ofNullable(language) + + /** Additional body properties to send with the request. */ + fun _additionalBodyProperties(): Map = additionalBodyProperties + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [RepositoryUnlinkParams]. + * + * The following fields are required: + * ```kotlin + * .uid() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RepositoryUnlinkParams]. */ + class Builder internal constructor() { + + private var uid: String? = null + private var language: Language? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(repositoryUnlinkParams: RepositoryUnlinkParams) = apply { + uid = repositoryUnlinkParams.uid + language = repositoryUnlinkParams.language + additionalHeaders = repositoryUnlinkParams.additionalHeaders.toBuilder() + additionalQueryParams = repositoryUnlinkParams.additionalQueryParams.toBuilder() + additionalBodyProperties = + repositoryUnlinkParams.additionalBodyProperties.toMutableMap() + } + + fun uid(uid: String) = apply { this.uid = uid } + + fun language(language: Language?) = apply { this.language = language } + + /** Alias for calling [Builder.language] with `language.orElse(null)`. */ + fun language(language: Optional) = language(language.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + putAllAdditionalBodyProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { + additionalBodyProperties.remove(key) + } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalBodyProperty) + } + + /** + * Returns an immutable instance of [RepositoryUnlinkParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .uid() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): RepositoryUnlinkParams = + RepositoryUnlinkParams( + checkRequired("uid", uid), + language, + additionalHeaders.build(), + additionalQueryParams.build(), + additionalBodyProperties.toImmutable(), + ) + } + + fun _body(): Optional> = + Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) + + fun _pathParam(index: Int): String = + when (index) { + 0 -> uid + 1 -> language?.toString() ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Language @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val TYPESCRIPT = of("typescript") + + @JvmField val PYTHON = of("python") + + @JvmField val CLI = of("cli") + + @JvmField val CSHARP = of("csharp") + + @JvmField val JAVA = of("java") + + @JvmField val RUBY = of("ruby") + + @JvmField val PHP = of("php") + + @JvmField val GO = of("go") + + @JvmField val RUST = of("rust") + + @JvmField val KOTLIN = of("kotlin") + + @JvmField val SWIFT = of("swift") + + @JvmField val CPP = of("cpp") + + @JvmField val DART = of("dart") + + @JvmStatic fun of(value: String) = Language(JsonField.of(value)) + } + + /** An enum containing [Language]'s known values. */ + enum class Known { + TYPESCRIPT, + PYTHON, + CLI, + CSHARP, + JAVA, + RUBY, + PHP, + GO, + RUST, + KOTLIN, + SWIFT, + CPP, + DART, + } + + /** + * An enum containing [Language]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Language] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + TYPESCRIPT, + PYTHON, + CLI, + CSHARP, + JAVA, + RUBY, + PHP, + GO, + RUST, + KOTLIN, + SWIFT, + CPP, + DART, + /** An enum member indicating that [Language] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + TYPESCRIPT -> Value.TYPESCRIPT + PYTHON -> Value.PYTHON + CLI -> Value.CLI + CSHARP -> Value.CSHARP + JAVA -> Value.JAVA + RUBY -> Value.RUBY + PHP -> Value.PHP + GO -> Value.GO + RUST -> Value.RUST + KOTLIN -> Value.KOTLIN + SWIFT -> Value.SWIFT + CPP -> Value.CPP + DART -> Value.DART + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws ScalarInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + TYPESCRIPT -> Known.TYPESCRIPT + PYTHON -> Known.PYTHON + CLI -> Known.CLI + CSHARP -> Known.CSHARP + JAVA -> Known.JAVA + RUBY -> Known.RUBY + PHP -> Known.PHP + GO -> Known.GO + RUST -> Known.RUST + KOTLIN -> Known.KOTLIN + SWIFT -> Known.SWIFT + CPP -> Known.CPP + DART -> Known.DART + else -> throw ScalarInvalidDataException("Unknown Language: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws ScalarInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { ScalarInvalidDataException("Value is not a String") } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Language = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Language && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RepositoryUnlinkParams && + uid == other.uid && + language == other.language && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams && + additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int = + Objects.hash( + uid, + language, + additionalHeaders, + additionalQueryParams, + additionalBodyProperties, + ) + + override fun toString() = + "RepositoryUnlinkParams{uid=$uid, language=$language, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/repositories/RepositoryUpdatePublishingParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/repositories/RepositoryUpdatePublishingParams.kt new file mode 100644 index 0000000..327f43b --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/repositories/RepositoryUpdatePublishingParams.kt @@ -0,0 +1,1118 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.sdks.repositories + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.Enum +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.Params +import com.scalar.core.checkRequired +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Toggle publish-on-merge and the release settings for a linked target. */ +class RepositoryUpdatePublishingParams +private constructor( + private val uid: String, + private val language: Language?, + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun publishOnMerge(): Boolean = body.publishOnMerge() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun authMethod(): Optional = body.authMethod() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun access(): Optional = body.access() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun tag(): Optional = body.tag() + + fun uid(): String = uid + + fun language(): Optional = Optional.ofNullable(language) + + /** + * Returns the raw JSON value of [publishOnMerge]. + * + * Unlike [publishOnMerge], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _publishOnMerge(): JsonField = body._publishOnMerge() + + /** + * Returns the raw JSON value of [authMethod]. + * + * Unlike [authMethod], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _authMethod(): JsonField = body._authMethod() + + /** + * Returns the raw JSON value of [access]. + * + * Unlike [access], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _access(): JsonField = body._access() + + /** + * Returns the raw JSON value of [tag]. + * + * Unlike [tag], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _tag(): JsonField = body._tag() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [RepositoryUpdatePublishingParams]. + * + * The following fields are required: + * ```kotlin + * .uid() + * .publishOnMerge() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RepositoryUpdatePublishingParams]. */ + class Builder internal constructor() { + + private var uid: String? = null + private var language: Language? = null + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(repositoryUpdatePublishingParams: RepositoryUpdatePublishingParams) = + apply { + uid = repositoryUpdatePublishingParams.uid + language = repositoryUpdatePublishingParams.language + body = repositoryUpdatePublishingParams.body.toBuilder() + additionalHeaders = repositoryUpdatePublishingParams.additionalHeaders.toBuilder() + additionalQueryParams = + repositoryUpdatePublishingParams.additionalQueryParams.toBuilder() + } + + fun uid(uid: String) = apply { this.uid = uid } + + fun language(language: Language?) = apply { this.language = language } + + /** Alias for calling [Builder.language] with `language.orElse(null)`. */ + fun language(language: Optional) = language(language.getOrNull()) + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [publishOnMerge] + * - [authMethod] + * - [access] + * - [tag] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + fun publishOnMerge(publishOnMerge: Boolean) = apply { body.publishOnMerge(publishOnMerge) } + + /** + * Sets [Builder.publishOnMerge] to an arbitrary JSON value. + * + * You should usually call [Builder.publishOnMerge] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun publishOnMerge(publishOnMerge: JsonField) = apply { + body.publishOnMerge(publishOnMerge) + } + + fun authMethod(authMethod: AuthMethod) = apply { body.authMethod(authMethod) } + + /** + * Sets [Builder.authMethod] to an arbitrary JSON value. + * + * You should usually call [Builder.authMethod] with a well-typed [AuthMethod] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun authMethod(authMethod: JsonField) = apply { body.authMethod(authMethod) } + + fun access(access: Access) = apply { body.access(access) } + + /** + * Sets [Builder.access] to an arbitrary JSON value. + * + * You should usually call [Builder.access] with a well-typed [Access] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun access(access: JsonField) = apply { body.access(access) } + + fun tag(tag: String) = apply { body.tag(tag) } + + /** + * Sets [Builder.tag] to an arbitrary JSON value. + * + * You should usually call [Builder.tag] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun tag(tag: JsonField) = apply { body.tag(tag) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [RepositoryUpdatePublishingParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .uid() + * .publishOnMerge() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): RepositoryUpdatePublishingParams = + RepositoryUpdatePublishingParams( + checkRequired("uid", uid), + language, + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> uid + 1 -> language?.toString() ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val publishOnMerge: JsonField, + private val authMethod: JsonField, + private val access: JsonField, + private val tag: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("publishOnMerge") + @ExcludeMissing + publishOnMerge: JsonField = JsonMissing.of(), + @JsonProperty("authMethod") + @ExcludeMissing + authMethod: JsonField = JsonMissing.of(), + @JsonProperty("access") @ExcludeMissing access: JsonField = JsonMissing.of(), + @JsonProperty("tag") @ExcludeMissing tag: JsonField = JsonMissing.of(), + ) : this(publishOnMerge, authMethod, access, tag, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun publishOnMerge(): Boolean = publishOnMerge.getRequired("publishOnMerge") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun authMethod(): Optional = authMethod.getOptional("authMethod") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun access(): Optional = access.getOptional("access") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun tag(): Optional = tag.getOptional("tag") + + /** + * Returns the raw JSON value of [publishOnMerge]. + * + * Unlike [publishOnMerge], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("publishOnMerge") + @ExcludeMissing + fun _publishOnMerge(): JsonField = publishOnMerge + + /** + * Returns the raw JSON value of [authMethod]. + * + * Unlike [authMethod], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("authMethod") + @ExcludeMissing + fun _authMethod(): JsonField = authMethod + + /** + * Returns the raw JSON value of [access]. + * + * Unlike [access], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("access") @ExcludeMissing fun _access(): JsonField = access + + /** + * Returns the raw JSON value of [tag]. + * + * Unlike [tag], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("tag") @ExcludeMissing fun _tag(): JsonField = tag + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```kotlin + * .publishOnMerge() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var publishOnMerge: JsonField? = null + private var authMethod: JsonField = JsonMissing.of() + private var access: JsonField = JsonMissing.of() + private var tag: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + publishOnMerge = body.publishOnMerge + authMethod = body.authMethod + access = body.access + tag = body.tag + additionalProperties = body.additionalProperties.toMutableMap() + } + + fun publishOnMerge(publishOnMerge: Boolean) = + publishOnMerge(JsonField.of(publishOnMerge)) + + /** + * Sets [Builder.publishOnMerge] to an arbitrary JSON value. + * + * You should usually call [Builder.publishOnMerge] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun publishOnMerge(publishOnMerge: JsonField) = apply { + this.publishOnMerge = publishOnMerge + } + + fun authMethod(authMethod: AuthMethod) = authMethod(JsonField.of(authMethod)) + + /** + * Sets [Builder.authMethod] to an arbitrary JSON value. + * + * You should usually call [Builder.authMethod] with a well-typed [AuthMethod] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun authMethod(authMethod: JsonField) = apply { + this.authMethod = authMethod + } + + fun access(access: Access) = access(JsonField.of(access)) + + /** + * Sets [Builder.access] to an arbitrary JSON value. + * + * You should usually call [Builder.access] with a well-typed [Access] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun access(access: JsonField) = apply { this.access = access } + + fun tag(tag: String) = tag(JsonField.of(tag)) + + /** + * Sets [Builder.tag] to an arbitrary JSON value. + * + * You should usually call [Builder.tag] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun tag(tag: JsonField) = apply { this.tag = tag } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .publishOnMerge() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Body = + Body( + checkRequired("publishOnMerge", publishOnMerge), + authMethod, + access, + tag, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Body = apply { + if (validated) { + return@apply + } + + publishOnMerge() + authMethod().ifPresent { it.validate() } + access().ifPresent { it.validate() } + tag() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (publishOnMerge.asKnown().isPresent) 1 else 0) + + (authMethod.asKnown().getOrNull()?.validity() ?: 0) + + (access.asKnown().getOrNull()?.validity() ?: 0) + + (if (tag.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + publishOnMerge == other.publishOnMerge && + authMethod == other.authMethod && + access == other.access && + tag == other.tag && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(publishOnMerge, authMethod, access, tag, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{publishOnMerge=$publishOnMerge, authMethod=$authMethod, access=$access, tag=$tag, additionalProperties=$additionalProperties}" + } + + class Language @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val TYPESCRIPT = of("typescript") + + @JvmField val PYTHON = of("python") + + @JvmField val CLI = of("cli") + + @JvmField val CSHARP = of("csharp") + + @JvmField val JAVA = of("java") + + @JvmField val RUBY = of("ruby") + + @JvmField val PHP = of("php") + + @JvmField val GO = of("go") + + @JvmField val RUST = of("rust") + + @JvmField val KOTLIN = of("kotlin") + + @JvmField val SWIFT = of("swift") + + @JvmField val CPP = of("cpp") + + @JvmField val DART = of("dart") + + @JvmStatic fun of(value: String) = Language(JsonField.of(value)) + } + + /** An enum containing [Language]'s known values. */ + enum class Known { + TYPESCRIPT, + PYTHON, + CLI, + CSHARP, + JAVA, + RUBY, + PHP, + GO, + RUST, + KOTLIN, + SWIFT, + CPP, + DART, + } + + /** + * An enum containing [Language]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Language] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + TYPESCRIPT, + PYTHON, + CLI, + CSHARP, + JAVA, + RUBY, + PHP, + GO, + RUST, + KOTLIN, + SWIFT, + CPP, + DART, + /** An enum member indicating that [Language] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + TYPESCRIPT -> Value.TYPESCRIPT + PYTHON -> Value.PYTHON + CLI -> Value.CLI + CSHARP -> Value.CSHARP + JAVA -> Value.JAVA + RUBY -> Value.RUBY + PHP -> Value.PHP + GO -> Value.GO + RUST -> Value.RUST + KOTLIN -> Value.KOTLIN + SWIFT -> Value.SWIFT + CPP -> Value.CPP + DART -> Value.DART + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws ScalarInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + TYPESCRIPT -> Known.TYPESCRIPT + PYTHON -> Known.PYTHON + CLI -> Known.CLI + CSHARP -> Known.CSHARP + JAVA -> Known.JAVA + RUBY -> Known.RUBY + PHP -> Known.PHP + GO -> Known.GO + RUST -> Known.RUST + KOTLIN -> Known.KOTLIN + SWIFT -> Known.SWIFT + CPP -> Known.CPP + DART -> Known.DART + else -> throw ScalarInvalidDataException("Unknown Language: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws ScalarInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { ScalarInvalidDataException("Value is not a String") } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Language = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Language && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class AuthMethod @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val OIDC = of("oidc") + + @JvmField val ACCESS_TOKEN = of("access-token") + + @JvmStatic fun of(value: String) = AuthMethod(JsonField.of(value)) + } + + /** An enum containing [AuthMethod]'s known values. */ + enum class Known { + OIDC, + ACCESS_TOKEN, + } + + /** + * An enum containing [AuthMethod]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [AuthMethod] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + OIDC, + ACCESS_TOKEN, + /** + * An enum member indicating that [AuthMethod] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + OIDC -> Value.OIDC + ACCESS_TOKEN -> Value.ACCESS_TOKEN + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws ScalarInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + OIDC -> Known.OIDC + ACCESS_TOKEN -> Known.ACCESS_TOKEN + else -> throw ScalarInvalidDataException("Unknown AuthMethod: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws ScalarInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { ScalarInvalidDataException("Value is not a String") } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): AuthMethod = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AuthMethod && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class Access @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val PUBLIC = of("public") + + @JvmField val RESTRICTED = of("restricted") + + @JvmStatic fun of(value: String) = Access(JsonField.of(value)) + } + + /** An enum containing [Access]'s known values. */ + enum class Known { + PUBLIC, + RESTRICTED, + } + + /** + * An enum containing [Access]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Access] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PUBLIC, + RESTRICTED, + /** An enum member indicating that [Access] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PUBLIC -> Value.PUBLIC + RESTRICTED -> Value.RESTRICTED + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws ScalarInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + PUBLIC -> Known.PUBLIC + RESTRICTED -> Known.RESTRICTED + else -> throw ScalarInvalidDataException("Unknown Access: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws ScalarInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { ScalarInvalidDataException("Value is not a String") } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Access = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Access && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RepositoryUpdatePublishingParams && + uid == other.uid && + language == other.language && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash(uid, language, body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "RepositoryUpdatePublishingParams{uid=$uid, language=$language, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/versions/VersionCreateParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/versions/VersionCreateParams.kt new file mode 100644 index 0000000..b290777 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/versions/VersionCreateParams.kt @@ -0,0 +1,510 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.sdks.versions + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.Params +import com.scalar.core.checkRequired +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Create a new SDK version against a specific API version. */ +class VersionCreateParams +private constructor( + private val uid: String?, + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun version(): String = body.version() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun apiVersion(): String = body.apiVersion() + + fun uid(): Optional = Optional.ofNullable(uid) + + /** + * Returns the raw JSON value of [version]. + * + * Unlike [version], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _version(): JsonField = body._version() + + /** + * Returns the raw JSON value of [apiVersion]. + * + * Unlike [apiVersion], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _apiVersion(): JsonField = body._apiVersion() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [VersionCreateParams]. + * + * The following fields are required: + * ```kotlin + * .version() + * .apiVersion() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [VersionCreateParams]. */ + class Builder internal constructor() { + + private var uid: String? = null + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(versionCreateParams: VersionCreateParams) = apply { + uid = versionCreateParams.uid + body = versionCreateParams.body.toBuilder() + additionalHeaders = versionCreateParams.additionalHeaders.toBuilder() + additionalQueryParams = versionCreateParams.additionalQueryParams.toBuilder() + } + + fun uid(uid: String?) = apply { this.uid = uid } + + /** Alias for calling [Builder.uid] with `uid.orElse(null)`. */ + fun uid(uid: Optional) = uid(uid.getOrNull()) + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [version] + * - [apiVersion] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + fun version(version: String) = apply { body.version(version) } + + /** + * Sets [Builder.version] to an arbitrary JSON value. + * + * You should usually call [Builder.version] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun version(version: JsonField) = apply { body.version(version) } + + fun apiVersion(apiVersion: String) = apply { body.apiVersion(apiVersion) } + + /** + * Sets [Builder.apiVersion] to an arbitrary JSON value. + * + * You should usually call [Builder.apiVersion] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun apiVersion(apiVersion: JsonField) = apply { body.apiVersion(apiVersion) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [VersionCreateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .version() + * .apiVersion() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): VersionCreateParams = + VersionCreateParams( + uid, + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> uid ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val version: JsonField, + private val apiVersion: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("version") @ExcludeMissing version: JsonField = JsonMissing.of(), + @JsonProperty("apiVersion") + @ExcludeMissing + apiVersion: JsonField = JsonMissing.of(), + ) : this(version, apiVersion, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun version(): String = version.getRequired("version") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun apiVersion(): String = apiVersion.getRequired("apiVersion") + + /** + * Returns the raw JSON value of [version]. + * + * Unlike [version], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("version") @ExcludeMissing fun _version(): JsonField = version + + /** + * Returns the raw JSON value of [apiVersion]. + * + * Unlike [apiVersion], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("apiVersion") + @ExcludeMissing + fun _apiVersion(): JsonField = apiVersion + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```kotlin + * .version() + * .apiVersion() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var version: JsonField? = null + private var apiVersion: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + version = body.version + apiVersion = body.apiVersion + additionalProperties = body.additionalProperties.toMutableMap() + } + + fun version(version: String) = version(JsonField.of(version)) + + /** + * Sets [Builder.version] to an arbitrary JSON value. + * + * You should usually call [Builder.version] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun version(version: JsonField) = apply { this.version = version } + + fun apiVersion(apiVersion: String) = apiVersion(JsonField.of(apiVersion)) + + /** + * Sets [Builder.apiVersion] to an arbitrary JSON value. + * + * You should usually call [Builder.apiVersion] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun apiVersion(apiVersion: JsonField) = apply { this.apiVersion = apiVersion } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .version() + * .apiVersion() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Body = + Body( + checkRequired("version", version), + checkRequired("apiVersion", apiVersion), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Body = apply { + if (validated) { + return@apply + } + + version() + apiVersion() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (version.asKnown().isPresent) 1 else 0) + + (if (apiVersion.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + version == other.version && + apiVersion == other.apiVersion && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(version, apiVersion, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{version=$version, apiVersion=$apiVersion, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is VersionCreateParams && + uid == other.uid && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = Objects.hash(uid, body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "VersionCreateParams{uid=$uid, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/versions/VersionDeleteParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/versions/VersionDeleteParams.kt new file mode 100644 index 0000000..098f9e6 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/versions/VersionDeleteParams.kt @@ -0,0 +1,258 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.sdks.versions + +import com.scalar.core.JsonValue +import com.scalar.core.Params +import com.scalar.core.checkRequired +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import com.scalar.core.toImmutable +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Permanently delete one version of an SDK. */ +class VersionDeleteParams +private constructor( + private val uid: String, + private val version: String?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, + private val additionalBodyProperties: Map, +) : Params { + + fun uid(): String = uid + + fun version(): Optional = Optional.ofNullable(version) + + /** Additional body properties to send with the request. */ + fun _additionalBodyProperties(): Map = additionalBodyProperties + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [VersionDeleteParams]. + * + * The following fields are required: + * ```kotlin + * .uid() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [VersionDeleteParams]. */ + class Builder internal constructor() { + + private var uid: String? = null + private var version: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(versionDeleteParams: VersionDeleteParams) = apply { + uid = versionDeleteParams.uid + version = versionDeleteParams.version + additionalHeaders = versionDeleteParams.additionalHeaders.toBuilder() + additionalQueryParams = versionDeleteParams.additionalQueryParams.toBuilder() + additionalBodyProperties = versionDeleteParams.additionalBodyProperties.toMutableMap() + } + + fun uid(uid: String) = apply { this.uid = uid } + + fun version(version: String?) = apply { this.version = version } + + /** Alias for calling [Builder.version] with `version.orElse(null)`. */ + fun version(version: Optional) = version(version.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + putAllAdditionalBodyProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { + additionalBodyProperties.remove(key) + } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalBodyProperty) + } + + /** + * Returns an immutable instance of [VersionDeleteParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .uid() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): VersionDeleteParams = + VersionDeleteParams( + checkRequired("uid", uid), + version, + additionalHeaders.build(), + additionalQueryParams.build(), + additionalBodyProperties.toImmutable(), + ) + } + + fun _body(): Optional> = + Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) + + fun _pathParam(index: Int): String = + when (index) { + 0 -> uid + 1 -> version ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is VersionDeleteParams && + uid == other.uid && + version == other.version && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams && + additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int = + Objects.hash( + uid, + version, + additionalHeaders, + additionalQueryParams, + additionalBodyProperties, + ) + + override fun toString() = + "VersionDeleteParams{uid=$uid, version=$version, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/teams/TeamListResponse.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/teams/Team.kt similarity index 92% rename from scalar-java-core/src/main/kotlin/com/scalar/models/teams/TeamListResponse.kt rename to scalar-java-core/src/main/kotlin/com/scalar/models/teams/Team.kt index 3c919ed..4a3a5ab 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/models/teams/TeamListResponse.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/teams/Team.kt @@ -16,7 +16,7 @@ import java.util.Collections import java.util.Objects import java.util.Optional -class TeamListResponse +class Team @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val uid: JsonField, @@ -116,7 +116,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [TeamListResponse]. + * Returns a mutable builder for constructing an instance of [Team]. * * The following fields are required: * ```kotlin @@ -129,7 +129,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [TeamListResponse]. */ + /** A builder for [Team]. */ class Builder internal constructor() { private var uid: JsonField? = null @@ -140,13 +140,13 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(teamListResponse: TeamListResponse) = apply { - uid = teamListResponse.uid - name = teamListResponse.name - imageUri = teamListResponse.imageUri - slug = teamListResponse.slug - theme = teamListResponse.theme - additionalProperties = teamListResponse.additionalProperties.toMutableMap() + internal fun from(team: Team) = apply { + uid = team.uid + name = team.name + imageUri = team.imageUri + slug = team.slug + theme = team.theme + additionalProperties = team.additionalProperties.toMutableMap() } fun uid(uid: String) = uid(JsonField.of(uid)) @@ -219,7 +219,7 @@ private constructor( } /** - * Returns an immutable instance of [TeamListResponse]. + * Returns an immutable instance of [Team]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -233,8 +233,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): TeamListResponse = - TeamListResponse( + fun build(): Team = + Team( checkRequired("uid", uid), checkRequired("name", name), imageUri, @@ -254,7 +254,7 @@ private constructor( * @throws ScalarInvalidDataException if any value type in this object doesn't match its * expected type. */ - fun validate(): TeamListResponse = apply { + fun validate(): Team = apply { if (validated) { return@apply } @@ -293,7 +293,7 @@ private constructor( return true } - return other is TeamListResponse && + return other is Team && uid == other.uid && name == other.name && imageUri == other.imageUri && @@ -309,5 +309,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "TeamListResponse{uid=$uid, name=$name, imageUri=$imageUri, slug=$slug, theme=$theme, additionalProperties=$additionalProperties}" + "Team{uid=$uid, name=$name, imageUri=$imageUri, slug=$slug, theme=$theme, additionalProperties=$additionalProperties}" } diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/teams/invites/InviteCancelParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/teams/invites/InviteCancelParams.kt new file mode 100644 index 0000000..0f23431 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/teams/invites/InviteCancelParams.kt @@ -0,0 +1,229 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.teams.invites + +import com.scalar.core.JsonValue +import com.scalar.core.Params +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import com.scalar.core.toImmutable +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Withdraw an invite that has not been accepted. */ +class InviteCancelParams +private constructor( + private val uid: String?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, + private val additionalBodyProperties: Map, +) : Params { + + fun uid(): Optional = Optional.ofNullable(uid) + + /** Additional body properties to send with the request. */ + fun _additionalBodyProperties(): Map = additionalBodyProperties + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): InviteCancelParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [InviteCancelParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InviteCancelParams]. */ + class Builder internal constructor() { + + private var uid: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(inviteCancelParams: InviteCancelParams) = apply { + uid = inviteCancelParams.uid + additionalHeaders = inviteCancelParams.additionalHeaders.toBuilder() + additionalQueryParams = inviteCancelParams.additionalQueryParams.toBuilder() + additionalBodyProperties = inviteCancelParams.additionalBodyProperties.toMutableMap() + } + + fun uid(uid: String?) = apply { this.uid = uid } + + /** Alias for calling [Builder.uid] with `uid.orElse(null)`. */ + fun uid(uid: Optional) = uid(uid.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + putAllAdditionalBodyProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { + additionalBodyProperties.remove(key) + } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalBodyProperty) + } + + /** + * Returns an immutable instance of [InviteCancelParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): InviteCancelParams = + InviteCancelParams( + uid, + additionalHeaders.build(), + additionalQueryParams.build(), + additionalBodyProperties.toImmutable(), + ) + } + + fun _body(): Optional> = + Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) + + fun _pathParam(index: Int): String = + when (index) { + 0 -> uid ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is InviteCancelParams && + uid == other.uid && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams && + additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int = + Objects.hash(uid, additionalHeaders, additionalQueryParams, additionalBodyProperties) + + override fun toString() = + "InviteCancelParams{uid=$uid, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/teams/invites/InviteMemberParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/teams/invites/InviteMemberParams.kt new file mode 100644 index 0000000..515f5af --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/teams/invites/InviteMemberParams.kt @@ -0,0 +1,484 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.teams.invites + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.Params +import com.scalar.core.checkRequired +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import kotlin.jvm.optionals.getOrNull + +/** Invite someone to the current team by email. */ +class InviteMemberParams +private constructor( + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun email(): String = body.email() + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun role(): Role = body.role() + + /** + * Returns the raw JSON value of [email]. + * + * Unlike [email], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _email(): JsonField = body._email() + + /** + * Returns the raw JSON value of [role]. + * + * Unlike [role], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _role(): JsonField = body._role() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [InviteMemberParams]. + * + * The following fields are required: + * ```kotlin + * .email() + * .role() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InviteMemberParams]. */ + class Builder internal constructor() { + + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(inviteMemberParams: InviteMemberParams) = apply { + body = inviteMemberParams.body.toBuilder() + additionalHeaders = inviteMemberParams.additionalHeaders.toBuilder() + additionalQueryParams = inviteMemberParams.additionalQueryParams.toBuilder() + } + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [email] + * - [role] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + fun email(email: String) = apply { body.email(email) } + + /** + * Sets [Builder.email] to an arbitrary JSON value. + * + * You should usually call [Builder.email] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun email(email: JsonField) = apply { body.email(email) } + + fun role(role: Role) = apply { body.role(role) } + + /** + * Sets [Builder.role] to an arbitrary JSON value. + * + * You should usually call [Builder.role] with a well-typed [Role] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun role(role: JsonField) = apply { body.role(role) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [InviteMemberParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .email() + * .role() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): InviteMemberParams = + InviteMemberParams( + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val email: JsonField, + private val role: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("email") @ExcludeMissing email: JsonField = JsonMissing.of(), + @JsonProperty("role") @ExcludeMissing role: JsonField = JsonMissing.of(), + ) : this(email, role, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun email(): String = email.getRequired("email") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun role(): Role = role.getRequired("role") + + /** + * Returns the raw JSON value of [email]. + * + * Unlike [email], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("email") @ExcludeMissing fun _email(): JsonField = email + + /** + * Returns the raw JSON value of [role]. + * + * Unlike [role], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("role") @ExcludeMissing fun _role(): JsonField = role + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```kotlin + * .email() + * .role() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var email: JsonField? = null + private var role: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + email = body.email + role = body.role + additionalProperties = body.additionalProperties.toMutableMap() + } + + fun email(email: String) = email(JsonField.of(email)) + + /** + * Sets [Builder.email] to an arbitrary JSON value. + * + * You should usually call [Builder.email] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun email(email: JsonField) = apply { this.email = email } + + fun role(role: Role) = role(JsonField.of(role)) + + /** + * Sets [Builder.role] to an arbitrary JSON value. + * + * You should usually call [Builder.role] with a well-typed [Role] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun role(role: JsonField) = apply { this.role = role } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .email() + * .role() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Body = + Body( + checkRequired("email", email), + checkRequired("role", role), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Body = apply { + if (validated) { + return@apply + } + + email() + role().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (email.asKnown().isPresent) 1 else 0) + + (role.asKnown().getOrNull()?.validity() ?: 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + email == other.email && + role == other.role && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(email, role, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{email=$email, role=$role, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is InviteMemberParams && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = Objects.hash(body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "InviteMemberParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/teams/invites/InviteResendParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/teams/invites/InviteResendParams.kt new file mode 100644 index 0000000..9d80ea0 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/teams/invites/InviteResendParams.kt @@ -0,0 +1,229 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.teams.invites + +import com.scalar.core.JsonValue +import com.scalar.core.Params +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import com.scalar.core.toImmutable +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Send the invite email again. */ +class InviteResendParams +private constructor( + private val uid: String?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, + private val additionalBodyProperties: Map, +) : Params { + + fun uid(): Optional = Optional.ofNullable(uid) + + /** Additional body properties to send with the request. */ + fun _additionalBodyProperties(): Map = additionalBodyProperties + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): InviteResendParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [InviteResendParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InviteResendParams]. */ + class Builder internal constructor() { + + private var uid: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(inviteResendParams: InviteResendParams) = apply { + uid = inviteResendParams.uid + additionalHeaders = inviteResendParams.additionalHeaders.toBuilder() + additionalQueryParams = inviteResendParams.additionalQueryParams.toBuilder() + additionalBodyProperties = inviteResendParams.additionalBodyProperties.toMutableMap() + } + + fun uid(uid: String?) = apply { this.uid = uid } + + /** Alias for calling [Builder.uid] with `uid.orElse(null)`. */ + fun uid(uid: Optional) = uid(uid.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + putAllAdditionalBodyProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { + additionalBodyProperties.remove(key) + } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalBodyProperty) + } + + /** + * Returns an immutable instance of [InviteResendParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): InviteResendParams = + InviteResendParams( + uid, + additionalHeaders.build(), + additionalQueryParams.build(), + additionalBodyProperties.toImmutable(), + ) + } + + fun _body(): Optional> = + Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) + + fun _pathParam(index: Int): String = + when (index) { + 0 -> uid ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is InviteResendParams && + uid == other.uid && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams && + additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int = + Objects.hash(uid, additionalHeaders, additionalQueryParams, additionalBodyProperties) + + override fun toString() = + "InviteResendParams{uid=$uid, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/teams/invites/Role.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/teams/invites/Role.kt new file mode 100644 index 0000000..a1bff55 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/teams/invites/Role.kt @@ -0,0 +1,150 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.teams.invites + +import com.fasterxml.jackson.annotation.JsonCreator +import com.scalar.core.Enum +import com.scalar.core.JsonField +import com.scalar.errors.ScalarInvalidDataException + +class Role @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't match + * any known member, and you want to know that value. For example, if the SDK is on an older + * version than the API, then the API may respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val OWNER = of("owner") + + @JvmField val ADMIN = of("admin") + + @JvmField val EDITOR = of("editor") + + @JvmField val VIEWER = of("viewer") + + @JvmStatic fun of(value: String) = Role(JsonField.of(value)) + } + + /** An enum containing [Role]'s known values. */ + enum class Known { + OWNER, + ADMIN, + EDITOR, + VIEWER, + } + + /** + * An enum containing [Role]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Role] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the SDK + * is on an older version than the API, then the API may respond with new members that the SDK + * is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + OWNER, + ADMIN, + EDITOR, + VIEWER, + /** An enum member indicating that [Role] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] if + * the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want to + * throw for the unknown case. + */ + fun value(): Value = + when (this) { + OWNER -> Value.OWNER + ADMIN -> Value.ADMIN + EDITOR -> Value.EDITOR + VIEWER -> Value.VIEWER + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't want + * to throw for the unknown case. + * + * @throws ScalarInvalidDataException if this class instance's value is a not a known member. + */ + fun known(): Known = + when (this) { + OWNER -> Known.OWNER + ADMIN -> Known.ADMIN + EDITOR -> Known.EDITOR + VIEWER -> Known.VIEWER + else -> throw ScalarInvalidDataException("Unknown Role: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging and + * generally doesn't throw. + * + * @throws ScalarInvalidDataException if this class instance's value does not have the expected + * primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { ScalarInvalidDataException("Value is not a String") } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Role = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Role && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/teams/members/MemberDeleteParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/teams/members/MemberDeleteParams.kt new file mode 100644 index 0000000..4c23990 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/teams/members/MemberDeleteParams.kt @@ -0,0 +1,229 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.teams.members + +import com.scalar.core.JsonValue +import com.scalar.core.Params +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import com.scalar.core.toImmutable +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Remove someone from the current team. */ +class MemberDeleteParams +private constructor( + private val uid: String?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, + private val additionalBodyProperties: Map, +) : Params { + + fun uid(): Optional = Optional.ofNullable(uid) + + /** Additional body properties to send with the request. */ + fun _additionalBodyProperties(): Map = additionalBodyProperties + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): MemberDeleteParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [MemberDeleteParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [MemberDeleteParams]. */ + class Builder internal constructor() { + + private var uid: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(memberDeleteParams: MemberDeleteParams) = apply { + uid = memberDeleteParams.uid + additionalHeaders = memberDeleteParams.additionalHeaders.toBuilder() + additionalQueryParams = memberDeleteParams.additionalQueryParams.toBuilder() + additionalBodyProperties = memberDeleteParams.additionalBodyProperties.toMutableMap() + } + + fun uid(uid: String?) = apply { this.uid = uid } + + /** Alias for calling [Builder.uid] with `uid.orElse(null)`. */ + fun uid(uid: Optional) = uid(uid.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + putAllAdditionalBodyProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { + additionalBodyProperties.remove(key) + } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalBodyProperty) + } + + /** + * Returns an immutable instance of [MemberDeleteParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): MemberDeleteParams = + MemberDeleteParams( + uid, + additionalHeaders.build(), + additionalQueryParams.build(), + additionalBodyProperties.toImmutable(), + ) + } + + fun _body(): Optional> = + Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) + + fun _pathParam(index: Int): String = + when (index) { + 0 -> uid ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is MemberDeleteParams && + uid == other.uid && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams && + additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int = + Objects.hash(uid, additionalHeaders, additionalQueryParams, additionalBodyProperties) + + override fun toString() = + "MemberDeleteParams{uid=$uid, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/teams/members/MemberListParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/teams/members/MemberListParams.kt new file mode 100644 index 0000000..4c4f3e1 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/teams/members/MemberListParams.kt @@ -0,0 +1,170 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.teams.members + +import com.scalar.core.Params +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import java.util.Objects + +/** List the members of the current team, along with the invites still outstanding. */ +class MemberListParams +private constructor( + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): MemberListParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [MemberListParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [MemberListParams]. */ + class Builder internal constructor() { + + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(memberListParams: MemberListParams) = apply { + additionalHeaders = memberListParams.additionalHeaders.toBuilder() + additionalQueryParams = memberListParams.additionalQueryParams.toBuilder() + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [MemberListParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): MemberListParams = + MemberListParams(additionalHeaders.build(), additionalQueryParams.build()) + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is MemberListParams && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = Objects.hash(additionalHeaders, additionalQueryParams) + + override fun toString() = + "MemberListParams{additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/teams/members/MemberListResponse.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/teams/members/MemberListResponse.kt new file mode 100644 index 0000000..5e636af --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/teams/members/MemberListResponse.kt @@ -0,0 +1,255 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.teams.members + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.checkKnown +import com.scalar.core.checkRequired +import com.scalar.core.toImmutable +import com.scalar.errors.ScalarInvalidDataException +import java.util.Collections +import java.util.Objects +import kotlin.jvm.optionals.getOrNull + +class MemberListResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val members: JsonField>, + private val pendingInvites: JsonField>, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("members") + @ExcludeMissing + members: JsonField> = JsonMissing.of(), + @JsonProperty("pendingInvites") + @ExcludeMissing + pendingInvites: JsonField> = JsonMissing.of(), + ) : this(members, pendingInvites, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun members(): List = members.getRequired("members") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun pendingInvites(): List = pendingInvites.getRequired("pendingInvites") + + /** + * Returns the raw JSON value of [members]. + * + * Unlike [members], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("members") @ExcludeMissing fun _members(): JsonField> = members + + /** + * Returns the raw JSON value of [pendingInvites]. + * + * Unlike [pendingInvites], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("pendingInvites") + @ExcludeMissing + fun _pendingInvites(): JsonField> = pendingInvites + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [MemberListResponse]. + * + * The following fields are required: + * ```kotlin + * .members() + * .pendingInvites() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [MemberListResponse]. */ + class Builder internal constructor() { + + private var members: JsonField>? = null + private var pendingInvites: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(memberListResponse: MemberListResponse) = apply { + members = memberListResponse.members.map { it.toMutableList() } + pendingInvites = memberListResponse.pendingInvites.map { it.toMutableList() } + additionalProperties = memberListResponse.additionalProperties.toMutableMap() + } + + fun members(members: List) = members(JsonField.of(members)) + + /** + * Sets [Builder.members] to an arbitrary JSON value. + * + * You should usually call [Builder.members] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun members(members: JsonField>) = apply { + this.members = members.map { it.toMutableList() } + } + + /** + * Adds a single [TeamMember] to [members]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addMember(member: TeamMember) = apply { + members = + (members ?: JsonField.of(mutableListOf())).also { + checkKnown("members", it).add(member) + } + } + + fun pendingInvites(pendingInvites: List) = + pendingInvites(JsonField.of(pendingInvites)) + + /** + * Sets [Builder.pendingInvites] to an arbitrary JSON value. + * + * You should usually call [Builder.pendingInvites] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun pendingInvites(pendingInvites: JsonField>) = apply { + this.pendingInvites = pendingInvites.map { it.toMutableList() } + } + + /** + * Adds a single [TeamInvite] to [pendingInvites]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addPendingInvite(pendingInvite: TeamInvite) = apply { + pendingInvites = + (pendingInvites ?: JsonField.of(mutableListOf())).also { + checkKnown("pendingInvites", it).add(pendingInvite) + } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [MemberListResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .members() + * .pendingInvites() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): MemberListResponse = + MemberListResponse( + checkRequired("members", members).map { it.toImmutable() }, + checkRequired("pendingInvites", pendingInvites).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): MemberListResponse = apply { + if (validated) { + return@apply + } + + members().forEach { it.validate() } + pendingInvites().forEach { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (members.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (pendingInvites.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is MemberListResponse && + members == other.members && + pendingInvites == other.pendingInvites && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(members, pendingInvites, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "MemberListResponse{members=$members, pendingInvites=$pendingInvites, additionalProperties=$additionalProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/teams/members/MemberUpdateParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/teams/members/MemberUpdateParams.kt new file mode 100644 index 0000000..60cd4f3 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/teams/members/MemberUpdateParams.kt @@ -0,0 +1,438 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.teams.members + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.Params +import com.scalar.core.checkRequired +import com.scalar.core.http.Headers +import com.scalar.core.http.QueryParams +import com.scalar.errors.ScalarInvalidDataException +import com.scalar.models.teams.invites.Role +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Change what a member of the current team is allowed to do. */ +class MemberUpdateParams +private constructor( + private val uid: String?, + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun role(): Role = body.role() + + fun uid(): Optional = Optional.ofNullable(uid) + + /** + * Returns the raw JSON value of [role]. + * + * Unlike [role], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _role(): JsonField = body._role() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [MemberUpdateParams]. + * + * The following fields are required: + * ```kotlin + * .role() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [MemberUpdateParams]. */ + class Builder internal constructor() { + + private var uid: String? = null + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(memberUpdateParams: MemberUpdateParams) = apply { + uid = memberUpdateParams.uid + body = memberUpdateParams.body.toBuilder() + additionalHeaders = memberUpdateParams.additionalHeaders.toBuilder() + additionalQueryParams = memberUpdateParams.additionalQueryParams.toBuilder() + } + + fun uid(uid: String?) = apply { this.uid = uid } + + /** Alias for calling [Builder.uid] with `uid.orElse(null)`. */ + fun uid(uid: Optional) = uid(uid.getOrNull()) + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [role] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + fun role(role: Role) = apply { body.role(role) } + + /** + * Sets [Builder.role] to an arbitrary JSON value. + * + * You should usually call [Builder.role] with a well-typed [Role] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun role(role: JsonField) = apply { body.role(role) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [MemberUpdateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .role() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): MemberUpdateParams = + MemberUpdateParams( + uid, + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> uid ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val role: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("role") @ExcludeMissing role: JsonField = JsonMissing.of() + ) : this(role, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun role(): Role = role.getRequired("role") + + /** + * Returns the raw JSON value of [role]. + * + * Unlike [role], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("role") @ExcludeMissing fun _role(): JsonField = role + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```kotlin + * .role() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var role: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + role = body.role + additionalProperties = body.additionalProperties.toMutableMap() + } + + fun role(role: Role) = role(JsonField.of(role)) + + /** + * Sets [Builder.role] to an arbitrary JSON value. + * + * You should usually call [Builder.role] with a well-typed [Role] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun role(role: JsonField) = apply { this.role = role } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .role() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Body = + Body(checkRequired("role", role), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Body = apply { + if (validated) { + return@apply + } + + role().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (role.asKnown().getOrNull()?.validity() ?: 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + role == other.role && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(role, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "Body{role=$role, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is MemberUpdateParams && + uid == other.uid && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = Objects.hash(uid, body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "MemberUpdateParams{uid=$uid, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/teams/members/TeamInvite.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/teams/members/TeamInvite.kt new file mode 100644 index 0000000..f446ae9 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/teams/members/TeamInvite.kt @@ -0,0 +1,282 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.teams.members + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.checkRequired +import com.scalar.errors.ScalarInvalidDataException +import com.scalar.models.teams.invites.Role +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class TeamInvite +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val uid: JsonField, + private val email: JsonField, + private val role: JsonField, + private val expires: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("uid") @ExcludeMissing uid: JsonField = JsonMissing.of(), + @JsonProperty("email") @ExcludeMissing email: JsonField = JsonMissing.of(), + @JsonProperty("role") @ExcludeMissing role: JsonField = JsonMissing.of(), + @JsonProperty("expires") @ExcludeMissing expires: JsonField = JsonMissing.of(), + ) : this(uid, email, role, expires, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun uid(): String = uid.getRequired("uid") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun email(): String = email.getRequired("email") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun role(): Role = role.getRequired("role") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun expires(): Optional = expires.getOptional("expires") + + /** + * Returns the raw JSON value of [uid]. + * + * Unlike [uid], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("uid") @ExcludeMissing fun _uid(): JsonField = uid + + /** + * Returns the raw JSON value of [email]. + * + * Unlike [email], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("email") @ExcludeMissing fun _email(): JsonField = email + + /** + * Returns the raw JSON value of [role]. + * + * Unlike [role], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("role") @ExcludeMissing fun _role(): JsonField = role + + /** + * Returns the raw JSON value of [expires]. + * + * Unlike [expires], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("expires") @ExcludeMissing fun _expires(): JsonField = expires + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [TeamInvite]. + * + * The following fields are required: + * ```kotlin + * .uid() + * .email() + * .role() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [TeamInvite]. */ + class Builder internal constructor() { + + private var uid: JsonField? = null + private var email: JsonField? = null + private var role: JsonField? = null + private var expires: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(teamInvite: TeamInvite) = apply { + uid = teamInvite.uid + email = teamInvite.email + role = teamInvite.role + expires = teamInvite.expires + additionalProperties = teamInvite.additionalProperties.toMutableMap() + } + + fun uid(uid: String) = uid(JsonField.of(uid)) + + /** + * Sets [Builder.uid] to an arbitrary JSON value. + * + * You should usually call [Builder.uid] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun uid(uid: JsonField) = apply { this.uid = uid } + + fun email(email: String) = email(JsonField.of(email)) + + /** + * Sets [Builder.email] to an arbitrary JSON value. + * + * You should usually call [Builder.email] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun email(email: JsonField) = apply { this.email = email } + + fun role(role: Role) = role(JsonField.of(role)) + + /** + * Sets [Builder.role] to an arbitrary JSON value. + * + * You should usually call [Builder.role] with a well-typed [Role] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun role(role: JsonField) = apply { this.role = role } + + fun expires(expires: Double) = expires(JsonField.of(expires)) + + /** + * Sets [Builder.expires] to an arbitrary JSON value. + * + * You should usually call [Builder.expires] with a well-typed [Double] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun expires(expires: JsonField) = apply { this.expires = expires } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [TeamInvite]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .uid() + * .email() + * .role() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): TeamInvite = + TeamInvite( + checkRequired("uid", uid), + checkRequired("email", email), + checkRequired("role", role), + expires, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): TeamInvite = apply { + if (validated) { + return@apply + } + + uid() + email() + role().validate() + expires() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (uid.asKnown().isPresent) 1 else 0) + + (if (email.asKnown().isPresent) 1 else 0) + + (role.asKnown().getOrNull()?.validity() ?: 0) + + (if (expires.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is TeamInvite && + uid == other.uid && + email == other.email && + role == other.role && + expires == other.expires && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(uid, email, role, expires, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "TeamInvite{uid=$uid, email=$email, role=$role, expires=$expires, additionalProperties=$additionalProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/teams/members/TeamMember.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/teams/members/TeamMember.kt new file mode 100644 index 0000000..bde2580 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/teams/members/TeamMember.kt @@ -0,0 +1,285 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.models.teams.members + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.scalar.core.ExcludeMissing +import com.scalar.core.JsonField +import com.scalar.core.JsonMissing +import com.scalar.core.JsonValue +import com.scalar.core.checkRequired +import com.scalar.errors.ScalarInvalidDataException +import com.scalar.models.teams.invites.Role +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class TeamMember +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val uid: JsonField, + private val role: JsonField, + private val displayName: JsonField, + private val imageUri: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("uid") @ExcludeMissing uid: JsonField = JsonMissing.of(), + @JsonProperty("role") @ExcludeMissing role: JsonField = JsonMissing.of(), + @JsonProperty("displayName") + @ExcludeMissing + displayName: JsonField = JsonMissing.of(), + @JsonProperty("imageUri") @ExcludeMissing imageUri: JsonField = JsonMissing.of(), + ) : this(uid, role, displayName, imageUri, mutableMapOf()) + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun uid(): String = uid.getRequired("uid") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun role(): Role = role.getRequired("role") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun displayName(): String = displayName.getRequired("displayName") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun imageUri(): Optional = imageUri.getOptional("imageUri") + + /** + * Returns the raw JSON value of [uid]. + * + * Unlike [uid], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("uid") @ExcludeMissing fun _uid(): JsonField = uid + + /** + * Returns the raw JSON value of [role]. + * + * Unlike [role], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("role") @ExcludeMissing fun _role(): JsonField = role + + /** + * Returns the raw JSON value of [displayName]. + * + * Unlike [displayName], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("displayName") @ExcludeMissing fun _displayName(): JsonField = displayName + + /** + * Returns the raw JSON value of [imageUri]. + * + * Unlike [imageUri], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("imageUri") @ExcludeMissing fun _imageUri(): JsonField = imageUri + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [TeamMember]. + * + * The following fields are required: + * ```kotlin + * .uid() + * .role() + * .displayName() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [TeamMember]. */ + class Builder internal constructor() { + + private var uid: JsonField? = null + private var role: JsonField? = null + private var displayName: JsonField? = null + private var imageUri: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(teamMember: TeamMember) = apply { + uid = teamMember.uid + role = teamMember.role + displayName = teamMember.displayName + imageUri = teamMember.imageUri + additionalProperties = teamMember.additionalProperties.toMutableMap() + } + + fun uid(uid: String) = uid(JsonField.of(uid)) + + /** + * Sets [Builder.uid] to an arbitrary JSON value. + * + * You should usually call [Builder.uid] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun uid(uid: JsonField) = apply { this.uid = uid } + + fun role(role: Role) = role(JsonField.of(role)) + + /** + * Sets [Builder.role] to an arbitrary JSON value. + * + * You should usually call [Builder.role] with a well-typed [Role] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun role(role: JsonField) = apply { this.role = role } + + fun displayName(displayName: String) = displayName(JsonField.of(displayName)) + + /** + * Sets [Builder.displayName] to an arbitrary JSON value. + * + * You should usually call [Builder.displayName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun displayName(displayName: JsonField) = apply { this.displayName = displayName } + + fun imageUri(imageUri: String) = imageUri(JsonField.of(imageUri)) + + /** + * Sets [Builder.imageUri] to an arbitrary JSON value. + * + * You should usually call [Builder.imageUri] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun imageUri(imageUri: JsonField) = apply { this.imageUri = imageUri } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [TeamMember]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .uid() + * .role() + * .displayName() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): TeamMember = + TeamMember( + checkRequired("uid", uid), + checkRequired("role", role), + checkRequired("displayName", displayName), + imageUri, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ScalarInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): TeamMember = apply { + if (validated) { + return@apply + } + + uid() + role().validate() + displayName() + imageUri() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ScalarInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (uid.asKnown().isPresent) 1 else 0) + + (role.asKnown().getOrNull()?.validity() ?: 0) + + (if (displayName.asKnown().isPresent) 1 else 0) + + (if (imageUri.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is TeamMember && + uid == other.uid && + role == other.role && + displayName == other.displayName && + imageUri == other.imageUri && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(uid, role, displayName, imageUri, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "TeamMember{uid=$uid, role=$role, displayName=$displayName, imageUri=$imageUri, additionalProperties=$additionalProperties}" +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/themes/ThemeListResponse.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/themes/Theme.kt similarity index 92% rename from scalar-java-core/src/main/kotlin/com/scalar/models/themes/ThemeListResponse.kt rename to scalar-java-core/src/main/kotlin/com/scalar/models/themes/Theme.kt index 39ee64c..5f64666 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/models/themes/ThemeListResponse.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/themes/Theme.kt @@ -15,7 +15,7 @@ import com.scalar.errors.ScalarInvalidDataException import java.util.Collections import java.util.Objects -class ThemeListResponse +class Theme @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val uid: JsonField, @@ -102,7 +102,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [ThemeListResponse]. + * Returns a mutable builder for constructing an instance of [Theme]. * * The following fields are required: * ```kotlin @@ -115,7 +115,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [ThemeListResponse]. */ + /** A builder for [Theme]. */ class Builder internal constructor() { private var uid: JsonField? = null @@ -125,12 +125,12 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(themeListResponse: ThemeListResponse) = apply { - uid = themeListResponse.uid - name = themeListResponse.name - description = themeListResponse.description - slug = themeListResponse.slug - additionalProperties = themeListResponse.additionalProperties.toMutableMap() + internal fun from(theme: Theme) = apply { + uid = theme.uid + name = theme.name + description = theme.description + slug = theme.slug + additionalProperties = theme.additionalProperties.toMutableMap() } fun uid(uid: String) = uid(JsonField.of(uid)) @@ -194,7 +194,7 @@ private constructor( } /** - * Returns an immutable instance of [ThemeListResponse]. + * Returns an immutable instance of [Theme]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -208,8 +208,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): ThemeListResponse = - ThemeListResponse( + fun build(): Theme = + Theme( checkRequired("uid", uid), checkRequired("name", name), checkRequired("description", description), @@ -228,7 +228,7 @@ private constructor( * @throws ScalarInvalidDataException if any value type in this object doesn't match its * expected type. */ - fun validate(): ThemeListResponse = apply { + fun validate(): Theme = apply { if (validated) { return@apply } @@ -265,7 +265,7 @@ private constructor( return true } - return other is ThemeListResponse && + return other is Theme && uid == other.uid && name == other.name && description == other.description && @@ -280,5 +280,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "ThemeListResponse{uid=$uid, name=$name, description=$description, slug=$slug, additionalProperties=$additionalProperties}" + "Theme{uid=$uid, name=$name, description=$description, slug=$slug, additionalProperties=$additionalProperties}" } diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/AccessGroupServiceAsync.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/AccessGroupServiceAsync.kt new file mode 100644 index 0000000..1f1d725 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/AccessGroupServiceAsync.kt @@ -0,0 +1,319 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.async + +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.http.HttpResponseFor +import com.scalar.models.accessGroups.AccessGroupCreateParams +import com.scalar.models.accessGroups.AccessGroupCreateResponse +import com.scalar.models.accessGroups.AccessGroupDeleteParams +import com.scalar.models.accessGroups.AccessGroupRetrieveParams +import com.scalar.models.accessGroups.AccessGroupRetrieveResponse +import com.scalar.models.accessGroups.AccessGroupUpdateParams +import com.scalar.services.async.accessGroups.DomainServiceAsync +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer + +/** Access Groups */ +interface AccessGroupServiceAsync { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): AccessGroupServiceAsync + + /** Access Groups */ + fun domains(): DomainServiceAsync + + /** + * Create a group for the current team. Requires docs edit permission and the access groups + * billing feature. Domains are exact email domains, without wildcards or implicit subdomain + * matching. + */ + fun create(): CompletableFuture = + create(AccessGroupCreateParams.none()) + + /** @see create */ + fun create( + params: AccessGroupCreateParams = AccessGroupCreateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see create */ + fun create(params: AccessGroupCreateParams): CompletableFuture = + create(params, RequestOptions.none()) + + /** @see create */ + fun create(requestOptions: RequestOptions): CompletableFuture = + create(AccessGroupCreateParams.none(), requestOptions) + + /** Get a group and its email and domain allowlists by slug. */ + fun retrieve(slug: String): CompletableFuture = + retrieve(slug, AccessGroupRetrieveParams.none()) + + /** @see retrieve */ + fun retrieve( + slug: String, + params: AccessGroupRetrieveParams = AccessGroupRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + retrieve(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see retrieve */ + fun retrieve( + slug: String, + params: AccessGroupRetrieveParams, + ): CompletableFuture = + retrieve(slug, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: AccessGroupRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see retrieve */ + fun retrieve( + params: AccessGroupRetrieveParams + ): CompletableFuture = retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + slug: String, + requestOptions: RequestOptions, + ): CompletableFuture = + retrieve(slug, AccessGroupRetrieveParams.none(), requestOptions) + + /** + * Update group metadata. Requires docs edit permission. After changing the slug, use the new + * slug in subsequent requests. + */ + fun update(pathSlug: String): CompletableFuture = + update(pathSlug, AccessGroupUpdateParams.none()) + + /** @see update */ + fun update( + pathSlug: String, + params: AccessGroupUpdateParams = AccessGroupUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + update(params.toBuilder().pathSlug(pathSlug).build(), requestOptions) + + /** @see update */ + fun update(pathSlug: String, params: AccessGroupUpdateParams): CompletableFuture = + update(pathSlug, params, RequestOptions.none()) + + /** @see update */ + fun update( + params: AccessGroupUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see update */ + fun update(params: AccessGroupUpdateParams): CompletableFuture = + update(params, RequestOptions.none()) + + /** @see update */ + fun update(pathSlug: String, requestOptions: RequestOptions): CompletableFuture = + update(pathSlug, AccessGroupUpdateParams.none(), requestOptions) + + /** Delete a group and remove its project assignments. Requires docs edit permission. */ + fun delete(slug: String): CompletableFuture = delete(slug, AccessGroupDeleteParams.none()) + + /** @see delete */ + fun delete( + slug: String, + params: AccessGroupDeleteParams = AccessGroupDeleteParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = delete(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see delete */ + fun delete(slug: String, params: AccessGroupDeleteParams): CompletableFuture = + delete(slug, params, RequestOptions.none()) + + /** @see delete */ + fun delete( + params: AccessGroupDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see delete */ + fun delete(params: AccessGroupDeleteParams): CompletableFuture = + delete(params, RequestOptions.none()) + + /** @see delete */ + fun delete(slug: String, requestOptions: RequestOptions): CompletableFuture = + delete(slug, AccessGroupDeleteParams.none(), requestOptions) + + /** + * A view of [AccessGroupServiceAsync] that provides access to raw HTTP responses for each + * method. + */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): AccessGroupServiceAsync.WithRawResponse + + /** Access Groups */ + fun domains(): DomainServiceAsync.WithRawResponse + + /** + * Returns a raw HTTP response for `post /v1/access-groups`, but is otherwise the same as + * [AccessGroupServiceAsync.create]. + */ + fun create(): CompletableFuture> = + create(AccessGroupCreateParams.none()) + + /** @see create */ + fun create( + params: AccessGroupCreateParams = AccessGroupCreateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see create */ + fun create( + params: AccessGroupCreateParams + ): CompletableFuture> = + create(params, RequestOptions.none()) + + /** @see create */ + fun create( + requestOptions: RequestOptions + ): CompletableFuture> = + create(AccessGroupCreateParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /v1/access-groups/{slug}`, but is otherwise the same + * as [AccessGroupServiceAsync.retrieve]. + */ + fun retrieve( + slug: String + ): CompletableFuture> = + retrieve(slug, AccessGroupRetrieveParams.none()) + + /** @see retrieve */ + fun retrieve( + slug: String, + params: AccessGroupRetrieveParams = AccessGroupRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + retrieve(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see retrieve */ + fun retrieve( + slug: String, + params: AccessGroupRetrieveParams, + ): CompletableFuture> = + retrieve(slug, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: AccessGroupRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see retrieve */ + fun retrieve( + params: AccessGroupRetrieveParams + ): CompletableFuture> = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + slug: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + retrieve(slug, AccessGroupRetrieveParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `patch /v1/access-groups/{slug}`, but is otherwise the + * same as [AccessGroupServiceAsync.update]. + */ + fun update(pathSlug: String): CompletableFuture> = + update(pathSlug, AccessGroupUpdateParams.none()) + + /** @see update */ + fun update( + pathSlug: String, + params: AccessGroupUpdateParams = AccessGroupUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + update(params.toBuilder().pathSlug(pathSlug).build(), requestOptions) + + /** @see update */ + fun update( + pathSlug: String, + params: AccessGroupUpdateParams, + ): CompletableFuture> = + update(pathSlug, params, RequestOptions.none()) + + /** @see update */ + fun update( + params: AccessGroupUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see update */ + fun update(params: AccessGroupUpdateParams): CompletableFuture> = + update(params, RequestOptions.none()) + + /** @see update */ + fun update( + pathSlug: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + update(pathSlug, AccessGroupUpdateParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `delete /v1/access-groups/{slug}`, but is otherwise the + * same as [AccessGroupServiceAsync.delete]. + */ + fun delete(slug: String): CompletableFuture> = + delete(slug, AccessGroupDeleteParams.none()) + + /** @see delete */ + fun delete( + slug: String, + params: AccessGroupDeleteParams = AccessGroupDeleteParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + delete(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see delete */ + fun delete( + slug: String, + params: AccessGroupDeleteParams, + ): CompletableFuture> = delete(slug, params, RequestOptions.none()) + + /** @see delete */ + fun delete( + params: AccessGroupDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see delete */ + fun delete(params: AccessGroupDeleteParams): CompletableFuture> = + delete(params, RequestOptions.none()) + + /** @see delete */ + fun delete( + slug: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + delete(slug, AccessGroupDeleteParams.none(), requestOptions) + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/AccessGroupServiceAsyncImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/AccessGroupServiceAsyncImpl.kt new file mode 100644 index 0000000..c21f039 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/AccessGroupServiceAsyncImpl.kt @@ -0,0 +1,215 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.async + +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.checkRequired +import com.scalar.core.handlers.errorBodyHandler +import com.scalar.core.handlers.errorHandler +import com.scalar.core.handlers.jsonHandler +import com.scalar.core.http.HttpMethod +import com.scalar.core.http.HttpRequest +import com.scalar.core.http.HttpResponse +import com.scalar.core.http.HttpResponse.Handler +import com.scalar.core.http.HttpResponseFor +import com.scalar.core.http.json +import com.scalar.core.http.parseable +import com.scalar.core.prepareAsync +import com.scalar.models.accessGroups.AccessGroupCreateParams +import com.scalar.models.accessGroups.AccessGroupCreateResponse +import com.scalar.models.accessGroups.AccessGroupDeleteParams +import com.scalar.models.accessGroups.AccessGroupRetrieveParams +import com.scalar.models.accessGroups.AccessGroupRetrieveResponse +import com.scalar.models.accessGroups.AccessGroupUpdateParams +import com.scalar.services.async.accessGroups.DomainServiceAsync +import com.scalar.services.async.accessGroups.DomainServiceAsyncImpl +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +/** Access Groups */ +class AccessGroupServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + AccessGroupServiceAsync { + + private val withRawResponse: AccessGroupServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + private val domains: DomainServiceAsync by lazy { DomainServiceAsyncImpl(clientOptions) } + + override fun withRawResponse(): AccessGroupServiceAsync.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): AccessGroupServiceAsync = + AccessGroupServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + /** Access Groups */ + override fun domains(): DomainServiceAsync = domains + + override fun create( + params: AccessGroupCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // post /v1/access-groups + withRawResponse().create(params, requestOptions).thenApply { it.parse() } + + override fun retrieve( + params: AccessGroupRetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /v1/access-groups/{slug} + withRawResponse().retrieve(params, requestOptions).thenApply { it.parse() } + + override fun update( + params: AccessGroupUpdateParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // patch /v1/access-groups/{slug} + withRawResponse().update(params, requestOptions).thenApply { it.parse() } + + override fun delete( + params: AccessGroupDeleteParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // delete /v1/access-groups/{slug} + withRawResponse().delete(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + AccessGroupServiceAsync.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + private val domains: DomainServiceAsync.WithRawResponse by lazy { + DomainServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + override fun withOptions( + modifier: Consumer + ): AccessGroupServiceAsync.WithRawResponse = + AccessGroupServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + /** Access Groups */ + override fun domains(): DomainServiceAsync.WithRawResponse = domains + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun create( + params: AccessGroupCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "access-groups") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun retrieve( + params: AccessGroupRetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("slug", params.slug().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "access-groups", params._pathParam(0)) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val updateHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun update( + params: AccessGroupUpdateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("pathSlug", params.pathSlug().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.PATCH) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "access-groups", params._pathParam(0)) + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response.use { updateHandler.handle(it) } + } + } + } + + private val deleteHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun delete( + params: AccessGroupDeleteParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("slug", params.slug().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.DELETE) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "access-groups", params._pathParam(0)) + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response.use { deleteHandler.handle(it) } + } + } + } + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/AuthenticationServiceAsync.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/AuthenticationServiceAsync.kt index 27a6c59..ba00b69 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/async/AuthenticationServiceAsync.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/AuthenticationServiceAsync.kt @@ -8,7 +8,7 @@ import com.scalar.core.http.HttpResponseFor import com.scalar.models.authentication.AuthenticationExchangePersonalTokenParams import com.scalar.models.authentication.AuthenticationExchangePersonalTokenResponse import com.scalar.models.authentication.AuthenticationListCurrentUserParams -import com.scalar.models.authentication.AuthenticationListCurrentUserResponse +import com.scalar.models.authentication.User import java.util.concurrent.CompletableFuture import java.util.function.Consumer @@ -40,25 +40,21 @@ interface AuthenticationServiceAsync { ): CompletableFuture /** Get the authenticated user, including their available teams and theme. */ - fun listCurrentUser(): CompletableFuture = + fun listCurrentUser(): CompletableFuture = listCurrentUser(AuthenticationListCurrentUserParams.none()) /** @see listCurrentUser */ fun listCurrentUser( params: AuthenticationListCurrentUserParams = AuthenticationListCurrentUserParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture + ): CompletableFuture /** @see listCurrentUser */ - fun listCurrentUser( - params: AuthenticationListCurrentUserParams - ): CompletableFuture = + fun listCurrentUser(params: AuthenticationListCurrentUserParams): CompletableFuture = listCurrentUser(params, RequestOptions.none()) /** @see listCurrentUser */ - fun listCurrentUser( - requestOptions: RequestOptions - ): CompletableFuture = + fun listCurrentUser(requestOptions: RequestOptions): CompletableFuture = listCurrentUser(AuthenticationListCurrentUserParams.none(), requestOptions) /** @@ -95,8 +91,7 @@ interface AuthenticationServiceAsync { * Returns a raw HTTP response for `get /v1/auth/me`, but is otherwise the same as * [AuthenticationServiceAsync.listCurrentUser]. */ - fun listCurrentUser(): - CompletableFuture> = + fun listCurrentUser(): CompletableFuture> = listCurrentUser(AuthenticationListCurrentUserParams.none()) /** @see listCurrentUser */ @@ -104,18 +99,17 @@ interface AuthenticationServiceAsync { params: AuthenticationListCurrentUserParams = AuthenticationListCurrentUserParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> + ): CompletableFuture> /** @see listCurrentUser */ fun listCurrentUser( params: AuthenticationListCurrentUserParams - ): CompletableFuture> = - listCurrentUser(params, RequestOptions.none()) + ): CompletableFuture> = listCurrentUser(params, RequestOptions.none()) /** @see listCurrentUser */ fun listCurrentUser( requestOptions: RequestOptions - ): CompletableFuture> = + ): CompletableFuture> = listCurrentUser(AuthenticationListCurrentUserParams.none(), requestOptions) } } diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/AuthenticationServiceAsyncImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/AuthenticationServiceAsyncImpl.kt index f858c66..741de02 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/async/AuthenticationServiceAsyncImpl.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/AuthenticationServiceAsyncImpl.kt @@ -18,7 +18,7 @@ import com.scalar.core.prepareAsync import com.scalar.models.authentication.AuthenticationExchangePersonalTokenParams import com.scalar.models.authentication.AuthenticationExchangePersonalTokenResponse import com.scalar.models.authentication.AuthenticationListCurrentUserParams -import com.scalar.models.authentication.AuthenticationListCurrentUserResponse +import com.scalar.models.authentication.User import java.util.concurrent.CompletableFuture import java.util.function.Consumer @@ -47,7 +47,7 @@ internal constructor(private val clientOptions: ClientOptions) : AuthenticationS override fun listCurrentUser( params: AuthenticationListCurrentUserParams, requestOptions: RequestOptions, - ): CompletableFuture = + ): CompletableFuture = // get /v1/auth/me withRawResponse().listCurrentUser(params, requestOptions).thenApply { it.parse() } @@ -96,13 +96,13 @@ internal constructor(private val clientOptions: ClientOptions) : AuthenticationS } } - private val listCurrentUserHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val listCurrentUserHandler: Handler = + jsonHandler(clientOptions.jsonMapper) override fun listCurrentUser( params: AuthenticationListCurrentUserParams, requestOptions: RequestOptions, - ): CompletableFuture> { + ): CompletableFuture> { val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/LoginPortalServiceAsync.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/LoginPortalServiceAsync.kt index 48439e7..1f7a6c1 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/async/LoginPortalServiceAsync.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/LoginPortalServiceAsync.kt @@ -6,10 +6,10 @@ import com.scalar.core.ClientOptions import com.scalar.core.RequestOptions import com.scalar.core.http.HttpResponseFor import com.scalar.models.Uid +import com.scalar.models.loginPortals.LoginPortal import com.scalar.models.loginPortals.LoginPortalCreateParams import com.scalar.models.loginPortals.LoginPortalDeleteParams import com.scalar.models.loginPortals.LoginPortalListParams -import com.scalar.models.loginPortals.LoginPortalListResponse import com.scalar.models.loginPortals.LoginPortalRetrieveParams import com.scalar.models.loginPortals.LoginPortalRetrieveResponse import com.scalar.models.loginPortals.LoginPortalUpdateParams @@ -107,21 +107,20 @@ interface LoginPortalServiceAsync { update(slug, LoginPortalUpdateParams.none(), requestOptions) /** List all login portals for the current team. */ - fun list(): CompletableFuture> = - list(LoginPortalListParams.none()) + fun list(): CompletableFuture> = list(LoginPortalListParams.none()) /** @see list */ fun list( params: LoginPortalListParams = LoginPortalListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> + ): CompletableFuture> /** @see list */ - fun list(params: LoginPortalListParams): CompletableFuture> = + fun list(params: LoginPortalListParams): CompletableFuture> = list(params, RequestOptions.none()) /** @see list */ - fun list(requestOptions: RequestOptions): CompletableFuture> = + fun list(requestOptions: RequestOptions): CompletableFuture> = list(LoginPortalListParams.none(), requestOptions) /** Delete a login portal. */ @@ -265,25 +264,25 @@ interface LoginPortalServiceAsync { * Returns a raw HTTP response for `get /v1/login-portals`, but is otherwise the same as * [LoginPortalServiceAsync.list]. */ - fun list(): CompletableFuture>> = + fun list(): CompletableFuture>> = list(LoginPortalListParams.none()) /** @see list */ fun list( params: LoginPortalListParams = LoginPortalListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture>> + ): CompletableFuture>> /** @see list */ fun list( params: LoginPortalListParams - ): CompletableFuture>> = + ): CompletableFuture>> = list(params, RequestOptions.none()) /** @see list */ fun list( requestOptions: RequestOptions - ): CompletableFuture>> = + ): CompletableFuture>> = list(LoginPortalListParams.none(), requestOptions) /** diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/LoginPortalServiceAsyncImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/LoginPortalServiceAsyncImpl.kt index 3a34d32..c99a5af 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/async/LoginPortalServiceAsyncImpl.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/LoginPortalServiceAsyncImpl.kt @@ -17,10 +17,10 @@ import com.scalar.core.http.json import com.scalar.core.http.parseable import com.scalar.core.prepareAsync import com.scalar.models.Uid +import com.scalar.models.loginPortals.LoginPortal import com.scalar.models.loginPortals.LoginPortalCreateParams import com.scalar.models.loginPortals.LoginPortalDeleteParams import com.scalar.models.loginPortals.LoginPortalListParams -import com.scalar.models.loginPortals.LoginPortalListResponse import com.scalar.models.loginPortals.LoginPortalRetrieveParams import com.scalar.models.loginPortals.LoginPortalRetrieveResponse import com.scalar.models.loginPortals.LoginPortalUpdateParams @@ -65,7 +65,7 @@ class LoginPortalServiceAsyncImpl internal constructor(private val clientOptions override fun list( params: LoginPortalListParams, requestOptions: RequestOptions, - ): CompletableFuture> = + ): CompletableFuture> = // get /v1/login-portals withRawResponse().list(params, requestOptions).thenApply { it.parse() } @@ -179,13 +179,13 @@ class LoginPortalServiceAsyncImpl internal constructor(private val clientOptions } } - private val listHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper) + private val listHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) override fun list( params: LoginPortalListParams, requestOptions: RequestOptions, - ): CompletableFuture>> { + ): CompletableFuture>> { val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/McpServiceAsync.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/McpServiceAsync.kt new file mode 100644 index 0000000..573924a --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/McpServiceAsync.kt @@ -0,0 +1,39 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.async + +import com.scalar.core.ClientOptions +import com.scalar.services.async.mcp.ServerServiceAsync +import java.util.function.Consumer + +interface McpServiceAsync { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): McpServiceAsync + + /** MCP */ + fun servers(): ServerServiceAsync + + /** A view of [McpServiceAsync] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): McpServiceAsync.WithRawResponse + + /** MCP */ + fun servers(): ServerServiceAsync.WithRawResponse + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/McpServiceAsyncImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/McpServiceAsyncImpl.kt new file mode 100644 index 0000000..0170905 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/McpServiceAsyncImpl.kt @@ -0,0 +1,44 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.async + +import com.scalar.core.ClientOptions +import com.scalar.services.async.mcp.ServerServiceAsync +import com.scalar.services.async.mcp.ServerServiceAsyncImpl +import java.util.function.Consumer + +class McpServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + McpServiceAsync { + + private val withRawResponse: McpServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + private val servers: ServerServiceAsync by lazy { ServerServiceAsyncImpl(clientOptions) } + + override fun withRawResponse(): McpServiceAsync.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): McpServiceAsync = + McpServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + /** MCP */ + override fun servers(): ServerServiceAsync = servers + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + McpServiceAsync.WithRawResponse { + + private val servers: ServerServiceAsync.WithRawResponse by lazy { + ServerServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + override fun withOptions( + modifier: Consumer + ): McpServiceAsync.WithRawResponse = + McpServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + /** MCP */ + override fun servers(): ServerServiceAsync.WithRawResponse = servers + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/OAuthServiceAsync.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/OAuthServiceAsync.kt new file mode 100644 index 0000000..16f1d72 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/OAuthServiceAsync.kt @@ -0,0 +1,209 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.async + +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.http.HttpResponseFor +import com.scalar.models.oAuth.OAuthOauthAuthorizationServerMetadataParams +import com.scalar.models.oAuth.OAuthOauthAuthorizeParams +import com.scalar.models.oAuth.OAuthOauthRevokeParams +import com.scalar.models.oAuth.OAuthOauthTokenParams +import com.scalar.models.oAuth.OAuthOauthTokenResponse +import com.scalar.models.oAuth.OauthAuthorizationServerMetadata +import com.scalar.models.oAuth.OauthError +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer + +/** OAuth */ +interface OAuthServiceAsync { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): OAuthServiceAsync + + /** + * Discovery document for OAuth clients (RFC 8414): where the endpoints are and what they + * support. + */ + fun oauthAuthorizationServerMetadata(): CompletableFuture = + oauthAuthorizationServerMetadata(OAuthOauthAuthorizationServerMetadataParams.none()) + + /** @see oauthAuthorizationServerMetadata */ + fun oauthAuthorizationServerMetadata( + params: OAuthOauthAuthorizationServerMetadataParams = + OAuthOauthAuthorizationServerMetadataParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see oauthAuthorizationServerMetadata */ + fun oauthAuthorizationServerMetadata( + params: OAuthOauthAuthorizationServerMetadataParams + ): CompletableFuture = + oauthAuthorizationServerMetadata(params, RequestOptions.none()) + + /** @see oauthAuthorizationServerMetadata */ + fun oauthAuthorizationServerMetadata( + requestOptions: RequestOptions + ): CompletableFuture = + oauthAuthorizationServerMetadata( + OAuthOauthAuthorizationServerMetadataParams.none(), + requestOptions, + ) + + /** + * Authorization endpoint (RFC 6749 §4.1.1 with PKCE, RFC 7636). Validates the request and sends + * the user to the Scalar dashboard to approve it; the user returns to `redirect_uri` with a + * `code` to exchange at the token endpoint. Only `response_type=code` with + * `code_challenge_method=S256` is supported. + */ + fun oauthAuthorize(): CompletableFuture = oauthAuthorize(OAuthOauthAuthorizeParams.none()) + + /** @see oauthAuthorize */ + fun oauthAuthorize( + params: OAuthOauthAuthorizeParams = OAuthOauthAuthorizeParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see oauthAuthorize */ + fun oauthAuthorize(params: OAuthOauthAuthorizeParams): CompletableFuture = + oauthAuthorize(params, RequestOptions.none()) + + /** @see oauthAuthorize */ + fun oauthAuthorize(requestOptions: RequestOptions): CompletableFuture = + oauthAuthorize(OAuthOauthAuthorizeParams.none(), requestOptions) + + /** + * Revocation endpoint (RFC 7009). Revokes the refresh token and every token issued alongside + * it. The client authenticates as it does at the token endpoint. Responds 200 whether or not + * the token was live, as the RFC requires. + */ + fun oauthRevoke(params: OAuthOauthRevokeParams): CompletableFuture = + oauthRevoke(params, RequestOptions.none()) + + /** @see oauthRevoke */ + fun oauthRevoke( + params: OAuthOauthRevokeParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** + * Token endpoint (RFC 6749 §4.1.3 and §6). Accepts `application/x-www-form-urlencoded`. + * Confidential clients authenticate with HTTP Basic or `client_secret` in the body; public + * clients send `client_id` alone. The `authorization_code` grant needs `code`, `redirect_uri` + * and `code_verifier`; the `refresh_token` grant needs `refresh_token` and may narrow `scope`. + */ + fun oauthToken(params: OAuthOauthTokenParams): CompletableFuture = + oauthToken(params, RequestOptions.none()) + + /** @see oauthToken */ + fun oauthToken( + params: OAuthOauthTokenParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** A view of [OAuthServiceAsync] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): OAuthServiceAsync.WithRawResponse + + /** + * Returns a raw HTTP response for `get /.well-known/oauth-authorization-server`, but is + * otherwise the same as [OAuthServiceAsync.oauthAuthorizationServerMetadata]. + */ + fun oauthAuthorizationServerMetadata(): + CompletableFuture> = + oauthAuthorizationServerMetadata(OAuthOauthAuthorizationServerMetadataParams.none()) + + /** @see oauthAuthorizationServerMetadata */ + fun oauthAuthorizationServerMetadata( + params: OAuthOauthAuthorizationServerMetadataParams = + OAuthOauthAuthorizationServerMetadataParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see oauthAuthorizationServerMetadata */ + fun oauthAuthorizationServerMetadata( + params: OAuthOauthAuthorizationServerMetadataParams + ): CompletableFuture> = + oauthAuthorizationServerMetadata(params, RequestOptions.none()) + + /** @see oauthAuthorizationServerMetadata */ + fun oauthAuthorizationServerMetadata( + requestOptions: RequestOptions + ): CompletableFuture> = + oauthAuthorizationServerMetadata( + OAuthOauthAuthorizationServerMetadataParams.none(), + requestOptions, + ) + + /** + * Returns a raw HTTP response for `get /v1/oauth/authorize`, but is otherwise the same as + * [OAuthServiceAsync.oauthAuthorize]. + */ + fun oauthAuthorize(): CompletableFuture> = + oauthAuthorize(OAuthOauthAuthorizeParams.none()) + + /** @see oauthAuthorize */ + fun oauthAuthorize( + params: OAuthOauthAuthorizeParams = OAuthOauthAuthorizeParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see oauthAuthorize */ + fun oauthAuthorize( + params: OAuthOauthAuthorizeParams + ): CompletableFuture> = oauthAuthorize(params, RequestOptions.none()) + + /** @see oauthAuthorize */ + fun oauthAuthorize( + requestOptions: RequestOptions + ): CompletableFuture> = + oauthAuthorize(OAuthOauthAuthorizeParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `post /v1/oauth/revoke`, but is otherwise the same as + * [OAuthServiceAsync.oauthRevoke]. + */ + fun oauthRevoke( + params: OAuthOauthRevokeParams + ): CompletableFuture> = + oauthRevoke(params, RequestOptions.none()) + + /** @see oauthRevoke */ + fun oauthRevoke( + params: OAuthOauthRevokeParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `post /v1/oauth/token`, but is otherwise the same as + * [OAuthServiceAsync.oauthToken]. + */ + fun oauthToken( + params: OAuthOauthTokenParams + ): CompletableFuture> = + oauthToken(params, RequestOptions.none()) + + /** @see oauthToken */ + fun oauthToken( + params: OAuthOauthTokenParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/OAuthServiceAsyncImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/OAuthServiceAsyncImpl.kt new file mode 100644 index 0000000..f0790a5 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/OAuthServiceAsyncImpl.kt @@ -0,0 +1,201 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.async + +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.handlers.errorBodyHandler +import com.scalar.core.handlers.errorHandler +import com.scalar.core.handlers.jsonHandler +import com.scalar.core.http.HttpMethod +import com.scalar.core.http.HttpRequest +import com.scalar.core.http.HttpResponse +import com.scalar.core.http.HttpResponse.Handler +import com.scalar.core.http.HttpResponseFor +import com.scalar.core.http.json +import com.scalar.core.http.parseable +import com.scalar.core.prepareAsync +import com.scalar.models.oAuth.OAuthOauthAuthorizationServerMetadataParams +import com.scalar.models.oAuth.OAuthOauthAuthorizeParams +import com.scalar.models.oAuth.OAuthOauthRevokeParams +import com.scalar.models.oAuth.OAuthOauthTokenParams +import com.scalar.models.oAuth.OAuthOauthTokenResponse +import com.scalar.models.oAuth.OauthAuthorizationServerMetadata +import com.scalar.models.oAuth.OauthError +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer + +/** OAuth */ +class OAuthServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + OAuthServiceAsync { + + private val withRawResponse: OAuthServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): OAuthServiceAsync.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): OAuthServiceAsync = + OAuthServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun oauthAuthorizationServerMetadata( + params: OAuthOauthAuthorizationServerMetadataParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /.well-known/oauth-authorization-server + withRawResponse().oauthAuthorizationServerMetadata(params, requestOptions).thenApply { + it.parse() + } + + override fun oauthAuthorize( + params: OAuthOauthAuthorizeParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /v1/oauth/authorize + withRawResponse().oauthAuthorize(params, requestOptions).thenApply { it.parse() } + + override fun oauthRevoke( + params: OAuthOauthRevokeParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // post /v1/oauth/revoke + withRawResponse().oauthRevoke(params, requestOptions).thenApply { it.parse() } + + override fun oauthToken( + params: OAuthOauthTokenParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // post /v1/oauth/token + withRawResponse().oauthToken(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + OAuthServiceAsync.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): OAuthServiceAsync.WithRawResponse = + OAuthServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val oauthAuthorizationServerMetadataHandler: + Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun oauthAuthorizationServerMetadata( + params: OAuthOauthAuthorizationServerMetadataParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments(".well-known", "oauth-authorization-server") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { oauthAuthorizationServerMetadataHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val oauthAuthorizeHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun oauthAuthorize( + params: OAuthOauthAuthorizeParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "oauth", "authorize") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response.use { oauthAuthorizeHandler.handle(it) } + } + } + } + + private val oauthRevokeHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun oauthRevoke( + params: OAuthOauthRevokeParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "oauth", "revoke") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { oauthRevokeHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it?.validate() + } + } + } + } + } + + private val oauthTokenHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun oauthToken( + params: OAuthOauthTokenParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "oauth", "token") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { oauthTokenHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/RegistryServiceAsync.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/RegistryServiceAsync.kt index 5a59ac7..ac64b8f 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/async/RegistryServiceAsync.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/RegistryServiceAsync.kt @@ -6,6 +6,7 @@ import com.scalar.core.ClientOptions import com.scalar.core.RequestOptions import com.scalar.core.http.HttpResponseFor import com.scalar.models.ManagedDocVersion +import com.scalar.models.registry.ApiDocument import com.scalar.models.registry.RegistryCreateApiDocumentAccessGroupParams import com.scalar.models.registry.RegistryCreateApiDocumentParams import com.scalar.models.registry.RegistryCreateApiDocumentResponse @@ -14,10 +15,8 @@ import com.scalar.models.registry.RegistryDeleteApiDocumentAccessGroupParams import com.scalar.models.registry.RegistryDeleteApiDocumentParams import com.scalar.models.registry.RegistryDeleteApiDocumentVersionParams import com.scalar.models.registry.RegistryListAllApiDocumentsParams -import com.scalar.models.registry.RegistryListAllApiDocumentsResponse import com.scalar.models.registry.RegistryListApiDocumentVersionMetadataParams import com.scalar.models.registry.RegistryListApiDocumentsParams -import com.scalar.models.registry.RegistryListApiDocumentsResponse import com.scalar.models.registry.RegistryRetrieveApiDocumentVersionParams import com.scalar.models.registry.RegistryUpdateApiDocumentParams import com.scalar.models.registry.RegistryUpdateApiDocumentVersionParams @@ -194,25 +193,22 @@ interface RegistryServiceAsync { ): CompletableFuture = deleteApiDocumentVersion(params, RequestOptions.none()) /** List all API documents across every namespace the caller can access. */ - fun listAllApiDocuments(): CompletableFuture> = + fun listAllApiDocuments(): CompletableFuture> = listAllApiDocuments(RegistryListAllApiDocumentsParams.none()) /** @see listAllApiDocuments */ fun listAllApiDocuments( params: RegistryListAllApiDocumentsParams = RegistryListAllApiDocumentsParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> + ): CompletableFuture> /** @see listAllApiDocuments */ fun listAllApiDocuments( params: RegistryListAllApiDocumentsParams - ): CompletableFuture> = - listAllApiDocuments(params, RequestOptions.none()) + ): CompletableFuture> = listAllApiDocuments(params, RequestOptions.none()) /** @see listAllApiDocuments */ - fun listAllApiDocuments( - requestOptions: RequestOptions - ): CompletableFuture> = + fun listAllApiDocuments(requestOptions: RequestOptions): CompletableFuture> = listAllApiDocuments(RegistryListAllApiDocumentsParams.none(), requestOptions) /** Get metadata (uid, content shas, version sha, tags) for a specific API document version. */ @@ -243,9 +239,7 @@ interface RegistryServiceAsync { listApiDocumentVersionMetadata(params, RequestOptions.none()) /** List API documents in a namespace. */ - fun listApiDocuments( - namespace: String - ): CompletableFuture> = + fun listApiDocuments(namespace: String): CompletableFuture> = listApiDocuments(namespace, RegistryListApiDocumentsParams.none()) /** @see listApiDocuments */ @@ -253,33 +247,32 @@ interface RegistryServiceAsync { namespace: String, params: RegistryListApiDocumentsParams = RegistryListApiDocumentsParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = + ): CompletableFuture> = listApiDocuments(params.toBuilder().namespace(namespace).build(), requestOptions) /** @see listApiDocuments */ fun listApiDocuments( namespace: String, params: RegistryListApiDocumentsParams, - ): CompletableFuture> = + ): CompletableFuture> = listApiDocuments(namespace, params, RequestOptions.none()) /** @see listApiDocuments */ fun listApiDocuments( params: RegistryListApiDocumentsParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> + ): CompletableFuture> /** @see listApiDocuments */ fun listApiDocuments( params: RegistryListApiDocumentsParams - ): CompletableFuture> = - listApiDocuments(params, RequestOptions.none()) + ): CompletableFuture> = listApiDocuments(params, RequestOptions.none()) /** @see listApiDocuments */ fun listApiDocuments( namespace: String, requestOptions: RequestOptions, - ): CompletableFuture> = + ): CompletableFuture> = listApiDocuments(namespace, RegistryListApiDocumentsParams.none(), requestOptions) /** Get a specific API document version. */ @@ -556,26 +549,25 @@ interface RegistryServiceAsync { * Returns a raw HTTP response for `get /v1/apis`, but is otherwise the same as * [RegistryServiceAsync.listAllApiDocuments]. */ - fun listAllApiDocuments(): - CompletableFuture>> = + fun listAllApiDocuments(): CompletableFuture>> = listAllApiDocuments(RegistryListAllApiDocumentsParams.none()) /** @see listAllApiDocuments */ fun listAllApiDocuments( params: RegistryListAllApiDocumentsParams = RegistryListAllApiDocumentsParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture>> + ): CompletableFuture>> /** @see listAllApiDocuments */ fun listAllApiDocuments( params: RegistryListAllApiDocumentsParams - ): CompletableFuture>> = + ): CompletableFuture>> = listAllApiDocuments(params, RequestOptions.none()) /** @see listAllApiDocuments */ fun listAllApiDocuments( requestOptions: RequestOptions - ): CompletableFuture>> = + ): CompletableFuture>> = listAllApiDocuments(RegistryListAllApiDocumentsParams.none(), requestOptions) /** @@ -618,7 +610,7 @@ interface RegistryServiceAsync { */ fun listApiDocuments( namespace: String - ): CompletableFuture>> = + ): CompletableFuture>> = listApiDocuments(namespace, RegistryListApiDocumentsParams.none()) /** @see listApiDocuments */ @@ -626,33 +618,33 @@ interface RegistryServiceAsync { namespace: String, params: RegistryListApiDocumentsParams = RegistryListApiDocumentsParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture>> = + ): CompletableFuture>> = listApiDocuments(params.toBuilder().namespace(namespace).build(), requestOptions) /** @see listApiDocuments */ fun listApiDocuments( namespace: String, params: RegistryListApiDocumentsParams, - ): CompletableFuture>> = + ): CompletableFuture>> = listApiDocuments(namespace, params, RequestOptions.none()) /** @see listApiDocuments */ fun listApiDocuments( params: RegistryListApiDocumentsParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture>> + ): CompletableFuture>> /** @see listApiDocuments */ fun listApiDocuments( params: RegistryListApiDocumentsParams - ): CompletableFuture>> = + ): CompletableFuture>> = listApiDocuments(params, RequestOptions.none()) /** @see listApiDocuments */ fun listApiDocuments( namespace: String, requestOptions: RequestOptions, - ): CompletableFuture>> = + ): CompletableFuture>> = listApiDocuments(namespace, RegistryListApiDocumentsParams.none(), requestOptions) /** diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/RegistryServiceAsyncImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/RegistryServiceAsyncImpl.kt index ddec783..11a7f71 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/async/RegistryServiceAsyncImpl.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/RegistryServiceAsyncImpl.kt @@ -18,6 +18,7 @@ import com.scalar.core.http.json import com.scalar.core.http.parseable import com.scalar.core.prepareAsync import com.scalar.models.ManagedDocVersion +import com.scalar.models.registry.ApiDocument import com.scalar.models.registry.RegistryCreateApiDocumentAccessGroupParams import com.scalar.models.registry.RegistryCreateApiDocumentParams import com.scalar.models.registry.RegistryCreateApiDocumentResponse @@ -26,10 +27,8 @@ import com.scalar.models.registry.RegistryDeleteApiDocumentAccessGroupParams import com.scalar.models.registry.RegistryDeleteApiDocumentParams import com.scalar.models.registry.RegistryDeleteApiDocumentVersionParams import com.scalar.models.registry.RegistryListAllApiDocumentsParams -import com.scalar.models.registry.RegistryListAllApiDocumentsResponse import com.scalar.models.registry.RegistryListApiDocumentVersionMetadataParams import com.scalar.models.registry.RegistryListApiDocumentsParams -import com.scalar.models.registry.RegistryListApiDocumentsResponse import com.scalar.models.registry.RegistryRetrieveApiDocumentVersionParams import com.scalar.models.registry.RegistryUpdateApiDocumentParams import com.scalar.models.registry.RegistryUpdateApiDocumentVersionParams @@ -100,7 +99,7 @@ class RegistryServiceAsyncImpl internal constructor(private val clientOptions: C override fun listAllApiDocuments( params: RegistryListAllApiDocumentsParams, requestOptions: RequestOptions, - ): CompletableFuture> = + ): CompletableFuture> = // get /v1/apis withRawResponse().listAllApiDocuments(params, requestOptions).thenApply { it.parse() } @@ -116,7 +115,7 @@ class RegistryServiceAsyncImpl internal constructor(private val clientOptions: C override fun listApiDocuments( params: RegistryListApiDocumentsParams, requestOptions: RequestOptions, - ): CompletableFuture> = + ): CompletableFuture> = // get /v1/apis/{namespace} withRawResponse().listApiDocuments(params, requestOptions).thenApply { it.parse() } @@ -361,13 +360,13 @@ class RegistryServiceAsyncImpl internal constructor(private val clientOptions: C } } - private val listAllApiDocumentsHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper) + private val listAllApiDocumentsHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) override fun listAllApiDocuments( params: RegistryListAllApiDocumentsParams, requestOptions: RequestOptions, - ): CompletableFuture>> { + ): CompletableFuture>> { val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -432,13 +431,13 @@ class RegistryServiceAsyncImpl internal constructor(private val clientOptions: C } } - private val listApiDocumentsHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper) + private val listApiDocumentsHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) override fun listApiDocuments( params: RegistryListApiDocumentsParams, requestOptions: RequestOptions, - ): CompletableFuture>> { + ): CompletableFuture>> { // We check here instead of in the params builder because this can be specified // positionally or in the params class. checkRequired("namespace", params.namespace().getOrNull()) diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/RuleServiceAsync.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/RuleServiceAsync.kt index 00acd29..ff971bf 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/async/RuleServiceAsync.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/RuleServiceAsync.kt @@ -6,12 +6,12 @@ import com.scalar.core.ClientOptions import com.scalar.core.RequestOptions import com.scalar.core.http.HttpResponseFor import com.scalar.models.Uid +import com.scalar.models.rules.Rule import com.scalar.models.rules.RuleCreateRulesetAccessGroupParams import com.scalar.models.rules.RuleCreateRulesetParams import com.scalar.models.rules.RuleDeleteRulesetAccessGroupParams import com.scalar.models.rules.RuleDeleteRulesetParams import com.scalar.models.rules.RuleListRulesetsParams -import com.scalar.models.rules.RuleListRulesetsResponse import com.scalar.models.rules.RuleRetrieveRulesetDocumentParams import com.scalar.models.rules.RuleUpdateRulesetParams import java.util.concurrent.CompletableFuture @@ -127,7 +127,7 @@ interface RuleServiceAsync { ): CompletableFuture = deleteRulesetAccessGroup(params, RequestOptions.none()) /** List all rulesets in a namespace. */ - fun listRulesets(namespace: String): CompletableFuture> = + fun listRulesets(namespace: String): CompletableFuture> = listRulesets(namespace, RuleListRulesetsParams.none()) /** @see listRulesets */ @@ -135,33 +135,30 @@ interface RuleServiceAsync { namespace: String, params: RuleListRulesetsParams = RuleListRulesetsParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = + ): CompletableFuture> = listRulesets(params.toBuilder().namespace(namespace).build(), requestOptions) /** @see listRulesets */ fun listRulesets( namespace: String, params: RuleListRulesetsParams, - ): CompletableFuture> = - listRulesets(namespace, params, RequestOptions.none()) + ): CompletableFuture> = listRulesets(namespace, params, RequestOptions.none()) /** @see listRulesets */ fun listRulesets( params: RuleListRulesetsParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> + ): CompletableFuture> /** @see listRulesets */ - fun listRulesets( - params: RuleListRulesetsParams - ): CompletableFuture> = + fun listRulesets(params: RuleListRulesetsParams): CompletableFuture> = listRulesets(params, RequestOptions.none()) /** @see listRulesets */ fun listRulesets( namespace: String, requestOptions: RequestOptions, - ): CompletableFuture> = + ): CompletableFuture> = listRulesets(namespace, RuleListRulesetsParams.none(), requestOptions) /** Get a rule document by slug. */ @@ -343,9 +340,7 @@ interface RuleServiceAsync { * Returns a raw HTTP response for `get /v1/rulesets/{namespace}`, but is otherwise the same * as [RuleServiceAsync.listRulesets]. */ - fun listRulesets( - namespace: String - ): CompletableFuture>> = + fun listRulesets(namespace: String): CompletableFuture>> = listRulesets(namespace, RuleListRulesetsParams.none()) /** @see listRulesets */ @@ -353,33 +348,33 @@ interface RuleServiceAsync { namespace: String, params: RuleListRulesetsParams = RuleListRulesetsParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture>> = + ): CompletableFuture>> = listRulesets(params.toBuilder().namespace(namespace).build(), requestOptions) /** @see listRulesets */ fun listRulesets( namespace: String, params: RuleListRulesetsParams, - ): CompletableFuture>> = + ): CompletableFuture>> = listRulesets(namespace, params, RequestOptions.none()) /** @see listRulesets */ fun listRulesets( params: RuleListRulesetsParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture>> + ): CompletableFuture>> /** @see listRulesets */ fun listRulesets( params: RuleListRulesetsParams - ): CompletableFuture>> = + ): CompletableFuture>> = listRulesets(params, RequestOptions.none()) /** @see listRulesets */ fun listRulesets( namespace: String, requestOptions: RequestOptions, - ): CompletableFuture>> = + ): CompletableFuture>> = listRulesets(namespace, RuleListRulesetsParams.none(), requestOptions) /** diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/RuleServiceAsyncImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/RuleServiceAsyncImpl.kt index 8a12600..4e35e0e 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/async/RuleServiceAsyncImpl.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/RuleServiceAsyncImpl.kt @@ -18,12 +18,12 @@ import com.scalar.core.http.json import com.scalar.core.http.parseable import com.scalar.core.prepareAsync import com.scalar.models.Uid +import com.scalar.models.rules.Rule import com.scalar.models.rules.RuleCreateRulesetAccessGroupParams import com.scalar.models.rules.RuleCreateRulesetParams import com.scalar.models.rules.RuleDeleteRulesetAccessGroupParams import com.scalar.models.rules.RuleDeleteRulesetParams import com.scalar.models.rules.RuleListRulesetsParams -import com.scalar.models.rules.RuleListRulesetsResponse import com.scalar.models.rules.RuleRetrieveRulesetDocumentParams import com.scalar.models.rules.RuleUpdateRulesetParams import java.util.concurrent.CompletableFuture @@ -74,7 +74,7 @@ class RuleServiceAsyncImpl internal constructor(private val clientOptions: Clien override fun listRulesets( params: RuleListRulesetsParams, requestOptions: RequestOptions, - ): CompletableFuture> = + ): CompletableFuture> = // get /v1/rulesets/{namespace} withRawResponse().listRulesets(params, requestOptions).thenApply { it.parse() } @@ -234,13 +234,13 @@ class RuleServiceAsyncImpl internal constructor(private val clientOptions: Clien } } - private val listRulesetsHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper) + private val listRulesetsHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) override fun listRulesets( params: RuleListRulesetsParams, requestOptions: RequestOptions, - ): CompletableFuture>> { + ): CompletableFuture>> { // We check here instead of in the params builder because this can be specified // positionally or in the params class. checkRequired("namespace", params.namespace().getOrNull()) diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/ScalarDocServiceAsync.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/ScalarDocServiceAsync.kt index 11c5de3..9aef141 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/async/ScalarDocServiceAsync.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/ScalarDocServiceAsync.kt @@ -5,12 +5,29 @@ package com.scalar.services.async import com.scalar.core.ClientOptions import com.scalar.core.RequestOptions import com.scalar.core.http.HttpResponseFor +import com.scalar.models.scalarDocs.DocsProject +import com.scalar.models.scalarDocs.GithubProject import com.scalar.models.scalarDocs.ScalarDocCreateGuideParams import com.scalar.models.scalarDocs.ScalarDocCreateGuideResponse +import com.scalar.models.scalarDocs.ScalarDocCreateProjectParams +import com.scalar.models.scalarDocs.ScalarDocDeleteProjectParams import com.scalar.models.scalarDocs.ScalarDocListGuidesParams -import com.scalar.models.scalarDocs.ScalarDocListGuidesResponse +import com.scalar.models.scalarDocs.ScalarDocListProjectConfigParams +import com.scalar.models.scalarDocs.ScalarDocListProjectConfigResponse +import com.scalar.models.scalarDocs.ScalarDocListProjectDomainParams +import com.scalar.models.scalarDocs.ScalarDocListProjectDomainResponse +import com.scalar.models.scalarDocs.ScalarDocListProjectDomainStatusParams +import com.scalar.models.scalarDocs.ScalarDocListProjectDomainStatusResponse +import com.scalar.models.scalarDocs.ScalarDocListProjectsParams +import com.scalar.models.scalarDocs.ScalarDocListProjectsResponse import com.scalar.models.scalarDocs.ScalarDocPublishGuideParams import com.scalar.models.scalarDocs.ScalarDocPublishGuideResponse +import com.scalar.models.scalarDocs.ScalarDocPublishProjectParams +import com.scalar.models.scalarDocs.ScalarDocPublishProjectResponse +import com.scalar.models.scalarDocs.ScalarDocRetrieveProjectParams +import com.scalar.models.scalarDocs.ScalarDocUpdateProjectConfigParams +import com.scalar.models.scalarDocs.ScalarDocUpdateProjectConfigResponse +import com.scalar.models.scalarDocs.ScalarDocUpdateProjectParams import java.util.concurrent.CompletableFuture import java.util.function.Consumer @@ -40,28 +57,210 @@ interface ScalarDocServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** Create a docs project. Omit `provider` to have Scalar host the repository. */ + fun createProject(params: ScalarDocCreateProjectParams): CompletableFuture = + createProject(params, RequestOptions.none()) + + /** @see createProject */ + fun createProject( + params: ScalarDocCreateProjectParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** Delete a docs project, its deploys, its publish records and its cached builds. */ + fun deleteProject(slug: String): CompletableFuture = + deleteProject(slug, ScalarDocDeleteProjectParams.none()) + + /** @see deleteProject */ + fun deleteProject( + slug: String, + params: ScalarDocDeleteProjectParams = ScalarDocDeleteProjectParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + deleteProject(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see deleteProject */ + fun deleteProject(slug: String, params: ScalarDocDeleteProjectParams): CompletableFuture = + deleteProject(slug, params, RequestOptions.none()) + + /** @see deleteProject */ + fun deleteProject( + params: ScalarDocDeleteProjectParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see deleteProject */ + fun deleteProject(params: ScalarDocDeleteProjectParams): CompletableFuture = + deleteProject(params, RequestOptions.none()) + + /** @see deleteProject */ + fun deleteProject(slug: String, requestOptions: RequestOptions): CompletableFuture = + deleteProject(slug, ScalarDocDeleteProjectParams.none(), requestOptions) + /** List all guide projects. */ - fun listGuides(): CompletableFuture> = + fun listGuides(): CompletableFuture> = listGuides(ScalarDocListGuidesParams.none()) /** @see listGuides */ fun listGuides( params: ScalarDocListGuidesParams = ScalarDocListGuidesParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> + ): CompletableFuture> /** @see listGuides */ - fun listGuides( - params: ScalarDocListGuidesParams - ): CompletableFuture> = + fun listGuides(params: ScalarDocListGuidesParams): CompletableFuture> = listGuides(params, RequestOptions.none()) /** @see listGuides */ - fun listGuides( - requestOptions: RequestOptions - ): CompletableFuture> = + fun listGuides(requestOptions: RequestOptions): CompletableFuture> = listGuides(ScalarDocListGuidesParams.none(), requestOptions) + /** + * Read `scalar.config.json` straight from the project repository, without cloning it. + * `baseToken` is the compare-and-swap handle for a later write. + */ + fun listProjectConfig(slug: String): CompletableFuture = + listProjectConfig(slug, ScalarDocListProjectConfigParams.none()) + + /** @see listProjectConfig */ + fun listProjectConfig( + slug: String, + params: ScalarDocListProjectConfigParams = ScalarDocListProjectConfigParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + listProjectConfig(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see listProjectConfig */ + fun listProjectConfig( + slug: String, + params: ScalarDocListProjectConfigParams, + ): CompletableFuture = + listProjectConfig(slug, params, RequestOptions.none()) + + /** @see listProjectConfig */ + fun listProjectConfig( + params: ScalarDocListProjectConfigParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see listProjectConfig */ + fun listProjectConfig( + params: ScalarDocListProjectConfigParams + ): CompletableFuture = + listProjectConfig(params, RequestOptions.none()) + + /** @see listProjectConfig */ + fun listProjectConfig( + slug: String, + requestOptions: RequestOptions, + ): CompletableFuture = + listProjectConfig(slug, ScalarDocListProjectConfigParams.none(), requestOptions) + + /** The domains the project serves on — the Scalar-hosted one and the custom one, when set. */ + fun listProjectDomain(slug: String): CompletableFuture = + listProjectDomain(slug, ScalarDocListProjectDomainParams.none()) + + /** @see listProjectDomain */ + fun listProjectDomain( + slug: String, + params: ScalarDocListProjectDomainParams = ScalarDocListProjectDomainParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + listProjectDomain(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see listProjectDomain */ + fun listProjectDomain( + slug: String, + params: ScalarDocListProjectDomainParams, + ): CompletableFuture = + listProjectDomain(slug, params, RequestOptions.none()) + + /** @see listProjectDomain */ + fun listProjectDomain( + params: ScalarDocListProjectDomainParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see listProjectDomain */ + fun listProjectDomain( + params: ScalarDocListProjectDomainParams + ): CompletableFuture = + listProjectDomain(params, RequestOptions.none()) + + /** @see listProjectDomain */ + fun listProjectDomain( + slug: String, + requestOptions: RequestOptions, + ): CompletableFuture = + listProjectDomain(slug, ScalarDocListProjectDomainParams.none(), requestOptions) + + /** + * Whether the project custom domain points at Scalar yet. `expected` is the CNAME record to + * create; `found` is what resolves today. A project with no custom domain reports `verified` + * with no expected record, because Scalar serves its own subdomain directly. + */ + fun listProjectDomainStatus( + slug: String + ): CompletableFuture = + listProjectDomainStatus(slug, ScalarDocListProjectDomainStatusParams.none()) + + /** @see listProjectDomainStatus */ + fun listProjectDomainStatus( + slug: String, + params: ScalarDocListProjectDomainStatusParams = + ScalarDocListProjectDomainStatusParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + listProjectDomainStatus(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see listProjectDomainStatus */ + fun listProjectDomainStatus( + slug: String, + params: ScalarDocListProjectDomainStatusParams, + ): CompletableFuture = + listProjectDomainStatus(slug, params, RequestOptions.none()) + + /** @see listProjectDomainStatus */ + fun listProjectDomainStatus( + params: ScalarDocListProjectDomainStatusParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see listProjectDomainStatus */ + fun listProjectDomainStatus( + params: ScalarDocListProjectDomainStatusParams + ): CompletableFuture = + listProjectDomainStatus(params, RequestOptions.none()) + + /** @see listProjectDomainStatus */ + fun listProjectDomainStatus( + slug: String, + requestOptions: RequestOptions, + ): CompletableFuture = + listProjectDomainStatus(slug, ScalarDocListProjectDomainStatusParams.none(), requestOptions) + + /** List every docs project on the team. */ + fun listProjects(): CompletableFuture = + listProjects(ScalarDocListProjectsParams.none()) + + /** @see listProjects */ + fun listProjects( + params: ScalarDocListProjectsParams = ScalarDocListProjectsParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see listProjects */ + fun listProjects( + params: ScalarDocListProjectsParams + ): CompletableFuture = + listProjects(params, RequestOptions.none()) + + /** @see listProjects */ + fun listProjects( + requestOptions: RequestOptions + ): CompletableFuture = + listProjects(ScalarDocListProjectsParams.none(), requestOptions) + /** Start a new publish process. */ fun publishGuide(slug: String): CompletableFuture = publishGuide(slug, ScalarDocPublishGuideParams.none()) @@ -100,6 +299,141 @@ interface ScalarDocServiceAsync { ): CompletableFuture = publishGuide(slug, ScalarDocPublishGuideParams.none(), requestOptions) + /** Start a build and deploy. The returned `publishUid` identifies the publish record. */ + fun publishProject(slug: String): CompletableFuture = + publishProject(slug, ScalarDocPublishProjectParams.none()) + + /** @see publishProject */ + fun publishProject( + slug: String, + params: ScalarDocPublishProjectParams = ScalarDocPublishProjectParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + publishProject(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see publishProject */ + fun publishProject( + slug: String, + params: ScalarDocPublishProjectParams, + ): CompletableFuture = + publishProject(slug, params, RequestOptions.none()) + + /** @see publishProject */ + fun publishProject( + params: ScalarDocPublishProjectParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see publishProject */ + fun publishProject( + params: ScalarDocPublishProjectParams + ): CompletableFuture = + publishProject(params, RequestOptions.none()) + + /** @see publishProject */ + fun publishProject( + slug: String, + requestOptions: RequestOptions, + ): CompletableFuture = + publishProject(slug, ScalarDocPublishProjectParams.none(), requestOptions) + + /** Get a single docs project by its slug. */ + fun retrieveProject(slug: String): CompletableFuture = + retrieveProject(slug, ScalarDocRetrieveProjectParams.none()) + + /** @see retrieveProject */ + fun retrieveProject( + slug: String, + params: ScalarDocRetrieveProjectParams = ScalarDocRetrieveProjectParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + retrieveProject(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see retrieveProject */ + fun retrieveProject( + slug: String, + params: ScalarDocRetrieveProjectParams, + ): CompletableFuture = retrieveProject(slug, params, RequestOptions.none()) + + /** @see retrieveProject */ + fun retrieveProject( + params: ScalarDocRetrieveProjectParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see retrieveProject */ + fun retrieveProject(params: ScalarDocRetrieveProjectParams): CompletableFuture = + retrieveProject(params, RequestOptions.none()) + + /** @see retrieveProject */ + fun retrieveProject( + slug: String, + requestOptions: RequestOptions, + ): CompletableFuture = + retrieveProject(slug, ScalarDocRetrieveProjectParams.none(), requestOptions) + + /** + * Update project settings. Set `isPrivate` with `accessGroups` to put the site behind a login. + */ + fun updateProject(slug: String): CompletableFuture = + updateProject(slug, ScalarDocUpdateProjectParams.none()) + + /** @see updateProject */ + fun updateProject( + slug: String, + params: ScalarDocUpdateProjectParams = ScalarDocUpdateProjectParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + updateProject(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see updateProject */ + fun updateProject(slug: String, params: ScalarDocUpdateProjectParams): CompletableFuture = + updateProject(slug, params, RequestOptions.none()) + + /** @see updateProject */ + fun updateProject( + params: ScalarDocUpdateProjectParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see updateProject */ + fun updateProject(params: ScalarDocUpdateProjectParams): CompletableFuture = + updateProject(params, RequestOptions.none()) + + /** @see updateProject */ + fun updateProject(slug: String, requestOptions: RequestOptions): CompletableFuture = + updateProject(slug, ScalarDocUpdateProjectParams.none(), requestOptions) + + /** + * Commit `scalar.config.json` straight to the project repository. Pass the `baseToken` from the + * read this edit was based on; a conflict means the file moved underneath it. + */ + fun updateProjectConfig( + slug: String, + params: ScalarDocUpdateProjectConfigParams, + ): CompletableFuture = + updateProjectConfig(slug, params, RequestOptions.none()) + + /** @see updateProjectConfig */ + fun updateProjectConfig( + slug: String, + params: ScalarDocUpdateProjectConfigParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + updateProjectConfig(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see updateProjectConfig */ + fun updateProjectConfig( + params: ScalarDocUpdateProjectConfigParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see updateProjectConfig */ + fun updateProjectConfig( + params: ScalarDocUpdateProjectConfigParams + ): CompletableFuture = + updateProjectConfig(params, RequestOptions.none()) + /** * A view of [ScalarDocServiceAsync] that provides access to raw HTTP responses for each method. */ @@ -129,31 +463,245 @@ interface ScalarDocServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** + * Returns a raw HTTP response for `post /v1/docs`, but is otherwise the same as + * [ScalarDocServiceAsync.createProject]. + */ + fun createProject( + params: ScalarDocCreateProjectParams + ): CompletableFuture> = + createProject(params, RequestOptions.none()) + + /** @see createProject */ + fun createProject( + params: ScalarDocCreateProjectParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `delete /v1/docs/{slug}`, but is otherwise the same as + * [ScalarDocServiceAsync.deleteProject]. + */ + fun deleteProject(slug: String): CompletableFuture> = + deleteProject(slug, ScalarDocDeleteProjectParams.none()) + + /** @see deleteProject */ + fun deleteProject( + slug: String, + params: ScalarDocDeleteProjectParams = ScalarDocDeleteProjectParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + deleteProject(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see deleteProject */ + fun deleteProject( + slug: String, + params: ScalarDocDeleteProjectParams, + ): CompletableFuture> = + deleteProject(slug, params, RequestOptions.none()) + + /** @see deleteProject */ + fun deleteProject( + params: ScalarDocDeleteProjectParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see deleteProject */ + fun deleteProject( + params: ScalarDocDeleteProjectParams + ): CompletableFuture> = deleteProject(params, RequestOptions.none()) + + /** @see deleteProject */ + fun deleteProject( + slug: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + deleteProject(slug, ScalarDocDeleteProjectParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get /v1/guides`, but is otherwise the same as * [ScalarDocServiceAsync.listGuides]. */ - fun listGuides(): CompletableFuture>> = + fun listGuides(): CompletableFuture>> = listGuides(ScalarDocListGuidesParams.none()) /** @see listGuides */ fun listGuides( params: ScalarDocListGuidesParams = ScalarDocListGuidesParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture>> + ): CompletableFuture>> /** @see listGuides */ fun listGuides( params: ScalarDocListGuidesParams - ): CompletableFuture>> = + ): CompletableFuture>> = listGuides(params, RequestOptions.none()) /** @see listGuides */ fun listGuides( requestOptions: RequestOptions - ): CompletableFuture>> = + ): CompletableFuture>> = listGuides(ScalarDocListGuidesParams.none(), requestOptions) + /** + * Returns a raw HTTP response for `get /v1/docs/{slug}/config`, but is otherwise the same + * as [ScalarDocServiceAsync.listProjectConfig]. + */ + fun listProjectConfig( + slug: String + ): CompletableFuture> = + listProjectConfig(slug, ScalarDocListProjectConfigParams.none()) + + /** @see listProjectConfig */ + fun listProjectConfig( + slug: String, + params: ScalarDocListProjectConfigParams = ScalarDocListProjectConfigParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + listProjectConfig(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see listProjectConfig */ + fun listProjectConfig( + slug: String, + params: ScalarDocListProjectConfigParams, + ): CompletableFuture> = + listProjectConfig(slug, params, RequestOptions.none()) + + /** @see listProjectConfig */ + fun listProjectConfig( + params: ScalarDocListProjectConfigParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see listProjectConfig */ + fun listProjectConfig( + params: ScalarDocListProjectConfigParams + ): CompletableFuture> = + listProjectConfig(params, RequestOptions.none()) + + /** @see listProjectConfig */ + fun listProjectConfig( + slug: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + listProjectConfig(slug, ScalarDocListProjectConfigParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /v1/docs/{slug}/domain`, but is otherwise the same + * as [ScalarDocServiceAsync.listProjectDomain]. + */ + fun listProjectDomain( + slug: String + ): CompletableFuture> = + listProjectDomain(slug, ScalarDocListProjectDomainParams.none()) + + /** @see listProjectDomain */ + fun listProjectDomain( + slug: String, + params: ScalarDocListProjectDomainParams = ScalarDocListProjectDomainParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + listProjectDomain(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see listProjectDomain */ + fun listProjectDomain( + slug: String, + params: ScalarDocListProjectDomainParams, + ): CompletableFuture> = + listProjectDomain(slug, params, RequestOptions.none()) + + /** @see listProjectDomain */ + fun listProjectDomain( + params: ScalarDocListProjectDomainParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see listProjectDomain */ + fun listProjectDomain( + params: ScalarDocListProjectDomainParams + ): CompletableFuture> = + listProjectDomain(params, RequestOptions.none()) + + /** @see listProjectDomain */ + fun listProjectDomain( + slug: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + listProjectDomain(slug, ScalarDocListProjectDomainParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /v1/docs/{slug}/domain/status`, but is otherwise the + * same as [ScalarDocServiceAsync.listProjectDomainStatus]. + */ + fun listProjectDomainStatus( + slug: String + ): CompletableFuture> = + listProjectDomainStatus(slug, ScalarDocListProjectDomainStatusParams.none()) + + /** @see listProjectDomainStatus */ + fun listProjectDomainStatus( + slug: String, + params: ScalarDocListProjectDomainStatusParams = + ScalarDocListProjectDomainStatusParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + listProjectDomainStatus(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see listProjectDomainStatus */ + fun listProjectDomainStatus( + slug: String, + params: ScalarDocListProjectDomainStatusParams, + ): CompletableFuture> = + listProjectDomainStatus(slug, params, RequestOptions.none()) + + /** @see listProjectDomainStatus */ + fun listProjectDomainStatus( + params: ScalarDocListProjectDomainStatusParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see listProjectDomainStatus */ + fun listProjectDomainStatus( + params: ScalarDocListProjectDomainStatusParams + ): CompletableFuture> = + listProjectDomainStatus(params, RequestOptions.none()) + + /** @see listProjectDomainStatus */ + fun listProjectDomainStatus( + slug: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + listProjectDomainStatus( + slug, + ScalarDocListProjectDomainStatusParams.none(), + requestOptions, + ) + + /** + * Returns a raw HTTP response for `get /v1/docs`, but is otherwise the same as + * [ScalarDocServiceAsync.listProjects]. + */ + fun listProjects(): CompletableFuture> = + listProjects(ScalarDocListProjectsParams.none()) + + /** @see listProjects */ + fun listProjects( + params: ScalarDocListProjectsParams = ScalarDocListProjectsParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see listProjects */ + fun listProjects( + params: ScalarDocListProjectsParams + ): CompletableFuture> = + listProjects(params, RequestOptions.none()) + + /** @see listProjects */ + fun listProjects( + requestOptions: RequestOptions + ): CompletableFuture> = + listProjects(ScalarDocListProjectsParams.none(), requestOptions) + /** * Returns a raw HTTP response for `post /v1/guides/{slug}/publish`, but is otherwise the * same as [ScalarDocServiceAsync.publishGuide]. @@ -196,5 +744,159 @@ interface ScalarDocServiceAsync { requestOptions: RequestOptions, ): CompletableFuture> = publishGuide(slug, ScalarDocPublishGuideParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `post /v1/docs/{slug}/publish`, but is otherwise the same + * as [ScalarDocServiceAsync.publishProject]. + */ + fun publishProject( + slug: String + ): CompletableFuture> = + publishProject(slug, ScalarDocPublishProjectParams.none()) + + /** @see publishProject */ + fun publishProject( + slug: String, + params: ScalarDocPublishProjectParams = ScalarDocPublishProjectParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + publishProject(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see publishProject */ + fun publishProject( + slug: String, + params: ScalarDocPublishProjectParams, + ): CompletableFuture> = + publishProject(slug, params, RequestOptions.none()) + + /** @see publishProject */ + fun publishProject( + params: ScalarDocPublishProjectParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see publishProject */ + fun publishProject( + params: ScalarDocPublishProjectParams + ): CompletableFuture> = + publishProject(params, RequestOptions.none()) + + /** @see publishProject */ + fun publishProject( + slug: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + publishProject(slug, ScalarDocPublishProjectParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /v1/docs/{slug}`, but is otherwise the same as + * [ScalarDocServiceAsync.retrieveProject]. + */ + fun retrieveProject(slug: String): CompletableFuture> = + retrieveProject(slug, ScalarDocRetrieveProjectParams.none()) + + /** @see retrieveProject */ + fun retrieveProject( + slug: String, + params: ScalarDocRetrieveProjectParams = ScalarDocRetrieveProjectParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + retrieveProject(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see retrieveProject */ + fun retrieveProject( + slug: String, + params: ScalarDocRetrieveProjectParams, + ): CompletableFuture> = + retrieveProject(slug, params, RequestOptions.none()) + + /** @see retrieveProject */ + fun retrieveProject( + params: ScalarDocRetrieveProjectParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see retrieveProject */ + fun retrieveProject( + params: ScalarDocRetrieveProjectParams + ): CompletableFuture> = + retrieveProject(params, RequestOptions.none()) + + /** @see retrieveProject */ + fun retrieveProject( + slug: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + retrieveProject(slug, ScalarDocRetrieveProjectParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `patch /v1/docs/{slug}`, but is otherwise the same as + * [ScalarDocServiceAsync.updateProject]. + */ + fun updateProject(slug: String): CompletableFuture> = + updateProject(slug, ScalarDocUpdateProjectParams.none()) + + /** @see updateProject */ + fun updateProject( + slug: String, + params: ScalarDocUpdateProjectParams = ScalarDocUpdateProjectParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + updateProject(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see updateProject */ + fun updateProject( + slug: String, + params: ScalarDocUpdateProjectParams, + ): CompletableFuture> = + updateProject(slug, params, RequestOptions.none()) + + /** @see updateProject */ + fun updateProject( + params: ScalarDocUpdateProjectParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see updateProject */ + fun updateProject( + params: ScalarDocUpdateProjectParams + ): CompletableFuture> = updateProject(params, RequestOptions.none()) + + /** @see updateProject */ + fun updateProject( + slug: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + updateProject(slug, ScalarDocUpdateProjectParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `put /v1/docs/{slug}/config`, but is otherwise the same + * as [ScalarDocServiceAsync.updateProjectConfig]. + */ + fun updateProjectConfig( + slug: String, + params: ScalarDocUpdateProjectConfigParams, + ): CompletableFuture> = + updateProjectConfig(slug, params, RequestOptions.none()) + + /** @see updateProjectConfig */ + fun updateProjectConfig( + slug: String, + params: ScalarDocUpdateProjectConfigParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + updateProjectConfig(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see updateProjectConfig */ + fun updateProjectConfig( + params: ScalarDocUpdateProjectConfigParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see updateProjectConfig */ + fun updateProjectConfig( + params: ScalarDocUpdateProjectConfigParams + ): CompletableFuture> = + updateProjectConfig(params, RequestOptions.none()) } } diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/ScalarDocServiceAsyncImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/ScalarDocServiceAsyncImpl.kt index 23c2593..9f2886a 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/async/ScalarDocServiceAsyncImpl.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/ScalarDocServiceAsyncImpl.kt @@ -16,12 +16,29 @@ import com.scalar.core.http.HttpResponseFor import com.scalar.core.http.json import com.scalar.core.http.parseable import com.scalar.core.prepareAsync +import com.scalar.models.scalarDocs.DocsProject +import com.scalar.models.scalarDocs.GithubProject import com.scalar.models.scalarDocs.ScalarDocCreateGuideParams import com.scalar.models.scalarDocs.ScalarDocCreateGuideResponse +import com.scalar.models.scalarDocs.ScalarDocCreateProjectParams +import com.scalar.models.scalarDocs.ScalarDocDeleteProjectParams import com.scalar.models.scalarDocs.ScalarDocListGuidesParams -import com.scalar.models.scalarDocs.ScalarDocListGuidesResponse +import com.scalar.models.scalarDocs.ScalarDocListProjectConfigParams +import com.scalar.models.scalarDocs.ScalarDocListProjectConfigResponse +import com.scalar.models.scalarDocs.ScalarDocListProjectDomainParams +import com.scalar.models.scalarDocs.ScalarDocListProjectDomainResponse +import com.scalar.models.scalarDocs.ScalarDocListProjectDomainStatusParams +import com.scalar.models.scalarDocs.ScalarDocListProjectDomainStatusResponse +import com.scalar.models.scalarDocs.ScalarDocListProjectsParams +import com.scalar.models.scalarDocs.ScalarDocListProjectsResponse import com.scalar.models.scalarDocs.ScalarDocPublishGuideParams import com.scalar.models.scalarDocs.ScalarDocPublishGuideResponse +import com.scalar.models.scalarDocs.ScalarDocPublishProjectParams +import com.scalar.models.scalarDocs.ScalarDocPublishProjectResponse +import com.scalar.models.scalarDocs.ScalarDocRetrieveProjectParams +import com.scalar.models.scalarDocs.ScalarDocUpdateProjectConfigParams +import com.scalar.models.scalarDocs.ScalarDocUpdateProjectConfigResponse +import com.scalar.models.scalarDocs.ScalarDocUpdateProjectParams import java.util.concurrent.CompletableFuture import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull @@ -46,13 +63,55 @@ class ScalarDocServiceAsyncImpl internal constructor(private val clientOptions: // post /v1/guides withRawResponse().createGuide(params, requestOptions).thenApply { it.parse() } + override fun createProject( + params: ScalarDocCreateProjectParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // post /v1/docs + withRawResponse().createProject(params, requestOptions).thenApply { it.parse() } + + override fun deleteProject( + params: ScalarDocDeleteProjectParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // delete /v1/docs/{slug} + withRawResponse().deleteProject(params, requestOptions).thenApply { it.parse() } + override fun listGuides( params: ScalarDocListGuidesParams, requestOptions: RequestOptions, - ): CompletableFuture> = + ): CompletableFuture> = // get /v1/guides withRawResponse().listGuides(params, requestOptions).thenApply { it.parse() } + override fun listProjectConfig( + params: ScalarDocListProjectConfigParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /v1/docs/{slug}/config + withRawResponse().listProjectConfig(params, requestOptions).thenApply { it.parse() } + + override fun listProjectDomain( + params: ScalarDocListProjectDomainParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /v1/docs/{slug}/domain + withRawResponse().listProjectDomain(params, requestOptions).thenApply { it.parse() } + + override fun listProjectDomainStatus( + params: ScalarDocListProjectDomainStatusParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /v1/docs/{slug}/domain/status + withRawResponse().listProjectDomainStatus(params, requestOptions).thenApply { it.parse() } + + override fun listProjects( + params: ScalarDocListProjectsParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /v1/docs + withRawResponse().listProjects(params, requestOptions).thenApply { it.parse() } + override fun publishGuide( params: ScalarDocPublishGuideParams, requestOptions: RequestOptions, @@ -60,6 +119,34 @@ class ScalarDocServiceAsyncImpl internal constructor(private val clientOptions: // post /v1/guides/{slug}/publish withRawResponse().publishGuide(params, requestOptions).thenApply { it.parse() } + override fun publishProject( + params: ScalarDocPublishProjectParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // post /v1/docs/{slug}/publish + withRawResponse().publishProject(params, requestOptions).thenApply { it.parse() } + + override fun retrieveProject( + params: ScalarDocRetrieveProjectParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /v1/docs/{slug} + withRawResponse().retrieveProject(params, requestOptions).thenApply { it.parse() } + + override fun updateProject( + params: ScalarDocUpdateProjectParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // patch /v1/docs/{slug} + withRawResponse().updateProject(params, requestOptions).thenApply { it.parse() } + + override fun updateProjectConfig( + params: ScalarDocUpdateProjectConfigParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // put /v1/docs/{slug}/config + withRawResponse().updateProjectConfig(params, requestOptions).thenApply { it.parse() } + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : ScalarDocServiceAsync.WithRawResponse { @@ -104,13 +191,72 @@ class ScalarDocServiceAsyncImpl internal constructor(private val clientOptions: } } - private val listGuidesHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper) + private val createProjectHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun createProject( + params: ScalarDocCreateProjectParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "docs") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { createProjectHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val deleteProjectHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun deleteProject( + params: ScalarDocDeleteProjectParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("slug", params.slug().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.DELETE) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "docs", params._pathParam(0)) + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response.use { deleteProjectHandler.handle(it) } + } + } + } + + private val listGuidesHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) override fun listGuides( params: ScalarDocListGuidesParams, requestOptions: RequestOptions, - ): CompletableFuture>> { + ): CompletableFuture>> { val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -134,6 +280,136 @@ class ScalarDocServiceAsyncImpl internal constructor(private val clientOptions: } } + private val listProjectConfigHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun listProjectConfig( + params: ScalarDocListProjectConfigParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("slug", params.slug().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "docs", params._pathParam(0), "config") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { listProjectConfigHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val listProjectDomainHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun listProjectDomain( + params: ScalarDocListProjectDomainParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("slug", params.slug().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "docs", params._pathParam(0), "domain") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { listProjectDomainHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val listProjectDomainStatusHandler: + Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun listProjectDomainStatus( + params: ScalarDocListProjectDomainStatusParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("slug", params.slug().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "docs", params._pathParam(0), "domain", "status") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { listProjectDomainStatusHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val listProjectsHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun listProjects( + params: ScalarDocListProjectsParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "docs") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { listProjectsHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + private val publishGuideHandler: Handler = jsonHandler(clientOptions.jsonMapper) @@ -167,5 +443,134 @@ class ScalarDocServiceAsyncImpl internal constructor(private val clientOptions: } } } + + private val publishProjectHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun publishProject( + params: ScalarDocPublishProjectParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("slug", params.slug().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "docs", params._pathParam(0), "publish") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { publishProjectHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val retrieveProjectHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun retrieveProject( + params: ScalarDocRetrieveProjectParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("slug", params.slug().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "docs", params._pathParam(0)) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { retrieveProjectHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val updateProjectHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun updateProject( + params: ScalarDocUpdateProjectParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("slug", params.slug().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.PATCH) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "docs", params._pathParam(0)) + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response.use { updateProjectHandler.handle(it) } + } + } + } + + private val updateProjectConfigHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun updateProjectConfig( + params: ScalarDocUpdateProjectConfigParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("slug", params.slug().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "docs", params._pathParam(0), "config") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { updateProjectConfigHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } } } diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/SchemaServiceAsync.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/SchemaServiceAsync.kt index 7fd5692..56fa0b7 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/async/SchemaServiceAsync.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/SchemaServiceAsync.kt @@ -6,10 +6,10 @@ import com.scalar.core.ClientOptions import com.scalar.core.RequestOptions import com.scalar.core.http.HttpResponseFor import com.scalar.models.Uid +import com.scalar.models.schemas.Schema import com.scalar.models.schemas.SchemaCreateParams import com.scalar.models.schemas.SchemaDeleteParams import com.scalar.models.schemas.SchemaListParams -import com.scalar.models.schemas.SchemaListResponse import com.scalar.models.schemas.SchemaUpdateParams import com.scalar.services.async.schemas.AccessGroupServiceAsync import com.scalar.services.async.schemas.VersionServiceAsync @@ -81,7 +81,7 @@ interface SchemaServiceAsync { update(params, RequestOptions.none()) /** List schemas in a namespace. */ - fun list(namespace: String): CompletableFuture> = + fun list(namespace: String): CompletableFuture> = list(namespace, SchemaListParams.none()) /** @see list */ @@ -89,30 +89,25 @@ interface SchemaServiceAsync { namespace: String, params: SchemaListParams = SchemaListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = + ): CompletableFuture> = list(params.toBuilder().namespace(namespace).build(), requestOptions) /** @see list */ - fun list( - namespace: String, - params: SchemaListParams, - ): CompletableFuture> = list(namespace, params, RequestOptions.none()) + fun list(namespace: String, params: SchemaListParams): CompletableFuture> = + list(namespace, params, RequestOptions.none()) /** @see list */ fun list( params: SchemaListParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> + ): CompletableFuture> /** @see list */ - fun list(params: SchemaListParams): CompletableFuture> = + fun list(params: SchemaListParams): CompletableFuture> = list(params, RequestOptions.none()) /** @see list */ - fun list( - namespace: String, - requestOptions: RequestOptions, - ): CompletableFuture> = + fun list(namespace: String, requestOptions: RequestOptions): CompletableFuture> = list(namespace, SchemaListParams.none(), requestOptions) /** Delete a schema and all related versions. */ @@ -215,7 +210,7 @@ interface SchemaServiceAsync { * Returns a raw HTTP response for `get /v1/schemas/{namespace}`, but is otherwise the same * as [SchemaServiceAsync.list]. */ - fun list(namespace: String): CompletableFuture>> = + fun list(namespace: String): CompletableFuture>> = list(namespace, SchemaListParams.none()) /** @see list */ @@ -223,33 +218,31 @@ interface SchemaServiceAsync { namespace: String, params: SchemaListParams = SchemaListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture>> = + ): CompletableFuture>> = list(params.toBuilder().namespace(namespace).build(), requestOptions) /** @see list */ fun list( namespace: String, params: SchemaListParams, - ): CompletableFuture>> = + ): CompletableFuture>> = list(namespace, params, RequestOptions.none()) /** @see list */ fun list( params: SchemaListParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture>> + ): CompletableFuture>> /** @see list */ - fun list( - params: SchemaListParams - ): CompletableFuture>> = + fun list(params: SchemaListParams): CompletableFuture>> = list(params, RequestOptions.none()) /** @see list */ fun list( namespace: String, requestOptions: RequestOptions, - ): CompletableFuture>> = + ): CompletableFuture>> = list(namespace, SchemaListParams.none(), requestOptions) /** diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/SchemaServiceAsyncImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/SchemaServiceAsyncImpl.kt index 9e80e36..d84144d 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/async/SchemaServiceAsyncImpl.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/SchemaServiceAsyncImpl.kt @@ -17,10 +17,10 @@ import com.scalar.core.http.json import com.scalar.core.http.parseable import com.scalar.core.prepareAsync import com.scalar.models.Uid +import com.scalar.models.schemas.Schema import com.scalar.models.schemas.SchemaCreateParams import com.scalar.models.schemas.SchemaDeleteParams import com.scalar.models.schemas.SchemaListParams -import com.scalar.models.schemas.SchemaListResponse import com.scalar.models.schemas.SchemaUpdateParams import com.scalar.services.async.schemas.AccessGroupServiceAsync import com.scalar.services.async.schemas.AccessGroupServiceAsyncImpl @@ -72,7 +72,7 @@ class SchemaServiceAsyncImpl internal constructor(private val clientOptions: Cli override fun list( params: SchemaListParams, requestOptions: RequestOptions, - ): CompletableFuture> = + ): CompletableFuture> = // get /v1/schemas/{namespace} withRawResponse().list(params, requestOptions).thenApply { it.parse() } @@ -170,13 +170,13 @@ class SchemaServiceAsyncImpl internal constructor(private val clientOptions: Cli } } - private val listHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper) + private val listHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) override fun list( params: SchemaListParams, requestOptions: RequestOptions, - ): CompletableFuture>> { + ): CompletableFuture>> { // We check here instead of in the params builder because this can be specified // positionally or in the params class. checkRequired("namespace", params.namespace().getOrNull()) diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/SdkServiceAsync.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/SdkServiceAsync.kt new file mode 100644 index 0000000..7c8a06b --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/SdkServiceAsync.kt @@ -0,0 +1,387 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.async + +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.http.HttpResponseFor +import com.scalar.models.Uid +import com.scalar.models.sdks.Sdk +import com.scalar.models.sdks.SdkBuildParams +import com.scalar.models.sdks.SdkBuildResponse +import com.scalar.models.sdks.SdkCreateParams +import com.scalar.models.sdks.SdkDeleteParams +import com.scalar.models.sdks.SdkListParams +import com.scalar.models.sdks.SdkListResponse +import com.scalar.models.sdks.SdkRetrieveParams +import com.scalar.models.sdks.SdkUpdateParams +import com.scalar.services.async.sdks.RepositoryServiceAsync +import com.scalar.services.async.sdks.VersionServiceAsync +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer + +/** SDKs */ +interface SdkServiceAsync { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): SdkServiceAsync + + /** SDKs */ + fun versions(): VersionServiceAsync + + /** SDKs */ + fun repositories(): RepositoryServiceAsync + + /** Create an SDK from an API document, targeting one or more languages. */ + fun create(params: SdkCreateParams): CompletableFuture = + create(params, RequestOptions.none()) + + /** @see create */ + fun create( + params: SdkCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** Get a single SDK by its uid. */ + fun retrieve(uid: String): CompletableFuture = retrieve(uid, SdkRetrieveParams.none()) + + /** @see retrieve */ + fun retrieve( + uid: String, + params: SdkRetrieveParams = SdkRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = retrieve(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see retrieve */ + fun retrieve(uid: String, params: SdkRetrieveParams): CompletableFuture = + retrieve(uid, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: SdkRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see retrieve */ + fun retrieve(params: SdkRetrieveParams): CompletableFuture = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve(uid: String, requestOptions: RequestOptions): CompletableFuture = + retrieve(uid, SdkRetrieveParams.none(), requestOptions) + + /** Update SDK metadata, its linked API, or its config. */ + fun update(uid: String): CompletableFuture = update(uid, SdkUpdateParams.none()) + + /** @see update */ + fun update( + uid: String, + params: SdkUpdateParams = SdkUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = update(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see update */ + fun update(uid: String, params: SdkUpdateParams): CompletableFuture = + update(uid, params, RequestOptions.none()) + + /** @see update */ + fun update( + params: SdkUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see update */ + fun update(params: SdkUpdateParams): CompletableFuture = + update(params, RequestOptions.none()) + + /** @see update */ + fun update(uid: String, requestOptions: RequestOptions): CompletableFuture = + update(uid, SdkUpdateParams.none(), requestOptions) + + /** List every SDK on the team. */ + fun list(): CompletableFuture = list(SdkListParams.none()) + + /** @see list */ + fun list( + params: SdkListParams = SdkListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see list */ + fun list(params: SdkListParams): CompletableFuture = + list(params, RequestOptions.none()) + + /** @see list */ + fun list(requestOptions: RequestOptions): CompletableFuture = + list(SdkListParams.none(), requestOptions) + + /** Delete an SDK and every version it holds. */ + fun delete(uid: String): CompletableFuture = delete(uid, SdkDeleteParams.none()) + + /** @see delete */ + fun delete( + uid: String, + params: SdkDeleteParams = SdkDeleteParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = delete(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see delete */ + fun delete(uid: String, params: SdkDeleteParams): CompletableFuture = + delete(uid, params, RequestOptions.none()) + + /** @see delete */ + fun delete( + params: SdkDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see delete */ + fun delete(params: SdkDeleteParams): CompletableFuture = + delete(params, RequestOptions.none()) + + /** @see delete */ + fun delete(uid: String, requestOptions: RequestOptions): CompletableFuture = + delete(uid, SdkDeleteParams.none(), requestOptions) + + /** + * Start a build. Omit `version` to build the current work — the open draft, else the latest + * version — and the resolved version comes back in the response. + */ + fun build(uid: String): CompletableFuture = build(uid, SdkBuildParams.none()) + + /** @see build */ + fun build( + uid: String, + params: SdkBuildParams = SdkBuildParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + build(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see build */ + fun build(uid: String, params: SdkBuildParams): CompletableFuture = + build(uid, params, RequestOptions.none()) + + /** @see build */ + fun build( + params: SdkBuildParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see build */ + fun build(params: SdkBuildParams): CompletableFuture = + build(params, RequestOptions.none()) + + /** @see build */ + fun build(uid: String, requestOptions: RequestOptions): CompletableFuture = + build(uid, SdkBuildParams.none(), requestOptions) + + /** A view of [SdkServiceAsync] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): SdkServiceAsync.WithRawResponse + + /** SDKs */ + fun versions(): VersionServiceAsync.WithRawResponse + + /** SDKs */ + fun repositories(): RepositoryServiceAsync.WithRawResponse + + /** + * Returns a raw HTTP response for `post /v1/sdks`, but is otherwise the same as + * [SdkServiceAsync.create]. + */ + fun create(params: SdkCreateParams): CompletableFuture> = + create(params, RequestOptions.none()) + + /** @see create */ + fun create( + params: SdkCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `get /v1/sdks/{uid}`, but is otherwise the same as + * [SdkServiceAsync.retrieve]. + */ + fun retrieve(uid: String): CompletableFuture> = + retrieve(uid, SdkRetrieveParams.none()) + + /** @see retrieve */ + fun retrieve( + uid: String, + params: SdkRetrieveParams = SdkRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + retrieve(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see retrieve */ + fun retrieve( + uid: String, + params: SdkRetrieveParams, + ): CompletableFuture> = retrieve(uid, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: SdkRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see retrieve */ + fun retrieve(params: SdkRetrieveParams): CompletableFuture> = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + uid: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + retrieve(uid, SdkRetrieveParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `patch /v1/sdks/{uid}`, but is otherwise the same as + * [SdkServiceAsync.update]. + */ + fun update(uid: String): CompletableFuture> = + update(uid, SdkUpdateParams.none()) + + /** @see update */ + fun update( + uid: String, + params: SdkUpdateParams = SdkUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + update(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see update */ + fun update(uid: String, params: SdkUpdateParams): CompletableFuture> = + update(uid, params, RequestOptions.none()) + + /** @see update */ + fun update( + params: SdkUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see update */ + fun update(params: SdkUpdateParams): CompletableFuture> = + update(params, RequestOptions.none()) + + /** @see update */ + fun update( + uid: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + update(uid, SdkUpdateParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /v1/sdks`, but is otherwise the same as + * [SdkServiceAsync.list]. + */ + fun list(): CompletableFuture> = list(SdkListParams.none()) + + /** @see list */ + fun list( + params: SdkListParams = SdkListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see list */ + fun list(params: SdkListParams): CompletableFuture> = + list(params, RequestOptions.none()) + + /** @see list */ + fun list( + requestOptions: RequestOptions + ): CompletableFuture> = + list(SdkListParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `delete /v1/sdks/{uid}`, but is otherwise the same as + * [SdkServiceAsync.delete]. + */ + fun delete(uid: String): CompletableFuture> = + delete(uid, SdkDeleteParams.none()) + + /** @see delete */ + fun delete( + uid: String, + params: SdkDeleteParams = SdkDeleteParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + delete(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see delete */ + fun delete(uid: String, params: SdkDeleteParams): CompletableFuture> = + delete(uid, params, RequestOptions.none()) + + /** @see delete */ + fun delete( + params: SdkDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see delete */ + fun delete(params: SdkDeleteParams): CompletableFuture> = + delete(params, RequestOptions.none()) + + /** @see delete */ + fun delete( + uid: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + delete(uid, SdkDeleteParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `post /v1/sdks/{uid}/build`, but is otherwise the same as + * [SdkServiceAsync.build]. + */ + fun build(uid: String): CompletableFuture> = + build(uid, SdkBuildParams.none()) + + /** @see build */ + fun build( + uid: String, + params: SdkBuildParams = SdkBuildParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + build(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see build */ + fun build( + uid: String, + params: SdkBuildParams, + ): CompletableFuture> = + build(uid, params, RequestOptions.none()) + + /** @see build */ + fun build( + params: SdkBuildParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see build */ + fun build(params: SdkBuildParams): CompletableFuture> = + build(params, RequestOptions.none()) + + /** @see build */ + fun build( + uid: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + build(uid, SdkBuildParams.none(), requestOptions) + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/SdkServiceAsyncImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/SdkServiceAsyncImpl.kt new file mode 100644 index 0000000..0c9a81b --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/SdkServiceAsyncImpl.kt @@ -0,0 +1,311 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.async + +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.checkRequired +import com.scalar.core.handlers.errorBodyHandler +import com.scalar.core.handlers.errorHandler +import com.scalar.core.handlers.jsonHandler +import com.scalar.core.http.HttpMethod +import com.scalar.core.http.HttpRequest +import com.scalar.core.http.HttpResponse +import com.scalar.core.http.HttpResponse.Handler +import com.scalar.core.http.HttpResponseFor +import com.scalar.core.http.json +import com.scalar.core.http.parseable +import com.scalar.core.prepareAsync +import com.scalar.models.Uid +import com.scalar.models.sdks.Sdk +import com.scalar.models.sdks.SdkBuildParams +import com.scalar.models.sdks.SdkBuildResponse +import com.scalar.models.sdks.SdkCreateParams +import com.scalar.models.sdks.SdkDeleteParams +import com.scalar.models.sdks.SdkListParams +import com.scalar.models.sdks.SdkListResponse +import com.scalar.models.sdks.SdkRetrieveParams +import com.scalar.models.sdks.SdkUpdateParams +import com.scalar.services.async.sdks.RepositoryServiceAsync +import com.scalar.services.async.sdks.RepositoryServiceAsyncImpl +import com.scalar.services.async.sdks.VersionServiceAsync +import com.scalar.services.async.sdks.VersionServiceAsyncImpl +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +/** SDKs */ +class SdkServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + SdkServiceAsync { + + private val withRawResponse: SdkServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + private val versions: VersionServiceAsync by lazy { VersionServiceAsyncImpl(clientOptions) } + + private val repositories: RepositoryServiceAsync by lazy { + RepositoryServiceAsyncImpl(clientOptions) + } + + override fun withRawResponse(): SdkServiceAsync.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): SdkServiceAsync = + SdkServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + /** SDKs */ + override fun versions(): VersionServiceAsync = versions + + /** SDKs */ + override fun repositories(): RepositoryServiceAsync = repositories + + override fun create( + params: SdkCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // post /v1/sdks + withRawResponse().create(params, requestOptions).thenApply { it.parse() } + + override fun retrieve( + params: SdkRetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /v1/sdks/{uid} + withRawResponse().retrieve(params, requestOptions).thenApply { it.parse() } + + override fun update( + params: SdkUpdateParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // patch /v1/sdks/{uid} + withRawResponse().update(params, requestOptions).thenApply { it.parse() } + + override fun list( + params: SdkListParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /v1/sdks + withRawResponse().list(params, requestOptions).thenApply { it.parse() } + + override fun delete( + params: SdkDeleteParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // delete /v1/sdks/{uid} + withRawResponse().delete(params, requestOptions).thenApply { it.parse() } + + override fun build( + params: SdkBuildParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // post /v1/sdks/{uid}/build + withRawResponse().build(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + SdkServiceAsync.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + private val versions: VersionServiceAsync.WithRawResponse by lazy { + VersionServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val repositories: RepositoryServiceAsync.WithRawResponse by lazy { + RepositoryServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + override fun withOptions( + modifier: Consumer + ): SdkServiceAsync.WithRawResponse = + SdkServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + /** SDKs */ + override fun versions(): VersionServiceAsync.WithRawResponse = versions + + /** SDKs */ + override fun repositories(): RepositoryServiceAsync.WithRawResponse = repositories + + private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun create( + params: SdkCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "sdks") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val retrieveHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun retrieve( + params: SdkRetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("uid", params.uid().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "sdks", params._pathParam(0)) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val updateHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun update( + params: SdkUpdateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("uid", params.uid().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.PATCH) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "sdks", params._pathParam(0)) + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response.use { updateHandler.handle(it) } + } + } + } + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun list( + params: SdkListParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "sdks") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val deleteHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun delete( + params: SdkDeleteParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("uid", params.uid().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.DELETE) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "sdks", params._pathParam(0)) + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response.use { deleteHandler.handle(it) } + } + } + } + + private val buildHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun build( + params: SdkBuildParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("uid", params.uid().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "sdks", params._pathParam(0), "build") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { buildHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/TeamServiceAsync.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/TeamServiceAsync.kt index 51dc022..deaf7d9 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/async/TeamServiceAsync.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/TeamServiceAsync.kt @@ -5,8 +5,10 @@ package com.scalar.services.async import com.scalar.core.ClientOptions import com.scalar.core.RequestOptions import com.scalar.core.http.HttpResponseFor +import com.scalar.models.teams.Team import com.scalar.models.teams.TeamListParams -import com.scalar.models.teams.TeamListResponse +import com.scalar.services.async.teams.InviteServiceAsync +import com.scalar.services.async.teams.MemberServiceAsync import java.util.concurrent.CompletableFuture import java.util.function.Consumer @@ -25,21 +27,27 @@ interface TeamServiceAsync { */ fun withOptions(modifier: Consumer): TeamServiceAsync + /** Teams */ + fun members(): MemberServiceAsync + + /** Teams */ + fun invites(): InviteServiceAsync + /** List all available teams */ - fun list(): CompletableFuture> = list(TeamListParams.none()) + fun list(): CompletableFuture> = list(TeamListParams.none()) /** @see list */ fun list( params: TeamListParams = TeamListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> + ): CompletableFuture> /** @see list */ - fun list(params: TeamListParams): CompletableFuture> = + fun list(params: TeamListParams): CompletableFuture> = list(params, RequestOptions.none()) /** @see list */ - fun list(requestOptions: RequestOptions): CompletableFuture> = + fun list(requestOptions: RequestOptions): CompletableFuture> = list(TeamListParams.none(), requestOptions) /** A view of [TeamServiceAsync] that provides access to raw HTTP responses for each method. */ @@ -52,29 +60,30 @@ interface TeamServiceAsync { */ fun withOptions(modifier: Consumer): TeamServiceAsync.WithRawResponse + /** Teams */ + fun members(): MemberServiceAsync.WithRawResponse + + /** Teams */ + fun invites(): InviteServiceAsync.WithRawResponse + /** * Returns a raw HTTP response for `get /v1/teams`, but is otherwise the same as * [TeamServiceAsync.list]. */ - fun list(): CompletableFuture>> = - list(TeamListParams.none()) + fun list(): CompletableFuture>> = list(TeamListParams.none()) /** @see list */ fun list( params: TeamListParams = TeamListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture>> + ): CompletableFuture>> /** @see list */ - fun list( - params: TeamListParams - ): CompletableFuture>> = + fun list(params: TeamListParams): CompletableFuture>> = list(params, RequestOptions.none()) /** @see list */ - fun list( - requestOptions: RequestOptions - ): CompletableFuture>> = + fun list(requestOptions: RequestOptions): CompletableFuture>> = list(TeamListParams.none(), requestOptions) } } diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/TeamServiceAsyncImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/TeamServiceAsyncImpl.kt index 587dbab..f711056 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/async/TeamServiceAsyncImpl.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/TeamServiceAsyncImpl.kt @@ -14,8 +14,12 @@ import com.scalar.core.http.HttpResponse.Handler import com.scalar.core.http.HttpResponseFor import com.scalar.core.http.parseable import com.scalar.core.prepareAsync +import com.scalar.models.teams.Team import com.scalar.models.teams.TeamListParams -import com.scalar.models.teams.TeamListResponse +import com.scalar.services.async.teams.InviteServiceAsync +import com.scalar.services.async.teams.InviteServiceAsyncImpl +import com.scalar.services.async.teams.MemberServiceAsync +import com.scalar.services.async.teams.MemberServiceAsyncImpl import java.util.concurrent.CompletableFuture import java.util.function.Consumer @@ -27,15 +31,25 @@ class TeamServiceAsyncImpl internal constructor(private val clientOptions: Clien WithRawResponseImpl(clientOptions) } + private val members: MemberServiceAsync by lazy { MemberServiceAsyncImpl(clientOptions) } + + private val invites: InviteServiceAsync by lazy { InviteServiceAsyncImpl(clientOptions) } + override fun withRawResponse(): TeamServiceAsync.WithRawResponse = withRawResponse override fun withOptions(modifier: Consumer): TeamServiceAsync = TeamServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + /** Teams */ + override fun members(): MemberServiceAsync = members + + /** Teams */ + override fun invites(): InviteServiceAsync = invites + override fun list( params: TeamListParams, requestOptions: RequestOptions, - ): CompletableFuture> = + ): CompletableFuture> = // get /v1/teams withRawResponse().list(params, requestOptions).thenApply { it.parse() } @@ -45,6 +59,14 @@ class TeamServiceAsyncImpl internal constructor(private val clientOptions: Clien private val errorHandler: Handler = errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + private val members: MemberServiceAsync.WithRawResponse by lazy { + MemberServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val invites: InviteServiceAsync.WithRawResponse by lazy { + InviteServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + override fun withOptions( modifier: Consumer ): TeamServiceAsync.WithRawResponse = @@ -52,13 +74,19 @@ class TeamServiceAsyncImpl internal constructor(private val clientOptions: Clien clientOptions.toBuilder().apply(modifier::accept).build() ) - private val listHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper) + /** Teams */ + override fun members(): MemberServiceAsync.WithRawResponse = members + + /** Teams */ + override fun invites(): InviteServiceAsync.WithRawResponse = invites + + private val listHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) override fun list( params: TeamListParams, requestOptions: RequestOptions, - ): CompletableFuture>> { + ): CompletableFuture>> { val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/ThemeServiceAsync.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/ThemeServiceAsync.kt index 0547bce..7f9f16f 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/async/ThemeServiceAsync.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/ThemeServiceAsync.kt @@ -6,10 +6,10 @@ import com.scalar.core.ClientOptions import com.scalar.core.RequestOptions import com.scalar.core.http.HttpResponseFor import com.scalar.models.Uid +import com.scalar.models.themes.Theme import com.scalar.models.themes.ThemeCreateParams import com.scalar.models.themes.ThemeDeleteParams import com.scalar.models.themes.ThemeListParams -import com.scalar.models.themes.ThemeListResponse import com.scalar.models.themes.ThemeReplaceDocumentParams import com.scalar.models.themes.ThemeRetrieveParams import com.scalar.models.themes.ThemeUpdateParams @@ -99,20 +99,20 @@ interface ThemeServiceAsync { update(slug, ThemeUpdateParams.none(), requestOptions) /** List all team themes. */ - fun list(): CompletableFuture> = list(ThemeListParams.none()) + fun list(): CompletableFuture> = list(ThemeListParams.none()) /** @see list */ fun list( params: ThemeListParams = ThemeListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> + ): CompletableFuture> /** @see list */ - fun list(params: ThemeListParams): CompletableFuture> = + fun list(params: ThemeListParams): CompletableFuture> = list(params, RequestOptions.none()) /** @see list */ - fun list(requestOptions: RequestOptions): CompletableFuture> = + fun list(requestOptions: RequestOptions): CompletableFuture> = list(ThemeListParams.none(), requestOptions) /** Delete a theme by slug. */ @@ -271,25 +271,20 @@ interface ThemeServiceAsync { * Returns a raw HTTP response for `get /v1/themes`, but is otherwise the same as * [ThemeServiceAsync.list]. */ - fun list(): CompletableFuture>> = - list(ThemeListParams.none()) + fun list(): CompletableFuture>> = list(ThemeListParams.none()) /** @see list */ fun list( params: ThemeListParams = ThemeListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture>> + ): CompletableFuture>> /** @see list */ - fun list( - params: ThemeListParams - ): CompletableFuture>> = + fun list(params: ThemeListParams): CompletableFuture>> = list(params, RequestOptions.none()) /** @see list */ - fun list( - requestOptions: RequestOptions - ): CompletableFuture>> = + fun list(requestOptions: RequestOptions): CompletableFuture>> = list(ThemeListParams.none(), requestOptions) /** diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/ThemeServiceAsyncImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/ThemeServiceAsyncImpl.kt index da4c549..2a9c646 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/async/ThemeServiceAsyncImpl.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/ThemeServiceAsyncImpl.kt @@ -18,10 +18,10 @@ import com.scalar.core.http.json import com.scalar.core.http.parseable import com.scalar.core.prepareAsync import com.scalar.models.Uid +import com.scalar.models.themes.Theme import com.scalar.models.themes.ThemeCreateParams import com.scalar.models.themes.ThemeDeleteParams import com.scalar.models.themes.ThemeListParams -import com.scalar.models.themes.ThemeListResponse import com.scalar.models.themes.ThemeReplaceDocumentParams import com.scalar.models.themes.ThemeRetrieveParams import com.scalar.models.themes.ThemeUpdateParams @@ -66,7 +66,7 @@ class ThemeServiceAsyncImpl internal constructor(private val clientOptions: Clie override fun list( params: ThemeListParams, requestOptions: RequestOptions, - ): CompletableFuture> = + ): CompletableFuture> = // get /v1/themes withRawResponse().list(params, requestOptions).thenApply { it.parse() } @@ -181,13 +181,13 @@ class ThemeServiceAsyncImpl internal constructor(private val clientOptions: Clie } } - private val listHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper) + private val listHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) override fun list( params: ThemeListParams, requestOptions: RequestOptions, - ): CompletableFuture>> { + ): CompletableFuture>> { val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/accessGroups/DomainServiceAsync.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/accessGroups/DomainServiceAsync.kt new file mode 100644 index 0000000..a9c774a --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/accessGroups/DomainServiceAsync.kt @@ -0,0 +1,144 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.async.accessGroups + +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.http.HttpResponseFor +import com.scalar.models.accessGroups.domains.DomainCreateParams +import com.scalar.models.accessGroups.domains.DomainDeleteParams +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer + +/** Access Groups */ +interface DomainServiceAsync { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): DomainServiceAsync + + /** + * Allow an exact email domain in a group. Requires docs edit permission. A group supports up to + * 1000 domains. + */ + fun create(slug: String, params: DomainCreateParams): CompletableFuture = + create(slug, params, RequestOptions.none()) + + /** @see create */ + fun create( + slug: String, + params: DomainCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = create(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see create */ + fun create( + params: DomainCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see create */ + fun create(params: DomainCreateParams): CompletableFuture = + create(params, RequestOptions.none()) + + /** + * Remove an exact email domain from a group. Requires docs edit permission. Other allowed + * domains and emails are preserved. + */ + fun delete(slug: String, params: DomainDeleteParams): CompletableFuture = + delete(slug, params, RequestOptions.none()) + + /** @see delete */ + fun delete( + slug: String, + params: DomainDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = delete(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see delete */ + fun delete( + params: DomainDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see delete */ + fun delete(params: DomainDeleteParams): CompletableFuture = + delete(params, RequestOptions.none()) + + /** + * A view of [DomainServiceAsync] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): DomainServiceAsync.WithRawResponse + + /** + * Returns a raw HTTP response for `post /v1/access-groups/{slug}/domains`, but is otherwise + * the same as [DomainServiceAsync.create]. + */ + fun create( + slug: String, + params: DomainCreateParams, + ): CompletableFuture> = create(slug, params, RequestOptions.none()) + + /** @see create */ + fun create( + slug: String, + params: DomainCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + create(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see create */ + fun create( + params: DomainCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see create */ + fun create(params: DomainCreateParams): CompletableFuture> = + create(params, RequestOptions.none()) + + /** + * Returns a raw HTTP response for `delete /v1/access-groups/{slug}/domains`, but is + * otherwise the same as [DomainServiceAsync.delete]. + */ + fun delete( + slug: String, + params: DomainDeleteParams, + ): CompletableFuture> = delete(slug, params, RequestOptions.none()) + + /** @see delete */ + fun delete( + slug: String, + params: DomainDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + delete(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see delete */ + fun delete( + params: DomainDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see delete */ + fun delete(params: DomainDeleteParams): CompletableFuture> = + delete(params, RequestOptions.none()) + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/accessGroups/DomainServiceAsyncImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/accessGroups/DomainServiceAsyncImpl.kt new file mode 100644 index 0000000..711a8de --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/accessGroups/DomainServiceAsyncImpl.kt @@ -0,0 +1,119 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.async.accessGroups + +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.checkRequired +import com.scalar.core.handlers.errorBodyHandler +import com.scalar.core.handlers.errorHandler +import com.scalar.core.handlers.jsonHandler +import com.scalar.core.http.HttpMethod +import com.scalar.core.http.HttpRequest +import com.scalar.core.http.HttpResponse +import com.scalar.core.http.HttpResponse.Handler +import com.scalar.core.http.HttpResponseFor +import com.scalar.core.http.json +import com.scalar.core.http.parseable +import com.scalar.core.prepareAsync +import com.scalar.models.accessGroups.domains.DomainCreateParams +import com.scalar.models.accessGroups.domains.DomainDeleteParams +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +/** Access Groups */ +class DomainServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + DomainServiceAsync { + + private val withRawResponse: DomainServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): DomainServiceAsync.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): DomainServiceAsync = + DomainServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun create( + params: DomainCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // post /v1/access-groups/{slug}/domains + withRawResponse().create(params, requestOptions).thenApply { it.parse() } + + override fun delete( + params: DomainDeleteParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // delete /v1/access-groups/{slug}/domains + withRawResponse().delete(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + DomainServiceAsync.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): DomainServiceAsync.WithRawResponse = + DomainServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun create( + params: DomainCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("slug", params.slug().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "access-groups", params._pathParam(0), "domains") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response.use { createHandler.handle(it) } + } + } + } + + private val deleteHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun delete( + params: DomainDeleteParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("slug", params.slug().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.DELETE) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "access-groups", params._pathParam(0), "domains") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response.use { deleteHandler.handle(it) } + } + } + } + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/mcp/ServerServiceAsync.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/mcp/ServerServiceAsync.kt new file mode 100644 index 0000000..a94ba74 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/mcp/ServerServiceAsync.kt @@ -0,0 +1,322 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.async.mcp + +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.http.HttpResponseFor +import com.scalar.models.mcp.servers.McpServer +import com.scalar.models.mcp.servers.ServerCreateParams +import com.scalar.models.mcp.servers.ServerCreateResponse +import com.scalar.models.mcp.servers.ServerDeleteParams +import com.scalar.models.mcp.servers.ServerListParams +import com.scalar.models.mcp.servers.ServerRetrieveParams +import com.scalar.models.mcp.servers.ServerUpdateParams +import com.scalar.services.async.mcp.servers.InstallationServiceAsync +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer + +/** MCP */ +interface ServerServiceAsync { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): ServerServiceAsync + + /** MCP */ + fun installations(): InstallationServiceAsync + + /** + * Create an MCP server over one or more API document versions. The response carries the server + * and its first installation. + */ + fun create(params: ServerCreateParams): CompletableFuture = + create(params, RequestOptions.none()) + + /** @see create */ + fun create( + params: ServerCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** Get a single MCP server by its id. */ + fun retrieve(id: String): CompletableFuture = + retrieve(id, ServerRetrieveParams.none()) + + /** @see retrieve */ + fun retrieve( + id: String, + params: ServerRetrieveParams = ServerRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = retrieve(params.toBuilder().id(id).build(), requestOptions) + + /** @see retrieve */ + fun retrieve(id: String, params: ServerRetrieveParams): CompletableFuture = + retrieve(id, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: ServerRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see retrieve */ + fun retrieve(params: ServerRetrieveParams): CompletableFuture = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve(id: String, requestOptions: RequestOptions): CompletableFuture = + retrieve(id, ServerRetrieveParams.none(), requestOptions) + + /** Update MCP server metadata and which tools it exposes. */ + fun update(id: String): CompletableFuture = update(id, ServerUpdateParams.none()) + + /** @see update */ + fun update( + id: String, + params: ServerUpdateParams = ServerUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = update(params.toBuilder().id(id).build(), requestOptions) + + /** @see update */ + fun update(id: String, params: ServerUpdateParams): CompletableFuture = + update(id, params, RequestOptions.none()) + + /** @see update */ + fun update( + params: ServerUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see update */ + fun update(params: ServerUpdateParams): CompletableFuture = + update(params, RequestOptions.none()) + + /** @see update */ + fun update(id: String, requestOptions: RequestOptions): CompletableFuture = + update(id, ServerUpdateParams.none(), requestOptions) + + /** List every MCP server on the team. */ + fun list(): CompletableFuture> = list(ServerListParams.none()) + + /** @see list */ + fun list( + params: ServerListParams = ServerListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see list */ + fun list(params: ServerListParams): CompletableFuture> = + list(params, RequestOptions.none()) + + /** @see list */ + fun list(requestOptions: RequestOptions): CompletableFuture> = + list(ServerListParams.none(), requestOptions) + + /** Delete an MCP server and every installation it serves. */ + fun delete(id: String): CompletableFuture = delete(id, ServerDeleteParams.none()) + + /** @see delete */ + fun delete( + id: String, + params: ServerDeleteParams = ServerDeleteParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = delete(params.toBuilder().id(id).build(), requestOptions) + + /** @see delete */ + fun delete(id: String, params: ServerDeleteParams): CompletableFuture = + delete(id, params, RequestOptions.none()) + + /** @see delete */ + fun delete( + params: ServerDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see delete */ + fun delete(params: ServerDeleteParams): CompletableFuture = + delete(params, RequestOptions.none()) + + /** @see delete */ + fun delete(id: String, requestOptions: RequestOptions): CompletableFuture = + delete(id, ServerDeleteParams.none(), requestOptions) + + /** + * A view of [ServerServiceAsync] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): ServerServiceAsync.WithRawResponse + + /** MCP */ + fun installations(): InstallationServiceAsync.WithRawResponse + + /** + * Returns a raw HTTP response for `post /v1/mcp/servers`, but is otherwise the same as + * [ServerServiceAsync.create]. + */ + fun create( + params: ServerCreateParams + ): CompletableFuture> = + create(params, RequestOptions.none()) + + /** @see create */ + fun create( + params: ServerCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `get /v1/mcp/servers/{id}`, but is otherwise the same as + * [ServerServiceAsync.retrieve]. + */ + fun retrieve(id: String): CompletableFuture> = + retrieve(id, ServerRetrieveParams.none()) + + /** @see retrieve */ + fun retrieve( + id: String, + params: ServerRetrieveParams = ServerRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + retrieve(params.toBuilder().id(id).build(), requestOptions) + + /** @see retrieve */ + fun retrieve( + id: String, + params: ServerRetrieveParams, + ): CompletableFuture> = + retrieve(id, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: ServerRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see retrieve */ + fun retrieve(params: ServerRetrieveParams): CompletableFuture> = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + id: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + retrieve(id, ServerRetrieveParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `patch /v1/mcp/servers/{id}`, but is otherwise the same + * as [ServerServiceAsync.update]. + */ + fun update(id: String): CompletableFuture> = + update(id, ServerUpdateParams.none()) + + /** @see update */ + fun update( + id: String, + params: ServerUpdateParams = ServerUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + update(params.toBuilder().id(id).build(), requestOptions) + + /** @see update */ + fun update( + id: String, + params: ServerUpdateParams, + ): CompletableFuture> = update(id, params, RequestOptions.none()) + + /** @see update */ + fun update( + params: ServerUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see update */ + fun update(params: ServerUpdateParams): CompletableFuture> = + update(params, RequestOptions.none()) + + /** @see update */ + fun update( + id: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + update(id, ServerUpdateParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /v1/mcp/servers`, but is otherwise the same as + * [ServerServiceAsync.list]. + */ + fun list(): CompletableFuture>> = + list(ServerListParams.none()) + + /** @see list */ + fun list( + params: ServerListParams = ServerListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture>> + + /** @see list */ + fun list(params: ServerListParams): CompletableFuture>> = + list(params, RequestOptions.none()) + + /** @see list */ + fun list( + requestOptions: RequestOptions + ): CompletableFuture>> = + list(ServerListParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `delete /v1/mcp/servers/{id}`, but is otherwise the same + * as [ServerServiceAsync.delete]. + */ + fun delete(id: String): CompletableFuture> = + delete(id, ServerDeleteParams.none()) + + /** @see delete */ + fun delete( + id: String, + params: ServerDeleteParams = ServerDeleteParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + delete(params.toBuilder().id(id).build(), requestOptions) + + /** @see delete */ + fun delete( + id: String, + params: ServerDeleteParams, + ): CompletableFuture> = delete(id, params, RequestOptions.none()) + + /** @see delete */ + fun delete( + params: ServerDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see delete */ + fun delete(params: ServerDeleteParams): CompletableFuture> = + delete(params, RequestOptions.none()) + + /** @see delete */ + fun delete( + id: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + delete(id, ServerDeleteParams.none(), requestOptions) + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/mcp/ServerServiceAsyncImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/mcp/ServerServiceAsyncImpl.kt new file mode 100644 index 0000000..2ddf202 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/mcp/ServerServiceAsyncImpl.kt @@ -0,0 +1,262 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.async.mcp + +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.checkRequired +import com.scalar.core.handlers.errorBodyHandler +import com.scalar.core.handlers.errorHandler +import com.scalar.core.handlers.jsonHandler +import com.scalar.core.http.HttpMethod +import com.scalar.core.http.HttpRequest +import com.scalar.core.http.HttpResponse +import com.scalar.core.http.HttpResponse.Handler +import com.scalar.core.http.HttpResponseFor +import com.scalar.core.http.json +import com.scalar.core.http.parseable +import com.scalar.core.prepareAsync +import com.scalar.models.mcp.servers.McpServer +import com.scalar.models.mcp.servers.ServerCreateParams +import com.scalar.models.mcp.servers.ServerCreateResponse +import com.scalar.models.mcp.servers.ServerDeleteParams +import com.scalar.models.mcp.servers.ServerListParams +import com.scalar.models.mcp.servers.ServerRetrieveParams +import com.scalar.models.mcp.servers.ServerUpdateParams +import com.scalar.services.async.mcp.servers.InstallationServiceAsync +import com.scalar.services.async.mcp.servers.InstallationServiceAsyncImpl +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +/** MCP */ +class ServerServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + ServerServiceAsync { + + private val withRawResponse: ServerServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + private val installations: InstallationServiceAsync by lazy { + InstallationServiceAsyncImpl(clientOptions) + } + + override fun withRawResponse(): ServerServiceAsync.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): ServerServiceAsync = + ServerServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + /** MCP */ + override fun installations(): InstallationServiceAsync = installations + + override fun create( + params: ServerCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // post /v1/mcp/servers + withRawResponse().create(params, requestOptions).thenApply { it.parse() } + + override fun retrieve( + params: ServerRetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /v1/mcp/servers/{id} + withRawResponse().retrieve(params, requestOptions).thenApply { it.parse() } + + override fun update( + params: ServerUpdateParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // patch /v1/mcp/servers/{id} + withRawResponse().update(params, requestOptions).thenApply { it.parse() } + + override fun list( + params: ServerListParams, + requestOptions: RequestOptions, + ): CompletableFuture> = + // get /v1/mcp/servers + withRawResponse().list(params, requestOptions).thenApply { it.parse() } + + override fun delete( + params: ServerDeleteParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // delete /v1/mcp/servers/{id} + withRawResponse().delete(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + ServerServiceAsync.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + private val installations: InstallationServiceAsync.WithRawResponse by lazy { + InstallationServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + override fun withOptions( + modifier: Consumer + ): ServerServiceAsync.WithRawResponse = + ServerServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + /** MCP */ + override fun installations(): InstallationServiceAsync.WithRawResponse = installations + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun create( + params: ServerCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "mcp", "servers") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun retrieve( + params: ServerRetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("id", params.id().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "mcp", "servers", params._pathParam(0)) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun update( + params: ServerUpdateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("id", params.id().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.PATCH) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "mcp", "servers", params._pathParam(0)) + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { updateHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val listHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) + + override fun list( + params: ServerListParams, + requestOptions: RequestOptions, + ): CompletableFuture>> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "mcp", "servers") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.forEach { it.validate() } + } + } + } + } + } + + private val deleteHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun delete( + params: ServerDeleteParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("id", params.id().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.DELETE) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "mcp", "servers", params._pathParam(0)) + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response.use { deleteHandler.handle(it) } + } + } + } + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/mcp/servers/InstallationServiceAsync.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/mcp/servers/InstallationServiceAsync.kt new file mode 100644 index 0000000..1f28046 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/mcp/servers/InstallationServiceAsync.kt @@ -0,0 +1,460 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.async.mcp.servers + +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.http.HttpResponseFor +import com.scalar.models.mcp.servers.McpInstallation +import com.scalar.models.mcp.servers.installations.InstallationCreateAccessGroupParams +import com.scalar.models.mcp.servers.installations.InstallationCreateParams +import com.scalar.models.mcp.servers.installations.InstallationDeleteAccessGroupParams +import com.scalar.models.mcp.servers.installations.InstallationDeleteParams +import com.scalar.models.mcp.servers.installations.InstallationListParams +import com.scalar.models.mcp.servers.installations.InstallationRetrieveParams +import com.scalar.models.mcp.servers.installations.InstallationUpdateParams +import com.scalar.models.mcp.servers.installations.McpInstallationListItem +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer + +/** MCP */ +interface InstallationServiceAsync { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): InstallationServiceAsync + + /** + * Create an installation of an MCP server. `documentAuth` holds the credentials the server + * presents to the upstream API and is never returned. + */ + fun create(id: String, params: InstallationCreateParams): CompletableFuture = + create(id, params, RequestOptions.none()) + + /** @see create */ + fun create( + id: String, + params: InstallationCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + create(params.toBuilder().id(id).build(), requestOptions) + + /** @see create */ + fun create( + params: InstallationCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see create */ + fun create(params: InstallationCreateParams): CompletableFuture = + create(params, RequestOptions.none()) + + /** Get a single installation of an MCP server. */ + fun retrieve( + installationId: String, + params: InstallationRetrieveParams, + ): CompletableFuture = retrieve(installationId, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + installationId: String, + params: InstallationRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + retrieve(params.toBuilder().installationId(installationId).build(), requestOptions) + + /** @see retrieve */ + fun retrieve( + params: InstallationRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see retrieve */ + fun retrieve(params: InstallationRetrieveParams): CompletableFuture = + retrieve(params, RequestOptions.none()) + + /** Update an installation. Set `isPrivate` and add access groups to put it behind a login. */ + fun update( + installationId: String, + params: InstallationUpdateParams, + ): CompletableFuture = update(installationId, params, RequestOptions.none()) + + /** @see update */ + fun update( + installationId: String, + params: InstallationUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + update(params.toBuilder().installationId(installationId).build(), requestOptions) + + /** @see update */ + fun update( + params: InstallationUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see update */ + fun update(params: InstallationUpdateParams): CompletableFuture = + update(params, RequestOptions.none()) + + /** + * List the installations of an MCP server. An installation is what an MCP client connects to. + */ + fun list(id: String): CompletableFuture> = + list(id, InstallationListParams.none()) + + /** @see list */ + fun list( + id: String, + params: InstallationListParams = InstallationListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + list(params.toBuilder().id(id).build(), requestOptions) + + /** @see list */ + fun list( + id: String, + params: InstallationListParams, + ): CompletableFuture> = list(id, params, RequestOptions.none()) + + /** @see list */ + fun list( + params: InstallationListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see list */ + fun list(params: InstallationListParams): CompletableFuture> = + list(params, RequestOptions.none()) + + /** @see list */ + fun list( + id: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + list(id, InstallationListParams.none(), requestOptions) + + /** Delete an installation of an MCP server. */ + fun delete(installationId: String, params: InstallationDeleteParams): CompletableFuture = + delete(installationId, params, RequestOptions.none()) + + /** @see delete */ + fun delete( + installationId: String, + params: InstallationDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + delete(params.toBuilder().installationId(installationId).build(), requestOptions) + + /** @see delete */ + fun delete( + params: InstallationDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see delete */ + fun delete(params: InstallationDeleteParams): CompletableFuture = + delete(params, RequestOptions.none()) + + /** Let an access group reach a private installation. */ + fun createAccessGroup( + installationId: String, + params: InstallationCreateAccessGroupParams, + ): CompletableFuture = createAccessGroup(installationId, params, RequestOptions.none()) + + /** @see createAccessGroup */ + fun createAccessGroup( + installationId: String, + params: InstallationCreateAccessGroupParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + createAccessGroup(params.toBuilder().installationId(installationId).build(), requestOptions) + + /** @see createAccessGroup */ + fun createAccessGroup( + params: InstallationCreateAccessGroupParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see createAccessGroup */ + fun createAccessGroup(params: InstallationCreateAccessGroupParams): CompletableFuture = + createAccessGroup(params, RequestOptions.none()) + + /** Stop an access group reaching a private installation. */ + fun deleteAccessGroup( + installationId: String, + params: InstallationDeleteAccessGroupParams, + ): CompletableFuture = deleteAccessGroup(installationId, params, RequestOptions.none()) + + /** @see deleteAccessGroup */ + fun deleteAccessGroup( + installationId: String, + params: InstallationDeleteAccessGroupParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + deleteAccessGroup(params.toBuilder().installationId(installationId).build(), requestOptions) + + /** @see deleteAccessGroup */ + fun deleteAccessGroup( + params: InstallationDeleteAccessGroupParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see deleteAccessGroup */ + fun deleteAccessGroup(params: InstallationDeleteAccessGroupParams): CompletableFuture = + deleteAccessGroup(params, RequestOptions.none()) + + /** + * A view of [InstallationServiceAsync] that provides access to raw HTTP responses for each + * method. + */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): InstallationServiceAsync.WithRawResponse + + /** + * Returns a raw HTTP response for `post /v1/mcp/servers/{id}/installations`, but is + * otherwise the same as [InstallationServiceAsync.create]. + */ + fun create( + id: String, + params: InstallationCreateParams, + ): CompletableFuture> = + create(id, params, RequestOptions.none()) + + /** @see create */ + fun create( + id: String, + params: InstallationCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + create(params.toBuilder().id(id).build(), requestOptions) + + /** @see create */ + fun create( + params: InstallationCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see create */ + fun create( + params: InstallationCreateParams + ): CompletableFuture> = + create(params, RequestOptions.none()) + + /** + * Returns a raw HTTP response for `get + * /v1/mcp/servers/{id}/installations/{installationId}`, but is otherwise the same as + * [InstallationServiceAsync.retrieve]. + */ + fun retrieve( + installationId: String, + params: InstallationRetrieveParams, + ): CompletableFuture> = + retrieve(installationId, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + installationId: String, + params: InstallationRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + retrieve(params.toBuilder().installationId(installationId).build(), requestOptions) + + /** @see retrieve */ + fun retrieve( + params: InstallationRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see retrieve */ + fun retrieve( + params: InstallationRetrieveParams + ): CompletableFuture> = + retrieve(params, RequestOptions.none()) + + /** + * Returns a raw HTTP response for `patch + * /v1/mcp/servers/{id}/installations/{installationId}`, but is otherwise the same as + * [InstallationServiceAsync.update]. + */ + fun update( + installationId: String, + params: InstallationUpdateParams, + ): CompletableFuture> = + update(installationId, params, RequestOptions.none()) + + /** @see update */ + fun update( + installationId: String, + params: InstallationUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + update(params.toBuilder().installationId(installationId).build(), requestOptions) + + /** @see update */ + fun update( + params: InstallationUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see update */ + fun update( + params: InstallationUpdateParams + ): CompletableFuture> = + update(params, RequestOptions.none()) + + /** + * Returns a raw HTTP response for `get /v1/mcp/servers/{id}/installations`, but is + * otherwise the same as [InstallationServiceAsync.list]. + */ + fun list(id: String): CompletableFuture>> = + list(id, InstallationListParams.none()) + + /** @see list */ + fun list( + id: String, + params: InstallationListParams = InstallationListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture>> = + list(params.toBuilder().id(id).build(), requestOptions) + + /** @see list */ + fun list( + id: String, + params: InstallationListParams, + ): CompletableFuture>> = + list(id, params, RequestOptions.none()) + + /** @see list */ + fun list( + params: InstallationListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture>> + + /** @see list */ + fun list( + params: InstallationListParams + ): CompletableFuture>> = + list(params, RequestOptions.none()) + + /** @see list */ + fun list( + id: String, + requestOptions: RequestOptions, + ): CompletableFuture>> = + list(id, InstallationListParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `delete + * /v1/mcp/servers/{id}/installations/{installationId}`, but is otherwise the same as + * [InstallationServiceAsync.delete]. + */ + fun delete( + installationId: String, + params: InstallationDeleteParams, + ): CompletableFuture> = + delete(installationId, params, RequestOptions.none()) + + /** @see delete */ + fun delete( + installationId: String, + params: InstallationDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + delete(params.toBuilder().installationId(installationId).build(), requestOptions) + + /** @see delete */ + fun delete( + params: InstallationDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see delete */ + fun delete(params: InstallationDeleteParams): CompletableFuture> = + delete(params, RequestOptions.none()) + + /** + * Returns a raw HTTP response for `post + * /v1/mcp/servers/{id}/installations/{installationId}/access-group`, but is otherwise the + * same as [InstallationServiceAsync.createAccessGroup]. + */ + fun createAccessGroup( + installationId: String, + params: InstallationCreateAccessGroupParams, + ): CompletableFuture> = + createAccessGroup(installationId, params, RequestOptions.none()) + + /** @see createAccessGroup */ + fun createAccessGroup( + installationId: String, + params: InstallationCreateAccessGroupParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + createAccessGroup( + params.toBuilder().installationId(installationId).build(), + requestOptions, + ) + + /** @see createAccessGroup */ + fun createAccessGroup( + params: InstallationCreateAccessGroupParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see createAccessGroup */ + fun createAccessGroup( + params: InstallationCreateAccessGroupParams + ): CompletableFuture> = + createAccessGroup(params, RequestOptions.none()) + + /** + * Returns a raw HTTP response for `delete + * /v1/mcp/servers/{id}/installations/{installationId}/access-group`, but is otherwise the + * same as [InstallationServiceAsync.deleteAccessGroup]. + */ + fun deleteAccessGroup( + installationId: String, + params: InstallationDeleteAccessGroupParams, + ): CompletableFuture> = + deleteAccessGroup(installationId, params, RequestOptions.none()) + + /** @see deleteAccessGroup */ + fun deleteAccessGroup( + installationId: String, + params: InstallationDeleteAccessGroupParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + deleteAccessGroup( + params.toBuilder().installationId(installationId).build(), + requestOptions, + ) + + /** @see deleteAccessGroup */ + fun deleteAccessGroup( + params: InstallationDeleteAccessGroupParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see deleteAccessGroup */ + fun deleteAccessGroup( + params: InstallationDeleteAccessGroupParams + ): CompletableFuture> = + deleteAccessGroup(params, RequestOptions.none()) + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/mcp/servers/InstallationServiceAsyncImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/mcp/servers/InstallationServiceAsyncImpl.kt new file mode 100644 index 0000000..dc6292b --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/mcp/servers/InstallationServiceAsyncImpl.kt @@ -0,0 +1,361 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.async.mcp.servers + +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.checkRequired +import com.scalar.core.handlers.errorBodyHandler +import com.scalar.core.handlers.errorHandler +import com.scalar.core.handlers.jsonHandler +import com.scalar.core.http.HttpMethod +import com.scalar.core.http.HttpRequest +import com.scalar.core.http.HttpResponse +import com.scalar.core.http.HttpResponse.Handler +import com.scalar.core.http.HttpResponseFor +import com.scalar.core.http.json +import com.scalar.core.http.parseable +import com.scalar.core.prepareAsync +import com.scalar.models.mcp.servers.McpInstallation +import com.scalar.models.mcp.servers.installations.InstallationCreateAccessGroupParams +import com.scalar.models.mcp.servers.installations.InstallationCreateParams +import com.scalar.models.mcp.servers.installations.InstallationDeleteAccessGroupParams +import com.scalar.models.mcp.servers.installations.InstallationDeleteParams +import com.scalar.models.mcp.servers.installations.InstallationListParams +import com.scalar.models.mcp.servers.installations.InstallationRetrieveParams +import com.scalar.models.mcp.servers.installations.InstallationUpdateParams +import com.scalar.models.mcp.servers.installations.McpInstallationListItem +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +/** MCP */ +class InstallationServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + InstallationServiceAsync { + + private val withRawResponse: InstallationServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): InstallationServiceAsync.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): InstallationServiceAsync = + InstallationServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun create( + params: InstallationCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // post /v1/mcp/servers/{id}/installations + withRawResponse().create(params, requestOptions).thenApply { it.parse() } + + override fun retrieve( + params: InstallationRetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /v1/mcp/servers/{id}/installations/{installationId} + withRawResponse().retrieve(params, requestOptions).thenApply { it.parse() } + + override fun update( + params: InstallationUpdateParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // patch /v1/mcp/servers/{id}/installations/{installationId} + withRawResponse().update(params, requestOptions).thenApply { it.parse() } + + override fun list( + params: InstallationListParams, + requestOptions: RequestOptions, + ): CompletableFuture> = + // get /v1/mcp/servers/{id}/installations + withRawResponse().list(params, requestOptions).thenApply { it.parse() } + + override fun delete( + params: InstallationDeleteParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // delete /v1/mcp/servers/{id}/installations/{installationId} + withRawResponse().delete(params, requestOptions).thenApply { it.parse() } + + override fun createAccessGroup( + params: InstallationCreateAccessGroupParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // post /v1/mcp/servers/{id}/installations/{installationId}/access-group + withRawResponse().createAccessGroup(params, requestOptions).thenApply { it.parse() } + + override fun deleteAccessGroup( + params: InstallationDeleteAccessGroupParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // delete /v1/mcp/servers/{id}/installations/{installationId}/access-group + withRawResponse().deleteAccessGroup(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + InstallationServiceAsync.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): InstallationServiceAsync.WithRawResponse = + InstallationServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun create( + params: InstallationCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("id", params.id().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "mcp", "servers", params._pathParam(0), "installations") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun retrieve( + params: InstallationRetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("installationId", params.installationId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments( + "v1", + "mcp", + "servers", + params._pathParam(0), + "installations", + params._pathParam(1), + ) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun update( + params: InstallationUpdateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("installationId", params.installationId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.PATCH) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments( + "v1", + "mcp", + "servers", + params._pathParam(0), + "installations", + params._pathParam(1), + ) + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { updateHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val listHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) + + override fun list( + params: InstallationListParams, + requestOptions: RequestOptions, + ): CompletableFuture>> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("id", params.id().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "mcp", "servers", params._pathParam(0), "installations") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.forEach { it.validate() } + } + } + } + } + } + + private val deleteHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun delete( + params: InstallationDeleteParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("installationId", params.installationId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.DELETE) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments( + "v1", + "mcp", + "servers", + params._pathParam(0), + "installations", + params._pathParam(1), + ) + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response.use { deleteHandler.handle(it) } + } + } + } + + private val createAccessGroupHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun createAccessGroup( + params: InstallationCreateAccessGroupParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("installationId", params.installationId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments( + "v1", + "mcp", + "servers", + params._pathParam(0), + "installations", + params._pathParam(1), + "access-group", + ) + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response.use { createAccessGroupHandler.handle(it) } + } + } + } + + private val deleteAccessGroupHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun deleteAccessGroup( + params: InstallationDeleteAccessGroupParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("installationId", params.installationId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.DELETE) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments( + "v1", + "mcp", + "servers", + params._pathParam(0), + "installations", + params._pathParam(1), + "access-group", + ) + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response.use { deleteAccessGroupHandler.handle(it) } + } + } + } + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/sdks/RepositoryServiceAsync.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/sdks/RepositoryServiceAsync.kt new file mode 100644 index 0000000..9ff546a --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/sdks/RepositoryServiceAsync.kt @@ -0,0 +1,203 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.async.sdks + +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.http.HttpResponseFor +import com.scalar.models.sdks.repositories.RepositoryLinkParams +import com.scalar.models.sdks.repositories.RepositoryLinkResponse +import com.scalar.models.sdks.repositories.RepositoryUnlinkParams +import com.scalar.models.sdks.repositories.RepositoryUpdatePublishingParams +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer + +/** SDKs */ +interface RepositoryServiceAsync { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): RepositoryServiceAsync + + /** Link one language target to a GitHub repository, so builds sync there. */ + fun link(uid: String, params: RepositoryLinkParams): CompletableFuture = + link(uid, params, RequestOptions.none()) + + /** @see link */ + fun link( + uid: String, + params: RepositoryLinkParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + link(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see link */ + fun link( + params: RepositoryLinkParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see link */ + fun link(params: RepositoryLinkParams): CompletableFuture = + link(params, RequestOptions.none()) + + /** Unlink one language target from its repository. */ + fun unlink( + language: RepositoryUnlinkParams.Language, + params: RepositoryUnlinkParams, + ): CompletableFuture = unlink(language, params, RequestOptions.none()) + + /** @see unlink */ + fun unlink( + language: RepositoryUnlinkParams.Language, + params: RepositoryUnlinkParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + unlink(params.toBuilder().language(language).build(), requestOptions) + + /** @see unlink */ + fun unlink( + params: RepositoryUnlinkParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see unlink */ + fun unlink(params: RepositoryUnlinkParams): CompletableFuture = + unlink(params, RequestOptions.none()) + + /** Toggle publish-on-merge and the release settings for a linked target. */ + fun updatePublishing( + language: RepositoryUpdatePublishingParams.Language, + params: RepositoryUpdatePublishingParams, + ): CompletableFuture = updatePublishing(language, params, RequestOptions.none()) + + /** @see updatePublishing */ + fun updatePublishing( + language: RepositoryUpdatePublishingParams.Language, + params: RepositoryUpdatePublishingParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + updatePublishing(params.toBuilder().language(language).build(), requestOptions) + + /** @see updatePublishing */ + fun updatePublishing( + params: RepositoryUpdatePublishingParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see updatePublishing */ + fun updatePublishing(params: RepositoryUpdatePublishingParams): CompletableFuture = + updatePublishing(params, RequestOptions.none()) + + /** + * A view of [RepositoryServiceAsync] that provides access to raw HTTP responses for each + * method. + */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): RepositoryServiceAsync.WithRawResponse + + /** + * Returns a raw HTTP response for `post /v1/sdks/{uid}/repositories`, but is otherwise the + * same as [RepositoryServiceAsync.link]. + */ + fun link( + uid: String, + params: RepositoryLinkParams, + ): CompletableFuture> = + link(uid, params, RequestOptions.none()) + + /** @see link */ + fun link( + uid: String, + params: RepositoryLinkParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + link(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see link */ + fun link( + params: RepositoryLinkParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see link */ + fun link( + params: RepositoryLinkParams + ): CompletableFuture> = + link(params, RequestOptions.none()) + + /** + * Returns a raw HTTP response for `delete /v1/sdks/{uid}/repositories/{language}`, but is + * otherwise the same as [RepositoryServiceAsync.unlink]. + */ + fun unlink( + language: RepositoryUnlinkParams.Language, + params: RepositoryUnlinkParams, + ): CompletableFuture> = + unlink(language, params, RequestOptions.none()) + + /** @see unlink */ + fun unlink( + language: RepositoryUnlinkParams.Language, + params: RepositoryUnlinkParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + unlink(params.toBuilder().language(language).build(), requestOptions) + + /** @see unlink */ + fun unlink( + params: RepositoryUnlinkParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see unlink */ + fun unlink(params: RepositoryUnlinkParams): CompletableFuture> = + unlink(params, RequestOptions.none()) + + /** + * Returns a raw HTTP response for `post /v1/sdks/{uid}/repositories/{language}/publishing`, + * but is otherwise the same as [RepositoryServiceAsync.updatePublishing]. + */ + fun updatePublishing( + language: RepositoryUpdatePublishingParams.Language, + params: RepositoryUpdatePublishingParams, + ): CompletableFuture> = + updatePublishing(language, params, RequestOptions.none()) + + /** @see updatePublishing */ + fun updatePublishing( + language: RepositoryUpdatePublishingParams.Language, + params: RepositoryUpdatePublishingParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + updatePublishing(params.toBuilder().language(language).build(), requestOptions) + + /** @see updatePublishing */ + fun updatePublishing( + params: RepositoryUpdatePublishingParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see updatePublishing */ + fun updatePublishing( + params: RepositoryUpdatePublishingParams + ): CompletableFuture> = + updatePublishing(params, RequestOptions.none()) + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/sdks/RepositoryServiceAsyncImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/sdks/RepositoryServiceAsyncImpl.kt new file mode 100644 index 0000000..23c1123 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/sdks/RepositoryServiceAsyncImpl.kt @@ -0,0 +1,176 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.async.sdks + +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.checkRequired +import com.scalar.core.handlers.errorBodyHandler +import com.scalar.core.handlers.errorHandler +import com.scalar.core.handlers.jsonHandler +import com.scalar.core.http.HttpMethod +import com.scalar.core.http.HttpRequest +import com.scalar.core.http.HttpResponse +import com.scalar.core.http.HttpResponse.Handler +import com.scalar.core.http.HttpResponseFor +import com.scalar.core.http.json +import com.scalar.core.http.parseable +import com.scalar.core.prepareAsync +import com.scalar.models.sdks.repositories.RepositoryLinkParams +import com.scalar.models.sdks.repositories.RepositoryLinkResponse +import com.scalar.models.sdks.repositories.RepositoryUnlinkParams +import com.scalar.models.sdks.repositories.RepositoryUpdatePublishingParams +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +/** SDKs */ +class RepositoryServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + RepositoryServiceAsync { + + private val withRawResponse: RepositoryServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): RepositoryServiceAsync.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): RepositoryServiceAsync = + RepositoryServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun link( + params: RepositoryLinkParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // post /v1/sdks/{uid}/repositories + withRawResponse().link(params, requestOptions).thenApply { it.parse() } + + override fun unlink( + params: RepositoryUnlinkParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // delete /v1/sdks/{uid}/repositories/{language} + withRawResponse().unlink(params, requestOptions).thenApply { it.parse() } + + override fun updatePublishing( + params: RepositoryUpdatePublishingParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // post /v1/sdks/{uid}/repositories/{language}/publishing + withRawResponse().updatePublishing(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + RepositoryServiceAsync.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): RepositoryServiceAsync.WithRawResponse = + RepositoryServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val linkHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun link( + params: RepositoryLinkParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("uid", params.uid().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "sdks", params._pathParam(0), "repositories") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { linkHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val unlinkHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun unlink( + params: RepositoryUnlinkParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("language", params.language().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.DELETE) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments( + "v1", + "sdks", + params._pathParam(0), + "repositories", + params._pathParam(1), + ) + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response.use { unlinkHandler.handle(it) } + } + } + } + + private val updatePublishingHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun updatePublishing( + params: RepositoryUpdatePublishingParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("language", params.language().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments( + "v1", + "sdks", + params._pathParam(0), + "repositories", + params._pathParam(1), + "publishing", + ) + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response.use { updatePublishingHandler.handle(it) } + } + } + } + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/sdks/VersionServiceAsync.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/sdks/VersionServiceAsync.kt new file mode 100644 index 0000000..6ae1444 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/sdks/VersionServiceAsync.kt @@ -0,0 +1,138 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.async.sdks + +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.http.HttpResponseFor +import com.scalar.models.sdks.versions.VersionCreateParams +import com.scalar.models.sdks.versions.VersionDeleteParams +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer + +/** SDKs */ +interface VersionServiceAsync { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): VersionServiceAsync + + /** Create a new SDK version against a specific API version. */ + fun create(uid: String, params: VersionCreateParams): CompletableFuture = + create(uid, params, RequestOptions.none()) + + /** @see create */ + fun create( + uid: String, + params: VersionCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = create(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see create */ + fun create( + params: VersionCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see create */ + fun create(params: VersionCreateParams): CompletableFuture = + create(params, RequestOptions.none()) + + /** Permanently delete one version of an SDK. */ + fun delete(version: String, params: VersionDeleteParams): CompletableFuture = + delete(version, params, RequestOptions.none()) + + /** @see delete */ + fun delete( + version: String, + params: VersionDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = delete(params.toBuilder().version(version).build(), requestOptions) + + /** @see delete */ + fun delete( + params: VersionDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see delete */ + fun delete(params: VersionDeleteParams): CompletableFuture = + delete(params, RequestOptions.none()) + + /** + * A view of [VersionServiceAsync] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): VersionServiceAsync.WithRawResponse + + /** + * Returns a raw HTTP response for `post /v1/sdks/{uid}/versions`, but is otherwise the same + * as [VersionServiceAsync.create]. + */ + fun create( + uid: String, + params: VersionCreateParams, + ): CompletableFuture> = create(uid, params, RequestOptions.none()) + + /** @see create */ + fun create( + uid: String, + params: VersionCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + create(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see create */ + fun create( + params: VersionCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see create */ + fun create(params: VersionCreateParams): CompletableFuture> = + create(params, RequestOptions.none()) + + /** + * Returns a raw HTTP response for `delete /v1/sdks/{uid}/versions/{version}`, but is + * otherwise the same as [VersionServiceAsync.delete]. + */ + fun delete( + version: String, + params: VersionDeleteParams, + ): CompletableFuture> = delete(version, params, RequestOptions.none()) + + /** @see delete */ + fun delete( + version: String, + params: VersionDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + delete(params.toBuilder().version(version).build(), requestOptions) + + /** @see delete */ + fun delete( + params: VersionDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see delete */ + fun delete(params: VersionDeleteParams): CompletableFuture> = + delete(params, RequestOptions.none()) + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/sdks/VersionServiceAsyncImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/sdks/VersionServiceAsyncImpl.kt new file mode 100644 index 0000000..1c402e1 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/sdks/VersionServiceAsyncImpl.kt @@ -0,0 +1,125 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.async.sdks + +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.checkRequired +import com.scalar.core.handlers.errorBodyHandler +import com.scalar.core.handlers.errorHandler +import com.scalar.core.handlers.jsonHandler +import com.scalar.core.http.HttpMethod +import com.scalar.core.http.HttpRequest +import com.scalar.core.http.HttpResponse +import com.scalar.core.http.HttpResponse.Handler +import com.scalar.core.http.HttpResponseFor +import com.scalar.core.http.json +import com.scalar.core.http.parseable +import com.scalar.core.prepareAsync +import com.scalar.models.sdks.versions.VersionCreateParams +import com.scalar.models.sdks.versions.VersionDeleteParams +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +/** SDKs */ +class VersionServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + VersionServiceAsync { + + private val withRawResponse: VersionServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): VersionServiceAsync.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): VersionServiceAsync = + VersionServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun create( + params: VersionCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // post /v1/sdks/{uid}/versions + withRawResponse().create(params, requestOptions).thenApply { it.parse() } + + override fun delete( + params: VersionDeleteParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // delete /v1/sdks/{uid}/versions/{version} + withRawResponse().delete(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + VersionServiceAsync.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): VersionServiceAsync.WithRawResponse = + VersionServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun create( + params: VersionCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("uid", params.uid().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "sdks", params._pathParam(0), "versions") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response.use { createHandler.handle(it) } + } + } + } + + private val deleteHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun delete( + params: VersionDeleteParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("version", params.version().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.DELETE) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments( + "v1", + "sdks", + params._pathParam(0), + "versions", + params._pathParam(1), + ) + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response.use { deleteHandler.handle(it) } + } + } + } + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/teams/InviteServiceAsync.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/teams/InviteServiceAsync.kt new file mode 100644 index 0000000..61d666e --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/teams/InviteServiceAsync.kt @@ -0,0 +1,198 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.async.teams + +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.http.HttpResponseFor +import com.scalar.models.teams.invites.InviteCancelParams +import com.scalar.models.teams.invites.InviteMemberParams +import com.scalar.models.teams.invites.InviteResendParams +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer + +/** Teams */ +interface InviteServiceAsync { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): InviteServiceAsync + + /** Withdraw an invite that has not been accepted. */ + fun cancel(uid: String): CompletableFuture = cancel(uid, InviteCancelParams.none()) + + /** @see cancel */ + fun cancel( + uid: String, + params: InviteCancelParams = InviteCancelParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = cancel(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see cancel */ + fun cancel(uid: String, params: InviteCancelParams): CompletableFuture = + cancel(uid, params, RequestOptions.none()) + + /** @see cancel */ + fun cancel( + params: InviteCancelParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see cancel */ + fun cancel(params: InviteCancelParams): CompletableFuture = + cancel(params, RequestOptions.none()) + + /** @see cancel */ + fun cancel(uid: String, requestOptions: RequestOptions): CompletableFuture = + cancel(uid, InviteCancelParams.none(), requestOptions) + + /** Invite someone to the current team by email. */ + fun member(params: InviteMemberParams): CompletableFuture = + member(params, RequestOptions.none()) + + /** @see member */ + fun member( + params: InviteMemberParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** Send the invite email again. */ + fun resend(uid: String): CompletableFuture = resend(uid, InviteResendParams.none()) + + /** @see resend */ + fun resend( + uid: String, + params: InviteResendParams = InviteResendParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = resend(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see resend */ + fun resend(uid: String, params: InviteResendParams): CompletableFuture = + resend(uid, params, RequestOptions.none()) + + /** @see resend */ + fun resend( + params: InviteResendParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see resend */ + fun resend(params: InviteResendParams): CompletableFuture = + resend(params, RequestOptions.none()) + + /** @see resend */ + fun resend(uid: String, requestOptions: RequestOptions): CompletableFuture = + resend(uid, InviteResendParams.none(), requestOptions) + + /** + * A view of [InviteServiceAsync] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): InviteServiceAsync.WithRawResponse + + /** + * Returns a raw HTTP response for `delete /v1/teams/invites/{uid}`, but is otherwise the + * same as [InviteServiceAsync.cancel]. + */ + fun cancel(uid: String): CompletableFuture> = + cancel(uid, InviteCancelParams.none()) + + /** @see cancel */ + fun cancel( + uid: String, + params: InviteCancelParams = InviteCancelParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + cancel(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see cancel */ + fun cancel( + uid: String, + params: InviteCancelParams, + ): CompletableFuture> = cancel(uid, params, RequestOptions.none()) + + /** @see cancel */ + fun cancel( + params: InviteCancelParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see cancel */ + fun cancel(params: InviteCancelParams): CompletableFuture> = + cancel(params, RequestOptions.none()) + + /** @see cancel */ + fun cancel( + uid: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + cancel(uid, InviteCancelParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `post /v1/teams/invites`, but is otherwise the same as + * [InviteServiceAsync.member]. + */ + fun member(params: InviteMemberParams): CompletableFuture> = + member(params, RequestOptions.none()) + + /** @see member */ + fun member( + params: InviteMemberParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `patch /v1/teams/invites/{uid}`, but is otherwise the + * same as [InviteServiceAsync.resend]. + */ + fun resend(uid: String): CompletableFuture> = + resend(uid, InviteResendParams.none()) + + /** @see resend */ + fun resend( + uid: String, + params: InviteResendParams = InviteResendParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + resend(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see resend */ + fun resend( + uid: String, + params: InviteResendParams, + ): CompletableFuture> = resend(uid, params, RequestOptions.none()) + + /** @see resend */ + fun resend( + params: InviteResendParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see resend */ + fun resend(params: InviteResendParams): CompletableFuture> = + resend(params, RequestOptions.none()) + + /** @see resend */ + fun resend( + uid: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + resend(uid, InviteResendParams.none(), requestOptions) + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/teams/InviteServiceAsyncImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/teams/InviteServiceAsyncImpl.kt new file mode 100644 index 0000000..ca976b1 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/teams/InviteServiceAsyncImpl.kt @@ -0,0 +1,151 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.async.teams + +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.checkRequired +import com.scalar.core.handlers.errorBodyHandler +import com.scalar.core.handlers.errorHandler +import com.scalar.core.handlers.jsonHandler +import com.scalar.core.http.HttpMethod +import com.scalar.core.http.HttpRequest +import com.scalar.core.http.HttpResponse +import com.scalar.core.http.HttpResponse.Handler +import com.scalar.core.http.HttpResponseFor +import com.scalar.core.http.json +import com.scalar.core.http.parseable +import com.scalar.core.prepareAsync +import com.scalar.models.teams.invites.InviteCancelParams +import com.scalar.models.teams.invites.InviteMemberParams +import com.scalar.models.teams.invites.InviteResendParams +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +/** Teams */ +class InviteServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + InviteServiceAsync { + + private val withRawResponse: InviteServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): InviteServiceAsync.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): InviteServiceAsync = + InviteServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun cancel( + params: InviteCancelParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // delete /v1/teams/invites/{uid} + withRawResponse().cancel(params, requestOptions).thenApply { it.parse() } + + override fun member( + params: InviteMemberParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // post /v1/teams/invites + withRawResponse().member(params, requestOptions).thenApply { it.parse() } + + override fun resend( + params: InviteResendParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // patch /v1/teams/invites/{uid} + withRawResponse().resend(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + InviteServiceAsync.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): InviteServiceAsync.WithRawResponse = + InviteServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val cancelHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun cancel( + params: InviteCancelParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("uid", params.uid().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.DELETE) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "teams", "invites", params._pathParam(0)) + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response.use { cancelHandler.handle(it) } + } + } + } + + private val memberHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun member( + params: InviteMemberParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "teams", "invites") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response.use { memberHandler.handle(it) } + } + } + } + + private val resendHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun resend( + params: InviteResendParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("uid", params.uid().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.PATCH) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "teams", "invites", params._pathParam(0)) + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response.use { resendHandler.handle(it) } + } + } + } + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/teams/MemberServiceAsync.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/teams/MemberServiceAsync.kt new file mode 100644 index 0000000..8c391ca --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/teams/MemberServiceAsync.kt @@ -0,0 +1,198 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.async.teams + +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.http.HttpResponseFor +import com.scalar.models.teams.members.MemberDeleteParams +import com.scalar.models.teams.members.MemberListParams +import com.scalar.models.teams.members.MemberListResponse +import com.scalar.models.teams.members.MemberUpdateParams +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer + +/** Teams */ +interface MemberServiceAsync { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): MemberServiceAsync + + /** Change what a member of the current team is allowed to do. */ + fun update(uid: String, params: MemberUpdateParams): CompletableFuture = + update(uid, params, RequestOptions.none()) + + /** @see update */ + fun update( + uid: String, + params: MemberUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = update(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see update */ + fun update( + params: MemberUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see update */ + fun update(params: MemberUpdateParams): CompletableFuture = + update(params, RequestOptions.none()) + + /** List the members of the current team, along with the invites still outstanding. */ + fun list(): CompletableFuture = list(MemberListParams.none()) + + /** @see list */ + fun list( + params: MemberListParams = MemberListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see list */ + fun list(params: MemberListParams): CompletableFuture = + list(params, RequestOptions.none()) + + /** @see list */ + fun list(requestOptions: RequestOptions): CompletableFuture = + list(MemberListParams.none(), requestOptions) + + /** Remove someone from the current team. */ + fun delete(uid: String): CompletableFuture = delete(uid, MemberDeleteParams.none()) + + /** @see delete */ + fun delete( + uid: String, + params: MemberDeleteParams = MemberDeleteParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = delete(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see delete */ + fun delete(uid: String, params: MemberDeleteParams): CompletableFuture = + delete(uid, params, RequestOptions.none()) + + /** @see delete */ + fun delete( + params: MemberDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see delete */ + fun delete(params: MemberDeleteParams): CompletableFuture = + delete(params, RequestOptions.none()) + + /** @see delete */ + fun delete(uid: String, requestOptions: RequestOptions): CompletableFuture = + delete(uid, MemberDeleteParams.none(), requestOptions) + + /** + * A view of [MemberServiceAsync] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): MemberServiceAsync.WithRawResponse + + /** + * Returns a raw HTTP response for `patch /v1/teams/members/{uid}`, but is otherwise the + * same as [MemberServiceAsync.update]. + */ + fun update( + uid: String, + params: MemberUpdateParams, + ): CompletableFuture> = update(uid, params, RequestOptions.none()) + + /** @see update */ + fun update( + uid: String, + params: MemberUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + update(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see update */ + fun update( + params: MemberUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see update */ + fun update(params: MemberUpdateParams): CompletableFuture> = + update(params, RequestOptions.none()) + + /** + * Returns a raw HTTP response for `get /v1/teams/members`, but is otherwise the same as + * [MemberServiceAsync.list]. + */ + fun list(): CompletableFuture> = + list(MemberListParams.none()) + + /** @see list */ + fun list( + params: MemberListParams = MemberListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see list */ + fun list(params: MemberListParams): CompletableFuture> = + list(params, RequestOptions.none()) + + /** @see list */ + fun list( + requestOptions: RequestOptions + ): CompletableFuture> = + list(MemberListParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `delete /v1/teams/members/{uid}`, but is otherwise the + * same as [MemberServiceAsync.delete]. + */ + fun delete(uid: String): CompletableFuture> = + delete(uid, MemberDeleteParams.none()) + + /** @see delete */ + fun delete( + uid: String, + params: MemberDeleteParams = MemberDeleteParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + delete(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see delete */ + fun delete( + uid: String, + params: MemberDeleteParams, + ): CompletableFuture> = delete(uid, params, RequestOptions.none()) + + /** @see delete */ + fun delete( + params: MemberDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see delete */ + fun delete(params: MemberDeleteParams): CompletableFuture> = + delete(params, RequestOptions.none()) + + /** @see delete */ + fun delete( + uid: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + delete(uid, MemberDeleteParams.none(), requestOptions) + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/teams/MemberServiceAsyncImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/teams/MemberServiceAsyncImpl.kt new file mode 100644 index 0000000..4b7da4d --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/async/teams/MemberServiceAsyncImpl.kt @@ -0,0 +1,158 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.async.teams + +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.checkRequired +import com.scalar.core.handlers.errorBodyHandler +import com.scalar.core.handlers.errorHandler +import com.scalar.core.handlers.jsonHandler +import com.scalar.core.http.HttpMethod +import com.scalar.core.http.HttpRequest +import com.scalar.core.http.HttpResponse +import com.scalar.core.http.HttpResponse.Handler +import com.scalar.core.http.HttpResponseFor +import com.scalar.core.http.json +import com.scalar.core.http.parseable +import com.scalar.core.prepareAsync +import com.scalar.models.teams.members.MemberDeleteParams +import com.scalar.models.teams.members.MemberListParams +import com.scalar.models.teams.members.MemberListResponse +import com.scalar.models.teams.members.MemberUpdateParams +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +/** Teams */ +class MemberServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + MemberServiceAsync { + + private val withRawResponse: MemberServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): MemberServiceAsync.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): MemberServiceAsync = + MemberServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun update( + params: MemberUpdateParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // patch /v1/teams/members/{uid} + withRawResponse().update(params, requestOptions).thenApply { it.parse() } + + override fun list( + params: MemberListParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /v1/teams/members + withRawResponse().list(params, requestOptions).thenApply { it.parse() } + + override fun delete( + params: MemberDeleteParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // delete /v1/teams/members/{uid} + withRawResponse().delete(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + MemberServiceAsync.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): MemberServiceAsync.WithRawResponse = + MemberServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val updateHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun update( + params: MemberUpdateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("uid", params.uid().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.PATCH) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "teams", "members", params._pathParam(0)) + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response.use { updateHandler.handle(it) } + } + } + } + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun list( + params: MemberListParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "teams", "members") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val deleteHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun delete( + params: MemberDeleteParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("uid", params.uid().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.DELETE) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "teams", "members", params._pathParam(0)) + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response.use { deleteHandler.handle(it) } + } + } + } + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/AccessGroupService.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/AccessGroupService.kt new file mode 100644 index 0000000..6fcca74 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/AccessGroupService.kt @@ -0,0 +1,308 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.blocking + +import com.google.errorprone.annotations.MustBeClosed +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.http.HttpResponseFor +import com.scalar.models.accessGroups.AccessGroupCreateParams +import com.scalar.models.accessGroups.AccessGroupCreateResponse +import com.scalar.models.accessGroups.AccessGroupDeleteParams +import com.scalar.models.accessGroups.AccessGroupRetrieveParams +import com.scalar.models.accessGroups.AccessGroupRetrieveResponse +import com.scalar.models.accessGroups.AccessGroupUpdateParams +import com.scalar.services.blocking.accessGroups.DomainService +import java.util.function.Consumer + +/** Access Groups */ +interface AccessGroupService { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): AccessGroupService + + /** Access Groups */ + fun domains(): DomainService + + /** + * Create a group for the current team. Requires docs edit permission and the access groups + * billing feature. Domains are exact email domains, without wildcards or implicit subdomain + * matching. + */ + fun create(): AccessGroupCreateResponse = create(AccessGroupCreateParams.none()) + + /** @see create */ + fun create( + params: AccessGroupCreateParams = AccessGroupCreateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): AccessGroupCreateResponse + + /** @see create */ + fun create(params: AccessGroupCreateParams): AccessGroupCreateResponse = + create(params, RequestOptions.none()) + + /** @see create */ + fun create(requestOptions: RequestOptions): AccessGroupCreateResponse = + create(AccessGroupCreateParams.none(), requestOptions) + + /** Get a group and its email and domain allowlists by slug. */ + fun retrieve(slug: String): AccessGroupRetrieveResponse = + retrieve(slug, AccessGroupRetrieveParams.none()) + + /** @see retrieve */ + fun retrieve( + slug: String, + params: AccessGroupRetrieveParams = AccessGroupRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): AccessGroupRetrieveResponse = retrieve(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see retrieve */ + fun retrieve(slug: String, params: AccessGroupRetrieveParams): AccessGroupRetrieveResponse = + retrieve(slug, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: AccessGroupRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): AccessGroupRetrieveResponse + + /** @see retrieve */ + fun retrieve(params: AccessGroupRetrieveParams): AccessGroupRetrieveResponse = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve(slug: String, requestOptions: RequestOptions): AccessGroupRetrieveResponse = + retrieve(slug, AccessGroupRetrieveParams.none(), requestOptions) + + /** + * Update group metadata. Requires docs edit permission. After changing the slug, use the new + * slug in subsequent requests. + */ + fun update(pathSlug: String): Any? = update(pathSlug, AccessGroupUpdateParams.none()) + + /** @see update */ + fun update( + pathSlug: String, + params: AccessGroupUpdateParams = AccessGroupUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? = update(params.toBuilder().pathSlug(pathSlug).build(), requestOptions) + + /** @see update */ + fun update(pathSlug: String, params: AccessGroupUpdateParams): Any? = + update(pathSlug, params, RequestOptions.none()) + + /** @see update */ + fun update( + params: AccessGroupUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? + + /** @see update */ + fun update(params: AccessGroupUpdateParams): Any? = update(params, RequestOptions.none()) + + /** @see update */ + fun update(pathSlug: String, requestOptions: RequestOptions): Any? = + update(pathSlug, AccessGroupUpdateParams.none(), requestOptions) + + /** Delete a group and remove its project assignments. Requires docs edit permission. */ + fun delete(slug: String): Any? = delete(slug, AccessGroupDeleteParams.none()) + + /** @see delete */ + fun delete( + slug: String, + params: AccessGroupDeleteParams = AccessGroupDeleteParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? = delete(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see delete */ + fun delete(slug: String, params: AccessGroupDeleteParams): Any? = + delete(slug, params, RequestOptions.none()) + + /** @see delete */ + fun delete( + params: AccessGroupDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? + + /** @see delete */ + fun delete(params: AccessGroupDeleteParams): Any? = delete(params, RequestOptions.none()) + + /** @see delete */ + fun delete(slug: String, requestOptions: RequestOptions): Any? = + delete(slug, AccessGroupDeleteParams.none(), requestOptions) + + /** + * A view of [AccessGroupService] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): AccessGroupService.WithRawResponse + + /** Access Groups */ + fun domains(): DomainService.WithRawResponse + + /** + * Returns a raw HTTP response for `post /v1/access-groups`, but is otherwise the same as + * [AccessGroupService.create]. + */ + @MustBeClosed + fun create(): HttpResponseFor = + create(AccessGroupCreateParams.none()) + + /** @see create */ + @MustBeClosed + fun create( + params: AccessGroupCreateParams = AccessGroupCreateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see create */ + @MustBeClosed + fun create(params: AccessGroupCreateParams): HttpResponseFor = + create(params, RequestOptions.none()) + + /** @see create */ + @MustBeClosed + fun create(requestOptions: RequestOptions): HttpResponseFor = + create(AccessGroupCreateParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /v1/access-groups/{slug}`, but is otherwise the same + * as [AccessGroupService.retrieve]. + */ + @MustBeClosed + fun retrieve(slug: String): HttpResponseFor = + retrieve(slug, AccessGroupRetrieveParams.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + slug: String, + params: AccessGroupRetrieveParams = AccessGroupRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + retrieve(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + slug: String, + params: AccessGroupRetrieveParams, + ): HttpResponseFor = + retrieve(slug, params, RequestOptions.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + params: AccessGroupRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + params: AccessGroupRetrieveParams + ): HttpResponseFor = retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + slug: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + retrieve(slug, AccessGroupRetrieveParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `patch /v1/access-groups/{slug}`, but is otherwise the + * same as [AccessGroupService.update]. + */ + @MustBeClosed + fun update(pathSlug: String): HttpResponseFor = + update(pathSlug, AccessGroupUpdateParams.none()) + + /** @see update */ + @MustBeClosed + fun update( + pathSlug: String, + params: AccessGroupUpdateParams = AccessGroupUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + update(params.toBuilder().pathSlug(pathSlug).build(), requestOptions) + + /** @see update */ + @MustBeClosed + fun update(pathSlug: String, params: AccessGroupUpdateParams): HttpResponseFor = + update(pathSlug, params, RequestOptions.none()) + + /** @see update */ + @MustBeClosed + fun update( + params: AccessGroupUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see update */ + @MustBeClosed + fun update(params: AccessGroupUpdateParams): HttpResponseFor = + update(params, RequestOptions.none()) + + /** @see update */ + @MustBeClosed + fun update(pathSlug: String, requestOptions: RequestOptions): HttpResponseFor = + update(pathSlug, AccessGroupUpdateParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `delete /v1/access-groups/{slug}`, but is otherwise the + * same as [AccessGroupService.delete]. + */ + @MustBeClosed + fun delete(slug: String): HttpResponseFor = + delete(slug, AccessGroupDeleteParams.none()) + + /** @see delete */ + @MustBeClosed + fun delete( + slug: String, + params: AccessGroupDeleteParams = AccessGroupDeleteParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = delete(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see delete */ + @MustBeClosed + fun delete(slug: String, params: AccessGroupDeleteParams): HttpResponseFor = + delete(slug, params, RequestOptions.none()) + + /** @see delete */ + @MustBeClosed + fun delete( + params: AccessGroupDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see delete */ + @MustBeClosed + fun delete(params: AccessGroupDeleteParams): HttpResponseFor = + delete(params, RequestOptions.none()) + + /** @see delete */ + @MustBeClosed + fun delete(slug: String, requestOptions: RequestOptions): HttpResponseFor = + delete(slug, AccessGroupDeleteParams.none(), requestOptions) + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/AccessGroupServiceImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/AccessGroupServiceImpl.kt new file mode 100644 index 0000000..16b8d1e --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/AccessGroupServiceImpl.kt @@ -0,0 +1,196 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.blocking + +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.checkRequired +import com.scalar.core.handlers.errorBodyHandler +import com.scalar.core.handlers.errorHandler +import com.scalar.core.handlers.jsonHandler +import com.scalar.core.http.HttpMethod +import com.scalar.core.http.HttpRequest +import com.scalar.core.http.HttpResponse +import com.scalar.core.http.HttpResponse.Handler +import com.scalar.core.http.HttpResponseFor +import com.scalar.core.http.json +import com.scalar.core.http.parseable +import com.scalar.core.prepare +import com.scalar.models.accessGroups.AccessGroupCreateParams +import com.scalar.models.accessGroups.AccessGroupCreateResponse +import com.scalar.models.accessGroups.AccessGroupDeleteParams +import com.scalar.models.accessGroups.AccessGroupRetrieveParams +import com.scalar.models.accessGroups.AccessGroupRetrieveResponse +import com.scalar.models.accessGroups.AccessGroupUpdateParams +import com.scalar.services.blocking.accessGroups.DomainService +import com.scalar.services.blocking.accessGroups.DomainServiceImpl +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +/** Access Groups */ +class AccessGroupServiceImpl internal constructor(private val clientOptions: ClientOptions) : + AccessGroupService { + + private val withRawResponse: AccessGroupService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + private val domains: DomainService by lazy { DomainServiceImpl(clientOptions) } + + override fun withRawResponse(): AccessGroupService.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): AccessGroupService = + AccessGroupServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + /** Access Groups */ + override fun domains(): DomainService = domains + + override fun create( + params: AccessGroupCreateParams, + requestOptions: RequestOptions, + ): AccessGroupCreateResponse = + // post /v1/access-groups + withRawResponse().create(params, requestOptions).parse() + + override fun retrieve( + params: AccessGroupRetrieveParams, + requestOptions: RequestOptions, + ): AccessGroupRetrieveResponse = + // get /v1/access-groups/{slug} + withRawResponse().retrieve(params, requestOptions).parse() + + override fun update(params: AccessGroupUpdateParams, requestOptions: RequestOptions): Any? = + // patch /v1/access-groups/{slug} + withRawResponse().update(params, requestOptions).parse() + + override fun delete(params: AccessGroupDeleteParams, requestOptions: RequestOptions): Any? = + // delete /v1/access-groups/{slug} + withRawResponse().delete(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + AccessGroupService.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + private val domains: DomainService.WithRawResponse by lazy { + DomainServiceImpl.WithRawResponseImpl(clientOptions) + } + + override fun withOptions( + modifier: Consumer + ): AccessGroupService.WithRawResponse = + AccessGroupServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + /** Access Groups */ + override fun domains(): DomainService.WithRawResponse = domains + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun create( + params: AccessGroupCreateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "access-groups") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun retrieve( + params: AccessGroupRetrieveParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("slug", params.slug().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "access-groups", params._pathParam(0)) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val updateHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun update( + params: AccessGroupUpdateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("pathSlug", params.pathSlug().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.PATCH) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "access-groups", params._pathParam(0)) + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response.use { updateHandler.handle(it) } + } + } + + private val deleteHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun delete( + params: AccessGroupDeleteParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("slug", params.slug().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.DELETE) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "access-groups", params._pathParam(0)) + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response.use { deleteHandler.handle(it) } + } + } + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/AuthenticationService.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/AuthenticationService.kt index ee25709..67f8a8e 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/AuthenticationService.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/AuthenticationService.kt @@ -9,7 +9,7 @@ import com.scalar.core.http.HttpResponseFor import com.scalar.models.authentication.AuthenticationExchangePersonalTokenParams import com.scalar.models.authentication.AuthenticationExchangePersonalTokenResponse import com.scalar.models.authentication.AuthenticationListCurrentUserParams -import com.scalar.models.authentication.AuthenticationListCurrentUserResponse +import com.scalar.models.authentication.User import java.util.function.Consumer /** Authentication */ @@ -40,22 +40,20 @@ interface AuthenticationService { ): AuthenticationExchangePersonalTokenResponse /** Get the authenticated user, including their available teams and theme. */ - fun listCurrentUser(): AuthenticationListCurrentUserResponse = - listCurrentUser(AuthenticationListCurrentUserParams.none()) + fun listCurrentUser(): User = listCurrentUser(AuthenticationListCurrentUserParams.none()) /** @see listCurrentUser */ fun listCurrentUser( params: AuthenticationListCurrentUserParams = AuthenticationListCurrentUserParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): AuthenticationListCurrentUserResponse + ): User /** @see listCurrentUser */ - fun listCurrentUser( - params: AuthenticationListCurrentUserParams - ): AuthenticationListCurrentUserResponse = listCurrentUser(params, RequestOptions.none()) + fun listCurrentUser(params: AuthenticationListCurrentUserParams): User = + listCurrentUser(params, RequestOptions.none()) /** @see listCurrentUser */ - fun listCurrentUser(requestOptions: RequestOptions): AuthenticationListCurrentUserResponse = + fun listCurrentUser(requestOptions: RequestOptions): User = listCurrentUser(AuthenticationListCurrentUserParams.none(), requestOptions) /** @@ -94,7 +92,7 @@ interface AuthenticationService { * [AuthenticationService.listCurrentUser]. */ @MustBeClosed - fun listCurrentUser(): HttpResponseFor = + fun listCurrentUser(): HttpResponseFor = listCurrentUser(AuthenticationListCurrentUserParams.none()) /** @see listCurrentUser */ @@ -103,20 +101,16 @@ interface AuthenticationService { params: AuthenticationListCurrentUserParams = AuthenticationListCurrentUserParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor + ): HttpResponseFor /** @see listCurrentUser */ @MustBeClosed - fun listCurrentUser( - params: AuthenticationListCurrentUserParams - ): HttpResponseFor = + fun listCurrentUser(params: AuthenticationListCurrentUserParams): HttpResponseFor = listCurrentUser(params, RequestOptions.none()) /** @see listCurrentUser */ @MustBeClosed - fun listCurrentUser( - requestOptions: RequestOptions - ): HttpResponseFor = + fun listCurrentUser(requestOptions: RequestOptions): HttpResponseFor = listCurrentUser(AuthenticationListCurrentUserParams.none(), requestOptions) } } diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/AuthenticationServiceImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/AuthenticationServiceImpl.kt index 8ad0a7c..5effa7f 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/AuthenticationServiceImpl.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/AuthenticationServiceImpl.kt @@ -18,7 +18,7 @@ import com.scalar.core.prepare import com.scalar.models.authentication.AuthenticationExchangePersonalTokenParams import com.scalar.models.authentication.AuthenticationExchangePersonalTokenResponse import com.scalar.models.authentication.AuthenticationListCurrentUserParams -import com.scalar.models.authentication.AuthenticationListCurrentUserResponse +import com.scalar.models.authentication.User import java.util.function.Consumer /** Authentication */ @@ -44,7 +44,7 @@ class AuthenticationServiceImpl internal constructor(private val clientOptions: override fun listCurrentUser( params: AuthenticationListCurrentUserParams, requestOptions: RequestOptions, - ): AuthenticationListCurrentUserResponse = + ): User = // get /v1/auth/me withRawResponse().listCurrentUser(params, requestOptions).parse() @@ -90,13 +90,13 @@ class AuthenticationServiceImpl internal constructor(private val clientOptions: } } - private val listCurrentUserHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val listCurrentUserHandler: Handler = + jsonHandler(clientOptions.jsonMapper) override fun listCurrentUser( params: AuthenticationListCurrentUserParams, requestOptions: RequestOptions, - ): HttpResponseFor { + ): HttpResponseFor { val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/LoginPortalService.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/LoginPortalService.kt index b78f19e..3f73ba3 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/LoginPortalService.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/LoginPortalService.kt @@ -7,10 +7,10 @@ import com.scalar.core.ClientOptions import com.scalar.core.RequestOptions import com.scalar.core.http.HttpResponseFor import com.scalar.models.Uid +import com.scalar.models.loginPortals.LoginPortal import com.scalar.models.loginPortals.LoginPortalCreateParams import com.scalar.models.loginPortals.LoginPortalDeleteParams import com.scalar.models.loginPortals.LoginPortalListParams -import com.scalar.models.loginPortals.LoginPortalListResponse import com.scalar.models.loginPortals.LoginPortalRetrieveParams import com.scalar.models.loginPortals.LoginPortalRetrieveResponse import com.scalar.models.loginPortals.LoginPortalUpdateParams @@ -97,20 +97,19 @@ interface LoginPortalService { update(slug, LoginPortalUpdateParams.none(), requestOptions) /** List all login portals for the current team. */ - fun list(): List = list(LoginPortalListParams.none()) + fun list(): List = list(LoginPortalListParams.none()) /** @see list */ fun list( params: LoginPortalListParams = LoginPortalListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): List + ): List /** @see list */ - fun list(params: LoginPortalListParams): List = - list(params, RequestOptions.none()) + fun list(params: LoginPortalListParams): List = list(params, RequestOptions.none()) /** @see list */ - fun list(requestOptions: RequestOptions): List = + fun list(requestOptions: RequestOptions): List = list(LoginPortalListParams.none(), requestOptions) /** Delete a login portal. */ @@ -258,24 +257,23 @@ interface LoginPortalService { * [LoginPortalService.list]. */ @MustBeClosed - fun list(): HttpResponseFor> = - list(LoginPortalListParams.none()) + fun list(): HttpResponseFor> = list(LoginPortalListParams.none()) /** @see list */ @MustBeClosed fun list( params: LoginPortalListParams = LoginPortalListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor> + ): HttpResponseFor> /** @see list */ @MustBeClosed - fun list(params: LoginPortalListParams): HttpResponseFor> = + fun list(params: LoginPortalListParams): HttpResponseFor> = list(params, RequestOptions.none()) /** @see list */ @MustBeClosed - fun list(requestOptions: RequestOptions): HttpResponseFor> = + fun list(requestOptions: RequestOptions): HttpResponseFor> = list(LoginPortalListParams.none(), requestOptions) /** diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/LoginPortalServiceImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/LoginPortalServiceImpl.kt index 25d556f..a3648db 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/LoginPortalServiceImpl.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/LoginPortalServiceImpl.kt @@ -17,10 +17,10 @@ import com.scalar.core.http.json import com.scalar.core.http.parseable import com.scalar.core.prepare import com.scalar.models.Uid +import com.scalar.models.loginPortals.LoginPortal import com.scalar.models.loginPortals.LoginPortalCreateParams import com.scalar.models.loginPortals.LoginPortalDeleteParams import com.scalar.models.loginPortals.LoginPortalListParams -import com.scalar.models.loginPortals.LoginPortalListResponse import com.scalar.models.loginPortals.LoginPortalRetrieveParams import com.scalar.models.loginPortals.LoginPortalRetrieveResponse import com.scalar.models.loginPortals.LoginPortalUpdateParams @@ -58,7 +58,7 @@ class LoginPortalServiceImpl internal constructor(private val clientOptions: Cli override fun list( params: LoginPortalListParams, requestOptions: RequestOptions, - ): List = + ): List = // get /v1/login-portals withRawResponse().list(params, requestOptions).parse() @@ -160,13 +160,13 @@ class LoginPortalServiceImpl internal constructor(private val clientOptions: Cli } } - private val listHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper) + private val listHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) override fun list( params: LoginPortalListParams, requestOptions: RequestOptions, - ): HttpResponseFor> { + ): HttpResponseFor> { val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/McpService.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/McpService.kt new file mode 100644 index 0000000..5432618 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/McpService.kt @@ -0,0 +1,39 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.blocking + +import com.scalar.core.ClientOptions +import com.scalar.services.blocking.mcp.ServerService +import java.util.function.Consumer + +interface McpService { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): McpService + + /** MCP */ + fun servers(): ServerService + + /** A view of [McpService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): McpService.WithRawResponse + + /** MCP */ + fun servers(): ServerService.WithRawResponse + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/McpServiceImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/McpServiceImpl.kt new file mode 100644 index 0000000..a0f94aa --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/McpServiceImpl.kt @@ -0,0 +1,43 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.blocking + +import com.scalar.core.ClientOptions +import com.scalar.services.blocking.mcp.ServerService +import com.scalar.services.blocking.mcp.ServerServiceImpl +import java.util.function.Consumer + +class McpServiceImpl internal constructor(private val clientOptions: ClientOptions) : McpService { + + private val withRawResponse: McpService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + private val servers: ServerService by lazy { ServerServiceImpl(clientOptions) } + + override fun withRawResponse(): McpService.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): McpService = + McpServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + /** MCP */ + override fun servers(): ServerService = servers + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + McpService.WithRawResponse { + + private val servers: ServerService.WithRawResponse by lazy { + ServerServiceImpl.WithRawResponseImpl(clientOptions) + } + + override fun withOptions( + modifier: Consumer + ): McpService.WithRawResponse = + McpServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + /** MCP */ + override fun servers(): ServerService.WithRawResponse = servers + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/OAuthService.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/OAuthService.kt new file mode 100644 index 0000000..5452d5b --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/OAuthService.kt @@ -0,0 +1,211 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.blocking + +import com.google.errorprone.annotations.MustBeClosed +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.http.HttpResponseFor +import com.scalar.models.oAuth.OAuthOauthAuthorizationServerMetadataParams +import com.scalar.models.oAuth.OAuthOauthAuthorizeParams +import com.scalar.models.oAuth.OAuthOauthRevokeParams +import com.scalar.models.oAuth.OAuthOauthTokenParams +import com.scalar.models.oAuth.OAuthOauthTokenResponse +import com.scalar.models.oAuth.OauthAuthorizationServerMetadata +import com.scalar.models.oAuth.OauthError +import java.util.function.Consumer + +/** OAuth */ +interface OAuthService { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): OAuthService + + /** + * Discovery document for OAuth clients (RFC 8414): where the endpoints are and what they + * support. + */ + fun oauthAuthorizationServerMetadata(): OauthAuthorizationServerMetadata = + oauthAuthorizationServerMetadata(OAuthOauthAuthorizationServerMetadataParams.none()) + + /** @see oauthAuthorizationServerMetadata */ + fun oauthAuthorizationServerMetadata( + params: OAuthOauthAuthorizationServerMetadataParams = + OAuthOauthAuthorizationServerMetadataParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): OauthAuthorizationServerMetadata + + /** @see oauthAuthorizationServerMetadata */ + fun oauthAuthorizationServerMetadata( + params: OAuthOauthAuthorizationServerMetadataParams + ): OauthAuthorizationServerMetadata = + oauthAuthorizationServerMetadata(params, RequestOptions.none()) + + /** @see oauthAuthorizationServerMetadata */ + fun oauthAuthorizationServerMetadata( + requestOptions: RequestOptions + ): OauthAuthorizationServerMetadata = + oauthAuthorizationServerMetadata( + OAuthOauthAuthorizationServerMetadataParams.none(), + requestOptions, + ) + + /** + * Authorization endpoint (RFC 6749 §4.1.1 with PKCE, RFC 7636). Validates the request and sends + * the user to the Scalar dashboard to approve it; the user returns to `redirect_uri` with a + * `code` to exchange at the token endpoint. Only `response_type=code` with + * `code_challenge_method=S256` is supported. + */ + fun oauthAuthorize(): Any? = oauthAuthorize(OAuthOauthAuthorizeParams.none()) + + /** @see oauthAuthorize */ + fun oauthAuthorize( + params: OAuthOauthAuthorizeParams = OAuthOauthAuthorizeParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? + + /** @see oauthAuthorize */ + fun oauthAuthorize(params: OAuthOauthAuthorizeParams): Any? = + oauthAuthorize(params, RequestOptions.none()) + + /** @see oauthAuthorize */ + fun oauthAuthorize(requestOptions: RequestOptions): Any? = + oauthAuthorize(OAuthOauthAuthorizeParams.none(), requestOptions) + + /** + * Revocation endpoint (RFC 7009). Revokes the refresh token and every token issued alongside + * it. The client authenticates as it does at the token endpoint. Responds 200 whether or not + * the token was live, as the RFC requires. + */ + fun oauthRevoke(params: OAuthOauthRevokeParams): OauthError? = + oauthRevoke(params, RequestOptions.none()) + + /** @see oauthRevoke */ + fun oauthRevoke( + params: OAuthOauthRevokeParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): OauthError? + + /** + * Token endpoint (RFC 6749 §4.1.3 and §6). Accepts `application/x-www-form-urlencoded`. + * Confidential clients authenticate with HTTP Basic or `client_secret` in the body; public + * clients send `client_id` alone. The `authorization_code` grant needs `code`, `redirect_uri` + * and `code_verifier`; the `refresh_token` grant needs `refresh_token` and may narrow `scope`. + */ + fun oauthToken(params: OAuthOauthTokenParams): OAuthOauthTokenResponse = + oauthToken(params, RequestOptions.none()) + + /** @see oauthToken */ + fun oauthToken( + params: OAuthOauthTokenParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): OAuthOauthTokenResponse + + /** A view of [OAuthService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): OAuthService.WithRawResponse + + /** + * Returns a raw HTTP response for `get /.well-known/oauth-authorization-server`, but is + * otherwise the same as [OAuthService.oauthAuthorizationServerMetadata]. + */ + @MustBeClosed + fun oauthAuthorizationServerMetadata(): HttpResponseFor = + oauthAuthorizationServerMetadata(OAuthOauthAuthorizationServerMetadataParams.none()) + + /** @see oauthAuthorizationServerMetadata */ + @MustBeClosed + fun oauthAuthorizationServerMetadata( + params: OAuthOauthAuthorizationServerMetadataParams = + OAuthOauthAuthorizationServerMetadataParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see oauthAuthorizationServerMetadata */ + @MustBeClosed + fun oauthAuthorizationServerMetadata( + params: OAuthOauthAuthorizationServerMetadataParams + ): HttpResponseFor = + oauthAuthorizationServerMetadata(params, RequestOptions.none()) + + /** @see oauthAuthorizationServerMetadata */ + @MustBeClosed + fun oauthAuthorizationServerMetadata( + requestOptions: RequestOptions + ): HttpResponseFor = + oauthAuthorizationServerMetadata( + OAuthOauthAuthorizationServerMetadataParams.none(), + requestOptions, + ) + + /** + * Returns a raw HTTP response for `get /v1/oauth/authorize`, but is otherwise the same as + * [OAuthService.oauthAuthorize]. + */ + @MustBeClosed + fun oauthAuthorize(): HttpResponseFor = + oauthAuthorize(OAuthOauthAuthorizeParams.none()) + + /** @see oauthAuthorize */ + @MustBeClosed + fun oauthAuthorize( + params: OAuthOauthAuthorizeParams = OAuthOauthAuthorizeParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see oauthAuthorize */ + @MustBeClosed + fun oauthAuthorize(params: OAuthOauthAuthorizeParams): HttpResponseFor = + oauthAuthorize(params, RequestOptions.none()) + + /** @see oauthAuthorize */ + @MustBeClosed + fun oauthAuthorize(requestOptions: RequestOptions): HttpResponseFor = + oauthAuthorize(OAuthOauthAuthorizeParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `post /v1/oauth/revoke`, but is otherwise the same as + * [OAuthService.oauthRevoke]. + */ + @MustBeClosed + fun oauthRevoke(params: OAuthOauthRevokeParams): HttpResponseFor = + oauthRevoke(params, RequestOptions.none()) + + /** @see oauthRevoke */ + @MustBeClosed + fun oauthRevoke( + params: OAuthOauthRevokeParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `post /v1/oauth/token`, but is otherwise the same as + * [OAuthService.oauthToken]. + */ + @MustBeClosed + fun oauthToken(params: OAuthOauthTokenParams): HttpResponseFor = + oauthToken(params, RequestOptions.none()) + + /** @see oauthToken */ + @MustBeClosed + fun oauthToken( + params: OAuthOauthTokenParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/OAuthServiceImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/OAuthServiceImpl.kt new file mode 100644 index 0000000..bf2c8a9 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/OAuthServiceImpl.kt @@ -0,0 +1,186 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.blocking + +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.handlers.errorBodyHandler +import com.scalar.core.handlers.errorHandler +import com.scalar.core.handlers.jsonHandler +import com.scalar.core.http.HttpMethod +import com.scalar.core.http.HttpRequest +import com.scalar.core.http.HttpResponse +import com.scalar.core.http.HttpResponse.Handler +import com.scalar.core.http.HttpResponseFor +import com.scalar.core.http.json +import com.scalar.core.http.parseable +import com.scalar.core.prepare +import com.scalar.models.oAuth.OAuthOauthAuthorizationServerMetadataParams +import com.scalar.models.oAuth.OAuthOauthAuthorizeParams +import com.scalar.models.oAuth.OAuthOauthRevokeParams +import com.scalar.models.oAuth.OAuthOauthTokenParams +import com.scalar.models.oAuth.OAuthOauthTokenResponse +import com.scalar.models.oAuth.OauthAuthorizationServerMetadata +import com.scalar.models.oAuth.OauthError +import java.util.function.Consumer + +/** OAuth */ +class OAuthServiceImpl internal constructor(private val clientOptions: ClientOptions) : + OAuthService { + + private val withRawResponse: OAuthService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): OAuthService.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): OAuthService = + OAuthServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun oauthAuthorizationServerMetadata( + params: OAuthOauthAuthorizationServerMetadataParams, + requestOptions: RequestOptions, + ): OauthAuthorizationServerMetadata = + // get /.well-known/oauth-authorization-server + withRawResponse().oauthAuthorizationServerMetadata(params, requestOptions).parse() + + override fun oauthAuthorize( + params: OAuthOauthAuthorizeParams, + requestOptions: RequestOptions, + ): Any? = + // get /v1/oauth/authorize + withRawResponse().oauthAuthorize(params, requestOptions).parse() + + override fun oauthRevoke( + params: OAuthOauthRevokeParams, + requestOptions: RequestOptions, + ): OauthError? = + // post /v1/oauth/revoke + withRawResponse().oauthRevoke(params, requestOptions).parse() + + override fun oauthToken( + params: OAuthOauthTokenParams, + requestOptions: RequestOptions, + ): OAuthOauthTokenResponse = + // post /v1/oauth/token + withRawResponse().oauthToken(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + OAuthService.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): OAuthService.WithRawResponse = + OAuthServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val oauthAuthorizationServerMetadataHandler: + Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun oauthAuthorizationServerMetadata( + params: OAuthOauthAuthorizationServerMetadataParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments(".well-known", "oauth-authorization-server") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { oauthAuthorizationServerMetadataHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val oauthAuthorizeHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun oauthAuthorize( + params: OAuthOauthAuthorizeParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "oauth", "authorize") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response.use { oauthAuthorizeHandler.handle(it) } + } + } + + private val oauthRevokeHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun oauthRevoke( + params: OAuthOauthRevokeParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "oauth", "revoke") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { oauthRevokeHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it?.validate() + } + } + } + } + + private val oauthTokenHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun oauthToken( + params: OAuthOauthTokenParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "oauth", "token") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { oauthTokenHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/RegistryService.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/RegistryService.kt index 709bbc2..ed6288c 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/RegistryService.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/RegistryService.kt @@ -7,6 +7,7 @@ import com.scalar.core.ClientOptions import com.scalar.core.RequestOptions import com.scalar.core.http.HttpResponseFor import com.scalar.models.ManagedDocVersion +import com.scalar.models.registry.ApiDocument import com.scalar.models.registry.RegistryCreateApiDocumentAccessGroupParams import com.scalar.models.registry.RegistryCreateApiDocumentParams import com.scalar.models.registry.RegistryCreateApiDocumentResponse @@ -15,10 +16,8 @@ import com.scalar.models.registry.RegistryDeleteApiDocumentAccessGroupParams import com.scalar.models.registry.RegistryDeleteApiDocumentParams import com.scalar.models.registry.RegistryDeleteApiDocumentVersionParams import com.scalar.models.registry.RegistryListAllApiDocumentsParams -import com.scalar.models.registry.RegistryListAllApiDocumentsResponse import com.scalar.models.registry.RegistryListApiDocumentVersionMetadataParams import com.scalar.models.registry.RegistryListApiDocumentsParams -import com.scalar.models.registry.RegistryListApiDocumentsResponse import com.scalar.models.registry.RegistryRetrieveApiDocumentVersionParams import com.scalar.models.registry.RegistryUpdateApiDocumentParams import com.scalar.models.registry.RegistryUpdateApiDocumentVersionParams @@ -182,25 +181,21 @@ interface RegistryService { deleteApiDocumentVersion(params, RequestOptions.none()) /** List all API documents across every namespace the caller can access. */ - fun listAllApiDocuments(): List = + fun listAllApiDocuments(): List = listAllApiDocuments(RegistryListAllApiDocumentsParams.none()) /** @see listAllApiDocuments */ fun listAllApiDocuments( params: RegistryListAllApiDocumentsParams = RegistryListAllApiDocumentsParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): List + ): List /** @see listAllApiDocuments */ - fun listAllApiDocuments( - params: RegistryListAllApiDocumentsParams - ): List = + fun listAllApiDocuments(params: RegistryListAllApiDocumentsParams): List = listAllApiDocuments(params, RequestOptions.none()) /** @see listAllApiDocuments */ - fun listAllApiDocuments( - requestOptions: RequestOptions - ): List = + fun listAllApiDocuments(requestOptions: RequestOptions): List = listAllApiDocuments(RegistryListAllApiDocumentsParams.none(), requestOptions) /** Get metadata (uid, content shas, version sha, tags) for a specific API document version. */ @@ -229,7 +224,7 @@ interface RegistryService { ): ManagedDocVersion = listApiDocumentVersionMetadata(params, RequestOptions.none()) /** List API documents in a namespace. */ - fun listApiDocuments(namespace: String): List = + fun listApiDocuments(namespace: String): List = listApiDocuments(namespace, RegistryListApiDocumentsParams.none()) /** @see listApiDocuments */ @@ -237,32 +232,27 @@ interface RegistryService { namespace: String, params: RegistryListApiDocumentsParams = RegistryListApiDocumentsParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): List = + ): List = listApiDocuments(params.toBuilder().namespace(namespace).build(), requestOptions) /** @see listApiDocuments */ fun listApiDocuments( namespace: String, params: RegistryListApiDocumentsParams, - ): List = - listApiDocuments(namespace, params, RequestOptions.none()) + ): List = listApiDocuments(namespace, params, RequestOptions.none()) /** @see listApiDocuments */ fun listApiDocuments( params: RegistryListApiDocumentsParams, requestOptions: RequestOptions = RequestOptions.none(), - ): List + ): List /** @see listApiDocuments */ - fun listApiDocuments( - params: RegistryListApiDocumentsParams - ): List = listApiDocuments(params, RequestOptions.none()) + fun listApiDocuments(params: RegistryListApiDocumentsParams): List = + listApiDocuments(params, RequestOptions.none()) /** @see listApiDocuments */ - fun listApiDocuments( - namespace: String, - requestOptions: RequestOptions, - ): List = + fun listApiDocuments(namespace: String, requestOptions: RequestOptions): List = listApiDocuments(namespace, RegistryListApiDocumentsParams.none(), requestOptions) /** Get a specific API document version. */ @@ -547,7 +537,7 @@ interface RegistryService { * [RegistryService.listAllApiDocuments]. */ @MustBeClosed - fun listAllApiDocuments(): HttpResponseFor> = + fun listAllApiDocuments(): HttpResponseFor> = listAllApiDocuments(RegistryListAllApiDocumentsParams.none()) /** @see listAllApiDocuments */ @@ -555,20 +545,19 @@ interface RegistryService { fun listAllApiDocuments( params: RegistryListAllApiDocumentsParams = RegistryListAllApiDocumentsParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor> + ): HttpResponseFor> /** @see listAllApiDocuments */ @MustBeClosed fun listAllApiDocuments( params: RegistryListAllApiDocumentsParams - ): HttpResponseFor> = - listAllApiDocuments(params, RequestOptions.none()) + ): HttpResponseFor> = listAllApiDocuments(params, RequestOptions.none()) /** @see listAllApiDocuments */ @MustBeClosed fun listAllApiDocuments( requestOptions: RequestOptions - ): HttpResponseFor> = + ): HttpResponseFor> = listAllApiDocuments(RegistryListAllApiDocumentsParams.none(), requestOptions) /** @@ -614,9 +603,7 @@ interface RegistryService { * [RegistryService.listApiDocuments]. */ @MustBeClosed - fun listApiDocuments( - namespace: String - ): HttpResponseFor> = + fun listApiDocuments(namespace: String): HttpResponseFor> = listApiDocuments(namespace, RegistryListApiDocumentsParams.none()) /** @see listApiDocuments */ @@ -625,7 +612,7 @@ interface RegistryService { namespace: String, params: RegistryListApiDocumentsParams = RegistryListApiDocumentsParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor> = + ): HttpResponseFor> = listApiDocuments(params.toBuilder().namespace(namespace).build(), requestOptions) /** @see listApiDocuments */ @@ -633,7 +620,7 @@ interface RegistryService { fun listApiDocuments( namespace: String, params: RegistryListApiDocumentsParams, - ): HttpResponseFor> = + ): HttpResponseFor> = listApiDocuments(namespace, params, RequestOptions.none()) /** @see listApiDocuments */ @@ -641,21 +628,20 @@ interface RegistryService { fun listApiDocuments( params: RegistryListApiDocumentsParams, requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor> + ): HttpResponseFor> /** @see listApiDocuments */ @MustBeClosed fun listApiDocuments( params: RegistryListApiDocumentsParams - ): HttpResponseFor> = - listApiDocuments(params, RequestOptions.none()) + ): HttpResponseFor> = listApiDocuments(params, RequestOptions.none()) /** @see listApiDocuments */ @MustBeClosed fun listApiDocuments( namespace: String, requestOptions: RequestOptions, - ): HttpResponseFor> = + ): HttpResponseFor> = listApiDocuments(namespace, RegistryListApiDocumentsParams.none(), requestOptions) /** diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/RegistryServiceImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/RegistryServiceImpl.kt index 997e995..cb80a03 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/RegistryServiceImpl.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/RegistryServiceImpl.kt @@ -18,6 +18,7 @@ import com.scalar.core.http.json import com.scalar.core.http.parseable import com.scalar.core.prepare import com.scalar.models.ManagedDocVersion +import com.scalar.models.registry.ApiDocument import com.scalar.models.registry.RegistryCreateApiDocumentAccessGroupParams import com.scalar.models.registry.RegistryCreateApiDocumentParams import com.scalar.models.registry.RegistryCreateApiDocumentResponse @@ -26,10 +27,8 @@ import com.scalar.models.registry.RegistryDeleteApiDocumentAccessGroupParams import com.scalar.models.registry.RegistryDeleteApiDocumentParams import com.scalar.models.registry.RegistryDeleteApiDocumentVersionParams import com.scalar.models.registry.RegistryListAllApiDocumentsParams -import com.scalar.models.registry.RegistryListAllApiDocumentsResponse import com.scalar.models.registry.RegistryListApiDocumentVersionMetadataParams import com.scalar.models.registry.RegistryListApiDocumentsParams -import com.scalar.models.registry.RegistryListApiDocumentsResponse import com.scalar.models.registry.RegistryRetrieveApiDocumentVersionParams import com.scalar.models.registry.RegistryUpdateApiDocumentParams import com.scalar.models.registry.RegistryUpdateApiDocumentVersionParams @@ -95,7 +94,7 @@ class RegistryServiceImpl internal constructor(private val clientOptions: Client override fun listAllApiDocuments( params: RegistryListAllApiDocumentsParams, requestOptions: RequestOptions, - ): List = + ): List = // get /v1/apis withRawResponse().listAllApiDocuments(params, requestOptions).parse() @@ -109,7 +108,7 @@ class RegistryServiceImpl internal constructor(private val clientOptions: Client override fun listApiDocuments( params: RegistryListApiDocumentsParams, requestOptions: RequestOptions, - ): List = + ): List = // get /v1/apis/{namespace} withRawResponse().listApiDocuments(params, requestOptions).parse() @@ -334,13 +333,13 @@ class RegistryServiceImpl internal constructor(private val clientOptions: Client } } - private val listAllApiDocumentsHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper) + private val listAllApiDocumentsHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) override fun listAllApiDocuments( params: RegistryListAllApiDocumentsParams, requestOptions: RequestOptions, - ): HttpResponseFor> { + ): HttpResponseFor> { val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -399,13 +398,13 @@ class RegistryServiceImpl internal constructor(private val clientOptions: Client } } - private val listApiDocumentsHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper) + private val listApiDocumentsHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) override fun listApiDocuments( params: RegistryListApiDocumentsParams, requestOptions: RequestOptions, - ): HttpResponseFor> { + ): HttpResponseFor> { // We check here instead of in the params builder because this can be specified // positionally or in the params class. checkRequired("namespace", params.namespace().getOrNull()) diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/RuleService.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/RuleService.kt index c1baa3e..4d0f7ab 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/RuleService.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/RuleService.kt @@ -7,12 +7,12 @@ import com.scalar.core.ClientOptions import com.scalar.core.RequestOptions import com.scalar.core.http.HttpResponseFor import com.scalar.models.Uid +import com.scalar.models.rules.Rule import com.scalar.models.rules.RuleCreateRulesetAccessGroupParams import com.scalar.models.rules.RuleCreateRulesetParams import com.scalar.models.rules.RuleDeleteRulesetAccessGroupParams import com.scalar.models.rules.RuleDeleteRulesetParams import com.scalar.models.rules.RuleListRulesetsParams -import com.scalar.models.rules.RuleListRulesetsResponse import com.scalar.models.rules.RuleRetrieveRulesetDocumentParams import com.scalar.models.rules.RuleUpdateRulesetParams import java.util.function.Consumer @@ -117,7 +117,7 @@ interface RuleService { deleteRulesetAccessGroup(params, RequestOptions.none()) /** List all rulesets in a namespace. */ - fun listRulesets(namespace: String): List = + fun listRulesets(namespace: String): List = listRulesets(namespace, RuleListRulesetsParams.none()) /** @see listRulesets */ @@ -125,30 +125,24 @@ interface RuleService { namespace: String, params: RuleListRulesetsParams = RuleListRulesetsParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): List = - listRulesets(params.toBuilder().namespace(namespace).build(), requestOptions) + ): List = listRulesets(params.toBuilder().namespace(namespace).build(), requestOptions) /** @see listRulesets */ - fun listRulesets( - namespace: String, - params: RuleListRulesetsParams, - ): List = listRulesets(namespace, params, RequestOptions.none()) + fun listRulesets(namespace: String, params: RuleListRulesetsParams): List = + listRulesets(namespace, params, RequestOptions.none()) /** @see listRulesets */ fun listRulesets( params: RuleListRulesetsParams, requestOptions: RequestOptions = RequestOptions.none(), - ): List + ): List /** @see listRulesets */ - fun listRulesets(params: RuleListRulesetsParams): List = + fun listRulesets(params: RuleListRulesetsParams): List = listRulesets(params, RequestOptions.none()) /** @see listRulesets */ - fun listRulesets( - namespace: String, - requestOptions: RequestOptions, - ): List = + fun listRulesets(namespace: String, requestOptions: RequestOptions): List = listRulesets(namespace, RuleListRulesetsParams.none(), requestOptions) /** Get a rule document by slug. */ @@ -332,7 +326,7 @@ interface RuleService { * as [RuleService.listRulesets]. */ @MustBeClosed - fun listRulesets(namespace: String): HttpResponseFor> = + fun listRulesets(namespace: String): HttpResponseFor> = listRulesets(namespace, RuleListRulesetsParams.none()) /** @see listRulesets */ @@ -341,7 +335,7 @@ interface RuleService { namespace: String, params: RuleListRulesetsParams = RuleListRulesetsParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor> = + ): HttpResponseFor> = listRulesets(params.toBuilder().namespace(namespace).build(), requestOptions) /** @see listRulesets */ @@ -349,21 +343,18 @@ interface RuleService { fun listRulesets( namespace: String, params: RuleListRulesetsParams, - ): HttpResponseFor> = - listRulesets(namespace, params, RequestOptions.none()) + ): HttpResponseFor> = listRulesets(namespace, params, RequestOptions.none()) /** @see listRulesets */ @MustBeClosed fun listRulesets( params: RuleListRulesetsParams, requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor> + ): HttpResponseFor> /** @see listRulesets */ @MustBeClosed - fun listRulesets( - params: RuleListRulesetsParams - ): HttpResponseFor> = + fun listRulesets(params: RuleListRulesetsParams): HttpResponseFor> = listRulesets(params, RequestOptions.none()) /** @see listRulesets */ @@ -371,7 +362,7 @@ interface RuleService { fun listRulesets( namespace: String, requestOptions: RequestOptions, - ): HttpResponseFor> = + ): HttpResponseFor> = listRulesets(namespace, RuleListRulesetsParams.none(), requestOptions) /** diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/RuleServiceImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/RuleServiceImpl.kt index 66943ca..c5dc897 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/RuleServiceImpl.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/RuleServiceImpl.kt @@ -18,12 +18,12 @@ import com.scalar.core.http.json import com.scalar.core.http.parseable import com.scalar.core.prepare import com.scalar.models.Uid +import com.scalar.models.rules.Rule import com.scalar.models.rules.RuleCreateRulesetAccessGroupParams import com.scalar.models.rules.RuleCreateRulesetParams import com.scalar.models.rules.RuleDeleteRulesetAccessGroupParams import com.scalar.models.rules.RuleDeleteRulesetParams import com.scalar.models.rules.RuleListRulesetsParams -import com.scalar.models.rules.RuleListRulesetsResponse import com.scalar.models.rules.RuleRetrieveRulesetDocumentParams import com.scalar.models.rules.RuleUpdateRulesetParams import java.util.function.Consumer @@ -72,7 +72,7 @@ class RuleServiceImpl internal constructor(private val clientOptions: ClientOpti override fun listRulesets( params: RuleListRulesetsParams, requestOptions: RequestOptions, - ): List = + ): List = // get /v1/rulesets/{namespace} withRawResponse().listRulesets(params, requestOptions).parse() @@ -220,13 +220,13 @@ class RuleServiceImpl internal constructor(private val clientOptions: ClientOpti } } - private val listRulesetsHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper) + private val listRulesetsHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) override fun listRulesets( params: RuleListRulesetsParams, requestOptions: RequestOptions, - ): HttpResponseFor> { + ): HttpResponseFor> { // We check here instead of in the params builder because this can be specified // positionally or in the params class. checkRequired("namespace", params.namespace().getOrNull()) diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/ScalarDocService.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/ScalarDocService.kt index 3a5cf49..2c94961 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/ScalarDocService.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/ScalarDocService.kt @@ -6,12 +6,29 @@ import com.google.errorprone.annotations.MustBeClosed import com.scalar.core.ClientOptions import com.scalar.core.RequestOptions import com.scalar.core.http.HttpResponseFor +import com.scalar.models.scalarDocs.DocsProject +import com.scalar.models.scalarDocs.GithubProject import com.scalar.models.scalarDocs.ScalarDocCreateGuideParams import com.scalar.models.scalarDocs.ScalarDocCreateGuideResponse +import com.scalar.models.scalarDocs.ScalarDocCreateProjectParams +import com.scalar.models.scalarDocs.ScalarDocDeleteProjectParams import com.scalar.models.scalarDocs.ScalarDocListGuidesParams -import com.scalar.models.scalarDocs.ScalarDocListGuidesResponse +import com.scalar.models.scalarDocs.ScalarDocListProjectConfigParams +import com.scalar.models.scalarDocs.ScalarDocListProjectConfigResponse +import com.scalar.models.scalarDocs.ScalarDocListProjectDomainParams +import com.scalar.models.scalarDocs.ScalarDocListProjectDomainResponse +import com.scalar.models.scalarDocs.ScalarDocListProjectDomainStatusParams +import com.scalar.models.scalarDocs.ScalarDocListProjectDomainStatusResponse +import com.scalar.models.scalarDocs.ScalarDocListProjectsParams +import com.scalar.models.scalarDocs.ScalarDocListProjectsResponse import com.scalar.models.scalarDocs.ScalarDocPublishGuideParams import com.scalar.models.scalarDocs.ScalarDocPublishGuideResponse +import com.scalar.models.scalarDocs.ScalarDocPublishProjectParams +import com.scalar.models.scalarDocs.ScalarDocPublishProjectResponse +import com.scalar.models.scalarDocs.ScalarDocRetrieveProjectParams +import com.scalar.models.scalarDocs.ScalarDocUpdateProjectConfigParams +import com.scalar.models.scalarDocs.ScalarDocUpdateProjectConfigResponse +import com.scalar.models.scalarDocs.ScalarDocUpdateProjectParams import java.util.function.Consumer /** Scalar Docs */ @@ -39,24 +56,197 @@ interface ScalarDocService { requestOptions: RequestOptions = RequestOptions.none(), ): ScalarDocCreateGuideResponse + /** Create a docs project. Omit `provider` to have Scalar host the repository. */ + fun createProject(params: ScalarDocCreateProjectParams): DocsProject = + createProject(params, RequestOptions.none()) + + /** @see createProject */ + fun createProject( + params: ScalarDocCreateProjectParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): DocsProject + + /** Delete a docs project, its deploys, its publish records and its cached builds. */ + fun deleteProject(slug: String): Any? = deleteProject(slug, ScalarDocDeleteProjectParams.none()) + + /** @see deleteProject */ + fun deleteProject( + slug: String, + params: ScalarDocDeleteProjectParams = ScalarDocDeleteProjectParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? = deleteProject(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see deleteProject */ + fun deleteProject(slug: String, params: ScalarDocDeleteProjectParams): Any? = + deleteProject(slug, params, RequestOptions.none()) + + /** @see deleteProject */ + fun deleteProject( + params: ScalarDocDeleteProjectParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? + + /** @see deleteProject */ + fun deleteProject(params: ScalarDocDeleteProjectParams): Any? = + deleteProject(params, RequestOptions.none()) + + /** @see deleteProject */ + fun deleteProject(slug: String, requestOptions: RequestOptions): Any? = + deleteProject(slug, ScalarDocDeleteProjectParams.none(), requestOptions) + /** List all guide projects. */ - fun listGuides(): List = - listGuides(ScalarDocListGuidesParams.none()) + fun listGuides(): List = listGuides(ScalarDocListGuidesParams.none()) /** @see listGuides */ fun listGuides( params: ScalarDocListGuidesParams = ScalarDocListGuidesParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): List + ): List /** @see listGuides */ - fun listGuides(params: ScalarDocListGuidesParams): List = + fun listGuides(params: ScalarDocListGuidesParams): List = listGuides(params, RequestOptions.none()) /** @see listGuides */ - fun listGuides(requestOptions: RequestOptions): List = + fun listGuides(requestOptions: RequestOptions): List = listGuides(ScalarDocListGuidesParams.none(), requestOptions) + /** + * Read `scalar.config.json` straight from the project repository, without cloning it. + * `baseToken` is the compare-and-swap handle for a later write. + */ + fun listProjectConfig(slug: String): ScalarDocListProjectConfigResponse = + listProjectConfig(slug, ScalarDocListProjectConfigParams.none()) + + /** @see listProjectConfig */ + fun listProjectConfig( + slug: String, + params: ScalarDocListProjectConfigParams = ScalarDocListProjectConfigParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): ScalarDocListProjectConfigResponse = + listProjectConfig(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see listProjectConfig */ + fun listProjectConfig( + slug: String, + params: ScalarDocListProjectConfigParams, + ): ScalarDocListProjectConfigResponse = listProjectConfig(slug, params, RequestOptions.none()) + + /** @see listProjectConfig */ + fun listProjectConfig( + params: ScalarDocListProjectConfigParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): ScalarDocListProjectConfigResponse + + /** @see listProjectConfig */ + fun listProjectConfig( + params: ScalarDocListProjectConfigParams + ): ScalarDocListProjectConfigResponse = listProjectConfig(params, RequestOptions.none()) + + /** @see listProjectConfig */ + fun listProjectConfig( + slug: String, + requestOptions: RequestOptions, + ): ScalarDocListProjectConfigResponse = + listProjectConfig(slug, ScalarDocListProjectConfigParams.none(), requestOptions) + + /** The domains the project serves on — the Scalar-hosted one and the custom one, when set. */ + fun listProjectDomain(slug: String): ScalarDocListProjectDomainResponse = + listProjectDomain(slug, ScalarDocListProjectDomainParams.none()) + + /** @see listProjectDomain */ + fun listProjectDomain( + slug: String, + params: ScalarDocListProjectDomainParams = ScalarDocListProjectDomainParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): ScalarDocListProjectDomainResponse = + listProjectDomain(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see listProjectDomain */ + fun listProjectDomain( + slug: String, + params: ScalarDocListProjectDomainParams, + ): ScalarDocListProjectDomainResponse = listProjectDomain(slug, params, RequestOptions.none()) + + /** @see listProjectDomain */ + fun listProjectDomain( + params: ScalarDocListProjectDomainParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): ScalarDocListProjectDomainResponse + + /** @see listProjectDomain */ + fun listProjectDomain( + params: ScalarDocListProjectDomainParams + ): ScalarDocListProjectDomainResponse = listProjectDomain(params, RequestOptions.none()) + + /** @see listProjectDomain */ + fun listProjectDomain( + slug: String, + requestOptions: RequestOptions, + ): ScalarDocListProjectDomainResponse = + listProjectDomain(slug, ScalarDocListProjectDomainParams.none(), requestOptions) + + /** + * Whether the project custom domain points at Scalar yet. `expected` is the CNAME record to + * create; `found` is what resolves today. A project with no custom domain reports `verified` + * with no expected record, because Scalar serves its own subdomain directly. + */ + fun listProjectDomainStatus(slug: String): ScalarDocListProjectDomainStatusResponse = + listProjectDomainStatus(slug, ScalarDocListProjectDomainStatusParams.none()) + + /** @see listProjectDomainStatus */ + fun listProjectDomainStatus( + slug: String, + params: ScalarDocListProjectDomainStatusParams = + ScalarDocListProjectDomainStatusParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): ScalarDocListProjectDomainStatusResponse = + listProjectDomainStatus(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see listProjectDomainStatus */ + fun listProjectDomainStatus( + slug: String, + params: ScalarDocListProjectDomainStatusParams, + ): ScalarDocListProjectDomainStatusResponse = + listProjectDomainStatus(slug, params, RequestOptions.none()) + + /** @see listProjectDomainStatus */ + fun listProjectDomainStatus( + params: ScalarDocListProjectDomainStatusParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): ScalarDocListProjectDomainStatusResponse + + /** @see listProjectDomainStatus */ + fun listProjectDomainStatus( + params: ScalarDocListProjectDomainStatusParams + ): ScalarDocListProjectDomainStatusResponse = + listProjectDomainStatus(params, RequestOptions.none()) + + /** @see listProjectDomainStatus */ + fun listProjectDomainStatus( + slug: String, + requestOptions: RequestOptions, + ): ScalarDocListProjectDomainStatusResponse = + listProjectDomainStatus(slug, ScalarDocListProjectDomainStatusParams.none(), requestOptions) + + /** List every docs project on the team. */ + fun listProjects(): ScalarDocListProjectsResponse = + listProjects(ScalarDocListProjectsParams.none()) + + /** @see listProjects */ + fun listProjects( + params: ScalarDocListProjectsParams = ScalarDocListProjectsParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): ScalarDocListProjectsResponse + + /** @see listProjects */ + fun listProjects(params: ScalarDocListProjectsParams): ScalarDocListProjectsResponse = + listProjects(params, RequestOptions.none()) + + /** @see listProjects */ + fun listProjects(requestOptions: RequestOptions): ScalarDocListProjectsResponse = + listProjects(ScalarDocListProjectsParams.none(), requestOptions) + /** Start a new publish process. */ fun publishGuide(slug: String): ScalarDocPublishGuideResponse = publishGuide(slug, ScalarDocPublishGuideParams.none()) @@ -89,6 +279,129 @@ interface ScalarDocService { fun publishGuide(slug: String, requestOptions: RequestOptions): ScalarDocPublishGuideResponse = publishGuide(slug, ScalarDocPublishGuideParams.none(), requestOptions) + /** Start a build and deploy. The returned `publishUid` identifies the publish record. */ + fun publishProject(slug: String): ScalarDocPublishProjectResponse = + publishProject(slug, ScalarDocPublishProjectParams.none()) + + /** @see publishProject */ + fun publishProject( + slug: String, + params: ScalarDocPublishProjectParams = ScalarDocPublishProjectParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): ScalarDocPublishProjectResponse = + publishProject(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see publishProject */ + fun publishProject( + slug: String, + params: ScalarDocPublishProjectParams, + ): ScalarDocPublishProjectResponse = publishProject(slug, params, RequestOptions.none()) + + /** @see publishProject */ + fun publishProject( + params: ScalarDocPublishProjectParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): ScalarDocPublishProjectResponse + + /** @see publishProject */ + fun publishProject(params: ScalarDocPublishProjectParams): ScalarDocPublishProjectResponse = + publishProject(params, RequestOptions.none()) + + /** @see publishProject */ + fun publishProject( + slug: String, + requestOptions: RequestOptions, + ): ScalarDocPublishProjectResponse = + publishProject(slug, ScalarDocPublishProjectParams.none(), requestOptions) + + /** Get a single docs project by its slug. */ + fun retrieveProject(slug: String): DocsProject = + retrieveProject(slug, ScalarDocRetrieveProjectParams.none()) + + /** @see retrieveProject */ + fun retrieveProject( + slug: String, + params: ScalarDocRetrieveProjectParams = ScalarDocRetrieveProjectParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): DocsProject = retrieveProject(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see retrieveProject */ + fun retrieveProject(slug: String, params: ScalarDocRetrieveProjectParams): DocsProject = + retrieveProject(slug, params, RequestOptions.none()) + + /** @see retrieveProject */ + fun retrieveProject( + params: ScalarDocRetrieveProjectParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): DocsProject + + /** @see retrieveProject */ + fun retrieveProject(params: ScalarDocRetrieveProjectParams): DocsProject = + retrieveProject(params, RequestOptions.none()) + + /** @see retrieveProject */ + fun retrieveProject(slug: String, requestOptions: RequestOptions): DocsProject = + retrieveProject(slug, ScalarDocRetrieveProjectParams.none(), requestOptions) + + /** + * Update project settings. Set `isPrivate` with `accessGroups` to put the site behind a login. + */ + fun updateProject(slug: String): Any? = updateProject(slug, ScalarDocUpdateProjectParams.none()) + + /** @see updateProject */ + fun updateProject( + slug: String, + params: ScalarDocUpdateProjectParams = ScalarDocUpdateProjectParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? = updateProject(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see updateProject */ + fun updateProject(slug: String, params: ScalarDocUpdateProjectParams): Any? = + updateProject(slug, params, RequestOptions.none()) + + /** @see updateProject */ + fun updateProject( + params: ScalarDocUpdateProjectParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? + + /** @see updateProject */ + fun updateProject(params: ScalarDocUpdateProjectParams): Any? = + updateProject(params, RequestOptions.none()) + + /** @see updateProject */ + fun updateProject(slug: String, requestOptions: RequestOptions): Any? = + updateProject(slug, ScalarDocUpdateProjectParams.none(), requestOptions) + + /** + * Commit `scalar.config.json` straight to the project repository. Pass the `baseToken` from the + * read this edit was based on; a conflict means the file moved underneath it. + */ + fun updateProjectConfig( + slug: String, + params: ScalarDocUpdateProjectConfigParams, + ): ScalarDocUpdateProjectConfigResponse = + updateProjectConfig(slug, params, RequestOptions.none()) + + /** @see updateProjectConfig */ + fun updateProjectConfig( + slug: String, + params: ScalarDocUpdateProjectConfigParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): ScalarDocUpdateProjectConfigResponse = + updateProjectConfig(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see updateProjectConfig */ + fun updateProjectConfig( + params: ScalarDocUpdateProjectConfigParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): ScalarDocUpdateProjectConfigResponse + + /** @see updateProjectConfig */ + fun updateProjectConfig( + params: ScalarDocUpdateProjectConfigParams + ): ScalarDocUpdateProjectConfigResponse = updateProjectConfig(params, RequestOptions.none()) + /** A view of [ScalarDocService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -116,12 +429,68 @@ interface ScalarDocService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** + * Returns a raw HTTP response for `post /v1/docs`, but is otherwise the same as + * [ScalarDocService.createProject]. + */ + @MustBeClosed + fun createProject(params: ScalarDocCreateProjectParams): HttpResponseFor = + createProject(params, RequestOptions.none()) + + /** @see createProject */ + @MustBeClosed + fun createProject( + params: ScalarDocCreateProjectParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `delete /v1/docs/{slug}`, but is otherwise the same as + * [ScalarDocService.deleteProject]. + */ + @MustBeClosed + fun deleteProject(slug: String): HttpResponseFor = + deleteProject(slug, ScalarDocDeleteProjectParams.none()) + + /** @see deleteProject */ + @MustBeClosed + fun deleteProject( + slug: String, + params: ScalarDocDeleteProjectParams = ScalarDocDeleteProjectParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + deleteProject(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see deleteProject */ + @MustBeClosed + fun deleteProject( + slug: String, + params: ScalarDocDeleteProjectParams, + ): HttpResponseFor = deleteProject(slug, params, RequestOptions.none()) + + /** @see deleteProject */ + @MustBeClosed + fun deleteProject( + params: ScalarDocDeleteProjectParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see deleteProject */ + @MustBeClosed + fun deleteProject(params: ScalarDocDeleteProjectParams): HttpResponseFor = + deleteProject(params, RequestOptions.none()) + + /** @see deleteProject */ + @MustBeClosed + fun deleteProject(slug: String, requestOptions: RequestOptions): HttpResponseFor = + deleteProject(slug, ScalarDocDeleteProjectParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get /v1/guides`, but is otherwise the same as * [ScalarDocService.listGuides]. */ @MustBeClosed - fun listGuides(): HttpResponseFor> = + fun listGuides(): HttpResponseFor> = listGuides(ScalarDocListGuidesParams.none()) /** @see listGuides */ @@ -129,22 +498,195 @@ interface ScalarDocService { fun listGuides( params: ScalarDocListGuidesParams = ScalarDocListGuidesParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor> + ): HttpResponseFor> /** @see listGuides */ @MustBeClosed - fun listGuides( - params: ScalarDocListGuidesParams - ): HttpResponseFor> = + fun listGuides(params: ScalarDocListGuidesParams): HttpResponseFor> = listGuides(params, RequestOptions.none()) /** @see listGuides */ @MustBeClosed - fun listGuides( - requestOptions: RequestOptions - ): HttpResponseFor> = + fun listGuides(requestOptions: RequestOptions): HttpResponseFor> = listGuides(ScalarDocListGuidesParams.none(), requestOptions) + /** + * Returns a raw HTTP response for `get /v1/docs/{slug}/config`, but is otherwise the same + * as [ScalarDocService.listProjectConfig]. + */ + @MustBeClosed + fun listProjectConfig(slug: String): HttpResponseFor = + listProjectConfig(slug, ScalarDocListProjectConfigParams.none()) + + /** @see listProjectConfig */ + @MustBeClosed + fun listProjectConfig( + slug: String, + params: ScalarDocListProjectConfigParams = ScalarDocListProjectConfigParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + listProjectConfig(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see listProjectConfig */ + @MustBeClosed + fun listProjectConfig( + slug: String, + params: ScalarDocListProjectConfigParams, + ): HttpResponseFor = + listProjectConfig(slug, params, RequestOptions.none()) + + /** @see listProjectConfig */ + @MustBeClosed + fun listProjectConfig( + params: ScalarDocListProjectConfigParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see listProjectConfig */ + @MustBeClosed + fun listProjectConfig( + params: ScalarDocListProjectConfigParams + ): HttpResponseFor = + listProjectConfig(params, RequestOptions.none()) + + /** @see listProjectConfig */ + @MustBeClosed + fun listProjectConfig( + slug: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + listProjectConfig(slug, ScalarDocListProjectConfigParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /v1/docs/{slug}/domain`, but is otherwise the same + * as [ScalarDocService.listProjectDomain]. + */ + @MustBeClosed + fun listProjectDomain(slug: String): HttpResponseFor = + listProjectDomain(slug, ScalarDocListProjectDomainParams.none()) + + /** @see listProjectDomain */ + @MustBeClosed + fun listProjectDomain( + slug: String, + params: ScalarDocListProjectDomainParams = ScalarDocListProjectDomainParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + listProjectDomain(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see listProjectDomain */ + @MustBeClosed + fun listProjectDomain( + slug: String, + params: ScalarDocListProjectDomainParams, + ): HttpResponseFor = + listProjectDomain(slug, params, RequestOptions.none()) + + /** @see listProjectDomain */ + @MustBeClosed + fun listProjectDomain( + params: ScalarDocListProjectDomainParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see listProjectDomain */ + @MustBeClosed + fun listProjectDomain( + params: ScalarDocListProjectDomainParams + ): HttpResponseFor = + listProjectDomain(params, RequestOptions.none()) + + /** @see listProjectDomain */ + @MustBeClosed + fun listProjectDomain( + slug: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + listProjectDomain(slug, ScalarDocListProjectDomainParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /v1/docs/{slug}/domain/status`, but is otherwise the + * same as [ScalarDocService.listProjectDomainStatus]. + */ + @MustBeClosed + fun listProjectDomainStatus( + slug: String + ): HttpResponseFor = + listProjectDomainStatus(slug, ScalarDocListProjectDomainStatusParams.none()) + + /** @see listProjectDomainStatus */ + @MustBeClosed + fun listProjectDomainStatus( + slug: String, + params: ScalarDocListProjectDomainStatusParams = + ScalarDocListProjectDomainStatusParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + listProjectDomainStatus(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see listProjectDomainStatus */ + @MustBeClosed + fun listProjectDomainStatus( + slug: String, + params: ScalarDocListProjectDomainStatusParams, + ): HttpResponseFor = + listProjectDomainStatus(slug, params, RequestOptions.none()) + + /** @see listProjectDomainStatus */ + @MustBeClosed + fun listProjectDomainStatus( + params: ScalarDocListProjectDomainStatusParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see listProjectDomainStatus */ + @MustBeClosed + fun listProjectDomainStatus( + params: ScalarDocListProjectDomainStatusParams + ): HttpResponseFor = + listProjectDomainStatus(params, RequestOptions.none()) + + /** @see listProjectDomainStatus */ + @MustBeClosed + fun listProjectDomainStatus( + slug: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + listProjectDomainStatus( + slug, + ScalarDocListProjectDomainStatusParams.none(), + requestOptions, + ) + + /** + * Returns a raw HTTP response for `get /v1/docs`, but is otherwise the same as + * [ScalarDocService.listProjects]. + */ + @MustBeClosed + fun listProjects(): HttpResponseFor = + listProjects(ScalarDocListProjectsParams.none()) + + /** @see listProjects */ + @MustBeClosed + fun listProjects( + params: ScalarDocListProjectsParams = ScalarDocListProjectsParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see listProjects */ + @MustBeClosed + fun listProjects( + params: ScalarDocListProjectsParams + ): HttpResponseFor = + listProjects(params, RequestOptions.none()) + + /** @see listProjects */ + @MustBeClosed + fun listProjects( + requestOptions: RequestOptions + ): HttpResponseFor = + listProjects(ScalarDocListProjectsParams.none(), requestOptions) + /** * Returns a raw HTTP response for `post /v1/guides/{slug}/publish`, but is otherwise the * same as [ScalarDocService.publishGuide]. @@ -191,5 +733,171 @@ interface ScalarDocService { requestOptions: RequestOptions, ): HttpResponseFor = publishGuide(slug, ScalarDocPublishGuideParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `post /v1/docs/{slug}/publish`, but is otherwise the same + * as [ScalarDocService.publishProject]. + */ + @MustBeClosed + fun publishProject(slug: String): HttpResponseFor = + publishProject(slug, ScalarDocPublishProjectParams.none()) + + /** @see publishProject */ + @MustBeClosed + fun publishProject( + slug: String, + params: ScalarDocPublishProjectParams = ScalarDocPublishProjectParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + publishProject(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see publishProject */ + @MustBeClosed + fun publishProject( + slug: String, + params: ScalarDocPublishProjectParams, + ): HttpResponseFor = + publishProject(slug, params, RequestOptions.none()) + + /** @see publishProject */ + @MustBeClosed + fun publishProject( + params: ScalarDocPublishProjectParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see publishProject */ + @MustBeClosed + fun publishProject( + params: ScalarDocPublishProjectParams + ): HttpResponseFor = + publishProject(params, RequestOptions.none()) + + /** @see publishProject */ + @MustBeClosed + fun publishProject( + slug: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + publishProject(slug, ScalarDocPublishProjectParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /v1/docs/{slug}`, but is otherwise the same as + * [ScalarDocService.retrieveProject]. + */ + @MustBeClosed + fun retrieveProject(slug: String): HttpResponseFor = + retrieveProject(slug, ScalarDocRetrieveProjectParams.none()) + + /** @see retrieveProject */ + @MustBeClosed + fun retrieveProject( + slug: String, + params: ScalarDocRetrieveProjectParams = ScalarDocRetrieveProjectParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + retrieveProject(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see retrieveProject */ + @MustBeClosed + fun retrieveProject( + slug: String, + params: ScalarDocRetrieveProjectParams, + ): HttpResponseFor = retrieveProject(slug, params, RequestOptions.none()) + + /** @see retrieveProject */ + @MustBeClosed + fun retrieveProject( + params: ScalarDocRetrieveProjectParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see retrieveProject */ + @MustBeClosed + fun retrieveProject(params: ScalarDocRetrieveProjectParams): HttpResponseFor = + retrieveProject(params, RequestOptions.none()) + + /** @see retrieveProject */ + @MustBeClosed + fun retrieveProject( + slug: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + retrieveProject(slug, ScalarDocRetrieveProjectParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `patch /v1/docs/{slug}`, but is otherwise the same as + * [ScalarDocService.updateProject]. + */ + @MustBeClosed + fun updateProject(slug: String): HttpResponseFor = + updateProject(slug, ScalarDocUpdateProjectParams.none()) + + /** @see updateProject */ + @MustBeClosed + fun updateProject( + slug: String, + params: ScalarDocUpdateProjectParams = ScalarDocUpdateProjectParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + updateProject(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see updateProject */ + @MustBeClosed + fun updateProject( + slug: String, + params: ScalarDocUpdateProjectParams, + ): HttpResponseFor = updateProject(slug, params, RequestOptions.none()) + + /** @see updateProject */ + @MustBeClosed + fun updateProject( + params: ScalarDocUpdateProjectParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see updateProject */ + @MustBeClosed + fun updateProject(params: ScalarDocUpdateProjectParams): HttpResponseFor = + updateProject(params, RequestOptions.none()) + + /** @see updateProject */ + @MustBeClosed + fun updateProject(slug: String, requestOptions: RequestOptions): HttpResponseFor = + updateProject(slug, ScalarDocUpdateProjectParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `put /v1/docs/{slug}/config`, but is otherwise the same + * as [ScalarDocService.updateProjectConfig]. + */ + @MustBeClosed + fun updateProjectConfig( + slug: String, + params: ScalarDocUpdateProjectConfigParams, + ): HttpResponseFor = + updateProjectConfig(slug, params, RequestOptions.none()) + + /** @see updateProjectConfig */ + @MustBeClosed + fun updateProjectConfig( + slug: String, + params: ScalarDocUpdateProjectConfigParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + updateProjectConfig(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see updateProjectConfig */ + @MustBeClosed + fun updateProjectConfig( + params: ScalarDocUpdateProjectConfigParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see updateProjectConfig */ + @MustBeClosed + fun updateProjectConfig( + params: ScalarDocUpdateProjectConfigParams + ): HttpResponseFor = + updateProjectConfig(params, RequestOptions.none()) } } diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/ScalarDocServiceImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/ScalarDocServiceImpl.kt index 9a24b6a..cef209d 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/ScalarDocServiceImpl.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/ScalarDocServiceImpl.kt @@ -16,12 +16,29 @@ import com.scalar.core.http.HttpResponseFor import com.scalar.core.http.json import com.scalar.core.http.parseable import com.scalar.core.prepare +import com.scalar.models.scalarDocs.DocsProject +import com.scalar.models.scalarDocs.GithubProject import com.scalar.models.scalarDocs.ScalarDocCreateGuideParams import com.scalar.models.scalarDocs.ScalarDocCreateGuideResponse +import com.scalar.models.scalarDocs.ScalarDocCreateProjectParams +import com.scalar.models.scalarDocs.ScalarDocDeleteProjectParams import com.scalar.models.scalarDocs.ScalarDocListGuidesParams -import com.scalar.models.scalarDocs.ScalarDocListGuidesResponse +import com.scalar.models.scalarDocs.ScalarDocListProjectConfigParams +import com.scalar.models.scalarDocs.ScalarDocListProjectConfigResponse +import com.scalar.models.scalarDocs.ScalarDocListProjectDomainParams +import com.scalar.models.scalarDocs.ScalarDocListProjectDomainResponse +import com.scalar.models.scalarDocs.ScalarDocListProjectDomainStatusParams +import com.scalar.models.scalarDocs.ScalarDocListProjectDomainStatusResponse +import com.scalar.models.scalarDocs.ScalarDocListProjectsParams +import com.scalar.models.scalarDocs.ScalarDocListProjectsResponse import com.scalar.models.scalarDocs.ScalarDocPublishGuideParams import com.scalar.models.scalarDocs.ScalarDocPublishGuideResponse +import com.scalar.models.scalarDocs.ScalarDocPublishProjectParams +import com.scalar.models.scalarDocs.ScalarDocPublishProjectResponse +import com.scalar.models.scalarDocs.ScalarDocRetrieveProjectParams +import com.scalar.models.scalarDocs.ScalarDocUpdateProjectConfigParams +import com.scalar.models.scalarDocs.ScalarDocUpdateProjectConfigResponse +import com.scalar.models.scalarDocs.ScalarDocUpdateProjectParams import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull @@ -45,13 +62,55 @@ class ScalarDocServiceImpl internal constructor(private val clientOptions: Clien // post /v1/guides withRawResponse().createGuide(params, requestOptions).parse() + override fun createProject( + params: ScalarDocCreateProjectParams, + requestOptions: RequestOptions, + ): DocsProject = + // post /v1/docs + withRawResponse().createProject(params, requestOptions).parse() + + override fun deleteProject( + params: ScalarDocDeleteProjectParams, + requestOptions: RequestOptions, + ): Any? = + // delete /v1/docs/{slug} + withRawResponse().deleteProject(params, requestOptions).parse() + override fun listGuides( params: ScalarDocListGuidesParams, requestOptions: RequestOptions, - ): List = + ): List = // get /v1/guides withRawResponse().listGuides(params, requestOptions).parse() + override fun listProjectConfig( + params: ScalarDocListProjectConfigParams, + requestOptions: RequestOptions, + ): ScalarDocListProjectConfigResponse = + // get /v1/docs/{slug}/config + withRawResponse().listProjectConfig(params, requestOptions).parse() + + override fun listProjectDomain( + params: ScalarDocListProjectDomainParams, + requestOptions: RequestOptions, + ): ScalarDocListProjectDomainResponse = + // get /v1/docs/{slug}/domain + withRawResponse().listProjectDomain(params, requestOptions).parse() + + override fun listProjectDomainStatus( + params: ScalarDocListProjectDomainStatusParams, + requestOptions: RequestOptions, + ): ScalarDocListProjectDomainStatusResponse = + // get /v1/docs/{slug}/domain/status + withRawResponse().listProjectDomainStatus(params, requestOptions).parse() + + override fun listProjects( + params: ScalarDocListProjectsParams, + requestOptions: RequestOptions, + ): ScalarDocListProjectsResponse = + // get /v1/docs + withRawResponse().listProjects(params, requestOptions).parse() + override fun publishGuide( params: ScalarDocPublishGuideParams, requestOptions: RequestOptions, @@ -59,6 +118,34 @@ class ScalarDocServiceImpl internal constructor(private val clientOptions: Clien // post /v1/guides/{slug}/publish withRawResponse().publishGuide(params, requestOptions).parse() + override fun publishProject( + params: ScalarDocPublishProjectParams, + requestOptions: RequestOptions, + ): ScalarDocPublishProjectResponse = + // post /v1/docs/{slug}/publish + withRawResponse().publishProject(params, requestOptions).parse() + + override fun retrieveProject( + params: ScalarDocRetrieveProjectParams, + requestOptions: RequestOptions, + ): DocsProject = + // get /v1/docs/{slug} + withRawResponse().retrieveProject(params, requestOptions).parse() + + override fun updateProject( + params: ScalarDocUpdateProjectParams, + requestOptions: RequestOptions, + ): Any? = + // patch /v1/docs/{slug} + withRawResponse().updateProject(params, requestOptions).parse() + + override fun updateProjectConfig( + params: ScalarDocUpdateProjectConfigParams, + requestOptions: RequestOptions, + ): ScalarDocUpdateProjectConfigResponse = + // put /v1/docs/{slug}/config + withRawResponse().updateProjectConfig(params, requestOptions).parse() + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : ScalarDocService.WithRawResponse { @@ -100,13 +187,66 @@ class ScalarDocServiceImpl internal constructor(private val clientOptions: Clien } } - private val listGuidesHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper) + private val createProjectHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun createProject( + params: ScalarDocCreateProjectParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "docs") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { createProjectHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val deleteProjectHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun deleteProject( + params: ScalarDocDeleteProjectParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("slug", params.slug().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.DELETE) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "docs", params._pathParam(0)) + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response.use { deleteProjectHandler.handle(it) } + } + } + + private val listGuidesHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) override fun listGuides( params: ScalarDocListGuidesParams, requestOptions: RequestOptions, - ): HttpResponseFor> { + ): HttpResponseFor> { val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -127,6 +267,124 @@ class ScalarDocServiceImpl internal constructor(private val clientOptions: Clien } } + private val listProjectConfigHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun listProjectConfig( + params: ScalarDocListProjectConfigParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("slug", params.slug().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "docs", params._pathParam(0), "config") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { listProjectConfigHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val listProjectDomainHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun listProjectDomain( + params: ScalarDocListProjectDomainParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("slug", params.slug().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "docs", params._pathParam(0), "domain") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { listProjectDomainHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val listProjectDomainStatusHandler: + Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun listProjectDomainStatus( + params: ScalarDocListProjectDomainStatusParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("slug", params.slug().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "docs", params._pathParam(0), "domain", "status") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { listProjectDomainStatusHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val listProjectsHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun listProjects( + params: ScalarDocListProjectsParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "docs") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { listProjectsHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + private val publishGuideHandler: Handler = jsonHandler(clientOptions.jsonMapper) @@ -157,5 +415,122 @@ class ScalarDocServiceImpl internal constructor(private val clientOptions: Clien } } } + + private val publishProjectHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun publishProject( + params: ScalarDocPublishProjectParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("slug", params.slug().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "docs", params._pathParam(0), "publish") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { publishProjectHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val retrieveProjectHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun retrieveProject( + params: ScalarDocRetrieveProjectParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("slug", params.slug().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "docs", params._pathParam(0)) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { retrieveProjectHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val updateProjectHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun updateProject( + params: ScalarDocUpdateProjectParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("slug", params.slug().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.PATCH) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "docs", params._pathParam(0)) + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response.use { updateProjectHandler.handle(it) } + } + } + + private val updateProjectConfigHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun updateProjectConfig( + params: ScalarDocUpdateProjectConfigParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("slug", params.slug().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "docs", params._pathParam(0), "config") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { updateProjectConfigHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } } } diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/SchemaService.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/SchemaService.kt index b447f45..b44935f 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/SchemaService.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/SchemaService.kt @@ -7,10 +7,10 @@ import com.scalar.core.ClientOptions import com.scalar.core.RequestOptions import com.scalar.core.http.HttpResponseFor import com.scalar.models.Uid +import com.scalar.models.schemas.Schema import com.scalar.models.schemas.SchemaCreateParams import com.scalar.models.schemas.SchemaDeleteParams import com.scalar.models.schemas.SchemaListParams -import com.scalar.models.schemas.SchemaListResponse import com.scalar.models.schemas.SchemaUpdateParams import com.scalar.services.blocking.schemas.AccessGroupService import com.scalar.services.blocking.schemas.VersionService @@ -78,32 +78,30 @@ interface SchemaService { fun update(params: SchemaUpdateParams): Any? = update(params, RequestOptions.none()) /** List schemas in a namespace. */ - fun list(namespace: String): List = list(namespace, SchemaListParams.none()) + fun list(namespace: String): List = list(namespace, SchemaListParams.none()) /** @see list */ fun list( namespace: String, params: SchemaListParams = SchemaListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): List = - list(params.toBuilder().namespace(namespace).build(), requestOptions) + ): List = list(params.toBuilder().namespace(namespace).build(), requestOptions) /** @see list */ - fun list(namespace: String, params: SchemaListParams): List = + fun list(namespace: String, params: SchemaListParams): List = list(namespace, params, RequestOptions.none()) /** @see list */ fun list( params: SchemaListParams, requestOptions: RequestOptions = RequestOptions.none(), - ): List + ): List /** @see list */ - fun list(params: SchemaListParams): List = - list(params, RequestOptions.none()) + fun list(params: SchemaListParams): List = list(params, RequestOptions.none()) /** @see list */ - fun list(namespace: String, requestOptions: RequestOptions): List = + fun list(namespace: String, requestOptions: RequestOptions): List = list(namespace, SchemaListParams.none(), requestOptions) /** Delete a schema and all related versions. */ @@ -204,7 +202,7 @@ interface SchemaService { * as [SchemaService.list]. */ @MustBeClosed - fun list(namespace: String): HttpResponseFor> = + fun list(namespace: String): HttpResponseFor> = list(namespace, SchemaListParams.none()) /** @see list */ @@ -213,15 +211,12 @@ interface SchemaService { namespace: String, params: SchemaListParams = SchemaListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor> = + ): HttpResponseFor> = list(params.toBuilder().namespace(namespace).build(), requestOptions) /** @see list */ @MustBeClosed - fun list( - namespace: String, - params: SchemaListParams, - ): HttpResponseFor> = + fun list(namespace: String, params: SchemaListParams): HttpResponseFor> = list(namespace, params, RequestOptions.none()) /** @see list */ @@ -229,19 +224,16 @@ interface SchemaService { fun list( params: SchemaListParams, requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor> + ): HttpResponseFor> /** @see list */ @MustBeClosed - fun list(params: SchemaListParams): HttpResponseFor> = + fun list(params: SchemaListParams): HttpResponseFor> = list(params, RequestOptions.none()) /** @see list */ @MustBeClosed - fun list( - namespace: String, - requestOptions: RequestOptions, - ): HttpResponseFor> = + fun list(namespace: String, requestOptions: RequestOptions): HttpResponseFor> = list(namespace, SchemaListParams.none(), requestOptions) /** diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/SchemaServiceImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/SchemaServiceImpl.kt index 50dcea2..27ad860 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/SchemaServiceImpl.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/SchemaServiceImpl.kt @@ -17,10 +17,10 @@ import com.scalar.core.http.json import com.scalar.core.http.parseable import com.scalar.core.prepare import com.scalar.models.Uid +import com.scalar.models.schemas.Schema import com.scalar.models.schemas.SchemaCreateParams import com.scalar.models.schemas.SchemaDeleteParams import com.scalar.models.schemas.SchemaListParams -import com.scalar.models.schemas.SchemaListResponse import com.scalar.models.schemas.SchemaUpdateParams import com.scalar.services.blocking.schemas.AccessGroupService import com.scalar.services.blocking.schemas.AccessGroupServiceImpl @@ -60,10 +60,7 @@ class SchemaServiceImpl internal constructor(private val clientOptions: ClientOp // patch /v1/schemas/{namespace}/{slug} withRawResponse().update(params, requestOptions).parse() - override fun list( - params: SchemaListParams, - requestOptions: RequestOptions, - ): List = + override fun list(params: SchemaListParams, requestOptions: RequestOptions): List = // get /v1/schemas/{namespace} withRawResponse().list(params, requestOptions).parse() @@ -152,13 +149,13 @@ class SchemaServiceImpl internal constructor(private val clientOptions: ClientOp } } - private val listHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper) + private val listHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) override fun list( params: SchemaListParams, requestOptions: RequestOptions, - ): HttpResponseFor> { + ): HttpResponseFor> { // We check here instead of in the params builder because this can be specified // positionally or in the params class. checkRequired("namespace", params.namespace().getOrNull()) diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/SdkService.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/SdkService.kt new file mode 100644 index 0000000..491e153 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/SdkService.kt @@ -0,0 +1,381 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.blocking + +import com.google.errorprone.annotations.MustBeClosed +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.http.HttpResponseFor +import com.scalar.models.Uid +import com.scalar.models.sdks.Sdk +import com.scalar.models.sdks.SdkBuildParams +import com.scalar.models.sdks.SdkBuildResponse +import com.scalar.models.sdks.SdkCreateParams +import com.scalar.models.sdks.SdkDeleteParams +import com.scalar.models.sdks.SdkListParams +import com.scalar.models.sdks.SdkListResponse +import com.scalar.models.sdks.SdkRetrieveParams +import com.scalar.models.sdks.SdkUpdateParams +import com.scalar.services.blocking.sdks.RepositoryService +import com.scalar.services.blocking.sdks.VersionService +import java.util.function.Consumer + +/** SDKs */ +interface SdkService { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): SdkService + + /** SDKs */ + fun versions(): VersionService + + /** SDKs */ + fun repositories(): RepositoryService + + /** Create an SDK from an API document, targeting one or more languages. */ + fun create(params: SdkCreateParams): Uid = create(params, RequestOptions.none()) + + /** @see create */ + fun create(params: SdkCreateParams, requestOptions: RequestOptions = RequestOptions.none()): Uid + + /** Get a single SDK by its uid. */ + fun retrieve(uid: String): Sdk = retrieve(uid, SdkRetrieveParams.none()) + + /** @see retrieve */ + fun retrieve( + uid: String, + params: SdkRetrieveParams = SdkRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Sdk = retrieve(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see retrieve */ + fun retrieve(uid: String, params: SdkRetrieveParams): Sdk = + retrieve(uid, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: SdkRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Sdk + + /** @see retrieve */ + fun retrieve(params: SdkRetrieveParams): Sdk = retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve(uid: String, requestOptions: RequestOptions): Sdk = + retrieve(uid, SdkRetrieveParams.none(), requestOptions) + + /** Update SDK metadata, its linked API, or its config. */ + fun update(uid: String): Any? = update(uid, SdkUpdateParams.none()) + + /** @see update */ + fun update( + uid: String, + params: SdkUpdateParams = SdkUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? = update(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see update */ + fun update(uid: String, params: SdkUpdateParams): Any? = + update(uid, params, RequestOptions.none()) + + /** @see update */ + fun update( + params: SdkUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? + + /** @see update */ + fun update(params: SdkUpdateParams): Any? = update(params, RequestOptions.none()) + + /** @see update */ + fun update(uid: String, requestOptions: RequestOptions): Any? = + update(uid, SdkUpdateParams.none(), requestOptions) + + /** List every SDK on the team. */ + fun list(): SdkListResponse = list(SdkListParams.none()) + + /** @see list */ + fun list( + params: SdkListParams = SdkListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): SdkListResponse + + /** @see list */ + fun list(params: SdkListParams): SdkListResponse = list(params, RequestOptions.none()) + + /** @see list */ + fun list(requestOptions: RequestOptions): SdkListResponse = + list(SdkListParams.none(), requestOptions) + + /** Delete an SDK and every version it holds. */ + fun delete(uid: String): Any? = delete(uid, SdkDeleteParams.none()) + + /** @see delete */ + fun delete( + uid: String, + params: SdkDeleteParams = SdkDeleteParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? = delete(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see delete */ + fun delete(uid: String, params: SdkDeleteParams): Any? = + delete(uid, params, RequestOptions.none()) + + /** @see delete */ + fun delete( + params: SdkDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? + + /** @see delete */ + fun delete(params: SdkDeleteParams): Any? = delete(params, RequestOptions.none()) + + /** @see delete */ + fun delete(uid: String, requestOptions: RequestOptions): Any? = + delete(uid, SdkDeleteParams.none(), requestOptions) + + /** + * Start a build. Omit `version` to build the current work — the open draft, else the latest + * version — and the resolved version comes back in the response. + */ + fun build(uid: String): SdkBuildResponse = build(uid, SdkBuildParams.none()) + + /** @see build */ + fun build( + uid: String, + params: SdkBuildParams = SdkBuildParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): SdkBuildResponse = build(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see build */ + fun build(uid: String, params: SdkBuildParams): SdkBuildResponse = + build(uid, params, RequestOptions.none()) + + /** @see build */ + fun build( + params: SdkBuildParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): SdkBuildResponse + + /** @see build */ + fun build(params: SdkBuildParams): SdkBuildResponse = build(params, RequestOptions.none()) + + /** @see build */ + fun build(uid: String, requestOptions: RequestOptions): SdkBuildResponse = + build(uid, SdkBuildParams.none(), requestOptions) + + /** A view of [SdkService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): SdkService.WithRawResponse + + /** SDKs */ + fun versions(): VersionService.WithRawResponse + + /** SDKs */ + fun repositories(): RepositoryService.WithRawResponse + + /** + * Returns a raw HTTP response for `post /v1/sdks`, but is otherwise the same as + * [SdkService.create]. + */ + @MustBeClosed + fun create(params: SdkCreateParams): HttpResponseFor = + create(params, RequestOptions.none()) + + /** @see create */ + @MustBeClosed + fun create( + params: SdkCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `get /v1/sdks/{uid}`, but is otherwise the same as + * [SdkService.retrieve]. + */ + @MustBeClosed + fun retrieve(uid: String): HttpResponseFor = retrieve(uid, SdkRetrieveParams.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + uid: String, + params: SdkRetrieveParams = SdkRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = retrieve(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see retrieve */ + @MustBeClosed + fun retrieve(uid: String, params: SdkRetrieveParams): HttpResponseFor = + retrieve(uid, params, RequestOptions.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + params: SdkRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see retrieve */ + @MustBeClosed + fun retrieve(params: SdkRetrieveParams): HttpResponseFor = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve(uid: String, requestOptions: RequestOptions): HttpResponseFor = + retrieve(uid, SdkRetrieveParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `patch /v1/sdks/{uid}`, but is otherwise the same as + * [SdkService.update]. + */ + @MustBeClosed + fun update(uid: String): HttpResponseFor = update(uid, SdkUpdateParams.none()) + + /** @see update */ + @MustBeClosed + fun update( + uid: String, + params: SdkUpdateParams = SdkUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = update(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see update */ + @MustBeClosed + fun update(uid: String, params: SdkUpdateParams): HttpResponseFor = + update(uid, params, RequestOptions.none()) + + /** @see update */ + @MustBeClosed + fun update( + params: SdkUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see update */ + @MustBeClosed + fun update(params: SdkUpdateParams): HttpResponseFor = + update(params, RequestOptions.none()) + + /** @see update */ + @MustBeClosed + fun update(uid: String, requestOptions: RequestOptions): HttpResponseFor = + update(uid, SdkUpdateParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /v1/sdks`, but is otherwise the same as + * [SdkService.list]. + */ + @MustBeClosed fun list(): HttpResponseFor = list(SdkListParams.none()) + + /** @see list */ + @MustBeClosed + fun list( + params: SdkListParams = SdkListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see list */ + @MustBeClosed + fun list(params: SdkListParams): HttpResponseFor = + list(params, RequestOptions.none()) + + /** @see list */ + @MustBeClosed + fun list(requestOptions: RequestOptions): HttpResponseFor = + list(SdkListParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `delete /v1/sdks/{uid}`, but is otherwise the same as + * [SdkService.delete]. + */ + @MustBeClosed + fun delete(uid: String): HttpResponseFor = delete(uid, SdkDeleteParams.none()) + + /** @see delete */ + @MustBeClosed + fun delete( + uid: String, + params: SdkDeleteParams = SdkDeleteParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = delete(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see delete */ + @MustBeClosed + fun delete(uid: String, params: SdkDeleteParams): HttpResponseFor = + delete(uid, params, RequestOptions.none()) + + /** @see delete */ + @MustBeClosed + fun delete( + params: SdkDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see delete */ + @MustBeClosed + fun delete(params: SdkDeleteParams): HttpResponseFor = + delete(params, RequestOptions.none()) + + /** @see delete */ + @MustBeClosed + fun delete(uid: String, requestOptions: RequestOptions): HttpResponseFor = + delete(uid, SdkDeleteParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `post /v1/sdks/{uid}/build`, but is otherwise the same as + * [SdkService.build]. + */ + @MustBeClosed + fun build(uid: String): HttpResponseFor = + build(uid, SdkBuildParams.none()) + + /** @see build */ + @MustBeClosed + fun build( + uid: String, + params: SdkBuildParams = SdkBuildParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + build(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see build */ + @MustBeClosed + fun build(uid: String, params: SdkBuildParams): HttpResponseFor = + build(uid, params, RequestOptions.none()) + + /** @see build */ + @MustBeClosed + fun build( + params: SdkBuildParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see build */ + @MustBeClosed + fun build(params: SdkBuildParams): HttpResponseFor = + build(params, RequestOptions.none()) + + /** @see build */ + @MustBeClosed + fun build(uid: String, requestOptions: RequestOptions): HttpResponseFor = + build(uid, SdkBuildParams.none(), requestOptions) + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/SdkServiceImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/SdkServiceImpl.kt new file mode 100644 index 0000000..c35ec4a --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/SdkServiceImpl.kt @@ -0,0 +1,271 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.blocking + +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.checkRequired +import com.scalar.core.handlers.errorBodyHandler +import com.scalar.core.handlers.errorHandler +import com.scalar.core.handlers.jsonHandler +import com.scalar.core.http.HttpMethod +import com.scalar.core.http.HttpRequest +import com.scalar.core.http.HttpResponse +import com.scalar.core.http.HttpResponse.Handler +import com.scalar.core.http.HttpResponseFor +import com.scalar.core.http.json +import com.scalar.core.http.parseable +import com.scalar.core.prepare +import com.scalar.models.Uid +import com.scalar.models.sdks.Sdk +import com.scalar.models.sdks.SdkBuildParams +import com.scalar.models.sdks.SdkBuildResponse +import com.scalar.models.sdks.SdkCreateParams +import com.scalar.models.sdks.SdkDeleteParams +import com.scalar.models.sdks.SdkListParams +import com.scalar.models.sdks.SdkListResponse +import com.scalar.models.sdks.SdkRetrieveParams +import com.scalar.models.sdks.SdkUpdateParams +import com.scalar.services.blocking.sdks.RepositoryService +import com.scalar.services.blocking.sdks.RepositoryServiceImpl +import com.scalar.services.blocking.sdks.VersionService +import com.scalar.services.blocking.sdks.VersionServiceImpl +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +/** SDKs */ +class SdkServiceImpl internal constructor(private val clientOptions: ClientOptions) : SdkService { + + private val withRawResponse: SdkService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + private val versions: VersionService by lazy { VersionServiceImpl(clientOptions) } + + private val repositories: RepositoryService by lazy { RepositoryServiceImpl(clientOptions) } + + override fun withRawResponse(): SdkService.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): SdkService = + SdkServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + /** SDKs */ + override fun versions(): VersionService = versions + + /** SDKs */ + override fun repositories(): RepositoryService = repositories + + override fun create(params: SdkCreateParams, requestOptions: RequestOptions): Uid = + // post /v1/sdks + withRawResponse().create(params, requestOptions).parse() + + override fun retrieve(params: SdkRetrieveParams, requestOptions: RequestOptions): Sdk = + // get /v1/sdks/{uid} + withRawResponse().retrieve(params, requestOptions).parse() + + override fun update(params: SdkUpdateParams, requestOptions: RequestOptions): Any? = + // patch /v1/sdks/{uid} + withRawResponse().update(params, requestOptions).parse() + + override fun list(params: SdkListParams, requestOptions: RequestOptions): SdkListResponse = + // get /v1/sdks + withRawResponse().list(params, requestOptions).parse() + + override fun delete(params: SdkDeleteParams, requestOptions: RequestOptions): Any? = + // delete /v1/sdks/{uid} + withRawResponse().delete(params, requestOptions).parse() + + override fun build(params: SdkBuildParams, requestOptions: RequestOptions): SdkBuildResponse = + // post /v1/sdks/{uid}/build + withRawResponse().build(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + SdkService.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + private val versions: VersionService.WithRawResponse by lazy { + VersionServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val repositories: RepositoryService.WithRawResponse by lazy { + RepositoryServiceImpl.WithRawResponseImpl(clientOptions) + } + + override fun withOptions( + modifier: Consumer + ): SdkService.WithRawResponse = + SdkServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + /** SDKs */ + override fun versions(): VersionService.WithRawResponse = versions + + /** SDKs */ + override fun repositories(): RepositoryService.WithRawResponse = repositories + + private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun create( + params: SdkCreateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "sdks") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val retrieveHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun retrieve( + params: SdkRetrieveParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("uid", params.uid().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "sdks", params._pathParam(0)) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val updateHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun update( + params: SdkUpdateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("uid", params.uid().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.PATCH) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "sdks", params._pathParam(0)) + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response.use { updateHandler.handle(it) } + } + } + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun list( + params: SdkListParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "sdks") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val deleteHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun delete( + params: SdkDeleteParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("uid", params.uid().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.DELETE) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "sdks", params._pathParam(0)) + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response.use { deleteHandler.handle(it) } + } + } + + private val buildHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun build( + params: SdkBuildParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("uid", params.uid().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "sdks", params._pathParam(0), "build") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { buildHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/TeamService.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/TeamService.kt index b35dcec..4bc4fc7 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/TeamService.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/TeamService.kt @@ -6,8 +6,10 @@ import com.google.errorprone.annotations.MustBeClosed import com.scalar.core.ClientOptions import com.scalar.core.RequestOptions import com.scalar.core.http.HttpResponseFor +import com.scalar.models.teams.Team import com.scalar.models.teams.TeamListParams -import com.scalar.models.teams.TeamListResponse +import com.scalar.services.blocking.teams.InviteService +import com.scalar.services.blocking.teams.MemberService import java.util.function.Consumer /** Teams */ @@ -25,20 +27,26 @@ interface TeamService { */ fun withOptions(modifier: Consumer): TeamService + /** Teams */ + fun members(): MemberService + + /** Teams */ + fun invites(): InviteService + /** List all available teams */ - fun list(): List = list(TeamListParams.none()) + fun list(): List = list(TeamListParams.none()) /** @see list */ fun list( params: TeamListParams = TeamListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): List + ): List /** @see list */ - fun list(params: TeamListParams): List = list(params, RequestOptions.none()) + fun list(params: TeamListParams): List = list(params, RequestOptions.none()) /** @see list */ - fun list(requestOptions: RequestOptions): List = + fun list(requestOptions: RequestOptions): List = list(TeamListParams.none(), requestOptions) /** A view of [TeamService] that provides access to raw HTTP responses for each method. */ @@ -51,28 +59,33 @@ interface TeamService { */ fun withOptions(modifier: Consumer): TeamService.WithRawResponse + /** Teams */ + fun members(): MemberService.WithRawResponse + + /** Teams */ + fun invites(): InviteService.WithRawResponse + /** * Returns a raw HTTP response for `get /v1/teams`, but is otherwise the same as * [TeamService.list]. */ - @MustBeClosed - fun list(): HttpResponseFor> = list(TeamListParams.none()) + @MustBeClosed fun list(): HttpResponseFor> = list(TeamListParams.none()) /** @see list */ @MustBeClosed fun list( params: TeamListParams = TeamListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor> + ): HttpResponseFor> /** @see list */ @MustBeClosed - fun list(params: TeamListParams): HttpResponseFor> = + fun list(params: TeamListParams): HttpResponseFor> = list(params, RequestOptions.none()) /** @see list */ @MustBeClosed - fun list(requestOptions: RequestOptions): HttpResponseFor> = + fun list(requestOptions: RequestOptions): HttpResponseFor> = list(TeamListParams.none(), requestOptions) } } diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/TeamServiceImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/TeamServiceImpl.kt index c0d5584..a723801 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/TeamServiceImpl.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/TeamServiceImpl.kt @@ -14,8 +14,12 @@ import com.scalar.core.http.HttpResponse.Handler import com.scalar.core.http.HttpResponseFor import com.scalar.core.http.parseable import com.scalar.core.prepare +import com.scalar.models.teams.Team import com.scalar.models.teams.TeamListParams -import com.scalar.models.teams.TeamListResponse +import com.scalar.services.blocking.teams.InviteService +import com.scalar.services.blocking.teams.InviteServiceImpl +import com.scalar.services.blocking.teams.MemberService +import com.scalar.services.blocking.teams.MemberServiceImpl import java.util.function.Consumer /** Teams */ @@ -25,15 +29,22 @@ class TeamServiceImpl internal constructor(private val clientOptions: ClientOpti WithRawResponseImpl(clientOptions) } + private val members: MemberService by lazy { MemberServiceImpl(clientOptions) } + + private val invites: InviteService by lazy { InviteServiceImpl(clientOptions) } + override fun withRawResponse(): TeamService.WithRawResponse = withRawResponse override fun withOptions(modifier: Consumer): TeamService = TeamServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - override fun list( - params: TeamListParams, - requestOptions: RequestOptions, - ): List = + /** Teams */ + override fun members(): MemberService = members + + /** Teams */ + override fun invites(): InviteService = invites + + override fun list(params: TeamListParams, requestOptions: RequestOptions): List = // get /v1/teams withRawResponse().list(params, requestOptions).parse() @@ -43,6 +54,14 @@ class TeamServiceImpl internal constructor(private val clientOptions: ClientOpti private val errorHandler: Handler = errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + private val members: MemberService.WithRawResponse by lazy { + MemberServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val invites: InviteService.WithRawResponse by lazy { + InviteServiceImpl.WithRawResponseImpl(clientOptions) + } + override fun withOptions( modifier: Consumer ): TeamService.WithRawResponse = @@ -50,13 +69,19 @@ class TeamServiceImpl internal constructor(private val clientOptions: ClientOpti clientOptions.toBuilder().apply(modifier::accept).build() ) - private val listHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper) + /** Teams */ + override fun members(): MemberService.WithRawResponse = members + + /** Teams */ + override fun invites(): InviteService.WithRawResponse = invites + + private val listHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) override fun list( params: TeamListParams, requestOptions: RequestOptions, - ): HttpResponseFor> { + ): HttpResponseFor> { val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/ThemeService.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/ThemeService.kt index 8895bf8..45314e4 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/ThemeService.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/ThemeService.kt @@ -7,10 +7,10 @@ import com.scalar.core.ClientOptions import com.scalar.core.RequestOptions import com.scalar.core.http.HttpResponseFor import com.scalar.models.Uid +import com.scalar.models.themes.Theme import com.scalar.models.themes.ThemeCreateParams import com.scalar.models.themes.ThemeDeleteParams import com.scalar.models.themes.ThemeListParams -import com.scalar.models.themes.ThemeListResponse import com.scalar.models.themes.ThemeReplaceDocumentParams import com.scalar.models.themes.ThemeRetrieveParams import com.scalar.models.themes.ThemeUpdateParams @@ -95,19 +95,19 @@ interface ThemeService { update(slug, ThemeUpdateParams.none(), requestOptions) /** List all team themes. */ - fun list(): List = list(ThemeListParams.none()) + fun list(): List = list(ThemeListParams.none()) /** @see list */ fun list( params: ThemeListParams = ThemeListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): List + ): List /** @see list */ - fun list(params: ThemeListParams): List = list(params, RequestOptions.none()) + fun list(params: ThemeListParams): List = list(params, RequestOptions.none()) /** @see list */ - fun list(requestOptions: RequestOptions): List = + fun list(requestOptions: RequestOptions): List = list(ThemeListParams.none(), requestOptions) /** Delete a theme by slug. */ @@ -262,24 +262,23 @@ interface ThemeService { * Returns a raw HTTP response for `get /v1/themes`, but is otherwise the same as * [ThemeService.list]. */ - @MustBeClosed - fun list(): HttpResponseFor> = list(ThemeListParams.none()) + @MustBeClosed fun list(): HttpResponseFor> = list(ThemeListParams.none()) /** @see list */ @MustBeClosed fun list( params: ThemeListParams = ThemeListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor> + ): HttpResponseFor> /** @see list */ @MustBeClosed - fun list(params: ThemeListParams): HttpResponseFor> = + fun list(params: ThemeListParams): HttpResponseFor> = list(params, RequestOptions.none()) /** @see list */ @MustBeClosed - fun list(requestOptions: RequestOptions): HttpResponseFor> = + fun list(requestOptions: RequestOptions): HttpResponseFor> = list(ThemeListParams.none(), requestOptions) /** diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/ThemeServiceImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/ThemeServiceImpl.kt index a0403c9..067e8e8 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/ThemeServiceImpl.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/ThemeServiceImpl.kt @@ -18,10 +18,10 @@ import com.scalar.core.http.json import com.scalar.core.http.parseable import com.scalar.core.prepare import com.scalar.models.Uid +import com.scalar.models.themes.Theme import com.scalar.models.themes.ThemeCreateParams import com.scalar.models.themes.ThemeDeleteParams import com.scalar.models.themes.ThemeListParams -import com.scalar.models.themes.ThemeListResponse import com.scalar.models.themes.ThemeReplaceDocumentParams import com.scalar.models.themes.ThemeRetrieveParams import com.scalar.models.themes.ThemeUpdateParams @@ -53,10 +53,7 @@ class ThemeServiceImpl internal constructor(private val clientOptions: ClientOpt // patch /v1/themes/{slug} withRawResponse().update(params, requestOptions).parse() - override fun list( - params: ThemeListParams, - requestOptions: RequestOptions, - ): List = + override fun list(params: ThemeListParams, requestOptions: RequestOptions): List = // get /v1/themes withRawResponse().list(params, requestOptions).parse() @@ -159,13 +156,13 @@ class ThemeServiceImpl internal constructor(private val clientOptions: ClientOpt } } - private val listHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper) + private val listHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) override fun list( params: ThemeListParams, requestOptions: RequestOptions, - ): HttpResponseFor> { + ): HttpResponseFor> { val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/accessGroups/DomainService.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/accessGroups/DomainService.kt new file mode 100644 index 0000000..1b30b35 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/accessGroups/DomainService.kt @@ -0,0 +1,140 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.blocking.accessGroups + +import com.google.errorprone.annotations.MustBeClosed +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.http.HttpResponseFor +import com.scalar.models.accessGroups.domains.DomainCreateParams +import com.scalar.models.accessGroups.domains.DomainDeleteParams +import java.util.function.Consumer + +/** Access Groups */ +interface DomainService { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): DomainService + + /** + * Allow an exact email domain in a group. Requires docs edit permission. A group supports up to + * 1000 domains. + */ + fun create(slug: String, params: DomainCreateParams): Any? = + create(slug, params, RequestOptions.none()) + + /** @see create */ + fun create( + slug: String, + params: DomainCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? = create(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see create */ + fun create( + params: DomainCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? + + /** @see create */ + fun create(params: DomainCreateParams): Any? = create(params, RequestOptions.none()) + + /** + * Remove an exact email domain from a group. Requires docs edit permission. Other allowed + * domains and emails are preserved. + */ + fun delete(slug: String, params: DomainDeleteParams): Any? = + delete(slug, params, RequestOptions.none()) + + /** @see delete */ + fun delete( + slug: String, + params: DomainDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? = delete(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see delete */ + fun delete( + params: DomainDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? + + /** @see delete */ + fun delete(params: DomainDeleteParams): Any? = delete(params, RequestOptions.none()) + + /** A view of [DomainService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): DomainService.WithRawResponse + + /** + * Returns a raw HTTP response for `post /v1/access-groups/{slug}/domains`, but is otherwise + * the same as [DomainService.create]. + */ + @MustBeClosed + fun create(slug: String, params: DomainCreateParams): HttpResponseFor = + create(slug, params, RequestOptions.none()) + + /** @see create */ + @MustBeClosed + fun create( + slug: String, + params: DomainCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = create(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see create */ + @MustBeClosed + fun create( + params: DomainCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see create */ + @MustBeClosed + fun create(params: DomainCreateParams): HttpResponseFor = + create(params, RequestOptions.none()) + + /** + * Returns a raw HTTP response for `delete /v1/access-groups/{slug}/domains`, but is + * otherwise the same as [DomainService.delete]. + */ + @MustBeClosed + fun delete(slug: String, params: DomainDeleteParams): HttpResponseFor = + delete(slug, params, RequestOptions.none()) + + /** @see delete */ + @MustBeClosed + fun delete( + slug: String, + params: DomainDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = delete(params.toBuilder().slug(slug).build(), requestOptions) + + /** @see delete */ + @MustBeClosed + fun delete( + params: DomainDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see delete */ + @MustBeClosed + fun delete(params: DomainDeleteParams): HttpResponseFor = + delete(params, RequestOptions.none()) + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/accessGroups/DomainServiceImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/accessGroups/DomainServiceImpl.kt new file mode 100644 index 0000000..462bb96 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/accessGroups/DomainServiceImpl.kt @@ -0,0 +1,106 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.blocking.accessGroups + +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.checkRequired +import com.scalar.core.handlers.errorBodyHandler +import com.scalar.core.handlers.errorHandler +import com.scalar.core.handlers.jsonHandler +import com.scalar.core.http.HttpMethod +import com.scalar.core.http.HttpRequest +import com.scalar.core.http.HttpResponse +import com.scalar.core.http.HttpResponse.Handler +import com.scalar.core.http.HttpResponseFor +import com.scalar.core.http.json +import com.scalar.core.http.parseable +import com.scalar.core.prepare +import com.scalar.models.accessGroups.domains.DomainCreateParams +import com.scalar.models.accessGroups.domains.DomainDeleteParams +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +/** Access Groups */ +class DomainServiceImpl internal constructor(private val clientOptions: ClientOptions) : + DomainService { + + private val withRawResponse: DomainService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): DomainService.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): DomainService = + DomainServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun create(params: DomainCreateParams, requestOptions: RequestOptions): Any? = + // post /v1/access-groups/{slug}/domains + withRawResponse().create(params, requestOptions).parse() + + override fun delete(params: DomainDeleteParams, requestOptions: RequestOptions): Any? = + // delete /v1/access-groups/{slug}/domains + withRawResponse().delete(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + DomainService.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): DomainService.WithRawResponse = + DomainServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun create( + params: DomainCreateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("slug", params.slug().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "access-groups", params._pathParam(0), "domains") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response.use { createHandler.handle(it) } + } + } + + private val deleteHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun delete( + params: DomainDeleteParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("slug", params.slug().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.DELETE) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "access-groups", params._pathParam(0), "domains") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response.use { deleteHandler.handle(it) } + } + } + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/mcp/ServerService.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/mcp/ServerService.kt new file mode 100644 index 0000000..d690bb3 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/mcp/ServerService.kt @@ -0,0 +1,310 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.blocking.mcp + +import com.google.errorprone.annotations.MustBeClosed +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.http.HttpResponseFor +import com.scalar.models.mcp.servers.McpServer +import com.scalar.models.mcp.servers.ServerCreateParams +import com.scalar.models.mcp.servers.ServerCreateResponse +import com.scalar.models.mcp.servers.ServerDeleteParams +import com.scalar.models.mcp.servers.ServerListParams +import com.scalar.models.mcp.servers.ServerRetrieveParams +import com.scalar.models.mcp.servers.ServerUpdateParams +import com.scalar.services.blocking.mcp.servers.InstallationService +import java.util.function.Consumer + +/** MCP */ +interface ServerService { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): ServerService + + /** MCP */ + fun installations(): InstallationService + + /** + * Create an MCP server over one or more API document versions. The response carries the server + * and its first installation. + */ + fun create(params: ServerCreateParams): ServerCreateResponse = + create(params, RequestOptions.none()) + + /** @see create */ + fun create( + params: ServerCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): ServerCreateResponse + + /** Get a single MCP server by its id. */ + fun retrieve(id: String): McpServer = retrieve(id, ServerRetrieveParams.none()) + + /** @see retrieve */ + fun retrieve( + id: String, + params: ServerRetrieveParams = ServerRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): McpServer = retrieve(params.toBuilder().id(id).build(), requestOptions) + + /** @see retrieve */ + fun retrieve(id: String, params: ServerRetrieveParams): McpServer = + retrieve(id, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: ServerRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): McpServer + + /** @see retrieve */ + fun retrieve(params: ServerRetrieveParams): McpServer = retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve(id: String, requestOptions: RequestOptions): McpServer = + retrieve(id, ServerRetrieveParams.none(), requestOptions) + + /** Update MCP server metadata and which tools it exposes. */ + fun update(id: String): McpServer = update(id, ServerUpdateParams.none()) + + /** @see update */ + fun update( + id: String, + params: ServerUpdateParams = ServerUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): McpServer = update(params.toBuilder().id(id).build(), requestOptions) + + /** @see update */ + fun update(id: String, params: ServerUpdateParams): McpServer = + update(id, params, RequestOptions.none()) + + /** @see update */ + fun update( + params: ServerUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): McpServer + + /** @see update */ + fun update(params: ServerUpdateParams): McpServer = update(params, RequestOptions.none()) + + /** @see update */ + fun update(id: String, requestOptions: RequestOptions): McpServer = + update(id, ServerUpdateParams.none(), requestOptions) + + /** List every MCP server on the team. */ + fun list(): List = list(ServerListParams.none()) + + /** @see list */ + fun list( + params: ServerListParams = ServerListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): List + + /** @see list */ + fun list(params: ServerListParams): List = list(params, RequestOptions.none()) + + /** @see list */ + fun list(requestOptions: RequestOptions): List = + list(ServerListParams.none(), requestOptions) + + /** Delete an MCP server and every installation it serves. */ + fun delete(id: String): Any? = delete(id, ServerDeleteParams.none()) + + /** @see delete */ + fun delete( + id: String, + params: ServerDeleteParams = ServerDeleteParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? = delete(params.toBuilder().id(id).build(), requestOptions) + + /** @see delete */ + fun delete(id: String, params: ServerDeleteParams): Any? = + delete(id, params, RequestOptions.none()) + + /** @see delete */ + fun delete( + params: ServerDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? + + /** @see delete */ + fun delete(params: ServerDeleteParams): Any? = delete(params, RequestOptions.none()) + + /** @see delete */ + fun delete(id: String, requestOptions: RequestOptions): Any? = + delete(id, ServerDeleteParams.none(), requestOptions) + + /** A view of [ServerService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): ServerService.WithRawResponse + + /** MCP */ + fun installations(): InstallationService.WithRawResponse + + /** + * Returns a raw HTTP response for `post /v1/mcp/servers`, but is otherwise the same as + * [ServerService.create]. + */ + @MustBeClosed + fun create(params: ServerCreateParams): HttpResponseFor = + create(params, RequestOptions.none()) + + /** @see create */ + @MustBeClosed + fun create( + params: ServerCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `get /v1/mcp/servers/{id}`, but is otherwise the same as + * [ServerService.retrieve]. + */ + @MustBeClosed + fun retrieve(id: String): HttpResponseFor = + retrieve(id, ServerRetrieveParams.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + id: String, + params: ServerRetrieveParams = ServerRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = retrieve(params.toBuilder().id(id).build(), requestOptions) + + /** @see retrieve */ + @MustBeClosed + fun retrieve(id: String, params: ServerRetrieveParams): HttpResponseFor = + retrieve(id, params, RequestOptions.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + params: ServerRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see retrieve */ + @MustBeClosed + fun retrieve(params: ServerRetrieveParams): HttpResponseFor = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve(id: String, requestOptions: RequestOptions): HttpResponseFor = + retrieve(id, ServerRetrieveParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `patch /v1/mcp/servers/{id}`, but is otherwise the same + * as [ServerService.update]. + */ + @MustBeClosed + fun update(id: String): HttpResponseFor = update(id, ServerUpdateParams.none()) + + /** @see update */ + @MustBeClosed + fun update( + id: String, + params: ServerUpdateParams = ServerUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = update(params.toBuilder().id(id).build(), requestOptions) + + /** @see update */ + @MustBeClosed + fun update(id: String, params: ServerUpdateParams): HttpResponseFor = + update(id, params, RequestOptions.none()) + + /** @see update */ + @MustBeClosed + fun update( + params: ServerUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see update */ + @MustBeClosed + fun update(params: ServerUpdateParams): HttpResponseFor = + update(params, RequestOptions.none()) + + /** @see update */ + @MustBeClosed + fun update(id: String, requestOptions: RequestOptions): HttpResponseFor = + update(id, ServerUpdateParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /v1/mcp/servers`, but is otherwise the same as + * [ServerService.list]. + */ + @MustBeClosed fun list(): HttpResponseFor> = list(ServerListParams.none()) + + /** @see list */ + @MustBeClosed + fun list( + params: ServerListParams = ServerListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor> + + /** @see list */ + @MustBeClosed + fun list(params: ServerListParams): HttpResponseFor> = + list(params, RequestOptions.none()) + + /** @see list */ + @MustBeClosed + fun list(requestOptions: RequestOptions): HttpResponseFor> = + list(ServerListParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `delete /v1/mcp/servers/{id}`, but is otherwise the same + * as [ServerService.delete]. + */ + @MustBeClosed + fun delete(id: String): HttpResponseFor = delete(id, ServerDeleteParams.none()) + + /** @see delete */ + @MustBeClosed + fun delete( + id: String, + params: ServerDeleteParams = ServerDeleteParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = delete(params.toBuilder().id(id).build(), requestOptions) + + /** @see delete */ + @MustBeClosed + fun delete(id: String, params: ServerDeleteParams): HttpResponseFor = + delete(id, params, RequestOptions.none()) + + /** @see delete */ + @MustBeClosed + fun delete( + params: ServerDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see delete */ + @MustBeClosed + fun delete(params: ServerDeleteParams): HttpResponseFor = + delete(params, RequestOptions.none()) + + /** @see delete */ + @MustBeClosed + fun delete(id: String, requestOptions: RequestOptions): HttpResponseFor = + delete(id, ServerDeleteParams.none(), requestOptions) + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/mcp/ServerServiceImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/mcp/ServerServiceImpl.kt new file mode 100644 index 0000000..23ec83b --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/mcp/ServerServiceImpl.kt @@ -0,0 +1,234 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.blocking.mcp + +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.checkRequired +import com.scalar.core.handlers.errorBodyHandler +import com.scalar.core.handlers.errorHandler +import com.scalar.core.handlers.jsonHandler +import com.scalar.core.http.HttpMethod +import com.scalar.core.http.HttpRequest +import com.scalar.core.http.HttpResponse +import com.scalar.core.http.HttpResponse.Handler +import com.scalar.core.http.HttpResponseFor +import com.scalar.core.http.json +import com.scalar.core.http.parseable +import com.scalar.core.prepare +import com.scalar.models.mcp.servers.McpServer +import com.scalar.models.mcp.servers.ServerCreateParams +import com.scalar.models.mcp.servers.ServerCreateResponse +import com.scalar.models.mcp.servers.ServerDeleteParams +import com.scalar.models.mcp.servers.ServerListParams +import com.scalar.models.mcp.servers.ServerRetrieveParams +import com.scalar.models.mcp.servers.ServerUpdateParams +import com.scalar.services.blocking.mcp.servers.InstallationService +import com.scalar.services.blocking.mcp.servers.InstallationServiceImpl +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +/** MCP */ +class ServerServiceImpl internal constructor(private val clientOptions: ClientOptions) : + ServerService { + + private val withRawResponse: ServerService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + private val installations: InstallationService by lazy { + InstallationServiceImpl(clientOptions) + } + + override fun withRawResponse(): ServerService.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): ServerService = + ServerServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + /** MCP */ + override fun installations(): InstallationService = installations + + override fun create( + params: ServerCreateParams, + requestOptions: RequestOptions, + ): ServerCreateResponse = + // post /v1/mcp/servers + withRawResponse().create(params, requestOptions).parse() + + override fun retrieve(params: ServerRetrieveParams, requestOptions: RequestOptions): McpServer = + // get /v1/mcp/servers/{id} + withRawResponse().retrieve(params, requestOptions).parse() + + override fun update(params: ServerUpdateParams, requestOptions: RequestOptions): McpServer = + // patch /v1/mcp/servers/{id} + withRawResponse().update(params, requestOptions).parse() + + override fun list(params: ServerListParams, requestOptions: RequestOptions): List = + // get /v1/mcp/servers + withRawResponse().list(params, requestOptions).parse() + + override fun delete(params: ServerDeleteParams, requestOptions: RequestOptions): Any? = + // delete /v1/mcp/servers/{id} + withRawResponse().delete(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + ServerService.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + private val installations: InstallationService.WithRawResponse by lazy { + InstallationServiceImpl.WithRawResponseImpl(clientOptions) + } + + override fun withOptions( + modifier: Consumer + ): ServerService.WithRawResponse = + ServerServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + /** MCP */ + override fun installations(): InstallationService.WithRawResponse = installations + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun create( + params: ServerCreateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "mcp", "servers") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun retrieve( + params: ServerRetrieveParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("id", params.id().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "mcp", "servers", params._pathParam(0)) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun update( + params: ServerUpdateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("id", params.id().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.PATCH) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "mcp", "servers", params._pathParam(0)) + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { updateHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val listHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) + + override fun list( + params: ServerListParams, + requestOptions: RequestOptions, + ): HttpResponseFor> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "mcp", "servers") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.forEach { it.validate() } + } + } + } + } + + private val deleteHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun delete( + params: ServerDeleteParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("id", params.id().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.DELETE) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "mcp", "servers", params._pathParam(0)) + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response.use { deleteHandler.handle(it) } + } + } + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/mcp/servers/InstallationService.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/mcp/servers/InstallationService.kt new file mode 100644 index 0000000..930cc4d --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/mcp/servers/InstallationService.kt @@ -0,0 +1,455 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.blocking.mcp.servers + +import com.google.errorprone.annotations.MustBeClosed +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.http.HttpResponseFor +import com.scalar.models.mcp.servers.McpInstallation +import com.scalar.models.mcp.servers.installations.InstallationCreateAccessGroupParams +import com.scalar.models.mcp.servers.installations.InstallationCreateParams +import com.scalar.models.mcp.servers.installations.InstallationDeleteAccessGroupParams +import com.scalar.models.mcp.servers.installations.InstallationDeleteParams +import com.scalar.models.mcp.servers.installations.InstallationListParams +import com.scalar.models.mcp.servers.installations.InstallationRetrieveParams +import com.scalar.models.mcp.servers.installations.InstallationUpdateParams +import com.scalar.models.mcp.servers.installations.McpInstallationListItem +import java.util.function.Consumer + +/** MCP */ +interface InstallationService { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): InstallationService + + /** + * Create an installation of an MCP server. `documentAuth` holds the credentials the server + * presents to the upstream API and is never returned. + */ + fun create(id: String, params: InstallationCreateParams): McpInstallation = + create(id, params, RequestOptions.none()) + + /** @see create */ + fun create( + id: String, + params: InstallationCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): McpInstallation = create(params.toBuilder().id(id).build(), requestOptions) + + /** @see create */ + fun create( + params: InstallationCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): McpInstallation + + /** @see create */ + fun create(params: InstallationCreateParams): McpInstallation = + create(params, RequestOptions.none()) + + /** Get a single installation of an MCP server. */ + fun retrieve(installationId: String, params: InstallationRetrieveParams): McpInstallation = + retrieve(installationId, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + installationId: String, + params: InstallationRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): McpInstallation = + retrieve(params.toBuilder().installationId(installationId).build(), requestOptions) + + /** @see retrieve */ + fun retrieve( + params: InstallationRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): McpInstallation + + /** @see retrieve */ + fun retrieve(params: InstallationRetrieveParams): McpInstallation = + retrieve(params, RequestOptions.none()) + + /** Update an installation. Set `isPrivate` and add access groups to put it behind a login. */ + fun update(installationId: String, params: InstallationUpdateParams): McpInstallation = + update(installationId, params, RequestOptions.none()) + + /** @see update */ + fun update( + installationId: String, + params: InstallationUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): McpInstallation = + update(params.toBuilder().installationId(installationId).build(), requestOptions) + + /** @see update */ + fun update( + params: InstallationUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): McpInstallation + + /** @see update */ + fun update(params: InstallationUpdateParams): McpInstallation = + update(params, RequestOptions.none()) + + /** + * List the installations of an MCP server. An installation is what an MCP client connects to. + */ + fun list(id: String): List = list(id, InstallationListParams.none()) + + /** @see list */ + fun list( + id: String, + params: InstallationListParams = InstallationListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): List = list(params.toBuilder().id(id).build(), requestOptions) + + /** @see list */ + fun list(id: String, params: InstallationListParams): List = + list(id, params, RequestOptions.none()) + + /** @see list */ + fun list( + params: InstallationListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): List + + /** @see list */ + fun list(params: InstallationListParams): List = + list(params, RequestOptions.none()) + + /** @see list */ + fun list(id: String, requestOptions: RequestOptions): List = + list(id, InstallationListParams.none(), requestOptions) + + /** Delete an installation of an MCP server. */ + fun delete(installationId: String, params: InstallationDeleteParams): Any? = + delete(installationId, params, RequestOptions.none()) + + /** @see delete */ + fun delete( + installationId: String, + params: InstallationDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? = delete(params.toBuilder().installationId(installationId).build(), requestOptions) + + /** @see delete */ + fun delete( + params: InstallationDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? + + /** @see delete */ + fun delete(params: InstallationDeleteParams): Any? = delete(params, RequestOptions.none()) + + /** Let an access group reach a private installation. */ + fun createAccessGroup( + installationId: String, + params: InstallationCreateAccessGroupParams, + ): Any? = createAccessGroup(installationId, params, RequestOptions.none()) + + /** @see createAccessGroup */ + fun createAccessGroup( + installationId: String, + params: InstallationCreateAccessGroupParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? = + createAccessGroup(params.toBuilder().installationId(installationId).build(), requestOptions) + + /** @see createAccessGroup */ + fun createAccessGroup( + params: InstallationCreateAccessGroupParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? + + /** @see createAccessGroup */ + fun createAccessGroup(params: InstallationCreateAccessGroupParams): Any? = + createAccessGroup(params, RequestOptions.none()) + + /** Stop an access group reaching a private installation. */ + fun deleteAccessGroup( + installationId: String, + params: InstallationDeleteAccessGroupParams, + ): Any? = deleteAccessGroup(installationId, params, RequestOptions.none()) + + /** @see deleteAccessGroup */ + fun deleteAccessGroup( + installationId: String, + params: InstallationDeleteAccessGroupParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? = + deleteAccessGroup(params.toBuilder().installationId(installationId).build(), requestOptions) + + /** @see deleteAccessGroup */ + fun deleteAccessGroup( + params: InstallationDeleteAccessGroupParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? + + /** @see deleteAccessGroup */ + fun deleteAccessGroup(params: InstallationDeleteAccessGroupParams): Any? = + deleteAccessGroup(params, RequestOptions.none()) + + /** + * A view of [InstallationService] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): InstallationService.WithRawResponse + + /** + * Returns a raw HTTP response for `post /v1/mcp/servers/{id}/installations`, but is + * otherwise the same as [InstallationService.create]. + */ + @MustBeClosed + fun create(id: String, params: InstallationCreateParams): HttpResponseFor = + create(id, params, RequestOptions.none()) + + /** @see create */ + @MustBeClosed + fun create( + id: String, + params: InstallationCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + create(params.toBuilder().id(id).build(), requestOptions) + + /** @see create */ + @MustBeClosed + fun create( + params: InstallationCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see create */ + @MustBeClosed + fun create(params: InstallationCreateParams): HttpResponseFor = + create(params, RequestOptions.none()) + + /** + * Returns a raw HTTP response for `get + * /v1/mcp/servers/{id}/installations/{installationId}`, but is otherwise the same as + * [InstallationService.retrieve]. + */ + @MustBeClosed + fun retrieve( + installationId: String, + params: InstallationRetrieveParams, + ): HttpResponseFor = + retrieve(installationId, params, RequestOptions.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + installationId: String, + params: InstallationRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + retrieve(params.toBuilder().installationId(installationId).build(), requestOptions) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + params: InstallationRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see retrieve */ + @MustBeClosed + fun retrieve(params: InstallationRetrieveParams): HttpResponseFor = + retrieve(params, RequestOptions.none()) + + /** + * Returns a raw HTTP response for `patch + * /v1/mcp/servers/{id}/installations/{installationId}`, but is otherwise the same as + * [InstallationService.update]. + */ + @MustBeClosed + fun update( + installationId: String, + params: InstallationUpdateParams, + ): HttpResponseFor = update(installationId, params, RequestOptions.none()) + + /** @see update */ + @MustBeClosed + fun update( + installationId: String, + params: InstallationUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + update(params.toBuilder().installationId(installationId).build(), requestOptions) + + /** @see update */ + @MustBeClosed + fun update( + params: InstallationUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see update */ + @MustBeClosed + fun update(params: InstallationUpdateParams): HttpResponseFor = + update(params, RequestOptions.none()) + + /** + * Returns a raw HTTP response for `get /v1/mcp/servers/{id}/installations`, but is + * otherwise the same as [InstallationService.list]. + */ + @MustBeClosed + fun list(id: String): HttpResponseFor> = + list(id, InstallationListParams.none()) + + /** @see list */ + @MustBeClosed + fun list( + id: String, + params: InstallationListParams = InstallationListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor> = + list(params.toBuilder().id(id).build(), requestOptions) + + /** @see list */ + @MustBeClosed + fun list( + id: String, + params: InstallationListParams, + ): HttpResponseFor> = list(id, params, RequestOptions.none()) + + /** @see list */ + @MustBeClosed + fun list( + params: InstallationListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor> + + /** @see list */ + @MustBeClosed + fun list(params: InstallationListParams): HttpResponseFor> = + list(params, RequestOptions.none()) + + /** @see list */ + @MustBeClosed + fun list( + id: String, + requestOptions: RequestOptions, + ): HttpResponseFor> = + list(id, InstallationListParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `delete + * /v1/mcp/servers/{id}/installations/{installationId}`, but is otherwise the same as + * [InstallationService.delete]. + */ + @MustBeClosed + fun delete( + installationId: String, + params: InstallationDeleteParams, + ): HttpResponseFor = delete(installationId, params, RequestOptions.none()) + + /** @see delete */ + @MustBeClosed + fun delete( + installationId: String, + params: InstallationDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + delete(params.toBuilder().installationId(installationId).build(), requestOptions) + + /** @see delete */ + @MustBeClosed + fun delete( + params: InstallationDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see delete */ + @MustBeClosed + fun delete(params: InstallationDeleteParams): HttpResponseFor = + delete(params, RequestOptions.none()) + + /** + * Returns a raw HTTP response for `post + * /v1/mcp/servers/{id}/installations/{installationId}/access-group`, but is otherwise the + * same as [InstallationService.createAccessGroup]. + */ + @MustBeClosed + fun createAccessGroup( + installationId: String, + params: InstallationCreateAccessGroupParams, + ): HttpResponseFor = createAccessGroup(installationId, params, RequestOptions.none()) + + /** @see createAccessGroup */ + @MustBeClosed + fun createAccessGroup( + installationId: String, + params: InstallationCreateAccessGroupParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + createAccessGroup( + params.toBuilder().installationId(installationId).build(), + requestOptions, + ) + + /** @see createAccessGroup */ + @MustBeClosed + fun createAccessGroup( + params: InstallationCreateAccessGroupParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see createAccessGroup */ + @MustBeClosed + fun createAccessGroup(params: InstallationCreateAccessGroupParams): HttpResponseFor = + createAccessGroup(params, RequestOptions.none()) + + /** + * Returns a raw HTTP response for `delete + * /v1/mcp/servers/{id}/installations/{installationId}/access-group`, but is otherwise the + * same as [InstallationService.deleteAccessGroup]. + */ + @MustBeClosed + fun deleteAccessGroup( + installationId: String, + params: InstallationDeleteAccessGroupParams, + ): HttpResponseFor = deleteAccessGroup(installationId, params, RequestOptions.none()) + + /** @see deleteAccessGroup */ + @MustBeClosed + fun deleteAccessGroup( + installationId: String, + params: InstallationDeleteAccessGroupParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + deleteAccessGroup( + params.toBuilder().installationId(installationId).build(), + requestOptions, + ) + + /** @see deleteAccessGroup */ + @MustBeClosed + fun deleteAccessGroup( + params: InstallationDeleteAccessGroupParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see deleteAccessGroup */ + @MustBeClosed + fun deleteAccessGroup(params: InstallationDeleteAccessGroupParams): HttpResponseFor = + deleteAccessGroup(params, RequestOptions.none()) + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/mcp/servers/InstallationServiceImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/mcp/servers/InstallationServiceImpl.kt new file mode 100644 index 0000000..041fef3 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/mcp/servers/InstallationServiceImpl.kt @@ -0,0 +1,336 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.blocking.mcp.servers + +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.checkRequired +import com.scalar.core.handlers.errorBodyHandler +import com.scalar.core.handlers.errorHandler +import com.scalar.core.handlers.jsonHandler +import com.scalar.core.http.HttpMethod +import com.scalar.core.http.HttpRequest +import com.scalar.core.http.HttpResponse +import com.scalar.core.http.HttpResponse.Handler +import com.scalar.core.http.HttpResponseFor +import com.scalar.core.http.json +import com.scalar.core.http.parseable +import com.scalar.core.prepare +import com.scalar.models.mcp.servers.McpInstallation +import com.scalar.models.mcp.servers.installations.InstallationCreateAccessGroupParams +import com.scalar.models.mcp.servers.installations.InstallationCreateParams +import com.scalar.models.mcp.servers.installations.InstallationDeleteAccessGroupParams +import com.scalar.models.mcp.servers.installations.InstallationDeleteParams +import com.scalar.models.mcp.servers.installations.InstallationListParams +import com.scalar.models.mcp.servers.installations.InstallationRetrieveParams +import com.scalar.models.mcp.servers.installations.InstallationUpdateParams +import com.scalar.models.mcp.servers.installations.McpInstallationListItem +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +/** MCP */ +class InstallationServiceImpl internal constructor(private val clientOptions: ClientOptions) : + InstallationService { + + private val withRawResponse: InstallationService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): InstallationService.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): InstallationService = + InstallationServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun create( + params: InstallationCreateParams, + requestOptions: RequestOptions, + ): McpInstallation = + // post /v1/mcp/servers/{id}/installations + withRawResponse().create(params, requestOptions).parse() + + override fun retrieve( + params: InstallationRetrieveParams, + requestOptions: RequestOptions, + ): McpInstallation = + // get /v1/mcp/servers/{id}/installations/{installationId} + withRawResponse().retrieve(params, requestOptions).parse() + + override fun update( + params: InstallationUpdateParams, + requestOptions: RequestOptions, + ): McpInstallation = + // patch /v1/mcp/servers/{id}/installations/{installationId} + withRawResponse().update(params, requestOptions).parse() + + override fun list( + params: InstallationListParams, + requestOptions: RequestOptions, + ): List = + // get /v1/mcp/servers/{id}/installations + withRawResponse().list(params, requestOptions).parse() + + override fun delete(params: InstallationDeleteParams, requestOptions: RequestOptions): Any? = + // delete /v1/mcp/servers/{id}/installations/{installationId} + withRawResponse().delete(params, requestOptions).parse() + + override fun createAccessGroup( + params: InstallationCreateAccessGroupParams, + requestOptions: RequestOptions, + ): Any? = + // post /v1/mcp/servers/{id}/installations/{installationId}/access-group + withRawResponse().createAccessGroup(params, requestOptions).parse() + + override fun deleteAccessGroup( + params: InstallationDeleteAccessGroupParams, + requestOptions: RequestOptions, + ): Any? = + // delete /v1/mcp/servers/{id}/installations/{installationId}/access-group + withRawResponse().deleteAccessGroup(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + InstallationService.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): InstallationService.WithRawResponse = + InstallationServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun create( + params: InstallationCreateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("id", params.id().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "mcp", "servers", params._pathParam(0), "installations") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun retrieve( + params: InstallationRetrieveParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("installationId", params.installationId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments( + "v1", + "mcp", + "servers", + params._pathParam(0), + "installations", + params._pathParam(1), + ) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun update( + params: InstallationUpdateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("installationId", params.installationId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.PATCH) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments( + "v1", + "mcp", + "servers", + params._pathParam(0), + "installations", + params._pathParam(1), + ) + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { updateHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val listHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) + + override fun list( + params: InstallationListParams, + requestOptions: RequestOptions, + ): HttpResponseFor> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("id", params.id().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "mcp", "servers", params._pathParam(0), "installations") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.forEach { it.validate() } + } + } + } + } + + private val deleteHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun delete( + params: InstallationDeleteParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("installationId", params.installationId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.DELETE) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments( + "v1", + "mcp", + "servers", + params._pathParam(0), + "installations", + params._pathParam(1), + ) + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response.use { deleteHandler.handle(it) } + } + } + + private val createAccessGroupHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun createAccessGroup( + params: InstallationCreateAccessGroupParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("installationId", params.installationId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments( + "v1", + "mcp", + "servers", + params._pathParam(0), + "installations", + params._pathParam(1), + "access-group", + ) + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response.use { createAccessGroupHandler.handle(it) } + } + } + + private val deleteAccessGroupHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun deleteAccessGroup( + params: InstallationDeleteAccessGroupParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("installationId", params.installationId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.DELETE) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments( + "v1", + "mcp", + "servers", + params._pathParam(0), + "installations", + params._pathParam(1), + "access-group", + ) + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response.use { deleteAccessGroupHandler.handle(it) } + } + } + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/sdks/RepositoryService.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/sdks/RepositoryService.kt new file mode 100644 index 0000000..aac96db --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/sdks/RepositoryService.kt @@ -0,0 +1,199 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.blocking.sdks + +import com.google.errorprone.annotations.MustBeClosed +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.http.HttpResponseFor +import com.scalar.models.sdks.repositories.RepositoryLinkParams +import com.scalar.models.sdks.repositories.RepositoryLinkResponse +import com.scalar.models.sdks.repositories.RepositoryUnlinkParams +import com.scalar.models.sdks.repositories.RepositoryUpdatePublishingParams +import java.util.function.Consumer + +/** SDKs */ +interface RepositoryService { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): RepositoryService + + /** Link one language target to a GitHub repository, so builds sync there. */ + fun link(uid: String, params: RepositoryLinkParams): RepositoryLinkResponse = + link(uid, params, RequestOptions.none()) + + /** @see link */ + fun link( + uid: String, + params: RepositoryLinkParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): RepositoryLinkResponse = link(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see link */ + fun link( + params: RepositoryLinkParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): RepositoryLinkResponse + + /** @see link */ + fun link(params: RepositoryLinkParams): RepositoryLinkResponse = + link(params, RequestOptions.none()) + + /** Unlink one language target from its repository. */ + fun unlink(language: RepositoryUnlinkParams.Language, params: RepositoryUnlinkParams): Any? = + unlink(language, params, RequestOptions.none()) + + /** @see unlink */ + fun unlink( + language: RepositoryUnlinkParams.Language, + params: RepositoryUnlinkParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? = unlink(params.toBuilder().language(language).build(), requestOptions) + + /** @see unlink */ + fun unlink( + params: RepositoryUnlinkParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? + + /** @see unlink */ + fun unlink(params: RepositoryUnlinkParams): Any? = unlink(params, RequestOptions.none()) + + /** Toggle publish-on-merge and the release settings for a linked target. */ + fun updatePublishing( + language: RepositoryUpdatePublishingParams.Language, + params: RepositoryUpdatePublishingParams, + ): Any? = updatePublishing(language, params, RequestOptions.none()) + + /** @see updatePublishing */ + fun updatePublishing( + language: RepositoryUpdatePublishingParams.Language, + params: RepositoryUpdatePublishingParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? = updatePublishing(params.toBuilder().language(language).build(), requestOptions) + + /** @see updatePublishing */ + fun updatePublishing( + params: RepositoryUpdatePublishingParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? + + /** @see updatePublishing */ + fun updatePublishing(params: RepositoryUpdatePublishingParams): Any? = + updatePublishing(params, RequestOptions.none()) + + /** A view of [RepositoryService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): RepositoryService.WithRawResponse + + /** + * Returns a raw HTTP response for `post /v1/sdks/{uid}/repositories`, but is otherwise the + * same as [RepositoryService.link]. + */ + @MustBeClosed + fun link( + uid: String, + params: RepositoryLinkParams, + ): HttpResponseFor = link(uid, params, RequestOptions.none()) + + /** @see link */ + @MustBeClosed + fun link( + uid: String, + params: RepositoryLinkParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + link(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see link */ + @MustBeClosed + fun link( + params: RepositoryLinkParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see link */ + @MustBeClosed + fun link(params: RepositoryLinkParams): HttpResponseFor = + link(params, RequestOptions.none()) + + /** + * Returns a raw HTTP response for `delete /v1/sdks/{uid}/repositories/{language}`, but is + * otherwise the same as [RepositoryService.unlink]. + */ + @MustBeClosed + fun unlink( + language: RepositoryUnlinkParams.Language, + params: RepositoryUnlinkParams, + ): HttpResponseFor = unlink(language, params, RequestOptions.none()) + + /** @see unlink */ + @MustBeClosed + fun unlink( + language: RepositoryUnlinkParams.Language, + params: RepositoryUnlinkParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + unlink(params.toBuilder().language(language).build(), requestOptions) + + /** @see unlink */ + @MustBeClosed + fun unlink( + params: RepositoryUnlinkParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see unlink */ + @MustBeClosed + fun unlink(params: RepositoryUnlinkParams): HttpResponseFor = + unlink(params, RequestOptions.none()) + + /** + * Returns a raw HTTP response for `post /v1/sdks/{uid}/repositories/{language}/publishing`, + * but is otherwise the same as [RepositoryService.updatePublishing]. + */ + @MustBeClosed + fun updatePublishing( + language: RepositoryUpdatePublishingParams.Language, + params: RepositoryUpdatePublishingParams, + ): HttpResponseFor = updatePublishing(language, params, RequestOptions.none()) + + /** @see updatePublishing */ + @MustBeClosed + fun updatePublishing( + language: RepositoryUpdatePublishingParams.Language, + params: RepositoryUpdatePublishingParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + updatePublishing(params.toBuilder().language(language).build(), requestOptions) + + /** @see updatePublishing */ + @MustBeClosed + fun updatePublishing( + params: RepositoryUpdatePublishingParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see updatePublishing */ + @MustBeClosed + fun updatePublishing(params: RepositoryUpdatePublishingParams): HttpResponseFor = + updatePublishing(params, RequestOptions.none()) + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/sdks/RepositoryServiceImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/sdks/RepositoryServiceImpl.kt new file mode 100644 index 0000000..737335c --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/sdks/RepositoryServiceImpl.kt @@ -0,0 +1,163 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.blocking.sdks + +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.checkRequired +import com.scalar.core.handlers.errorBodyHandler +import com.scalar.core.handlers.errorHandler +import com.scalar.core.handlers.jsonHandler +import com.scalar.core.http.HttpMethod +import com.scalar.core.http.HttpRequest +import com.scalar.core.http.HttpResponse +import com.scalar.core.http.HttpResponse.Handler +import com.scalar.core.http.HttpResponseFor +import com.scalar.core.http.json +import com.scalar.core.http.parseable +import com.scalar.core.prepare +import com.scalar.models.sdks.repositories.RepositoryLinkParams +import com.scalar.models.sdks.repositories.RepositoryLinkResponse +import com.scalar.models.sdks.repositories.RepositoryUnlinkParams +import com.scalar.models.sdks.repositories.RepositoryUpdatePublishingParams +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +/** SDKs */ +class RepositoryServiceImpl internal constructor(private val clientOptions: ClientOptions) : + RepositoryService { + + private val withRawResponse: RepositoryService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): RepositoryService.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): RepositoryService = + RepositoryServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun link( + params: RepositoryLinkParams, + requestOptions: RequestOptions, + ): RepositoryLinkResponse = + // post /v1/sdks/{uid}/repositories + withRawResponse().link(params, requestOptions).parse() + + override fun unlink(params: RepositoryUnlinkParams, requestOptions: RequestOptions): Any? = + // delete /v1/sdks/{uid}/repositories/{language} + withRawResponse().unlink(params, requestOptions).parse() + + override fun updatePublishing( + params: RepositoryUpdatePublishingParams, + requestOptions: RequestOptions, + ): Any? = + // post /v1/sdks/{uid}/repositories/{language}/publishing + withRawResponse().updatePublishing(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + RepositoryService.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): RepositoryService.WithRawResponse = + RepositoryServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val linkHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun link( + params: RepositoryLinkParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("uid", params.uid().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "sdks", params._pathParam(0), "repositories") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { linkHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val unlinkHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun unlink( + params: RepositoryUnlinkParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("language", params.language().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.DELETE) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments( + "v1", + "sdks", + params._pathParam(0), + "repositories", + params._pathParam(1), + ) + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response.use { unlinkHandler.handle(it) } + } + } + + private val updatePublishingHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun updatePublishing( + params: RepositoryUpdatePublishingParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("language", params.language().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments( + "v1", + "sdks", + params._pathParam(0), + "repositories", + params._pathParam(1), + "publishing", + ) + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response.use { updatePublishingHandler.handle(it) } + } + } + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/sdks/VersionService.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/sdks/VersionService.kt new file mode 100644 index 0000000..7269983 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/sdks/VersionService.kt @@ -0,0 +1,135 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.blocking.sdks + +import com.google.errorprone.annotations.MustBeClosed +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.http.HttpResponseFor +import com.scalar.models.sdks.versions.VersionCreateParams +import com.scalar.models.sdks.versions.VersionDeleteParams +import java.util.function.Consumer + +/** SDKs */ +interface VersionService { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): VersionService + + /** Create a new SDK version against a specific API version. */ + fun create(uid: String, params: VersionCreateParams): Any? = + create(uid, params, RequestOptions.none()) + + /** @see create */ + fun create( + uid: String, + params: VersionCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? = create(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see create */ + fun create( + params: VersionCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? + + /** @see create */ + fun create(params: VersionCreateParams): Any? = create(params, RequestOptions.none()) + + /** Permanently delete one version of an SDK. */ + fun delete(version: String, params: VersionDeleteParams): Any? = + delete(version, params, RequestOptions.none()) + + /** @see delete */ + fun delete( + version: String, + params: VersionDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? = delete(params.toBuilder().version(version).build(), requestOptions) + + /** @see delete */ + fun delete( + params: VersionDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? + + /** @see delete */ + fun delete(params: VersionDeleteParams): Any? = delete(params, RequestOptions.none()) + + /** A view of [VersionService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): VersionService.WithRawResponse + + /** + * Returns a raw HTTP response for `post /v1/sdks/{uid}/versions`, but is otherwise the same + * as [VersionService.create]. + */ + @MustBeClosed + fun create(uid: String, params: VersionCreateParams): HttpResponseFor = + create(uid, params, RequestOptions.none()) + + /** @see create */ + @MustBeClosed + fun create( + uid: String, + params: VersionCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = create(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see create */ + @MustBeClosed + fun create( + params: VersionCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see create */ + @MustBeClosed + fun create(params: VersionCreateParams): HttpResponseFor = + create(params, RequestOptions.none()) + + /** + * Returns a raw HTTP response for `delete /v1/sdks/{uid}/versions/{version}`, but is + * otherwise the same as [VersionService.delete]. + */ + @MustBeClosed + fun delete(version: String, params: VersionDeleteParams): HttpResponseFor = + delete(version, params, RequestOptions.none()) + + /** @see delete */ + @MustBeClosed + fun delete( + version: String, + params: VersionDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + delete(params.toBuilder().version(version).build(), requestOptions) + + /** @see delete */ + @MustBeClosed + fun delete( + params: VersionDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see delete */ + @MustBeClosed + fun delete(params: VersionDeleteParams): HttpResponseFor = + delete(params, RequestOptions.none()) + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/sdks/VersionServiceImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/sdks/VersionServiceImpl.kt new file mode 100644 index 0000000..0563f1c --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/sdks/VersionServiceImpl.kt @@ -0,0 +1,112 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.blocking.sdks + +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.checkRequired +import com.scalar.core.handlers.errorBodyHandler +import com.scalar.core.handlers.errorHandler +import com.scalar.core.handlers.jsonHandler +import com.scalar.core.http.HttpMethod +import com.scalar.core.http.HttpRequest +import com.scalar.core.http.HttpResponse +import com.scalar.core.http.HttpResponse.Handler +import com.scalar.core.http.HttpResponseFor +import com.scalar.core.http.json +import com.scalar.core.http.parseable +import com.scalar.core.prepare +import com.scalar.models.sdks.versions.VersionCreateParams +import com.scalar.models.sdks.versions.VersionDeleteParams +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +/** SDKs */ +class VersionServiceImpl internal constructor(private val clientOptions: ClientOptions) : + VersionService { + + private val withRawResponse: VersionService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): VersionService.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): VersionService = + VersionServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun create(params: VersionCreateParams, requestOptions: RequestOptions): Any? = + // post /v1/sdks/{uid}/versions + withRawResponse().create(params, requestOptions).parse() + + override fun delete(params: VersionDeleteParams, requestOptions: RequestOptions): Any? = + // delete /v1/sdks/{uid}/versions/{version} + withRawResponse().delete(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + VersionService.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): VersionService.WithRawResponse = + VersionServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun create( + params: VersionCreateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("uid", params.uid().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "sdks", params._pathParam(0), "versions") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response.use { createHandler.handle(it) } + } + } + + private val deleteHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun delete( + params: VersionDeleteParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("version", params.version().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.DELETE) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments( + "v1", + "sdks", + params._pathParam(0), + "versions", + params._pathParam(1), + ) + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response.use { deleteHandler.handle(it) } + } + } + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/teams/InviteService.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/teams/InviteService.kt new file mode 100644 index 0000000..a2b05de --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/teams/InviteService.kt @@ -0,0 +1,191 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.blocking.teams + +import com.google.errorprone.annotations.MustBeClosed +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.http.HttpResponseFor +import com.scalar.models.teams.invites.InviteCancelParams +import com.scalar.models.teams.invites.InviteMemberParams +import com.scalar.models.teams.invites.InviteResendParams +import java.util.function.Consumer + +/** Teams */ +interface InviteService { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): InviteService + + /** Withdraw an invite that has not been accepted. */ + fun cancel(uid: String): Any? = cancel(uid, InviteCancelParams.none()) + + /** @see cancel */ + fun cancel( + uid: String, + params: InviteCancelParams = InviteCancelParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? = cancel(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see cancel */ + fun cancel(uid: String, params: InviteCancelParams): Any? = + cancel(uid, params, RequestOptions.none()) + + /** @see cancel */ + fun cancel( + params: InviteCancelParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? + + /** @see cancel */ + fun cancel(params: InviteCancelParams): Any? = cancel(params, RequestOptions.none()) + + /** @see cancel */ + fun cancel(uid: String, requestOptions: RequestOptions): Any? = + cancel(uid, InviteCancelParams.none(), requestOptions) + + /** Invite someone to the current team by email. */ + fun member(params: InviteMemberParams): Any? = member(params, RequestOptions.none()) + + /** @see member */ + fun member( + params: InviteMemberParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? + + /** Send the invite email again. */ + fun resend(uid: String): Any? = resend(uid, InviteResendParams.none()) + + /** @see resend */ + fun resend( + uid: String, + params: InviteResendParams = InviteResendParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? = resend(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see resend */ + fun resend(uid: String, params: InviteResendParams): Any? = + resend(uid, params, RequestOptions.none()) + + /** @see resend */ + fun resend( + params: InviteResendParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? + + /** @see resend */ + fun resend(params: InviteResendParams): Any? = resend(params, RequestOptions.none()) + + /** @see resend */ + fun resend(uid: String, requestOptions: RequestOptions): Any? = + resend(uid, InviteResendParams.none(), requestOptions) + + /** A view of [InviteService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): InviteService.WithRawResponse + + /** + * Returns a raw HTTP response for `delete /v1/teams/invites/{uid}`, but is otherwise the + * same as [InviteService.cancel]. + */ + @MustBeClosed + fun cancel(uid: String): HttpResponseFor = cancel(uid, InviteCancelParams.none()) + + /** @see cancel */ + @MustBeClosed + fun cancel( + uid: String, + params: InviteCancelParams = InviteCancelParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = cancel(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see cancel */ + @MustBeClosed + fun cancel(uid: String, params: InviteCancelParams): HttpResponseFor = + cancel(uid, params, RequestOptions.none()) + + /** @see cancel */ + @MustBeClosed + fun cancel( + params: InviteCancelParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see cancel */ + @MustBeClosed + fun cancel(params: InviteCancelParams): HttpResponseFor = + cancel(params, RequestOptions.none()) + + /** @see cancel */ + @MustBeClosed + fun cancel(uid: String, requestOptions: RequestOptions): HttpResponseFor = + cancel(uid, InviteCancelParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `post /v1/teams/invites`, but is otherwise the same as + * [InviteService.member]. + */ + @MustBeClosed + fun member(params: InviteMemberParams): HttpResponseFor = + member(params, RequestOptions.none()) + + /** @see member */ + @MustBeClosed + fun member( + params: InviteMemberParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `patch /v1/teams/invites/{uid}`, but is otherwise the + * same as [InviteService.resend]. + */ + @MustBeClosed + fun resend(uid: String): HttpResponseFor = resend(uid, InviteResendParams.none()) + + /** @see resend */ + @MustBeClosed + fun resend( + uid: String, + params: InviteResendParams = InviteResendParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = resend(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see resend */ + @MustBeClosed + fun resend(uid: String, params: InviteResendParams): HttpResponseFor = + resend(uid, params, RequestOptions.none()) + + /** @see resend */ + @MustBeClosed + fun resend( + params: InviteResendParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see resend */ + @MustBeClosed + fun resend(params: InviteResendParams): HttpResponseFor = + resend(params, RequestOptions.none()) + + /** @see resend */ + @MustBeClosed + fun resend(uid: String, requestOptions: RequestOptions): HttpResponseFor = + resend(uid, InviteResendParams.none(), requestOptions) + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/teams/InviteServiceImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/teams/InviteServiceImpl.kt new file mode 100644 index 0000000..7b0ca21 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/teams/InviteServiceImpl.kt @@ -0,0 +1,132 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.blocking.teams + +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.checkRequired +import com.scalar.core.handlers.errorBodyHandler +import com.scalar.core.handlers.errorHandler +import com.scalar.core.handlers.jsonHandler +import com.scalar.core.http.HttpMethod +import com.scalar.core.http.HttpRequest +import com.scalar.core.http.HttpResponse +import com.scalar.core.http.HttpResponse.Handler +import com.scalar.core.http.HttpResponseFor +import com.scalar.core.http.json +import com.scalar.core.http.parseable +import com.scalar.core.prepare +import com.scalar.models.teams.invites.InviteCancelParams +import com.scalar.models.teams.invites.InviteMemberParams +import com.scalar.models.teams.invites.InviteResendParams +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +/** Teams */ +class InviteServiceImpl internal constructor(private val clientOptions: ClientOptions) : + InviteService { + + private val withRawResponse: InviteService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): InviteService.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): InviteService = + InviteServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun cancel(params: InviteCancelParams, requestOptions: RequestOptions): Any? = + // delete /v1/teams/invites/{uid} + withRawResponse().cancel(params, requestOptions).parse() + + override fun member(params: InviteMemberParams, requestOptions: RequestOptions): Any? = + // post /v1/teams/invites + withRawResponse().member(params, requestOptions).parse() + + override fun resend(params: InviteResendParams, requestOptions: RequestOptions): Any? = + // patch /v1/teams/invites/{uid} + withRawResponse().resend(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + InviteService.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): InviteService.WithRawResponse = + InviteServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val cancelHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun cancel( + params: InviteCancelParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("uid", params.uid().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.DELETE) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "teams", "invites", params._pathParam(0)) + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response.use { cancelHandler.handle(it) } + } + } + + private val memberHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun member( + params: InviteMemberParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "teams", "invites") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response.use { memberHandler.handle(it) } + } + } + + private val resendHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun resend( + params: InviteResendParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("uid", params.uid().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.PATCH) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "teams", "invites", params._pathParam(0)) + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response.use { resendHandler.handle(it) } + } + } + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/teams/MemberService.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/teams/MemberService.kt new file mode 100644 index 0000000..3c88535 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/teams/MemberService.kt @@ -0,0 +1,192 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.blocking.teams + +import com.google.errorprone.annotations.MustBeClosed +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.http.HttpResponseFor +import com.scalar.models.teams.members.MemberDeleteParams +import com.scalar.models.teams.members.MemberListParams +import com.scalar.models.teams.members.MemberListResponse +import com.scalar.models.teams.members.MemberUpdateParams +import java.util.function.Consumer + +/** Teams */ +interface MemberService { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): MemberService + + /** Change what a member of the current team is allowed to do. */ + fun update(uid: String, params: MemberUpdateParams): Any? = + update(uid, params, RequestOptions.none()) + + /** @see update */ + fun update( + uid: String, + params: MemberUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? = update(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see update */ + fun update( + params: MemberUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? + + /** @see update */ + fun update(params: MemberUpdateParams): Any? = update(params, RequestOptions.none()) + + /** List the members of the current team, along with the invites still outstanding. */ + fun list(): MemberListResponse = list(MemberListParams.none()) + + /** @see list */ + fun list( + params: MemberListParams = MemberListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): MemberListResponse + + /** @see list */ + fun list(params: MemberListParams): MemberListResponse = list(params, RequestOptions.none()) + + /** @see list */ + fun list(requestOptions: RequestOptions): MemberListResponse = + list(MemberListParams.none(), requestOptions) + + /** Remove someone from the current team. */ + fun delete(uid: String): Any? = delete(uid, MemberDeleteParams.none()) + + /** @see delete */ + fun delete( + uid: String, + params: MemberDeleteParams = MemberDeleteParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? = delete(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see delete */ + fun delete(uid: String, params: MemberDeleteParams): Any? = + delete(uid, params, RequestOptions.none()) + + /** @see delete */ + fun delete( + params: MemberDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Any? + + /** @see delete */ + fun delete(params: MemberDeleteParams): Any? = delete(params, RequestOptions.none()) + + /** @see delete */ + fun delete(uid: String, requestOptions: RequestOptions): Any? = + delete(uid, MemberDeleteParams.none(), requestOptions) + + /** A view of [MemberService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): MemberService.WithRawResponse + + /** + * Returns a raw HTTP response for `patch /v1/teams/members/{uid}`, but is otherwise the + * same as [MemberService.update]. + */ + @MustBeClosed + fun update(uid: String, params: MemberUpdateParams): HttpResponseFor = + update(uid, params, RequestOptions.none()) + + /** @see update */ + @MustBeClosed + fun update( + uid: String, + params: MemberUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = update(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see update */ + @MustBeClosed + fun update( + params: MemberUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see update */ + @MustBeClosed + fun update(params: MemberUpdateParams): HttpResponseFor = + update(params, RequestOptions.none()) + + /** + * Returns a raw HTTP response for `get /v1/teams/members`, but is otherwise the same as + * [MemberService.list]. + */ + @MustBeClosed + fun list(): HttpResponseFor = list(MemberListParams.none()) + + /** @see list */ + @MustBeClosed + fun list( + params: MemberListParams = MemberListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see list */ + @MustBeClosed + fun list(params: MemberListParams): HttpResponseFor = + list(params, RequestOptions.none()) + + /** @see list */ + @MustBeClosed + fun list(requestOptions: RequestOptions): HttpResponseFor = + list(MemberListParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `delete /v1/teams/members/{uid}`, but is otherwise the + * same as [MemberService.delete]. + */ + @MustBeClosed + fun delete(uid: String): HttpResponseFor = delete(uid, MemberDeleteParams.none()) + + /** @see delete */ + @MustBeClosed + fun delete( + uid: String, + params: MemberDeleteParams = MemberDeleteParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = delete(params.toBuilder().uid(uid).build(), requestOptions) + + /** @see delete */ + @MustBeClosed + fun delete(uid: String, params: MemberDeleteParams): HttpResponseFor = + delete(uid, params, RequestOptions.none()) + + /** @see delete */ + @MustBeClosed + fun delete( + params: MemberDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see delete */ + @MustBeClosed + fun delete(params: MemberDeleteParams): HttpResponseFor = + delete(params, RequestOptions.none()) + + /** @see delete */ + @MustBeClosed + fun delete(uid: String, requestOptions: RequestOptions): HttpResponseFor = + delete(uid, MemberDeleteParams.none(), requestOptions) + } +} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/teams/MemberServiceImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/teams/MemberServiceImpl.kt new file mode 100644 index 0000000..d257301 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/teams/MemberServiceImpl.kt @@ -0,0 +1,142 @@ +// File generated by Scalar SDK Generator. DO NOT EDIT. + +package com.scalar.services.blocking.teams + +import com.scalar.core.ClientOptions +import com.scalar.core.RequestOptions +import com.scalar.core.checkRequired +import com.scalar.core.handlers.errorBodyHandler +import com.scalar.core.handlers.errorHandler +import com.scalar.core.handlers.jsonHandler +import com.scalar.core.http.HttpMethod +import com.scalar.core.http.HttpRequest +import com.scalar.core.http.HttpResponse +import com.scalar.core.http.HttpResponse.Handler +import com.scalar.core.http.HttpResponseFor +import com.scalar.core.http.json +import com.scalar.core.http.parseable +import com.scalar.core.prepare +import com.scalar.models.teams.members.MemberDeleteParams +import com.scalar.models.teams.members.MemberListParams +import com.scalar.models.teams.members.MemberListResponse +import com.scalar.models.teams.members.MemberUpdateParams +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +/** Teams */ +class MemberServiceImpl internal constructor(private val clientOptions: ClientOptions) : + MemberService { + + private val withRawResponse: MemberService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): MemberService.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): MemberService = + MemberServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun update(params: MemberUpdateParams, requestOptions: RequestOptions): Any? = + // patch /v1/teams/members/{uid} + withRawResponse().update(params, requestOptions).parse() + + override fun list( + params: MemberListParams, + requestOptions: RequestOptions, + ): MemberListResponse = + // get /v1/teams/members + withRawResponse().list(params, requestOptions).parse() + + override fun delete(params: MemberDeleteParams, requestOptions: RequestOptions): Any? = + // delete /v1/teams/members/{uid} + withRawResponse().delete(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + MemberService.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): MemberService.WithRawResponse = + MemberServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val updateHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun update( + params: MemberUpdateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("uid", params.uid().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.PATCH) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "teams", "members", params._pathParam(0)) + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response.use { updateHandler.handle(it) } + } + } + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun list( + params: MemberListParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "teams", "members") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val deleteHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun delete( + params: MemberDeleteParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("uid", params.uid().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.DELETE) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "teams", "members", params._pathParam(0)) + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response.use { deleteHandler.handle(it) } + } + } + } +} diff --git a/scalar-java-proguard-test/src/test/kotlin/com/scalar/proguard/ProGuardCompatibilityTest.kt b/scalar-java-proguard-test/src/test/kotlin/com/scalar/proguard/ProGuardCompatibilityTest.kt index ef7f441..bc8f1cc 100644 --- a/scalar-java-proguard-test/src/test/kotlin/com/scalar/proguard/ProGuardCompatibilityTest.kt +++ b/scalar-java-proguard-test/src/test/kotlin/com/scalar/proguard/ProGuardCompatibilityTest.kt @@ -6,6 +6,7 @@ import com.fasterxml.jackson.core.type.TypeReference import com.scalar.client.okhttp.ScalarOkHttpClient import com.scalar.core.jsonMapper import com.scalar.models.Value400 +import com.scalar.models.registry.Method import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertNotNull @@ -33,6 +34,7 @@ internal class ProGuardCompatibilityTest { test.keepRulesAreOnTheClasspath() test.clientResolvesEveryService() test.value400Roundtrips() + test.methodRoundtrips() } } @@ -51,12 +53,16 @@ internal class ProGuardCompatibilityTest { assertNotNull(client.registry()) assertNotNull(client.schemas()) assertNotNull(client.loginPortals()) + assertNotNull(client.accessGroups()) assertNotNull(client.rules()) assertNotNull(client.themes()) assertNotNull(client.teams()) assertNotNull(client.scalarDocs()) assertNotNull(client.namespaces()) assertNotNull(client.authentication()) + assertNotNull(client.sdks()) + assertNotNull(client.mcp()) + assertNotNull(client.oAuth()) } @Test @@ -72,4 +78,18 @@ internal class ProGuardCompatibilityTest { ), ) } + + @Test + fun methodRoundtrips() { + val method = Method.DELETE + val methodJson = jsonMapper().writeValueAsString(method) + + assertEquals( + methodJson, + jsonMapper() + .writeValueAsString( + jsonMapper().readValue(methodJson, object : TypeReference() {}) + ), + ) + } } diff --git a/scalar-sdk.manifest.json b/scalar-sdk.manifest.json index be91ffa..a3e3a29 100644 --- a/scalar-sdk.manifest.json +++ b/scalar-sdk.manifest.json @@ -1218,6 +1218,33 @@ "additionalProperties": false } }, + { + "name": "access_group_name", + "source": "access_group_name", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "maxLength": 40 + } + } + }, + { + "name": "email_domain", + "source": "email_domain", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "pattern": "^([A-Za-z0-9]+(-[A-Za-z0-9]+)*\\.)+[A-Za-z]{2,}$", + "maxLength": 253 + } + } + }, { "name": "rule", "source": "rule", @@ -1427,6 +1454,137 @@ "type": "string" } }, + { + "name": "team_member", + "source": "team_member", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "uid", + "publicName": "uid", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "nanoid" + } + }, + { + "name": "role", + "publicName": "role", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "role" + } + }, + { + "name": "displayName", + "publicName": "displayName", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "imageUri", + "publicName": "imageUri", + "required": false, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + } + ], + "additionalProperties": false + } + }, + { + "name": "role", + "source": "role", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "enum", + "values": [ + "owner", + "admin", + "editor", + "viewer" + ], + "names": [ + "Owner", + "Admin", + "Editor", + "Viewer" + ], + "deprecations": [ + false, + false, + false, + false + ] + } + }, + { + "name": "team_invite", + "source": "team_invite", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "uid", + "publicName": "uid", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "nanoid" + } + }, + { + "name": "email", + "publicName": "email", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "email" + } + }, + { + "name": "role", + "publicName": "role", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "role" + } + }, + { + "name": "expires", + "publicName": "expires", + "required": false, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "number" + } + } + ], + "additionalProperties": false + } + }, { "name": "email", "source": "email", @@ -1965,118 +2123,9648 @@ ], "additionalProperties": false } - } - ], - "resources": [ - "registry", - "schemas", - "schemas.version", - "schemas.accessGroup", - "loginPortals", - "rules", - "themes", - "teams", - "scalarDocs", - "namespaces", - "authentication" - ], - "publicResources": [ - "registry", - "schemas", - "schemas.version", - "schemas.accessGroup", - "loginPortals", - "rules", - "themes", - "teams", - "scalarDocs", - "namespaces", - "authentication" - ], - "operations": [ + }, { - "resource": "registry", - "publicResource": "registry", - "operation": "listAllApiDocuments", - "publicOperation": "listAllApiDocuments", + "name": "sdk", + "source": "sdk", + "publicAliases": [], "deprecated": false, - "method": "GET", - "path": "/v1/apis", - "pathParams": [], - "publicPathParams": [], - "queryParams": [], - "publicQueryParams": [], - "headerParams": [], - "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], - "pathParamDetails": [], - "queryParamDetails": [], - "headerParamDetails": [], - "cookieParams": [], - "publicCookieParams": [], - "cookieParamDetails": [], - "response": { - "status": "200", - "contentType": "application/json", - "encoding": "json", - "contents": [ + "type": { + "kind": "object", + "properties": [ { - "contentType": "application/json", - "encoding": "json" - } - ] - }, - "result": { - "successStatus": "200", - "errorStatuses": [ - "400", - "401", - "403", - "404", - "422", - "500" - ] - }, - "errorResponses": [ - { - "status": "400", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" + "name": "uid", + "publicName": "uid", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "nanoid" } - ], - "model": { - "name": "400", - "publicAliases": [] - } - }, - { - "status": "401", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" + }, + { + "name": "title", + "publicName": "title", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "maxLength": 100 + } } - ], - "model": { - "name": "401", - "publicAliases": [] - } - }, - { - "status": "403", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", + }, + { + "name": "slug", + "publicName": "slug", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "slug" + } + }, + { + "name": "namespace", + "publicName": "namespace", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "namespace" + } + }, + { + "name": "description", + "publicName": "description", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "isPrivate", + "publicName": "isPrivate", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "boolean" + } + }, + { + "name": "apiUid", + "publicName": "apiUid", + "required": true, + "deprecated": false, + "type": { + "kind": "union", + "variants": [ + { + "kind": "ref", + "name": "nanoid" + }, + { + "kind": "null" + } + ] + } + }, + { + "name": "apiVersion", + "publicName": "apiVersion", + "required": false, + "deprecated": false, + "type": { + "kind": "union", + "variants": [ + { + "kind": "ref", + "name": "version" + }, + { + "kind": "null" + } + ] + } + }, + { + "name": "currentVersion", + "publicName": "currentVersion", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "version" + } + }, + { + "name": "targets", + "publicName": "targets", + "required": true, + "deprecated": false, + "type": { + "kind": "array", + "items": { + "kind": "ref", + "name": "sdk_target_summary" + } + } + }, + { + "name": "versions", + "publicName": "versions", + "required": true, + "deprecated": false, + "type": { + "kind": "array", + "items": { + "kind": "ref", + "name": "sdk_version" + } + } + } + ], + "additionalProperties": false + } + }, + { + "name": "sdk_target_summary", + "source": "sdk_target_summary", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "language", + "publicName": "language", + "required": true, + "deprecated": false, + "type": { + "kind": "enum", + "values": [ + "typescript", + "python", + "cli", + "csharp", + "java", + "ruby", + "php", + "go", + "rust", + "kotlin", + "swift", + "cpp", + "dart" + ], + "names": [ + "Typescript", + "Python", + "Cli", + "Csharp", + "Java", + "Ruby", + "Php", + "Go", + "Rust", + "Kotlin", + "Swift", + "Cpp", + "Dart" + ], + "deprecations": [ + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + ] + } + }, + { + "name": "slug", + "publicName": "slug", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "slug" + } + } + ], + "additionalProperties": false + } + }, + { + "name": "sdk_version", + "source": "sdk_version", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "version", + "publicName": "version", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "version" + } + }, + { + "name": "apiVersion", + "publicName": "apiVersion", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "version" + } + }, + { + "name": "status", + "publicName": "status", + "required": true, + "deprecated": false, + "type": { + "kind": "enum", + "values": [ + "draft", + "published" + ], + "names": [ + "Draft", + "Published" + ], + "deprecations": [ + false, + false + ] + } + }, + { + "name": "languages", + "publicName": "languages", + "required": true, + "deprecated": false, + "type": { + "kind": "array", + "items": { + "kind": "enum", + "values": [ + "typescript", + "python", + "cli", + "csharp", + "java", + "ruby", + "php", + "go", + "rust", + "kotlin", + "swift", + "cpp", + "dart" + ], + "names": [ + "Typescript", + "Python", + "Cli", + "Csharp", + "Java", + "Ruby", + "Php", + "Go", + "Rust", + "Kotlin", + "Swift", + "Cpp", + "Dart" + ], + "deprecations": [ + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + ] + } + } + }, + { + "name": "publishedAt", + "publicName": "publishedAt", + "required": false, + "deprecated": false, + "type": { + "kind": "ref", + "name": "timestamp" + } + }, + { + "name": "createdAt", + "publicName": "createdAt", + "required": false, + "deprecated": false, + "type": { + "kind": "ref", + "name": "timestamp" + } + } + ], + "additionalProperties": false + } + }, + { + "name": "docs_project", + "source": "docs_project", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "uid", + "publicName": "uid", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "nanoid" + } + }, + { + "name": "name", + "publicName": "name", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "slug", + "publicName": "slug", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "slug" + } + }, + { + "name": "isPrivate", + "publicName": "isPrivate", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "boolean" + } + }, + { + "name": "accessGroups", + "publicName": "accessGroups", + "required": true, + "deprecated": false, + "type": { + "kind": "unknown" + } + }, + { + "name": "loginPortalUid", + "publicName": "loginPortalUid", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "activeThemeId", + "publicName": "activeThemeId", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "agentEnabled", + "publicName": "agentEnabled", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "boolean" + } + }, + { + "name": "analyticsEnabled", + "publicName": "analyticsEnabled", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "boolean" + } + }, + { + "name": "lastPublished", + "publicName": "lastPublished", + "required": true, + "deprecated": false, + "type": { + "kind": "union", + "variants": [ + { + "kind": "ref", + "name": "timestamp" + }, + { + "kind": "null" + } + ] + } + }, + { + "name": "publishStatus", + "publicName": "publishStatus", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + } + ], + "additionalProperties": false + } + }, + { + "name": "mcp_server", + "source": "mcp_server", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "id", + "publicName": "id", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "name", + "publicName": "name", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "slug", + "publicName": "slug", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "slug" + } + }, + { + "name": "autoAddOperations", + "publicName": "autoAddOperations", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "boolean" + } + }, + { + "name": "createdAt", + "publicName": "createdAt", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "updatedAt", + "publicName": "updatedAt", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + } + ], + "additionalProperties": false + } + }, + { + "name": "mcp_installation", + "source": "mcp_installation", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "id", + "publicName": "id", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "mcpServerId", + "publicName": "mcpServerId", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "name", + "publicName": "name", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "slug", + "publicName": "slug", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "slug" + } + }, + { + "name": "isPrivate", + "publicName": "isPrivate", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "boolean" + } + }, + { + "name": "accessGroups", + "publicName": "accessGroups", + "required": true, + "deprecated": false, + "type": { + "kind": "array", + "items": { + "kind": "primitive", + "type": "string" + } + } + }, + { + "name": "loginPortalUid", + "publicName": "loginPortalUid", + "required": true, + "deprecated": false, + "type": { + "kind": "union", + "variants": [ + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "null" + } + ] + } + }, + { + "name": "mcpVersion", + "publicName": "mcpVersion", + "required": true, + "deprecated": false, + "type": { + "kind": "union", + "variants": [ + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "null" + } + ] + } + }, + { + "name": "piiRedactionEnabled", + "publicName": "piiRedactionEnabled", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "boolean" + } + }, + { + "name": "credentialRedactionEnabled", + "publicName": "credentialRedactionEnabled", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "boolean" + } + } + ], + "additionalProperties": false + } + }, + { + "name": "mcp_installation_list_item", + "source": "mcp_installation_list_item", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "id", + "publicName": "id", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "name", + "publicName": "name", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "slug", + "publicName": "slug", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "slug" + } + }, + { + "name": "isPrivate", + "publicName": "isPrivate", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "boolean" + } + }, + { + "name": "mcpVersion", + "publicName": "mcpVersion", + "required": true, + "deprecated": false, + "type": { + "kind": "union", + "variants": [ + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "null" + } + ] + } + } + ], + "additionalProperties": false + } + }, + { + "name": "oauth_token", + "source": "oauth_token", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "access_token", + "publicName": "access_token", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "token_type", + "publicName": "token_type", + "required": true, + "deprecated": false, + "type": { + "kind": "literal", + "value": "Bearer" + } + }, + { + "name": "expires_in", + "publicName": "expires_in", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "integer", + "validation": { + "minimum": -9007199254740991, + "maximum": 9007199254740991 + } + } + }, + { + "name": "refresh_token", + "publicName": "refresh_token", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "scope", + "publicName": "scope", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "oauth_scope" + } + } + ], + "additionalProperties": false + } + }, + { + "name": "oauth_scope", + "source": "oauth_scope", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "enum", + "values": [ + "read", + "write", + "admin" + ], + "names": [ + "Read", + "Write", + "Admin" + ], + "deprecations": [ + false, + false, + false + ] + } + }, + { + "name": "oauth_error", + "source": "oauth_error", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "error", + "publicName": "error", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "error_description", + "publicName": "error_description", + "required": false, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + } + ], + "additionalProperties": false + } + }, + { + "name": "oauth_token_request", + "source": "oauth_token_request", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "grant_type", + "publicName": "grant_type", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "maxLength": 64 + } + } + }, + { + "name": "client_id", + "publicName": "client_id", + "required": false, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "maxLength": 256 + } + } + }, + { + "name": "client_secret", + "publicName": "client_secret", + "required": false, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "maxLength": 256 + } + } + }, + { + "name": "code", + "publicName": "code", + "required": false, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "maxLength": 256 + } + } + }, + { + "name": "redirect_uri", + "publicName": "redirect_uri", + "required": false, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "maxLength": 2048 + } + } + }, + { + "name": "code_verifier", + "publicName": "code_verifier", + "required": false, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "maxLength": 256 + } + } + }, + { + "name": "refresh_token", + "publicName": "refresh_token", + "required": false, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "maxLength": 4096 + } + } + }, + { + "name": "scope", + "publicName": "scope", + "required": false, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "maxLength": 256 + } + } + } + ], + "additionalProperties": false + } + }, + { + "name": "oauth_revoke_request", + "source": "oauth_revoke_request", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "token", + "publicName": "token", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "maxLength": 4096 + } + } + }, + { + "name": "token_type_hint", + "publicName": "token_type_hint", + "required": false, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "maxLength": 64 + } + } + }, + { + "name": "client_id", + "publicName": "client_id", + "required": false, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "maxLength": 256 + } + } + }, + { + "name": "client_secret", + "publicName": "client_secret", + "required": false, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "maxLength": 256 + } + } + } + ], + "additionalProperties": false + } + }, + { + "name": "oauth_authorization_server_metadata", + "source": "oauth_authorization_server_metadata", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "issuer", + "publicName": "issuer", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "authorization_endpoint", + "publicName": "authorization_endpoint", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "token_endpoint", + "publicName": "token_endpoint", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "revocation_endpoint", + "publicName": "revocation_endpoint", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "response_types_supported", + "publicName": "response_types_supported", + "required": true, + "deprecated": false, + "type": { + "kind": "array", + "items": { + "kind": "primitive", + "type": "string" + } + } + }, + { + "name": "grant_types_supported", + "publicName": "grant_types_supported", + "required": true, + "deprecated": false, + "type": { + "kind": "array", + "items": { + "kind": "primitive", + "type": "string" + } + } + }, + { + "name": "code_challenge_methods_supported", + "publicName": "code_challenge_methods_supported", + "required": true, + "deprecated": false, + "type": { + "kind": "array", + "items": { + "kind": "primitive", + "type": "string" + } + } + }, + { + "name": "token_endpoint_auth_methods_supported", + "publicName": "token_endpoint_auth_methods_supported", + "required": true, + "deprecated": false, + "type": { + "kind": "array", + "items": { + "kind": "primitive", + "type": "string" + } + } + }, + { + "name": "revocation_endpoint_auth_methods_supported", + "publicName": "revocation_endpoint_auth_methods_supported", + "required": true, + "deprecated": false, + "type": { + "kind": "array", + "items": { + "kind": "primitive", + "type": "string" + } + } + }, + { + "name": "scopes_supported", + "publicName": "scopes_supported", + "required": true, + "deprecated": false, + "type": { + "kind": "array", + "items": { + "kind": "primitive", + "type": "string" + } + } + } + ], + "additionalProperties": false + } + } + ], + "resources": [ + "registry", + "schemas", + "schemas.version", + "schemas.accessGroup", + "loginPortals", + "accessGroups", + "accessGroups.domains", + "rules", + "themes", + "teams", + "teams.members", + "teams.invites", + "scalarDocs", + "namespaces", + "authentication", + "sdks", + "sdks.versions", + "sdks.repositories", + "mcp", + "mcp.servers", + "mcp.servers.installations", + "oAuth" + ], + "publicResources": [ + "registry", + "schemas", + "schemas.version", + "schemas.accessGroup", + "loginPortals", + "accessGroups", + "accessGroups.domains", + "rules", + "themes", + "teams", + "teams.members", + "teams.invites", + "scalarDocs", + "namespaces", + "authentication", + "sdks", + "sdks.versions", + "sdks.repositories", + "mcp", + "mcp.servers", + "mcp.servers.installations", + "oAuth" + ], + "operations": [ + { + "resource": "registry", + "publicResource": "registry", + "operation": "listAllApiDocuments", + "publicOperation": "listAllApiDocuments", + "deprecated": false, + "method": "GET", + "path": "/v1/apis", + "pathParams": [], + "publicPathParams": [], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "registry", + "publicResource": "registry", + "operation": "listApiDocuments", + "publicOperation": "listApiDocuments", + "deprecated": false, + "method": "GET", + "path": "/v1/apis/{namespace}", + "pathParams": [ + "namespace" + ], + "publicPathParams": [ + "namespace" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "RegistryListApiDocumentsParams" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "registry", + "publicResource": "registry", + "operation": "createApiDocument", + "publicOperation": "createApiDocument", + "deprecated": false, + "method": "POST", + "path": "/v1/apis/{namespace}", + "pathParams": [ + "namespace" + ], + "publicPathParams": [ + "namespace" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "title", + "description", + "version", + "slug", + "ruleset", + "isPrivate", + "document" + ], + "publicBodyParams": [ + "title", + "description", + "version", + "slug", + "ruleset", + "isPrivate", + "document" + ], + "bodyParamDetails": [ + { + "name": "title", + "required": true + }, + { + "name": "description", + "required": false + }, + { + "name": "version", + "required": true + }, + { + "name": "slug", + "required": true + }, + { + "name": "ruleset", + "required": false + }, + { + "name": "isPrivate", + "required": false + }, + { + "name": "document", + "required": true + } + ], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "RegistryCreateApiDocumentParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "registry", + "publicResource": "registry", + "operation": "updateApiDocument", + "publicOperation": "updateApiDocument", + "deprecated": false, + "method": "PATCH", + "path": "/v1/apis/{namespace}/{slug}", + "pathParams": [ + "namespace", + "slug" + ], + "publicPathParams": [ + "namespace", + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "title", + "description", + "isPrivate", + "ruleset" + ], + "publicBodyParams": [ + "title", + "description", + "isPrivate", + "ruleset" + ], + "bodyParamDetails": [ + { + "name": "title", + "required": false + }, + { + "name": "description", + "required": false + }, + { + "name": "isPrivate", + "required": false + }, + { + "name": "ruleset", + "required": false + } + ], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "RegistryUpdateApiDocumentParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "registry", + "publicResource": "registry", + "operation": "deleteApiDocument", + "publicOperation": "deleteApiDocument", + "deprecated": false, + "method": "DELETE", + "path": "/v1/apis/{namespace}/{slug}", + "pathParams": [ + "namespace", + "slug" + ], + "publicPathParams": [ + "namespace", + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "RegistryDeleteApiDocumentParams" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "registry", + "publicResource": "registry", + "operation": "retrieveApiDocumentVersion", + "publicOperation": "retrieveApiDocumentVersion", + "deprecated": false, + "method": "GET", + "path": "/v1/apis/{namespace}/{slug}/version/{semver}", + "pathParams": [ + "namespace", + "slug", + "semver" + ], + "publicPathParams": [ + "namespace", + "slug", + "semver" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "semver", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "RegistryRetrieveApiDocumentVersionParams" + }, + "response": { + "status": "200", + "contentType": "text/plain", + "encoding": "text", + "contents": [ + { + "contentType": "text/plain", + "encoding": "text" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "registry", + "publicResource": "registry", + "operation": "updateApiDocumentVersion", + "publicOperation": "updateApiDocumentVersion", + "deprecated": false, + "method": "PATCH", + "path": "/v1/apis/{namespace}/{slug}/version/{semver}", + "pathParams": [ + "namespace", + "slug", + "semver" + ], + "publicPathParams": [ + "namespace", + "slug", + "semver" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "document" + ], + "publicBodyParams": [ + "document" + ], + "bodyParamDetails": [ + { + "name": "document", + "required": true + } + ], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "semver", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "RegistryUpdateApiDocumentVersionParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "registry", + "publicResource": "registry", + "operation": "deleteApiDocumentVersion", + "publicOperation": "deleteApiDocumentVersion", + "deprecated": false, + "method": "DELETE", + "path": "/v1/apis/{namespace}/{slug}/version/{semver}", + "pathParams": [ + "namespace", + "slug", + "semver" + ], + "publicPathParams": [ + "namespace", + "slug", + "semver" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "semver", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "RegistryDeleteApiDocumentVersionParams" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "registry", + "publicResource": "registry", + "operation": "listApiDocumentVersionMetadata", + "publicOperation": "listApiDocumentVersionMetadata", + "deprecated": false, + "method": "GET", + "path": "/v1/apis/{namespace}/{slug}/version/{semver}/metadata", + "pathParams": [ + "namespace", + "slug", + "semver" + ], + "publicPathParams": [ + "namespace", + "slug", + "semver" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "semver", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "RegistryListApiDocumentVersionMetadataParams" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "responseModel": { + "name": "managed_doc_version", + "publicAliases": [] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "registry", + "publicResource": "registry", + "operation": "createApiDocumentVersion", + "publicOperation": "createApiDocumentVersion", + "deprecated": false, + "method": "POST", + "path": "/v1/apis/{namespace}/{slug}/version", + "pathParams": [ + "namespace", + "slug" + ], + "publicPathParams": [ + "namespace", + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "version", + "document", + "force" + ], + "publicBodyParams": [ + "version", + "document", + "force" + ], + "bodyParamDetails": [ + { + "name": "version", + "required": true + }, + { + "name": "document", + "required": true + }, + { + "name": "force", + "required": false + } + ], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "RegistryCreateApiDocumentVersionParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "responseModel": { + "name": "managed_doc_version", + "publicAliases": [] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "registry", + "publicResource": "registry", + "operation": "createApiDocumentAccessGroup", + "publicOperation": "createApiDocumentAccessGroup", + "deprecated": false, + "method": "POST", + "path": "/v1/apis/{namespace}/{slug}/access-group", + "pathParams": [ + "namespace", + "slug" + ], + "publicPathParams": [ + "namespace", + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "accessGroupSlug" + ], + "publicBodyParams": [ + "accessGroupSlug" + ], + "bodyParamDetails": [ + { + "name": "accessGroupSlug", + "required": true + } + ], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "RegistryCreateApiDocumentAccessGroupParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "registry", + "publicResource": "registry", + "operation": "deleteApiDocumentAccessGroup", + "publicOperation": "deleteApiDocumentAccessGroup", + "deprecated": false, + "method": "DELETE", + "path": "/v1/apis/{namespace}/{slug}/access-group", + "pathParams": [ + "namespace", + "slug" + ], + "publicPathParams": [ + "namespace", + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "accessGroupSlug" + ], + "publicBodyParams": [ + "accessGroupSlug" + ], + "bodyParamDetails": [ + { + "name": "accessGroupSlug", + "required": true + } + ], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "RegistryDeleteApiDocumentAccessGroupParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "schemas", + "publicResource": "schemas", + "operation": "list", + "publicOperation": "list", + "deprecated": false, + "method": "GET", + "path": "/v1/schemas/{namespace}", + "pathParams": [ + "namespace" + ], + "publicPathParams": [ + "namespace" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "SchemaListParams" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "schemas", + "publicResource": "schemas", + "operation": "create", + "publicOperation": "create", + "deprecated": false, + "method": "POST", + "path": "/v1/schemas/{namespace}", + "pathParams": [ + "namespace" + ], + "publicPathParams": [ + "namespace" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "title", + "description", + "version", + "slug", + "isPrivate", + "document" + ], + "publicBodyParams": [ + "title", + "description", + "version", + "slug", + "isPrivate", + "document" + ], + "bodyParamDetails": [ + { + "name": "title", + "required": true + }, + { + "name": "description", + "required": false + }, + { + "name": "version", + "required": true + }, + { + "name": "slug", + "required": true + }, + { + "name": "isPrivate", + "required": false + }, + { + "name": "document", + "required": true + } + ], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "SchemaCreateParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "responseModel": { + "name": "uid", + "publicAliases": [] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "schemas", + "publicResource": "schemas", + "operation": "update", + "publicOperation": "update", + "deprecated": false, + "method": "PATCH", + "path": "/v1/schemas/{namespace}/{slug}", + "pathParams": [ + "namespace", + "slug" + ], + "publicPathParams": [ + "namespace", + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "title", + "description", + "isPrivate" + ], + "publicBodyParams": [ + "title", + "description", + "isPrivate" + ], + "bodyParamDetails": [ + { + "name": "title", + "required": false + }, + { + "name": "description", + "required": false + }, + { + "name": "isPrivate", + "required": false + } + ], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "SchemaUpdateParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "schemas", + "publicResource": "schemas", + "operation": "delete", + "publicOperation": "delete", + "deprecated": false, + "method": "DELETE", + "path": "/v1/schemas/{namespace}/{slug}", + "pathParams": [ + "namespace", + "slug" + ], + "publicPathParams": [ + "namespace", + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "SchemaDeleteParams" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "schemas.version", + "publicResource": "schemas.version", + "operation": "retrieve", + "publicOperation": "retrieve", + "deprecated": false, + "method": "GET", + "path": "/v1/schemas/{namespace}/{slug}/version/{semver}", + "pathParams": [ + "namespace", + "slug", + "semver" + ], + "publicPathParams": [ + "namespace", + "slug", + "semver" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "semver", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "VersionRetrieveParams" + }, + "response": { + "status": "200", + "contentType": "text/plain", + "encoding": "text", + "contents": [ + { + "contentType": "text/plain", + "encoding": "text" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "schemas.version", + "publicResource": "schemas.version", + "operation": "delete", + "publicOperation": "delete", + "deprecated": false, + "method": "DELETE", + "path": "/v1/schemas/{namespace}/{slug}/version/{semver}", + "pathParams": [ + "namespace", + "slug", + "semver" + ], + "publicPathParams": [ + "namespace", + "slug", + "semver" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "semver", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "VersionDeleteParams" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "schemas.version", + "publicResource": "schemas.version", + "operation": "create", + "publicOperation": "create", + "deprecated": false, + "method": "POST", + "path": "/v1/schemas/{namespace}/{slug}/version", + "pathParams": [ + "namespace", + "slug" + ], + "publicPathParams": [ + "namespace", + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "version", + "document", + "force" + ], + "publicBodyParams": [ + "version", + "document", + "force" + ], + "bodyParamDetails": [ + { + "name": "version", + "required": true + }, + { + "name": "document", + "required": true + }, + { + "name": "force", + "required": false + } + ], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "VersionCreateParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "schemas.accessGroup", + "publicResource": "schemas.accessGroup", + "operation": "create", + "publicOperation": "create", + "deprecated": false, + "method": "POST", + "path": "/v1/schemas/{namespace}/{slug}/access-group", + "pathParams": [ + "namespace", + "slug" + ], + "publicPathParams": [ + "namespace", + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "accessGroupSlug" + ], + "publicBodyParams": [ + "accessGroupSlug" + ], + "bodyParamDetails": [ + { + "name": "accessGroupSlug", + "required": true + } + ], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "AccessGroupCreateParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "schemas.accessGroup", + "publicResource": "schemas.accessGroup", + "operation": "delete", + "publicOperation": "delete", + "deprecated": false, + "method": "DELETE", + "path": "/v1/schemas/{namespace}/{slug}/access-group", + "pathParams": [ + "namespace", + "slug" + ], + "publicPathParams": [ + "namespace", + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "accessGroupSlug" + ], + "publicBodyParams": [ + "accessGroupSlug" + ], + "bodyParamDetails": [ + { + "name": "accessGroupSlug", + "required": true + } + ], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "AccessGroupDeleteParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "loginPortals", + "publicResource": "loginPortals", + "operation": "retrieve", + "publicOperation": "retrieve", + "deprecated": false, + "method": "GET", + "path": "/v1/login-portals/{slug}", + "pathParams": [ + "slug" + ], + "publicPathParams": [ + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [ + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "LoginPortalRetrieveParams" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "loginPortals", + "publicResource": "loginPortals", + "operation": "update", + "publicOperation": "update", + "deprecated": false, + "method": "PATCH", + "path": "/v1/login-portals/{slug}", + "pathParams": [ + "slug" + ], + "publicPathParams": [ + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "title" + ], + "publicBodyParams": [ + "title" + ], + "bodyParamDetails": [ + { + "name": "title", + "required": false + } + ], + "pathParamDetails": [ + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "LoginPortalUpdateParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "loginPortals", + "publicResource": "loginPortals", + "operation": "delete", + "publicOperation": "delete", + "deprecated": false, + "method": "DELETE", + "path": "/v1/login-portals/{slug}", + "pathParams": [ + "slug" + ], + "publicPathParams": [ + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [ + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "LoginPortalDeleteParams" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "loginPortals", + "publicResource": "loginPortals", + "operation": "create", + "publicOperation": "create", + "deprecated": false, + "method": "POST", + "path": "/v1/login-portals", + "pathParams": [], + "publicPathParams": [], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "title", + "slug", + "email", + "page" + ], + "publicBodyParams": [ + "title", + "slug", + "email", + "page" + ], + "bodyParamDetails": [ + { + "name": "title", + "required": true + }, + { + "name": "slug", + "required": true + }, + { + "name": "email", + "required": true + }, + { + "name": "page", + "required": true + } + ], + "pathParamDetails": [], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "LoginPortalCreateParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "responseModel": { + "name": "uid", + "publicAliases": [] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "loginPortals", + "publicResource": "loginPortals", + "operation": "list", + "publicOperation": "list", + "deprecated": false, + "method": "GET", + "path": "/v1/login-portals", + "pathParams": [], + "publicPathParams": [], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "accessGroups", + "publicResource": "accessGroups", + "operation": "create", + "publicOperation": "create", + "deprecated": false, + "method": "POST", + "path": "/v1/access-groups", + "pathParams": [], + "publicPathParams": [], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "name", + "slug", + "allowedDomains" + ], + "publicBodyParams": [ + "name", + "slug", + "allowedDomains" + ], + "bodyParamDetails": [ + { + "name": "name", + "required": false + }, + { + "name": "slug", + "required": false + }, + { + "name": "allowedDomains", + "required": false + } + ], + "pathParamDetails": [], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "AccessGroupCreateParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "accessGroups", + "publicResource": "accessGroups", + "operation": "retrieve", + "publicOperation": "retrieve", + "deprecated": false, + "method": "GET", + "path": "/v1/access-groups/{slug}", + "pathParams": [ + "slug" + ], + "publicPathParams": [ + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [ + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "AccessGroupRetrieveParams" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "accessGroups", + "publicResource": "accessGroups", + "operation": "update", + "publicOperation": "update", + "deprecated": false, + "method": "PATCH", + "path": "/v1/access-groups/{slug}", + "pathParams": [ + "slug" + ], + "publicPathParams": [ + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "name", + "slug" + ], + "publicBodyParams": [ + "name", + "slug" + ], + "bodyParamDetails": [ + { + "name": "name", + "required": false + }, + { + "name": "slug", + "required": false + } + ], + "pathParamDetails": [ + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "AccessGroupUpdateParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "accessGroups", + "publicResource": "accessGroups", + "operation": "delete", + "publicOperation": "delete", + "deprecated": false, + "method": "DELETE", + "path": "/v1/access-groups/{slug}", + "pathParams": [ + "slug" + ], + "publicPathParams": [ + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [ + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "AccessGroupDeleteParams" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "accessGroups.domains", + "publicResource": "accessGroups.domains", + "operation": "create", + "publicOperation": "create", + "deprecated": false, + "method": "POST", + "path": "/v1/access-groups/{slug}/domains", + "pathParams": [ + "slug" + ], + "publicPathParams": [ + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "domain" + ], + "publicBodyParams": [ + "domain" + ], + "bodyParamDetails": [ + { + "name": "domain", + "required": true + } + ], + "pathParamDetails": [ + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "DomainCreateParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "accessGroups.domains", + "publicResource": "accessGroups.domains", + "operation": "delete", + "publicOperation": "delete", + "deprecated": false, + "method": "DELETE", + "path": "/v1/access-groups/{slug}/domains", + "pathParams": [ + "slug" + ], + "publicPathParams": [ + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "domain" + ], + "publicBodyParams": [ + "domain" + ], + "bodyParamDetails": [ + { + "name": "domain", + "required": true + } + ], + "pathParamDetails": [ + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "DomainDeleteParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "rules", + "publicResource": "rules", + "operation": "listRulesets", + "publicOperation": "listRulesets", + "deprecated": false, + "method": "GET", + "path": "/v1/rulesets/{namespace}", + "pathParams": [ + "namespace" + ], + "publicPathParams": [ + "namespace" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "RuleListRulesetsParams" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "rules", + "publicResource": "rules", + "operation": "createRuleset", + "publicOperation": "createRuleset", + "deprecated": false, + "method": "POST", + "path": "/v1/rulesets/{namespace}", + "pathParams": [ + "namespace" + ], + "publicPathParams": [ + "namespace" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "title", + "description", + "slug", + "isPrivate", + "document" + ], + "publicBodyParams": [ + "title", + "description", + "slug", + "isPrivate", + "document" + ], + "bodyParamDetails": [ + { + "name": "title", + "required": true + }, + { + "name": "description", + "required": false + }, + { + "name": "slug", + "required": true + }, + { + "name": "isPrivate", + "required": false + }, + { + "name": "document", + "required": true + } + ], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "RuleCreateRulesetParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "responseModel": { + "name": "uid", + "publicAliases": [] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "rules", + "publicResource": "rules", + "operation": "updateRuleset", + "publicOperation": "updateRuleset", + "deprecated": false, + "method": "PATCH", + "path": "/v1/rulesets/{namespace}/{slug}", + "pathParams": [ + "namespace", + "slug" + ], + "publicPathParams": [ + "namespace", + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "namespace", + "slug", + "title", + "description", + "isPrivate" + ], + "publicBodyParams": [ + "namespace", + "slug", + "title", + "description", + "isPrivate" + ], + "bodyParamDetails": [ + { + "name": "namespace", + "required": false + }, + { + "name": "slug", + "required": false + }, + { + "name": "title", + "required": false + }, + { + "name": "description", + "required": false + }, + { + "name": "isPrivate", + "required": false + } + ], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "RuleUpdateRulesetParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "rules", + "publicResource": "rules", + "operation": "deleteRuleset", + "publicOperation": "deleteRuleset", + "deprecated": false, + "method": "DELETE", + "path": "/v1/rulesets/{namespace}/{slug}", + "pathParams": [ + "namespace", + "slug" + ], + "publicPathParams": [ + "namespace", + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "RuleDeleteRulesetParams" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "rules", + "publicResource": "rules", + "operation": "retrieveRulesetDocument", + "publicOperation": "retrieveRulesetDocument", + "deprecated": false, + "method": "GET", + "path": "/v1/rulesets/{namespace}/{slug}", + "pathParams": [ + "namespace", + "slug" + ], + "publicPathParams": [ + "namespace", + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "RuleRetrieveRulesetDocumentParams" + }, + "response": { + "status": "200", + "contentType": "text/plain", + "encoding": "text", + "contents": [ + { + "contentType": "text/plain", + "encoding": "text" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "rules", + "publicResource": "rules", + "operation": "createRulesetAccessGroup", + "publicOperation": "createRulesetAccessGroup", + "deprecated": false, + "method": "POST", + "path": "/v1/rulesets/{namespace}/{slug}/access-group", + "pathParams": [ + "namespace", + "slug" + ], + "publicPathParams": [ + "namespace", + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "accessGroupSlug" + ], + "publicBodyParams": [ + "accessGroupSlug" + ], + "bodyParamDetails": [ + { + "name": "accessGroupSlug", + "required": true + } + ], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "RuleCreateRulesetAccessGroupParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "rules", + "publicResource": "rules", + "operation": "deleteRulesetAccessGroup", + "publicOperation": "deleteRulesetAccessGroup", + "deprecated": false, + "method": "DELETE", + "path": "/v1/rulesets/{namespace}/{slug}/access-group", + "pathParams": [ + "namespace", + "slug" + ], + "publicPathParams": [ + "namespace", + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "accessGroupSlug" + ], + "publicBodyParams": [ + "accessGroupSlug" + ], + "bodyParamDetails": [ + { + "name": "accessGroupSlug", + "required": true + } + ], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "RuleDeleteRulesetAccessGroupParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "themes", + "publicResource": "themes", + "operation": "list", + "publicOperation": "list", + "deprecated": false, + "method": "GET", + "path": "/v1/themes", + "pathParams": [], + "publicPathParams": [], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "themes", + "publicResource": "themes", + "operation": "create", + "publicOperation": "create", + "deprecated": false, + "method": "POST", + "path": "/v1/themes", + "pathParams": [], + "publicPathParams": [], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "name", + "description", + "slug", + "document" + ], + "publicBodyParams": [ + "name", + "description", + "slug", + "document" + ], + "bodyParamDetails": [ + { + "name": "name", + "required": true + }, + { + "name": "description", + "required": false + }, + { + "name": "slug", + "required": true + }, + { + "name": "document", + "required": true + } + ], + "pathParamDetails": [], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "ThemeCreateParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "responseModel": { + "name": "uid", + "publicAliases": [] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "themes", + "publicResource": "themes", + "operation": "update", + "publicOperation": "update", + "deprecated": false, + "method": "PATCH", + "path": "/v1/themes/{slug}", + "pathParams": [ + "slug" + ], + "publicPathParams": [ + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "name", + "description" + ], + "publicBodyParams": [ + "name", + "description" + ], + "bodyParamDetails": [ + { + "name": "name", + "required": false + }, + { + "name": "description", + "required": false + } + ], + "pathParamDetails": [ + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "ThemeUpdateParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "themes", + "publicResource": "themes", + "operation": "replaceDocument", + "publicOperation": "replaceDocument", + "deprecated": false, + "method": "PUT", + "path": "/v1/themes/{slug}", + "pathParams": [ + "slug" + ], + "publicPathParams": [ + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "document" + ], + "publicBodyParams": [ + "document" + ], + "bodyParamDetails": [ + { + "name": "document", + "required": true + } + ], + "pathParamDetails": [ + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "ThemeReplaceDocumentParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "themes", + "publicResource": "themes", + "operation": "delete", + "publicOperation": "delete", + "deprecated": false, + "method": "DELETE", + "path": "/v1/themes/{slug}", + "pathParams": [ + "slug" + ], + "publicPathParams": [ + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [ + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "ThemeDeleteParams" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "themes", + "publicResource": "themes", + "operation": "retrieve", + "publicOperation": "retrieve", + "deprecated": false, + "method": "GET", + "path": "/v1/themes/{slug}", + "pathParams": [ + "slug" + ], + "publicPathParams": [ + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [ + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "ThemeRetrieveParams" + }, + "response": { + "status": "200", + "contentType": "text/plain", + "encoding": "text", + "contents": [ + { + "contentType": "text/plain", + "encoding": "text" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "teams", + "publicResource": "teams", + "operation": "list", + "publicOperation": "list", + "deprecated": false, + "method": "GET", + "path": "/v1/teams", + "pathParams": [], + "publicPathParams": [], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "teams.members", + "publicResource": "teams.members", + "operation": "list", + "publicOperation": "list", + "deprecated": false, + "method": "GET", + "path": "/v1/teams/members", + "pathParams": [], + "publicPathParams": [], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "teams.members", + "publicResource": "teams.members", + "operation": "update", + "publicOperation": "update", + "deprecated": false, + "method": "PATCH", + "path": "/v1/teams/members/{uid}", + "pathParams": [ + "uid" + ], + "publicPathParams": [ + "uid" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "role" + ], + "publicBodyParams": [ + "role" + ], + "bodyParamDetails": [ + { + "name": "role", + "required": true + } + ], + "pathParamDetails": [ + { + "name": "uid", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "MemberUpdateParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "teams.members", + "publicResource": "teams.members", + "operation": "delete", + "publicOperation": "delete", + "deprecated": false, + "method": "DELETE", + "path": "/v1/teams/members/{uid}", + "pathParams": [ + "uid" + ], + "publicPathParams": [ + "uid" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [ + { + "name": "uid", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "MemberDeleteParams" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", "encoding": "json" } ], @@ -2135,41 +11823,58 @@ "transport": "http" }, { - "resource": "registry", - "publicResource": "registry", - "operation": "listApiDocuments", - "publicOperation": "listApiDocuments", + "resource": "teams.invites", + "publicResource": "teams.invites", + "operation": "member", + "publicOperation": "member", "deprecated": false, - "method": "GET", - "path": "/v1/apis/{namespace}", - "pathParams": [ - "namespace" - ], - "publicPathParams": [ - "namespace" - ], + "method": "POST", + "path": "/v1/teams/invites", + "pathParams": [], + "publicPathParams": [], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], - "pathParamDetails": [ + "bodyParams": [ + "email", + "role" + ], + "publicBodyParams": [ + "email", + "role" + ], + "bodyParamDetails": [ { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false + "name": "email", + "required": true + }, + { + "name": "role", + "required": true } ], + "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RegistryListApiDocumentsParams" + "publicName": "InviteMemberParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" }, "response": { "status": "200", @@ -2289,74 +11994,183 @@ "transport": "http" }, { - "resource": "registry", - "publicResource": "registry", - "operation": "createApiDocument", - "publicOperation": "createApiDocument", + "resource": "teams.invites", + "publicResource": "teams.invites", + "operation": "resend", + "publicOperation": "resend", "deprecated": false, - "method": "POST", - "path": "/v1/apis/{namespace}", + "method": "PATCH", + "path": "/v1/teams/invites/{uid}", "pathParams": [ - "namespace" + "uid" ], "publicPathParams": [ - "namespace" + "uid" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "title", - "description", - "version", - "slug", - "ruleset", - "isPrivate", - "document" - ], - "publicBodyParams": [ - "title", - "description", - "version", - "slug", - "ruleset", - "isPrivate", - "document" - ], - "bodyParamDetails": [ + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [ { - "name": "title", - "required": true - }, + "name": "uid", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "InviteResendParams" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ { - "name": "description", - "required": false + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } }, { - "name": "version", - "required": true + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } }, { - "name": "slug", - "required": true + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } }, { - "name": "ruleset", - "required": false + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } }, { - "name": "isPrivate", - "required": false + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } }, { - "name": "document", - "required": true + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } } ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "teams.invites", + "publicResource": "teams.invites", + "operation": "cancel", + "publicOperation": "cancel", + "deprecated": false, + "method": "DELETE", + "path": "/v1/teams/invites/{uid}", + "pathParams": [ + "uid" + ], + "publicPathParams": [ + "uid" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], "pathParamDetails": [ { - "name": "namespace", + "name": "uid", "required": true, "style": "simple", "explode": false @@ -2366,22 +12180,9 @@ "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], - "cookieParamDetails": [], - "paramsModel": { - "publicName": "RegistryCreateApiDocumentParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "cookieParamDetails": [], + "paramsModel": { + "publicName": "InviteCancelParams" }, "response": { "status": "200", @@ -2501,90 +12302,28 @@ "transport": "http" }, { - "resource": "registry", - "publicResource": "registry", - "operation": "updateApiDocument", - "publicOperation": "updateApiDocument", + "resource": "scalarDocs", + "publicResource": "scalarDocs", + "operation": "listGuides", + "publicOperation": "listGuides", "deprecated": false, - "method": "PATCH", - "path": "/v1/apis/{namespace}/{slug}", - "pathParams": [ - "namespace", - "slug" - ], - "publicPathParams": [ - "namespace", - "slug" - ], + "method": "GET", + "path": "/v1/guides", + "pathParams": [], + "publicPathParams": [], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "title", - "description", - "isPrivate", - "ruleset" - ], - "publicBodyParams": [ - "title", - "description", - "isPrivate", - "ruleset" - ], - "bodyParamDetails": [ - { - "name": "title", - "required": false - }, - { - "name": "description", - "required": false - }, - { - "name": "isPrivate", - "required": false - }, - { - "name": "ruleset", - "required": false - } - ], - "pathParamDetails": [ - { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false - }, - { - "name": "slug", - "required": true, - "style": "simple", - "explode": false - } - ], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], - "paramsModel": { - "publicName": "RegistryUpdateApiDocumentParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" - }, "response": { "status": "200", "contentType": "application/json", @@ -2703,49 +12442,76 @@ "transport": "http" }, { - "resource": "registry", - "publicResource": "registry", - "operation": "deleteApiDocument", - "publicOperation": "deleteApiDocument", + "resource": "scalarDocs", + "publicResource": "scalarDocs", + "operation": "createGuide", + "publicOperation": "createGuide", "deprecated": false, - "method": "DELETE", - "path": "/v1/apis/{namespace}/{slug}", - "pathParams": [ - "namespace", - "slug" - ], - "publicPathParams": [ - "namespace", - "slug" - ], + "method": "POST", + "path": "/v1/guides", + "pathParams": [], + "publicPathParams": [], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], - "pathParamDetails": [ + "bodyParams": [ + "name", + "slug", + "isPrivate", + "allowedUsers", + "allowedDomains" + ], + "publicBodyParams": [ + "name", + "slug", + "isPrivate", + "allowedUsers", + "allowedDomains" + ], + "bodyParamDetails": [ { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false + "name": "name", + "required": true }, { "name": "slug", - "required": true, - "style": "simple", - "explode": false + "required": false + }, + { + "name": "isPrivate", + "required": true + }, + { + "name": "allowedUsers", + "required": true + }, + { + "name": "allowedDomains", + "required": true } ], + "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RegistryDeleteApiDocumentParams" + "publicName": "ScalarDocCreateGuideParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" }, "response": { "status": "200", @@ -2865,22 +12631,18 @@ "transport": "http" }, { - "resource": "registry", - "publicResource": "registry", - "operation": "retrieveApiDocumentVersion", - "publicOperation": "retrieveApiDocumentVersion", + "resource": "scalarDocs", + "publicResource": "scalarDocs", + "operation": "publishGuide", + "publicOperation": "publishGuide", "deprecated": false, - "method": "GET", - "path": "/v1/apis/{namespace}/{slug}/version/{semver}", + "method": "POST", + "path": "/v1/guides/{slug}/publish", "pathParams": [ - "namespace", - "slug", - "semver" + "slug" ], "publicPathParams": [ - "namespace", - "slug", - "semver" + "slug" ], "queryParams": [], "publicQueryParams": [], @@ -2890,23 +12652,11 @@ "publicBodyParams": [], "bodyParamDetails": [], "pathParamDetails": [ - { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false - }, { "name": "slug", "required": true, "style": "simple", "explode": false - }, - { - "name": "semver", - "required": true, - "style": "simple", - "explode": false } ], "queryParamDetails": [], @@ -2915,16 +12665,16 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RegistryRetrieveApiDocumentVersionParams" + "publicName": "ScalarDocPublishGuideParams" }, "response": { "status": "200", - "contentType": "text/plain", - "encoding": "text", + "contentType": "application/json", + "encoding": "json", "contents": [ { - "contentType": "text/plain", - "encoding": "text" + "contentType": "application/json", + "encoding": "json" } ] }, @@ -3034,80 +12784,42 @@ "responseLinks": [], "transport": "http" }, - { - "resource": "registry", - "publicResource": "registry", - "operation": "updateApiDocumentVersion", - "publicOperation": "updateApiDocumentVersion", - "deprecated": false, - "method": "PATCH", - "path": "/v1/apis/{namespace}/{slug}/version/{semver}", - "pathParams": [ - "namespace", - "slug", - "semver" - ], - "publicPathParams": [ - "namespace", - "slug", - "semver" - ], - "queryParams": [], - "publicQueryParams": [], - "headerParams": [], - "publicHeaderParams": [], - "bodyParams": [ - "document" - ], - "publicBodyParams": [ - "document" - ], - "bodyParamDetails": [ - { - "name": "document", - "required": true - } - ], - "pathParamDetails": [ - { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false - }, - { - "name": "slug", - "required": true, - "style": "simple", - "explode": false - }, + { + "resource": "scalarDocs", + "publicResource": "scalarDocs", + "operation": "listProjects", + "publicOperation": "listProjects", + "deprecated": false, + "method": "GET", + "path": "/v1/docs", + "pathParams": [], + "publicPathParams": [], + "queryParams": [ + "limit" + ], + "publicQueryParams": [ + "limit" + ], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [], + "queryParamDetails": [ { - "name": "semver", - "required": true, - "style": "simple", - "explode": false + "name": "limit", + "required": false, + "style": "form", + "explode": true } ], - "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RegistryUpdateApiDocumentVersionParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "ScalarDocListProjectsParams" }, "response": { "status": "200", @@ -3227,57 +12939,88 @@ "transport": "http" }, { - "resource": "registry", - "publicResource": "registry", - "operation": "deleteApiDocumentVersion", - "publicOperation": "deleteApiDocumentVersion", + "resource": "scalarDocs", + "publicResource": "scalarDocs", + "operation": "createProject", + "publicOperation": "createProject", "deprecated": false, - "method": "DELETE", - "path": "/v1/apis/{namespace}/{slug}/version/{semver}", - "pathParams": [ - "namespace", - "slug", - "semver" - ], - "publicPathParams": [ - "namespace", - "slug", - "semver" - ], + "method": "POST", + "path": "/v1/docs", + "pathParams": [], + "publicPathParams": [], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], - "pathParamDetails": [ + "bodyParams": [ + "name", + "slug", + "isPrivate", + "blank", + "provider", + "githubRepository", + "bitbucketRepository" + ], + "publicBodyParams": [ + "name", + "slug", + "isPrivate", + "blank", + "provider", + "githubRepository", + "bitbucketRepository" + ], + "bodyParamDetails": [ { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false + "name": "name", + "required": true }, { "name": "slug", - "required": true, - "style": "simple", - "explode": false + "required": false }, { - "name": "semver", - "required": true, - "style": "simple", - "explode": false + "name": "isPrivate", + "required": false + }, + { + "name": "blank", + "required": false + }, + { + "name": "provider", + "required": true + }, + { + "name": "githubRepository", + "required": false + }, + { + "name": "bitbucketRepository", + "required": false } ], + "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RegistryDeleteApiDocumentVersionParams" + "publicName": "ScalarDocCreateProjectParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" }, "response": { "status": "200", @@ -3290,6 +13033,10 @@ } ] }, + "responseModel": { + "name": "docs_project", + "publicAliases": [] + }, "result": { "successStatus": "200", "errorStatuses": [ @@ -3397,22 +13144,18 @@ "transport": "http" }, { - "resource": "registry", - "publicResource": "registry", - "operation": "listApiDocumentVersionMetadata", - "publicOperation": "listApiDocumentVersionMetadata", + "resource": "scalarDocs", + "publicResource": "scalarDocs", + "operation": "retrieveProject", + "publicOperation": "retrieveProject", "deprecated": false, "method": "GET", - "path": "/v1/apis/{namespace}/{slug}/version/{semver}/metadata", + "path": "/v1/docs/{slug}", "pathParams": [ - "namespace", - "slug", - "semver" + "slug" ], "publicPathParams": [ - "namespace", - "slug", - "semver" + "slug" ], "queryParams": [], "publicQueryParams": [], @@ -3422,23 +13165,11 @@ "publicBodyParams": [], "bodyParamDetails": [], "pathParamDetails": [ - { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false - }, { "name": "slug", "required": true, "style": "simple", "explode": false - }, - { - "name": "semver", - "required": true, - "style": "simple", - "explode": false } ], "queryParamDetails": [], @@ -3447,7 +13178,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RegistryListApiDocumentVersionMetadataParams" + "publicName": "ScalarDocRetrieveProjectParams" }, "response": { "status": "200", @@ -3461,7 +13192,7 @@ ] }, "responseModel": { - "name": "managed_doc_version", + "name": "docs_project", "publicAliases": [] }, "result": { @@ -3571,19 +13302,17 @@ "transport": "http" }, { - "resource": "registry", - "publicResource": "registry", - "operation": "createApiDocumentVersion", - "publicOperation": "createApiDocumentVersion", + "resource": "scalarDocs", + "publicResource": "scalarDocs", + "operation": "updateProject", + "publicOperation": "updateProject", "deprecated": false, - "method": "POST", - "path": "/v1/apis/{namespace}/{slug}/version", + "method": "PATCH", + "path": "/v1/docs/{slug}", "pathParams": [ - "namespace", "slug" ], "publicPathParams": [ - "namespace", "slug" ], "queryParams": [], @@ -3591,36 +13320,54 @@ "headerParams": [], "publicHeaderParams": [], "bodyParams": [ - "version", - "document", - "force" + "name", + "isPrivate", + "accessGroups", + "loginPortalUid", + "activeThemeId", + "agentEnabled", + "analyticsEnabled" ], "publicBodyParams": [ - "version", - "document", - "force" + "name", + "isPrivate", + "accessGroups", + "loginPortalUid", + "activeThemeId", + "agentEnabled", + "analyticsEnabled" ], "bodyParamDetails": [ { - "name": "version", - "required": true + "name": "name", + "required": false }, { - "name": "document", - "required": true + "name": "isPrivate", + "required": false }, { - "name": "force", + "name": "accessGroups", + "required": false + }, + { + "name": "loginPortalUid", + "required": false + }, + { + "name": "activeThemeId", + "required": false + }, + { + "name": "agentEnabled", + "required": false + }, + { + "name": "analyticsEnabled", "required": false } ], "pathParamDetails": [ - { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false - }, { "name": "slug", "required": true, @@ -3634,7 +13381,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RegistryCreateApiDocumentVersionParams" + "publicName": "ScalarDocUpdateProjectParams" }, "requestBody": { "contentType": "application/json", @@ -3660,10 +13407,6 @@ } ] }, - "responseModel": { - "name": "managed_doc_version", - "publicAliases": [] - }, "result": { "successStatus": "200", "errorStatuses": [ @@ -3771,71 +13514,41 @@ "transport": "http" }, { - "resource": "registry", - "publicResource": "registry", - "operation": "createApiDocumentAccessGroup", - "publicOperation": "createApiDocumentAccessGroup", + "resource": "scalarDocs", + "publicResource": "scalarDocs", + "operation": "deleteProject", + "publicOperation": "deleteProject", "deprecated": false, - "method": "POST", - "path": "/v1/apis/{namespace}/{slug}/access-group", + "method": "DELETE", + "path": "/v1/docs/{slug}", "pathParams": [ - "namespace", "slug" ], "publicPathParams": [ - "namespace", "slug" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "accessGroupSlug" - ], - "publicBodyParams": [ - "accessGroupSlug" - ], - "bodyParamDetails": [ - { - "name": "accessGroupSlug", - "required": true - } - ], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], "pathParamDetails": [ { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false - }, - { - "name": "slug", - "required": true, - "style": "simple", - "explode": false - } - ], - "queryParamDetails": [], - "headerParamDetails": [], - "cookieParams": [], - "publicCookieParams": [], - "cookieParamDetails": [], - "paramsModel": { - "publicName": "RegistryCreateApiDocumentAccessGroupParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "ScalarDocDeleteProjectParams" }, "response": { "status": "200", @@ -3955,19 +13668,17 @@ "transport": "http" }, { - "resource": "registry", - "publicResource": "registry", - "operation": "deleteApiDocumentAccessGroup", - "publicOperation": "deleteApiDocumentAccessGroup", + "resource": "scalarDocs", + "publicResource": "scalarDocs", + "operation": "publishProject", + "publicOperation": "publishProject", "deprecated": false, - "method": "DELETE", - "path": "/v1/apis/{namespace}/{slug}/access-group", + "method": "POST", + "path": "/v1/docs/{slug}/publish", "pathParams": [ - "namespace", "slug" ], "publicPathParams": [ - "namespace", "slug" ], "queryParams": [], @@ -3975,24 +13686,30 @@ "headerParams": [], "publicHeaderParams": [], "bodyParams": [ - "accessGroupSlug" + "commitSha", + "preview", + "configPath" ], "publicBodyParams": [ - "accessGroupSlug" + "commitSha", + "preview", + "configPath" ], "bodyParamDetails": [ { - "name": "accessGroupSlug", - "required": true + "name": "commitSha", + "required": false + }, + { + "name": "preview", + "required": false + }, + { + "name": "configPath", + "required": false } ], "pathParamDetails": [ - { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false - }, { "name": "slug", "required": true, @@ -4006,7 +13723,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RegistryDeleteApiDocumentAccessGroupParams" + "publicName": "ScalarDocPublishProjectParams" }, "requestBody": { "contentType": "application/json", @@ -4139,21 +13856,25 @@ "transport": "http" }, { - "resource": "schemas", - "publicResource": "schemas", - "operation": "list", - "publicOperation": "list", + "resource": "scalarDocs", + "publicResource": "scalarDocs", + "operation": "listProjectConfig", + "publicOperation": "listProjectConfig", "deprecated": false, "method": "GET", - "path": "/v1/schemas/{namespace}", + "path": "/v1/docs/{slug}/config", "pathParams": [ - "namespace" + "slug" ], "publicPathParams": [ - "namespace" + "slug" + ], + "queryParams": [ + "ref" + ], + "publicQueryParams": [ + "ref" ], - "queryParams": [], - "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], "bodyParams": [], @@ -4161,19 +13882,26 @@ "bodyParamDetails": [], "pathParamDetails": [ { - "name": "namespace", + "name": "slug", "required": true, "style": "simple", "explode": false } ], - "queryParamDetails": [], + "queryParamDetails": [ + { + "name": "ref", + "required": false, + "style": "form", + "explode": true + } + ], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "SchemaListParams" + "publicName": "ScalarDocListProjectConfigParams" }, "response": { "status": "200", @@ -4293,68 +14021,62 @@ "transport": "http" }, { - "resource": "schemas", - "publicResource": "schemas", - "operation": "create", - "publicOperation": "create", + "resource": "scalarDocs", + "publicResource": "scalarDocs", + "operation": "updateProjectConfig", + "publicOperation": "updateProjectConfig", "deprecated": false, - "method": "POST", - "path": "/v1/schemas/{namespace}", + "method": "PUT", + "path": "/v1/docs/{slug}/config", "pathParams": [ - "namespace" + "slug" ], "publicPathParams": [ - "namespace" + "slug" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], "bodyParams": [ - "title", - "description", - "version", - "slug", - "isPrivate", - "document" + "content", + "ref", + "baseToken", + "message", + "path" ], "publicBodyParams": [ - "title", - "description", - "version", - "slug", - "isPrivate", - "document" + "content", + "ref", + "baseToken", + "message", + "path" ], "bodyParamDetails": [ { - "name": "title", + "name": "content", "required": true }, { - "name": "description", + "name": "ref", "required": false }, { - "name": "version", - "required": true - }, - { - "name": "slug", - "required": true + "name": "baseToken", + "required": false }, { - "name": "isPrivate", + "name": "message", "required": false }, { - "name": "document", - "required": true + "name": "path", + "required": false } ], "pathParamDetails": [ { - "name": "namespace", + "name": "slug", "required": true, "style": "simple", "explode": false @@ -4366,7 +14088,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "SchemaCreateParams" + "publicName": "ScalarDocUpdateProjectConfigParams" }, "requestBody": { "contentType": "application/json", @@ -4392,10 +14114,6 @@ } ] }, - "responseModel": { - "name": "uid", - "publicAliases": [] - }, "result": { "successStatus": "200", "errorStatuses": [ @@ -4503,56 +14221,27 @@ "transport": "http" }, { - "resource": "schemas", - "publicResource": "schemas", - "operation": "update", - "publicOperation": "update", + "resource": "scalarDocs", + "publicResource": "scalarDocs", + "operation": "listProjectDomain", + "publicOperation": "listProjectDomain", "deprecated": false, - "method": "PATCH", - "path": "/v1/schemas/{namespace}/{slug}", + "method": "GET", + "path": "/v1/docs/{slug}/domain", "pathParams": [ - "namespace", "slug" ], "publicPathParams": [ - "namespace", "slug" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "title", - "description", - "isPrivate" - ], - "publicBodyParams": [ - "title", - "description", - "isPrivate" - ], - "bodyParamDetails": [ - { - "name": "title", - "required": false - }, - { - "name": "description", - "required": false - }, - { - "name": "isPrivate", - "required": false - } - ], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], "pathParamDetails": [ - { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false - }, { "name": "slug", "required": true, @@ -4566,20 +14255,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "SchemaUpdateParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "ScalarDocListProjectDomainParams" }, "response": { "status": "200", @@ -4699,19 +14375,17 @@ "transport": "http" }, { - "resource": "schemas", - "publicResource": "schemas", - "operation": "delete", - "publicOperation": "delete", + "resource": "scalarDocs", + "publicResource": "scalarDocs", + "operation": "listProjectDomainStatus", + "publicOperation": "listProjectDomainStatus", "deprecated": false, - "method": "DELETE", - "path": "/v1/schemas/{namespace}/{slug}", + "method": "GET", + "path": "/v1/docs/{slug}/domain/status", "pathParams": [ - "namespace", "slug" ], "publicPathParams": [ - "namespace", "slug" ], "queryParams": [], @@ -4722,12 +14396,6 @@ "publicBodyParams": [], "bodyParamDetails": [], "pathParamDetails": [ - { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false - }, { "name": "slug", "required": true, @@ -4741,7 +14409,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "SchemaDeleteParams" + "publicName": "ScalarDocListProjectDomainStatusParams" }, "response": { "status": "200", @@ -4861,23 +14529,15 @@ "transport": "http" }, { - "resource": "schemas.version", - "publicResource": "schemas.version", - "operation": "retrieve", - "publicOperation": "retrieve", + "resource": "namespaces", + "publicResource": "namespaces", + "operation": "list", + "publicOperation": "list", "deprecated": false, "method": "GET", - "path": "/v1/schemas/{namespace}/{slug}/version/{semver}", - "pathParams": [ - "namespace", - "slug", - "semver" - ], - "publicPathParams": [ - "namespace", - "slug", - "semver" - ], + "path": "/v1/namespaces", + "pathParams": [], + "publicPathParams": [], "queryParams": [], "publicQueryParams": [], "headerParams": [], @@ -4885,42 +14545,20 @@ "bodyParams": [], "publicBodyParams": [], "bodyParamDetails": [], - "pathParamDetails": [ - { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false - }, - { - "name": "slug", - "required": true, - "style": "simple", - "explode": false - }, - { - "name": "semver", - "required": true, - "style": "simple", - "explode": false - } - ], + "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], - "paramsModel": { - "publicName": "VersionRetrieveParams" - }, "response": { "status": "200", - "contentType": "text/plain", - "encoding": "text", + "contentType": "application/json", + "encoding": "json", "contents": [ { - "contentType": "text/plain", - "encoding": "text" + "contentType": "application/json", + "encoding": "json" } ] }, @@ -5031,57 +14669,52 @@ "transport": "http" }, { - "resource": "schemas.version", - "publicResource": "schemas.version", - "operation": "delete", - "publicOperation": "delete", - "deprecated": false, - "method": "DELETE", - "path": "/v1/schemas/{namespace}/{slug}/version/{semver}", - "pathParams": [ - "namespace", - "slug", - "semver" - ], - "publicPathParams": [ - "namespace", - "slug", - "semver" - ], + "resource": "authentication", + "publicResource": "authentication", + "operation": "exchangePersonalToken", + "publicOperation": "exchangePersonalToken", + "deprecated": false, + "method": "POST", + "path": "/v1/auth/exchange", + "pathParams": [], + "publicPathParams": [], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], - "pathParamDetails": [ - { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false - }, - { - "name": "slug", - "required": true, - "style": "simple", - "explode": false - }, + "bodyParams": [ + "personalToken" + ], + "publicBodyParams": [ + "personalToken" + ], + "bodyParamDetails": [ { - "name": "semver", - "required": true, - "style": "simple", - "explode": false + "name": "personalToken", + "required": true } ], + "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "VersionDeleteParams" + "publicName": "AuthenticationExchangePersonalTokenParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" }, "response": { "status": "200", @@ -5201,84 +14834,28 @@ "transport": "http" }, { - "resource": "schemas.version", - "publicResource": "schemas.version", - "operation": "create", - "publicOperation": "create", + "resource": "authentication", + "publicResource": "authentication", + "operation": "listCurrentUser", + "publicOperation": "listCurrentUser", "deprecated": false, - "method": "POST", - "path": "/v1/schemas/{namespace}/{slug}/version", - "pathParams": [ - "namespace", - "slug" - ], - "publicPathParams": [ - "namespace", - "slug" - ], + "method": "GET", + "path": "/v1/auth/me", + "pathParams": [], + "publicPathParams": [], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "version", - "document", - "force" - ], - "publicBodyParams": [ - "version", - "document", - "force" - ], - "bodyParamDetails": [ - { - "name": "version", - "required": true - }, - { - "name": "document", - "required": true - }, - { - "name": "force", - "required": false - } - ], - "pathParamDetails": [ - { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false - }, - { - "name": "slug", - "required": true, - "style": "simple", - "explode": false - } - ], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], - "paramsModel": { - "publicName": "VersionCreateParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" - }, "response": { "status": "200", "contentType": "application/json", @@ -5290,6 +14867,10 @@ } ] }, + "responseModel": { + "name": "user", + "publicAliases": [] + }, "result": { "successStatus": "200", "errorStatuses": [ @@ -5397,71 +14978,41 @@ "transport": "http" }, { - "resource": "schemas.accessGroup", - "publicResource": "schemas.accessGroup", - "operation": "create", - "publicOperation": "create", + "resource": "sdks", + "publicResource": "sdks", + "operation": "list", + "publicOperation": "list", "deprecated": false, - "method": "POST", - "path": "/v1/schemas/{namespace}/{slug}/access-group", - "pathParams": [ - "namespace", - "slug" + "method": "GET", + "path": "/v1/sdks", + "pathParams": [], + "publicPathParams": [], + "queryParams": [ + "limit" ], - "publicPathParams": [ - "namespace", - "slug" + "publicQueryParams": [ + "limit" ], - "queryParams": [], - "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "accessGroupSlug" - ], - "publicBodyParams": [ - "accessGroupSlug" - ], - "bodyParamDetails": [ - { - "name": "accessGroupSlug", - "required": true - } - ], - "pathParamDetails": [ - { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false - }, + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [], + "queryParamDetails": [ { - "name": "slug", - "required": true, - "style": "simple", - "explode": false + "name": "limit", + "required": false, + "style": "form", + "explode": true } ], - "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "AccessGroupCreateParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "SdkListParams" }, "response": { "status": "200", @@ -5581,58 +15132,69 @@ "transport": "http" }, { - "resource": "schemas.accessGroup", - "publicResource": "schemas.accessGroup", - "operation": "delete", - "publicOperation": "delete", + "resource": "sdks", + "publicResource": "sdks", + "operation": "create", + "publicOperation": "create", "deprecated": false, - "method": "DELETE", - "path": "/v1/schemas/{namespace}/{slug}/access-group", - "pathParams": [ - "namespace", - "slug" - ], - "publicPathParams": [ - "namespace", - "slug" - ], + "method": "POST", + "path": "/v1/sdks", + "pathParams": [], + "publicPathParams": [], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], "bodyParams": [ - "accessGroupSlug" + "apiUid", + "languages", + "title", + "slug", + "className", + "config" ], "publicBodyParams": [ - "accessGroupSlug" + "apiUid", + "languages", + "title", + "slug", + "className", + "config" ], "bodyParamDetails": [ { - "name": "accessGroupSlug", + "name": "apiUid", "required": true - } - ], - "pathParamDetails": [ + }, { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false + "name": "languages", + "required": true + }, + { + "name": "title", + "required": false }, { "name": "slug", - "required": true, - "style": "simple", - "explode": false + "required": false + }, + { + "name": "className", + "required": false + }, + { + "name": "config", + "required": false } ], + "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "AccessGroupDeleteParams" + "publicName": "SdkCreateParams" }, "requestBody": { "contentType": "application/json", @@ -5658,6 +15220,10 @@ } ] }, + "responseModel": { + "name": "uid", + "publicAliases": [] + }, "result": { "successStatus": "200", "errorStatuses": [ @@ -5765,18 +15331,18 @@ "transport": "http" }, { - "resource": "loginPortals", - "publicResource": "loginPortals", + "resource": "sdks", + "publicResource": "sdks", "operation": "retrieve", "publicOperation": "retrieve", "deprecated": false, "method": "GET", - "path": "/v1/login-portals/{slug}", + "path": "/v1/sdks/{uid}", "pathParams": [ - "slug" + "uid" ], "publicPathParams": [ - "slug" + "uid" ], "queryParams": [], "publicQueryParams": [], @@ -5787,7 +15353,7 @@ "bodyParamDetails": [], "pathParamDetails": [ { - "name": "slug", + "name": "uid", "required": true, "style": "simple", "explode": false @@ -5799,7 +15365,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "LoginPortalRetrieveParams" + "publicName": "SdkRetrieveParams" }, "response": { "status": "200", @@ -5812,6 +15378,10 @@ } ] }, + "responseModel": { + "name": "sdk", + "publicAliases": [] + }, "result": { "successStatus": "200", "errorStatuses": [ @@ -5919,38 +15489,68 @@ "transport": "http" }, { - "resource": "loginPortals", - "publicResource": "loginPortals", + "resource": "sdks", + "publicResource": "sdks", "operation": "update", "publicOperation": "update", "deprecated": false, "method": "PATCH", - "path": "/v1/login-portals/{slug}", + "path": "/v1/sdks/{uid}", "pathParams": [ - "slug" + "uid" ], "publicPathParams": [ - "slug" + "uid" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], "bodyParams": [ - "title" + "title", + "slug", + "isPrivate", + "config", + "apiUid", + "apiVersion" ], "publicBodyParams": [ - "title" + "title", + "slug", + "isPrivate", + "config", + "apiUid", + "apiVersion" ], "bodyParamDetails": [ { "name": "title", "required": false + }, + { + "name": "slug", + "required": false + }, + { + "name": "isPrivate", + "required": false + }, + { + "name": "config", + "required": false + }, + { + "name": "apiUid", + "required": false + }, + { + "name": "apiVersion", + "required": false } ], "pathParamDetails": [ { - "name": "slug", + "name": "uid", "required": true, "style": "simple", "explode": false @@ -5962,7 +15562,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "LoginPortalUpdateParams" + "publicName": "SdkUpdateParams" }, "requestBody": { "contentType": "application/json", @@ -6095,18 +15695,18 @@ "transport": "http" }, { - "resource": "loginPortals", - "publicResource": "loginPortals", + "resource": "sdks", + "publicResource": "sdks", "operation": "delete", "publicOperation": "delete", "deprecated": false, "method": "DELETE", - "path": "/v1/login-portals/{slug}", + "path": "/v1/sdks/{uid}", "pathParams": [ - "slug" + "uid" ], "publicPathParams": [ - "slug" + "uid" ], "queryParams": [], "publicQueryParams": [], @@ -6117,7 +15717,7 @@ "bodyParamDetails": [], "pathParamDetails": [ { - "name": "slug", + "name": "uid", "required": true, "style": "simple", "explode": false @@ -6129,7 +15729,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "LoginPortalDeleteParams" + "publicName": "SdkDeleteParams" }, "response": { "status": "200", @@ -6249,57 +15849,56 @@ "transport": "http" }, { - "resource": "loginPortals", - "publicResource": "loginPortals", - "operation": "create", - "publicOperation": "create", + "resource": "sdks", + "publicResource": "sdks", + "operation": "build", + "publicOperation": "build", "deprecated": false, "method": "POST", - "path": "/v1/login-portals", - "pathParams": [], - "publicPathParams": [], + "path": "/v1/sdks/{uid}/build", + "pathParams": [ + "uid" + ], + "publicPathParams": [ + "uid" + ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], "bodyParams": [ - "title", - "slug", - "email", - "page" + "version", + "languages" ], "publicBodyParams": [ - "title", - "slug", - "email", - "page" + "version", + "languages" ], "bodyParamDetails": [ { - "name": "title", - "required": true - }, - { - "name": "slug", - "required": true + "name": "version", + "required": false }, { - "name": "email", - "required": true - }, + "name": "languages", + "required": false + } + ], + "pathParamDetails": [ { - "name": "page", - "required": true + "name": "uid", + "required": true, + "style": "simple", + "explode": false } ], - "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "LoginPortalCreateParams" + "publicName": "SdkBuildParams" }, "requestBody": { "contentType": "application/json", @@ -6325,10 +15924,6 @@ } ] }, - "responseModel": { - "name": "uid", - "publicAliases": [] - }, "result": { "successStatus": "200", "errorStatuses": [ @@ -6436,28 +16031,70 @@ "transport": "http" }, { - "resource": "loginPortals", - "publicResource": "loginPortals", - "operation": "list", - "publicOperation": "list", + "resource": "sdks.versions", + "publicResource": "sdks.versions", + "operation": "create", + "publicOperation": "create", "deprecated": false, - "method": "GET", - "path": "/v1/login-portals", - "pathParams": [], - "publicPathParams": [], + "method": "POST", + "path": "/v1/sdks/{uid}/versions", + "pathParams": [ + "uid" + ], + "publicPathParams": [ + "uid" + ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], - "pathParamDetails": [], + "bodyParams": [ + "version", + "apiVersion" + ], + "publicBodyParams": [ + "version", + "apiVersion" + ], + "bodyParamDetails": [ + { + "name": "version", + "required": true + }, + { + "name": "apiVersion", + "required": true + } + ], + "pathParamDetails": [ + { + "name": "uid", + "required": true, + "style": "simple", + "explode": false + } + ], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], + "paramsModel": { + "publicName": "VersionCreateParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, "response": { "status": "200", "contentType": "application/json", @@ -6576,18 +16213,20 @@ "transport": "http" }, { - "resource": "rules", - "publicResource": "rules", - "operation": "listRulesets", - "publicOperation": "listRulesets", + "resource": "sdks.versions", + "publicResource": "sdks.versions", + "operation": "delete", + "publicOperation": "delete", "deprecated": false, - "method": "GET", - "path": "/v1/rulesets/{namespace}", + "method": "DELETE", + "path": "/v1/sdks/{uid}/versions/{version}", "pathParams": [ - "namespace" + "uid", + "version" ], "publicPathParams": [ - "namespace" + "uid", + "version" ], "queryParams": [], "publicQueryParams": [], @@ -6598,7 +16237,13 @@ "bodyParamDetails": [], "pathParamDetails": [ { - "name": "namespace", + "name": "uid", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "version", "required": true, "style": "simple", "explode": false @@ -6610,7 +16255,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RuleListRulesetsParams" + "publicName": "VersionDeleteParams" }, "response": { "status": "200", @@ -6730,62 +16375,56 @@ "transport": "http" }, { - "resource": "rules", - "publicResource": "rules", - "operation": "createRuleset", - "publicOperation": "createRuleset", + "resource": "sdks.repositories", + "publicResource": "sdks.repositories", + "operation": "link", + "publicOperation": "link", "deprecated": false, "method": "POST", - "path": "/v1/rulesets/{namespace}", + "path": "/v1/sdks/{uid}/repositories", "pathParams": [ - "namespace" + "uid" ], "publicPathParams": [ - "namespace" + "uid" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], "bodyParams": [ - "title", - "description", - "slug", - "isPrivate", - "document" + "language", + "repositoryId", + "baseBranch", + "prereleaseType" ], "publicBodyParams": [ - "title", - "description", - "slug", - "isPrivate", - "document" + "language", + "repositoryId", + "baseBranch", + "prereleaseType" ], "bodyParamDetails": [ { - "name": "title", + "name": "language", "required": true }, { - "name": "description", - "required": false + "name": "repositoryId", + "required": true }, { - "name": "slug", + "name": "baseBranch", "required": true }, { - "name": "isPrivate", + "name": "prereleaseType", "required": false - }, - { - "name": "document", - "required": true } ], "pathParamDetails": [ { - "name": "namespace", + "name": "uid", "required": true, "style": "simple", "explode": false @@ -6797,7 +16436,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RuleCreateRulesetParams" + "publicName": "RepositoryLinkParams" }, "requestBody": { "contentType": "application/json", @@ -6823,10 +16462,6 @@ } ] }, - "responseModel": { - "name": "uid", - "publicAliases": [] - }, "result": { "successStatus": "200", "errorStatuses": [ @@ -6934,70 +16569,37 @@ "transport": "http" }, { - "resource": "rules", - "publicResource": "rules", - "operation": "updateRuleset", - "publicOperation": "updateRuleset", + "resource": "sdks.repositories", + "publicResource": "sdks.repositories", + "operation": "unlink", + "publicOperation": "unlink", "deprecated": false, - "method": "PATCH", - "path": "/v1/rulesets/{namespace}/{slug}", - "pathParams": [ - "namespace", - "slug" - ], - "publicPathParams": [ - "namespace", - "slug" - ], - "queryParams": [], - "publicQueryParams": [], - "headerParams": [], - "publicHeaderParams": [], - "bodyParams": [ - "namespace", - "slug", - "title", - "description", - "isPrivate" - ], - "publicBodyParams": [ - "namespace", - "slug", - "title", - "description", - "isPrivate" - ], - "bodyParamDetails": [ - { - "name": "namespace", - "required": false - }, - { - "name": "slug", - "required": false - }, - { - "name": "title", - "required": false - }, - { - "name": "description", - "required": false - }, - { - "name": "isPrivate", - "required": false - } + "method": "DELETE", + "path": "/v1/sdks/{uid}/repositories/{language}", + "pathParams": [ + "uid", + "language" + ], + "publicPathParams": [ + "uid", + "language" ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], "pathParamDetails": [ { - "name": "namespace", + "name": "uid", "required": true, "style": "simple", "explode": false }, { - "name": "slug", + "name": "language", "required": true, "style": "simple", "explode": false @@ -7009,20 +16611,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RuleUpdateRulesetParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "RepositoryUnlinkParams" }, "response": { "status": "200", @@ -7142,37 +16731,64 @@ "transport": "http" }, { - "resource": "rules", - "publicResource": "rules", - "operation": "deleteRuleset", - "publicOperation": "deleteRuleset", + "resource": "sdks.repositories", + "publicResource": "sdks.repositories", + "operation": "updatePublishing", + "publicOperation": "updatePublishing", "deprecated": false, - "method": "DELETE", - "path": "/v1/rulesets/{namespace}/{slug}", + "method": "POST", + "path": "/v1/sdks/{uid}/repositories/{language}/publishing", "pathParams": [ - "namespace", - "slug" + "uid", + "language" ], "publicPathParams": [ - "namespace", - "slug" + "uid", + "language" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], + "bodyParams": [ + "publishOnMerge", + "authMethod", + "access", + "tag" + ], + "publicBodyParams": [ + "publishOnMerge", + "authMethod", + "access", + "tag" + ], + "bodyParamDetails": [ + { + "name": "publishOnMerge", + "required": true + }, + { + "name": "authMethod", + "required": false + }, + { + "name": "access", + "required": false + }, + { + "name": "tag", + "required": false + } + ], "pathParamDetails": [ { - "name": "namespace", + "name": "uid", "required": true, "style": "simple", "explode": false }, { - "name": "slug", + "name": "language", "required": true, "style": "simple", "explode": false @@ -7184,7 +16800,20 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RuleDeleteRulesetParams" + "publicName": "RepositoryUpdatePublishingParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" }, "response": { "status": "200", @@ -7304,21 +16933,15 @@ "transport": "http" }, { - "resource": "rules", - "publicResource": "rules", - "operation": "retrieveRulesetDocument", - "publicOperation": "retrieveRulesetDocument", + "resource": "mcp.servers", + "publicResource": "mcp.servers", + "operation": "list", + "publicOperation": "list", "deprecated": false, "method": "GET", - "path": "/v1/rulesets/{namespace}/{slug}", - "pathParams": [ - "namespace", - "slug" - ], - "publicPathParams": [ - "namespace", - "slug" - ], + "path": "/v1/mcp/servers", + "pathParams": [], + "publicPathParams": [], "queryParams": [], "publicQueryParams": [], "headerParams": [], @@ -7326,36 +16949,20 @@ "bodyParams": [], "publicBodyParams": [], "bodyParamDetails": [], - "pathParamDetails": [ - { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false - }, - { - "name": "slug", - "required": true, - "style": "simple", - "explode": false - } - ], + "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], - "paramsModel": { - "publicName": "RuleRetrieveRulesetDocumentParams" - }, "response": { "status": "200", - "contentType": "text/plain", - "encoding": "text", + "contentType": "application/json", + "encoding": "json", "contents": [ { - "contentType": "text/plain", - "encoding": "text" + "contentType": "application/json", + "encoding": "json" } ] }, @@ -7466,58 +17073,57 @@ "transport": "http" }, { - "resource": "rules", - "publicResource": "rules", - "operation": "createRulesetAccessGroup", - "publicOperation": "createRulesetAccessGroup", + "resource": "mcp.servers", + "publicResource": "mcp.servers", + "operation": "create", + "publicOperation": "create", "deprecated": false, "method": "POST", - "path": "/v1/rulesets/{namespace}/{slug}/access-group", - "pathParams": [ - "namespace", - "slug" - ], - "publicPathParams": [ - "namespace", - "slug" - ], + "path": "/v1/mcp/servers", + "pathParams": [], + "publicPathParams": [], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], "bodyParams": [ - "accessGroupSlug" + "name", + "slug", + "versionUids", + "projectUids" ], "publicBodyParams": [ - "accessGroupSlug" + "name", + "slug", + "versionUids", + "projectUids" ], "bodyParamDetails": [ { - "name": "accessGroupSlug", + "name": "name", "required": true - } - ], - "pathParamDetails": [ - { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false }, { "name": "slug", - "required": true, - "style": "simple", - "explode": false + "required": false + }, + { + "name": "versionUids", + "required": false + }, + { + "name": "projectUids", + "required": false } ], + "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RuleCreateRulesetAccessGroupParams" + "publicName": "ServerCreateParams" }, "requestBody": { "contentType": "application/json", @@ -7650,46 +17256,29 @@ "transport": "http" }, { - "resource": "rules", - "publicResource": "rules", - "operation": "deleteRulesetAccessGroup", - "publicOperation": "deleteRulesetAccessGroup", + "resource": "mcp.servers", + "publicResource": "mcp.servers", + "operation": "retrieve", + "publicOperation": "retrieve", "deprecated": false, - "method": "DELETE", - "path": "/v1/rulesets/{namespace}/{slug}/access-group", + "method": "GET", + "path": "/v1/mcp/servers/{id}", "pathParams": [ - "namespace", - "slug" + "id" ], "publicPathParams": [ - "namespace", - "slug" + "id" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "accessGroupSlug" - ], - "publicBodyParams": [ - "accessGroupSlug" - ], - "bodyParamDetails": [ - { - "name": "accessGroupSlug", - "required": true - } - ], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], "pathParamDetails": [ { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false - }, - { - "name": "slug", + "name": "id", "required": true, "style": "simple", "explode": false @@ -7701,20 +17290,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RuleDeleteRulesetAccessGroupParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "ServerRetrieveParams" }, "response": { "status": "200", @@ -7727,6 +17303,10 @@ } ] }, + "responseModel": { + "name": "mcp_server", + "publicAliases": [] + }, "result": { "successStatus": "200", "errorStatuses": [ @@ -7834,28 +17414,88 @@ "transport": "http" }, { - "resource": "themes", - "publicResource": "themes", - "operation": "list", - "publicOperation": "list", + "resource": "mcp.servers", + "publicResource": "mcp.servers", + "operation": "update", + "publicOperation": "update", "deprecated": false, - "method": "GET", - "path": "/v1/themes", - "pathParams": [], - "publicPathParams": [], + "method": "PATCH", + "path": "/v1/mcp/servers/{id}", + "pathParams": [ + "id" + ], + "publicPathParams": [ + "id" + ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], - "pathParamDetails": [], + "bodyParams": [ + "name", + "slug", + "autoAddOperations", + "operations", + "docsPages" + ], + "publicBodyParams": [ + "name", + "slug", + "autoAddOperations", + "operations", + "docsPages" + ], + "bodyParamDetails": [ + { + "name": "name", + "required": false + }, + { + "name": "slug", + "required": false + }, + { + "name": "autoAddOperations", + "required": false + }, + { + "name": "operations", + "required": false + }, + { + "name": "docsPages", + "required": false + } + ], + "pathParamDetails": [ + { + "name": "id", + "required": true, + "style": "simple", + "explode": false + } + ], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], + "paramsModel": { + "publicName": "ServerUpdateParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, "response": { "status": "200", "contentType": "application/json", @@ -7867,6 +17507,10 @@ } ] }, + "responseModel": { + "name": "mcp_server", + "publicAliases": [] + }, "result": { "successStatus": "200", "errorStatuses": [ @@ -7974,70 +17618,41 @@ "transport": "http" }, { - "resource": "themes", - "publicResource": "themes", - "operation": "create", - "publicOperation": "create", + "resource": "mcp.servers", + "publicResource": "mcp.servers", + "operation": "delete", + "publicOperation": "delete", "deprecated": false, - "method": "POST", - "path": "/v1/themes", - "pathParams": [], - "publicPathParams": [], + "method": "DELETE", + "path": "/v1/mcp/servers/{id}", + "pathParams": [ + "id" + ], + "publicPathParams": [ + "id" + ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "name", - "description", - "slug", - "document" - ], - "publicBodyParams": [ - "name", - "description", - "slug", - "document" - ], - "bodyParamDetails": [ - { - "name": "name", - "required": true - }, - { - "name": "description", - "required": false - }, - { - "name": "slug", - "required": true - }, + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [ { - "name": "document", - "required": true + "name": "id", + "required": true, + "style": "simple", + "explode": false } ], - "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "ThemeCreateParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "ServerDeleteParams" }, "response": { "status": "200", @@ -8050,10 +17665,6 @@ } ] }, - "responseModel": { - "name": "uid", - "publicAliases": [] - }, "result": { "successStatus": "200", "errorStatuses": [ @@ -8161,44 +17772,29 @@ "transport": "http" }, { - "resource": "themes", - "publicResource": "themes", - "operation": "update", - "publicOperation": "update", + "resource": "mcp.servers.installations", + "publicResource": "mcp.servers.installations", + "operation": "list", + "publicOperation": "list", "deprecated": false, - "method": "PATCH", - "path": "/v1/themes/{slug}", + "method": "GET", + "path": "/v1/mcp/servers/{id}/installations", "pathParams": [ - "slug" + "id" ], "publicPathParams": [ - "slug" + "id" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "name", - "description" - ], - "publicBodyParams": [ - "name", - "description" - ], - "bodyParamDetails": [ - { - "name": "name", - "required": false - }, - { - "name": "description", - "required": false - } - ], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], "pathParamDetails": [ { - "name": "slug", + "name": "id", "required": true, "style": "simple", "explode": false @@ -8210,20 +17806,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "ThemeUpdateParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "InstallationListParams" }, "response": { "status": "200", @@ -8343,38 +17926,50 @@ "transport": "http" }, { - "resource": "themes", - "publicResource": "themes", - "operation": "replaceDocument", - "publicOperation": "replaceDocument", + "resource": "mcp.servers.installations", + "publicResource": "mcp.servers.installations", + "operation": "create", + "publicOperation": "create", "deprecated": false, - "method": "PUT", - "path": "/v1/themes/{slug}", + "method": "POST", + "path": "/v1/mcp/servers/{id}/installations", "pathParams": [ - "slug" + "id" ], "publicPathParams": [ - "slug" + "id" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], "bodyParams": [ - "document" + "name", + "slug", + "documentAuth" ], "publicBodyParams": [ - "document" + "name", + "slug", + "documentAuth" ], "bodyParamDetails": [ { - "name": "document", + "name": "name", + "required": true + }, + { + "name": "slug", + "required": false + }, + { + "name": "documentAuth", "required": true } ], "pathParamDetails": [ { - "name": "slug", + "name": "id", "required": true, "style": "simple", "explode": false @@ -8386,7 +17981,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "ThemeReplaceDocumentParams" + "publicName": "InstallationCreateParams" }, "requestBody": { "contentType": "application/json", @@ -8412,6 +18007,10 @@ } ] }, + "responseModel": { + "name": "mcp_installation", + "publicAliases": [] + }, "result": { "successStatus": "200", "errorStatuses": [ @@ -8519,18 +18118,20 @@ "transport": "http" }, { - "resource": "themes", - "publicResource": "themes", - "operation": "delete", - "publicOperation": "delete", + "resource": "mcp.servers.installations", + "publicResource": "mcp.servers.installations", + "operation": "retrieve", + "publicOperation": "retrieve", "deprecated": false, - "method": "DELETE", - "path": "/v1/themes/{slug}", + "method": "GET", + "path": "/v1/mcp/servers/{id}/installations/{installationId}", "pathParams": [ - "slug" + "id", + "installationId" ], "publicPathParams": [ - "slug" + "id", + "installationId" ], "queryParams": [], "publicQueryParams": [], @@ -8541,7 +18142,13 @@ "bodyParamDetails": [], "pathParamDetails": [ { - "name": "slug", + "name": "id", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "installationId", "required": true, "style": "simple", "explode": false @@ -8553,7 +18160,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "ThemeDeleteParams" + "publicName": "InstallationRetrieveParams" }, "response": { "status": "200", @@ -8566,6 +18173,10 @@ } ] }, + "responseModel": { + "name": "mcp_installation", + "publicAliases": [] + }, "result": { "successStatus": "200", "errorStatuses": [ @@ -8673,29 +18284,76 @@ "transport": "http" }, { - "resource": "themes", - "publicResource": "themes", - "operation": "retrieve", - "publicOperation": "retrieve", + "resource": "mcp.servers.installations", + "publicResource": "mcp.servers.installations", + "operation": "update", + "publicOperation": "update", "deprecated": false, - "method": "GET", - "path": "/v1/themes/{slug}", + "method": "PATCH", + "path": "/v1/mcp/servers/{id}/installations/{installationId}", "pathParams": [ - "slug" + "id", + "installationId" ], "publicPathParams": [ - "slug" + "id", + "installationId" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], - "pathParamDetails": [ + "bodyParams": [ + "name", + "slug", + "isPrivate", + "loginPortalUid", + "documentAuth", + "mcpVersion" + ], + "publicBodyParams": [ + "name", + "slug", + "isPrivate", + "loginPortalUid", + "documentAuth", + "mcpVersion" + ], + "bodyParamDetails": [ + { + "name": "name", + "required": false + }, { "name": "slug", + "required": false + }, + { + "name": "isPrivate", + "required": false + }, + { + "name": "loginPortalUid", + "required": false + }, + { + "name": "documentAuth", + "required": false + }, + { + "name": "mcpVersion", + "required": false + } + ], + "pathParamDetails": [ + { + "name": "id", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "installationId", "required": true, "style": "simple", "explode": false @@ -8707,19 +18365,36 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "ThemeRetrieveParams" + "publicName": "InstallationUpdateParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" }, "response": { "status": "200", - "contentType": "text/plain", - "encoding": "text", + "contentType": "application/json", + "encoding": "json", "contents": [ { - "contentType": "text/plain", - "encoding": "text" + "contentType": "application/json", + "encoding": "json" } ] }, + "responseModel": { + "name": "mcp_installation", + "publicAliases": [] + }, "result": { "successStatus": "200", "errorStatuses": [ @@ -8827,15 +18502,21 @@ "transport": "http" }, { - "resource": "teams", - "publicResource": "teams", - "operation": "list", - "publicOperation": "list", + "resource": "mcp.servers.installations", + "publicResource": "mcp.servers.installations", + "operation": "delete", + "publicOperation": "delete", "deprecated": false, - "method": "GET", - "path": "/v1/teams", - "pathParams": [], - "publicPathParams": [], + "method": "DELETE", + "path": "/v1/mcp/servers/{id}/installations/{installationId}", + "pathParams": [ + "id", + "installationId" + ], + "publicPathParams": [ + "id", + "installationId" + ], "queryParams": [], "publicQueryParams": [], "headerParams": [], @@ -8843,12 +18524,28 @@ "bodyParams": [], "publicBodyParams": [], "bodyParamDetails": [], - "pathParamDetails": [], + "pathParamDetails": [ + { + "name": "id", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "installationId", + "required": true, + "style": "simple", + "explode": false + } + ], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], + "paramsModel": { + "publicName": "InstallationDeleteParams" + }, "response": { "status": "200", "contentType": "application/json", @@ -8967,28 +18664,72 @@ "transport": "http" }, { - "resource": "scalarDocs", - "publicResource": "scalarDocs", - "operation": "listGuides", - "publicOperation": "listGuides", + "resource": "mcp.servers.installations", + "publicResource": "mcp.servers.installations", + "operation": "createAccessGroup", + "publicOperation": "createAccessGroup", "deprecated": false, - "method": "GET", - "path": "/v1/guides", - "pathParams": [], - "publicPathParams": [], + "method": "POST", + "path": "/v1/mcp/servers/{id}/installations/{installationId}/access-group", + "pathParams": [ + "id", + "installationId" + ], + "publicPathParams": [ + "id", + "installationId" + ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], - "pathParamDetails": [], + "bodyParams": [ + "accessGroupUid" + ], + "publicBodyParams": [ + "accessGroupUid" + ], + "bodyParamDetails": [ + { + "name": "accessGroupUid", + "required": true + } + ], + "pathParamDetails": [ + { + "name": "id", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "installationId", + "required": true, + "style": "simple", + "explode": false + } + ], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], + "paramsModel": { + "publicName": "InstallationCreateAccessGroupParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, "response": { "status": "200", "contentType": "application/json", @@ -9107,63 +18848,58 @@ "transport": "http" }, { - "resource": "scalarDocs", - "publicResource": "scalarDocs", - "operation": "createGuide", - "publicOperation": "createGuide", + "resource": "mcp.servers.installations", + "publicResource": "mcp.servers.installations", + "operation": "deleteAccessGroup", + "publicOperation": "deleteAccessGroup", "deprecated": false, - "method": "POST", - "path": "/v1/guides", - "pathParams": [], - "publicPathParams": [], + "method": "DELETE", + "path": "/v1/mcp/servers/{id}/installations/{installationId}/access-group", + "pathParams": [ + "id", + "installationId" + ], + "publicPathParams": [ + "id", + "installationId" + ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], "bodyParams": [ - "name", - "slug", - "isPrivate", - "allowedUsers", - "allowedDomains" + "accessGroupUid" ], "publicBodyParams": [ - "name", - "slug", - "isPrivate", - "allowedUsers", - "allowedDomains" + "accessGroupUid" ], "bodyParamDetails": [ { - "name": "name", - "required": true - }, - { - "name": "slug", - "required": false - }, - { - "name": "isPrivate", + "name": "accessGroupUid", "required": true - }, + } + ], + "pathParamDetails": [ { - "name": "allowedUsers", - "required": true + "name": "id", + "required": true, + "style": "simple", + "explode": false }, { - "name": "allowedDomains", - "required": true + "name": "installationId", + "required": true, + "style": "simple", + "explode": false } ], - "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "ScalarDocCreateGuideParams" + "publicName": "InstallationDeleteAccessGroupParams" }, "requestBody": { "contentType": "application/json", @@ -9296,19 +19032,15 @@ "transport": "http" }, { - "resource": "scalarDocs", - "publicResource": "scalarDocs", - "operation": "publishGuide", - "publicOperation": "publishGuide", + "resource": "oAuth", + "publicResource": "oAuth", + "operation": "oauthAuthorize", + "publicOperation": "oauthAuthorize", "deprecated": false, - "method": "POST", - "path": "/v1/guides/{slug}/publish", - "pathParams": [ - "slug" - ], - "publicPathParams": [ - "slug" - ], + "method": "GET", + "path": "/v1/oauth/authorize", + "pathParams": [], + "publicPathParams": [], "queryParams": [], "publicQueryParams": [], "headerParams": [], @@ -9316,22 +19048,12 @@ "bodyParams": [], "publicBodyParams": [], "bodyParamDetails": [], - "pathParamDetails": [ - { - "name": "slug", - "required": true, - "style": "simple", - "explode": false - } - ], + "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], - "paramsModel": { - "publicName": "ScalarDocPublishGuideParams" - }, "response": { "status": "200", "contentType": "application/json", @@ -9450,28 +19172,95 @@ "transport": "http" }, { - "resource": "namespaces", - "publicResource": "namespaces", - "operation": "list", - "publicOperation": "list", + "resource": "oAuth", + "publicResource": "oAuth", + "operation": "oauthToken", + "publicOperation": "oauthToken", "deprecated": false, - "method": "GET", - "path": "/v1/namespaces", + "method": "POST", + "path": "/v1/oauth/token", "pathParams": [], "publicPathParams": [], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], + "bodyParams": [ + "grant_type", + "client_id", + "client_secret", + "code", + "redirect_uri", + "code_verifier", + "refresh_token", + "scope" + ], + "publicBodyParams": [ + "grant_type", + "client_id", + "client_secret", + "code", + "redirect_uri", + "code_verifier", + "refresh_token", + "scope" + ], + "bodyParamDetails": [ + { + "name": "grant_type", + "required": true + }, + { + "name": "client_id", + "required": false + }, + { + "name": "client_secret", + "required": false + }, + { + "name": "code", + "required": false + }, + { + "name": "redirect_uri", + "required": false + }, + { + "name": "code_verifier", + "required": false + }, + { + "name": "refresh_token", + "required": false + }, + { + "name": "scope", + "required": false + } + ], "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], + "paramsModel": { + "publicName": "OAuthOauthTokenParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, "response": { "status": "200", "contentType": "application/json", @@ -9590,13 +19379,13 @@ "transport": "http" }, { - "resource": "authentication", - "publicResource": "authentication", - "operation": "exchangePersonalToken", - "publicOperation": "exchangePersonalToken", + "resource": "oAuth", + "publicResource": "oAuth", + "operation": "oauthRevoke", + "publicOperation": "oauthRevoke", "deprecated": false, "method": "POST", - "path": "/v1/auth/exchange", + "path": "/v1/oauth/revoke", "pathParams": [], "publicPathParams": [], "queryParams": [], @@ -9604,15 +19393,33 @@ "headerParams": [], "publicHeaderParams": [], "bodyParams": [ - "personalToken" + "token", + "token_type_hint", + "client_id", + "client_secret" ], "publicBodyParams": [ - "personalToken" + "token", + "token_type_hint", + "client_id", + "client_secret" ], "bodyParamDetails": [ { - "name": "personalToken", + "name": "token", "required": true + }, + { + "name": "token_type_hint", + "required": false + }, + { + "name": "client_id", + "required": false + }, + { + "name": "client_secret", + "required": false } ], "pathParamDetails": [], @@ -9622,7 +19429,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "AuthenticationExchangePersonalTokenParams" + "publicName": "OAuthOauthRevokeParams" }, "requestBody": { "contentType": "application/json", @@ -9755,13 +19562,13 @@ "transport": "http" }, { - "resource": "authentication", - "publicResource": "authentication", - "operation": "listCurrentUser", - "publicOperation": "listCurrentUser", + "resource": "oAuth", + "publicResource": "oAuth", + "operation": "oauthAuthorizationServerMetadata", + "publicOperation": "oauthAuthorizationServerMetadata", "deprecated": false, "method": "GET", - "path": "/v1/auth/me", + "path": "/.well-known/oauth-authorization-server", "pathParams": [], "publicPathParams": [], "queryParams": [], @@ -9789,7 +19596,7 @@ ] }, "responseModel": { - "name": "user", + "name": "oauth_authorization_server_metadata", "publicAliases": [] }, "result": { diff --git a/tests/smoke-test.java b/tests/smoke-test.java index f3f9d7a..b648e11 100644 --- a/tests/smoke-test.java +++ b/tests/smoke-test.java @@ -6,6 +6,10 @@ // against a mock server and reads the JSON report produced via SCALAR_SMOKE_REPORT. import com.scalar.client.ScalarClient; import com.scalar.client.okhttp.ScalarOkHttpClient; +import com.scalar.models.accessGroups.AccessGroupRetrieveParams; +import com.scalar.models.accessGroups.AccessGroupUpdateParams; +import com.scalar.models.accessGroups.domains.DomainCreateParams; +import com.scalar.models.accessGroups.domains.DomainDeleteParams; import com.scalar.models.authentication.AuthenticationExchangePersonalTokenParams; import com.scalar.models.loginPortals.LoginPortalCreateParams; import com.scalar.models.loginPortals.LoginPortalDeleteParams; @@ -13,6 +17,19 @@ import com.scalar.models.loginPortals.LoginPortalPage; import com.scalar.models.loginPortals.LoginPortalRetrieveParams; import com.scalar.models.loginPortals.LoginPortalUpdateParams; +import com.scalar.models.mcp.servers.ServerCreateParams; +import com.scalar.models.mcp.servers.ServerDeleteParams; +import com.scalar.models.mcp.servers.ServerRetrieveParams; +import com.scalar.models.mcp.servers.ServerUpdateParams; +import com.scalar.models.mcp.servers.installations.InstallationCreateAccessGroupParams; +import com.scalar.models.mcp.servers.installations.InstallationCreateParams; +import com.scalar.models.mcp.servers.installations.InstallationDeleteAccessGroupParams; +import com.scalar.models.mcp.servers.installations.InstallationDeleteParams; +import com.scalar.models.mcp.servers.installations.InstallationListParams; +import com.scalar.models.mcp.servers.installations.InstallationRetrieveParams; +import com.scalar.models.mcp.servers.installations.InstallationUpdateParams; +import com.scalar.models.oAuth.OAuthOauthRevokeParams; +import com.scalar.models.oAuth.OAuthOauthTokenParams; import com.scalar.models.registry.AccessGroup; import com.scalar.models.registry.RegistryCreateApiDocumentAccessGroupParams; import com.scalar.models.registry.RegistryCreateApiDocumentParams; @@ -33,16 +50,37 @@ import com.scalar.models.rules.RuleRetrieveRulesetDocumentParams; import com.scalar.models.rules.RuleUpdateRulesetParams; import com.scalar.models.scalarDocs.ScalarDocCreateGuideParams; +import com.scalar.models.scalarDocs.ScalarDocCreateProjectParams; +import com.scalar.models.scalarDocs.ScalarDocDeleteProjectParams; +import com.scalar.models.scalarDocs.ScalarDocListProjectConfigParams; +import com.scalar.models.scalarDocs.ScalarDocListProjectDomainParams; +import com.scalar.models.scalarDocs.ScalarDocListProjectDomainStatusParams; +import com.scalar.models.scalarDocs.ScalarDocListProjectsParams; import com.scalar.models.scalarDocs.ScalarDocPublishGuideParams; +import com.scalar.models.scalarDocs.ScalarDocPublishProjectParams; +import com.scalar.models.scalarDocs.ScalarDocRetrieveProjectParams; +import com.scalar.models.scalarDocs.ScalarDocUpdateProjectConfigParams; +import com.scalar.models.scalarDocs.ScalarDocUpdateProjectParams; import com.scalar.models.schemas.SchemaCreateParams; import com.scalar.models.schemas.SchemaDeleteParams; import com.scalar.models.schemas.SchemaListParams; import com.scalar.models.schemas.SchemaUpdateParams; -import com.scalar.models.schemas.accessGroup.AccessGroupCreateParams; -import com.scalar.models.schemas.accessGroup.AccessGroupDeleteParams; -import com.scalar.models.schemas.version.VersionCreateParams; -import com.scalar.models.schemas.version.VersionDeleteParams; import com.scalar.models.schemas.version.VersionRetrieveParams; +import com.scalar.models.sdks.SdkBuildParams; +import com.scalar.models.sdks.SdkCreateParams; +import com.scalar.models.sdks.SdkDeleteParams; +import com.scalar.models.sdks.SdkListParams; +import com.scalar.models.sdks.SdkRetrieveParams; +import com.scalar.models.sdks.SdkUpdateParams; +import com.scalar.models.sdks.repositories.RepositoryLinkParams; +import com.scalar.models.sdks.repositories.RepositoryUnlinkParams; +import com.scalar.models.sdks.repositories.RepositoryUpdatePublishingParams; +import com.scalar.models.teams.invites.InviteCancelParams; +import com.scalar.models.teams.invites.InviteMemberParams; +import com.scalar.models.teams.invites.InviteResendParams; +import com.scalar.models.teams.invites.Role; +import com.scalar.models.teams.members.MemberDeleteParams; +import com.scalar.models.teams.members.MemberUpdateParams; import com.scalar.models.themes.ThemeCreateParams; import com.scalar.models.themes.ThemeDeleteParams; import com.scalar.models.themes.ThemeReplaceDocumentParams; @@ -289,14 +327,18 @@ private static void _smokeCase21() throws Exception { } private static void _smokeCase22() throws Exception { - VersionDeleteParams params = - VersionDeleteParams.builder().namespace("namespace").slug("slug").semver("semver").build(); + com.scalar.models.schemas.version.VersionDeleteParams params = + com.scalar.models.schemas.version.VersionDeleteParams.builder() + .namespace("namespace") + .slug("slug") + .semver("semver") + .build(); var version = client.schemas().version().delete(params); } private static void _smokeCase23() throws Exception { - VersionCreateParams params = - VersionCreateParams.builder() + com.scalar.models.schemas.version.VersionCreateParams params = + com.scalar.models.schemas.version.VersionCreateParams.builder() .namespace("namespace") .slug("slug") .version("x") @@ -306,8 +348,8 @@ private static void _smokeCase23() throws Exception { } private static void _smokeCase24() throws Exception { - VersionCreateParams params = - VersionCreateParams.builder() + com.scalar.models.schemas.version.VersionCreateParams params = + com.scalar.models.schemas.version.VersionCreateParams.builder() .namespace("namespace") .slug("slug") .version("x") @@ -318,8 +360,13 @@ private static void _smokeCase24() throws Exception { } private static void _smokeCase25() throws Exception { - AccessGroupCreateParams params = - AccessGroupCreateParams.builder() + com.scalar.models.schemas.accessGroup.AccessGroupCreateParams params = + com.scalar + .models + .schemas + .accessGroup + .AccessGroupCreateParams + .builder() .namespace("namespace") .slug("slug") .accessGroup(AccessGroup.builder().accessGroupSlug("x").build()) @@ -328,8 +375,13 @@ private static void _smokeCase25() throws Exception { } private static void _smokeCase26() throws Exception { - AccessGroupDeleteParams params = - AccessGroupDeleteParams.builder() + com.scalar.models.schemas.accessGroup.AccessGroupDeleteParams params = + com.scalar + .models + .schemas + .accessGroup + .AccessGroupDeleteParams + .builder() .namespace("namespace") .slug("slug") .accessGroup(AccessGroup.builder().accessGroupSlug("x").build()) @@ -403,11 +455,61 @@ private static void _smokeCase32() throws Exception { } private static void _smokeCase33() throws Exception { + var accessGroup = client.accessGroups().create(); + } + + private static void _smokeCase34() throws Exception { + com.scalar.models.accessGroups.AccessGroupCreateParams params = + com.scalar + .models + .accessGroups + .AccessGroupCreateParams + .builder() + .name("") + .slug("x") + .allowedDomains("value") + .build(); + var accessGroup = client.accessGroups().create(params); + } + + private static void _smokeCase35() throws Exception { + AccessGroupRetrieveParams params = AccessGroupRetrieveParams.builder().slug("slug").build(); + var accessGroup = client.accessGroups().retrieve(params); + } + + private static void _smokeCase36() throws Exception { + AccessGroupUpdateParams params = AccessGroupUpdateParams.builder().pathSlug("pathSlug").build(); + var accessGroup = client.accessGroups().update(params); + } + + private static void _smokeCase37() throws Exception { + AccessGroupUpdateParams params = + AccessGroupUpdateParams.builder().pathSlug("pathSlug").name("").bodySlug("x").build(); + var accessGroup = client.accessGroups().update(params); + } + + private static void _smokeCase38() throws Exception { + com.scalar.models.accessGroups.AccessGroupDeleteParams params = + com.scalar.models.accessGroups.AccessGroupDeleteParams.builder().slug("slug").build(); + var accessGroup = client.accessGroups().delete(params); + } + + private static void _smokeCase39() throws Exception { + DomainCreateParams params = DomainCreateParams.builder().slug("slug").domain("").build(); + var domain = client.accessGroups().domains().create(params); + } + + private static void _smokeCase40() throws Exception { + DomainDeleteParams params = DomainDeleteParams.builder().slug("slug").domain("").build(); + var domain = client.accessGroups().domains().delete(params); + } + + private static void _smokeCase41() throws Exception { RuleListRulesetsParams params = RuleListRulesetsParams.builder().namespace("namespace").build(); var rule = client.rules().listRulesets(params); } - private static void _smokeCase34() throws Exception { + private static void _smokeCase42() throws Exception { RuleCreateRulesetParams params = RuleCreateRulesetParams.builder() .namespace("namespace") @@ -418,7 +520,7 @@ private static void _smokeCase34() throws Exception { var rule = client.rules().createRuleset(params); } - private static void _smokeCase35() throws Exception { + private static void _smokeCase43() throws Exception { RuleCreateRulesetParams params = RuleCreateRulesetParams.builder() .namespace("namespace") @@ -431,7 +533,7 @@ private static void _smokeCase35() throws Exception { var rule = client.rules().createRuleset(params); } - private static void _smokeCase36() throws Exception { + private static void _smokeCase44() throws Exception { RuleUpdateRulesetParams params = RuleUpdateRulesetParams.builder() .pathNamespace("pathNamespace") @@ -440,7 +542,7 @@ private static void _smokeCase36() throws Exception { var rule = client.rules().updateRuleset(params); } - private static void _smokeCase37() throws Exception { + private static void _smokeCase45() throws Exception { RuleUpdateRulesetParams params = RuleUpdateRulesetParams.builder() .pathNamespace("pathNamespace") @@ -454,19 +556,19 @@ private static void _smokeCase37() throws Exception { var rule = client.rules().updateRuleset(params); } - private static void _smokeCase38() throws Exception { + private static void _smokeCase46() throws Exception { RuleDeleteRulesetParams params = RuleDeleteRulesetParams.builder().namespace("namespace").slug("slug").build(); var rule = client.rules().deleteRuleset(params); } - private static void _smokeCase39() throws Exception { + private static void _smokeCase47() throws Exception { RuleRetrieveRulesetDocumentParams params = RuleRetrieveRulesetDocumentParams.builder().namespace("namespace").slug("slug").build(); var rule = client.rules().retrieveRulesetDocument(params); } - private static void _smokeCase40() throws Exception { + private static void _smokeCase48() throws Exception { RuleCreateRulesetAccessGroupParams params = RuleCreateRulesetAccessGroupParams.builder() .namespace("namespace") @@ -476,7 +578,7 @@ private static void _smokeCase40() throws Exception { var rule = client.rules().createRulesetAccessGroup(params); } - private static void _smokeCase41() throws Exception { + private static void _smokeCase49() throws Exception { RuleDeleteRulesetAccessGroupParams params = RuleDeleteRulesetAccessGroupParams.builder() .namespace("namespace") @@ -486,57 +588,87 @@ private static void _smokeCase41() throws Exception { var rule = client.rules().deleteRulesetAccessGroup(params); } - private static void _smokeCase42() throws Exception { + private static void _smokeCase50() throws Exception { var theme = client.themes().list(); } - private static void _smokeCase43() throws Exception { + private static void _smokeCase51() throws Exception { ThemeCreateParams params = ThemeCreateParams.builder().name("").slug("").document("").build(); var theme = client.themes().create(params); } - private static void _smokeCase44() throws Exception { + private static void _smokeCase52() throws Exception { ThemeCreateParams params = ThemeCreateParams.builder().name("").description("").slug("").document("").build(); var theme = client.themes().create(params); } - private static void _smokeCase45() throws Exception { + private static void _smokeCase53() throws Exception { ThemeUpdateParams params = ThemeUpdateParams.builder().slug("slug").build(); var theme = client.themes().update(params); } - private static void _smokeCase46() throws Exception { + private static void _smokeCase54() throws Exception { ThemeUpdateParams params = ThemeUpdateParams.builder().slug("slug").name("").description("").build(); var theme = client.themes().update(params); } - private static void _smokeCase47() throws Exception { + private static void _smokeCase55() throws Exception { ThemeReplaceDocumentParams params = ThemeReplaceDocumentParams.builder().slug("slug").document("").build(); var theme = client.themes().replaceDocument(params); } - private static void _smokeCase48() throws Exception { + private static void _smokeCase56() throws Exception { ThemeDeleteParams params = ThemeDeleteParams.builder().slug("slug").build(); var theme = client.themes().delete(params); } - private static void _smokeCase49() throws Exception { + private static void _smokeCase57() throws Exception { ThemeRetrieveParams params = ThemeRetrieveParams.builder().slug("slug").build(); var theme = client.themes().retrieve(params); } - private static void _smokeCase50() throws Exception { + private static void _smokeCase58() throws Exception { var team = client.teams().list(); } - private static void _smokeCase51() throws Exception { + private static void _smokeCase59() throws Exception { + var member = client.teams().members().list(); + } + + private static void _smokeCase60() throws Exception { + MemberUpdateParams params = MemberUpdateParams.builder().uid("uidxx").role(Role.OWNER).build(); + var member = client.teams().members().update(params); + } + + private static void _smokeCase61() throws Exception { + MemberDeleteParams params = MemberDeleteParams.builder().uid("uidxx").build(); + var member = client.teams().members().delete(params); + } + + private static void _smokeCase62() throws Exception { + InviteMemberParams params = + InviteMemberParams.builder().email("user@example.com").role(Role.OWNER).build(); + var invite = client.teams().invites().member(params); + } + + private static void _smokeCase63() throws Exception { + InviteResendParams params = InviteResendParams.builder().uid("uidxx").build(); + var invite = client.teams().invites().resend(params); + } + + private static void _smokeCase64() throws Exception { + InviteCancelParams params = InviteCancelParams.builder().uid("uidxx").build(); + var invite = client.teams().invites().cancel(params); + } + + private static void _smokeCase65() throws Exception { var scalarDoc = client.scalarDocs().listGuides(); } - private static void _smokeCase52() throws Exception { + private static void _smokeCase66() throws Exception { ScalarDocCreateGuideParams params = ScalarDocCreateGuideParams.builder() .name("") @@ -547,7 +679,7 @@ private static void _smokeCase52() throws Exception { var scalarDoc = client.scalarDocs().createGuide(params); } - private static void _smokeCase53() throws Exception { + private static void _smokeCase67() throws Exception { ScalarDocCreateGuideParams params = ScalarDocCreateGuideParams.builder() .name("") @@ -559,25 +691,478 @@ private static void _smokeCase53() throws Exception { var scalarDoc = client.scalarDocs().createGuide(params); } - private static void _smokeCase54() throws Exception { + private static void _smokeCase68() throws Exception { ScalarDocPublishGuideParams params = ScalarDocPublishGuideParams.builder().slug("slug").build(); var scalarDoc = client.scalarDocs().publishGuide(params); } - private static void _smokeCase55() throws Exception { + private static void _smokeCase69() throws Exception { + var scalarDoc = client.scalarDocs().listProjects(); + } + + private static void _smokeCase70() throws Exception { + ScalarDocListProjectsParams params = ScalarDocListProjectsParams.builder().limit(1L).build(); + var scalarDoc = client.scalarDocs().listProjects(params); + } + + private static void _smokeCase71() throws Exception { + ScalarDocCreateProjectParams params = + ScalarDocCreateProjectParams.builder() + .name("") + .provider(ScalarDocCreateProjectParams.Provider.of("forgejo")) + .build(); + var scalarDoc = client.scalarDocs().createProject(params); + } + + private static void _smokeCase72() throws Exception { + ScalarDocCreateProjectParams params = + ScalarDocCreateProjectParams.builder() + .name("") + .slug("x") + .isPrivate(false) + .blank(false) + .provider(ScalarDocCreateProjectParams.Provider.of("forgejo")) + .githubRepository( + ScalarDocCreateProjectParams.GithubRepository.builder() + .installationId(0L) + .repoId(0L) + .build()) + .bitbucketRepository( + ScalarDocCreateProjectParams.BitbucketRepository.builder() + .workspaceUuid("") + .repoUuid("") + .build()) + .build(); + var scalarDoc = client.scalarDocs().createProject(params); + } + + private static void _smokeCase73() throws Exception { + ScalarDocRetrieveProjectParams params = + ScalarDocRetrieveProjectParams.builder().slug("slug").build(); + var scalarDoc = client.scalarDocs().retrieveProject(params); + } + + private static void _smokeCase74() throws Exception { + ScalarDocUpdateProjectParams params = + ScalarDocUpdateProjectParams.builder().slug("slug").build(); + var scalarDoc = client.scalarDocs().updateProject(params); + } + + private static void _smokeCase75() throws Exception { + ScalarDocUpdateProjectParams params = + ScalarDocUpdateProjectParams.builder() + .slug("slug") + .name("") + .isPrivate(false) + .accessGroups(java.util.List.of("xxxxx")) + .loginPortalUid(ScalarDocUpdateProjectParams.LoginPortalUid.ofNanoid("xxxxx")) + .activeThemeId("xxxxx") + .agentEnabled(false) + .analyticsEnabled(false) + .build(); + var scalarDoc = client.scalarDocs().updateProject(params); + } + + private static void _smokeCase76() throws Exception { + ScalarDocDeleteProjectParams params = + ScalarDocDeleteProjectParams.builder().slug("slug").build(); + var scalarDoc = client.scalarDocs().deleteProject(params); + } + + private static void _smokeCase77() throws Exception { + ScalarDocPublishProjectParams params = + ScalarDocPublishProjectParams.builder().slug("slug").build(); + var scalarDoc = client.scalarDocs().publishProject(params); + } + + private static void _smokeCase78() throws Exception { + ScalarDocPublishProjectParams params = + ScalarDocPublishProjectParams.builder() + .slug("slug") + .commitSha("") + .preview(false) + .configPath("") + .build(); + var scalarDoc = client.scalarDocs().publishProject(params); + } + + private static void _smokeCase79() throws Exception { + ScalarDocListProjectConfigParams params = + ScalarDocListProjectConfigParams.builder().slug("slug").build(); + var scalarDoc = client.scalarDocs().listProjectConfig(params); + } + + private static void _smokeCase80() throws Exception { + ScalarDocListProjectConfigParams params = + ScalarDocListProjectConfigParams.builder().slug("slug").ref("ref").build(); + var scalarDoc = client.scalarDocs().listProjectConfig(params); + } + + private static void _smokeCase81() throws Exception { + ScalarDocUpdateProjectConfigParams params = + ScalarDocUpdateProjectConfigParams.builder().slug("slug").content("").build(); + var scalarDoc = client.scalarDocs().updateProjectConfig(params); + } + + private static void _smokeCase82() throws Exception { + ScalarDocUpdateProjectConfigParams params = + ScalarDocUpdateProjectConfigParams.builder() + .slug("slug") + .content("") + .ref("") + .baseToken("") + .message("") + .path("") + .build(); + var scalarDoc = client.scalarDocs().updateProjectConfig(params); + } + + private static void _smokeCase83() throws Exception { + ScalarDocListProjectDomainParams params = + ScalarDocListProjectDomainParams.builder().slug("slug").build(); + var scalarDoc = client.scalarDocs().listProjectDomain(params); + } + + private static void _smokeCase84() throws Exception { + ScalarDocListProjectDomainStatusParams params = + ScalarDocListProjectDomainStatusParams.builder().slug("slug").build(); + var scalarDoc = client.scalarDocs().listProjectDomainStatus(params); + } + + private static void _smokeCase85() throws Exception { var namespace = client.namespaces().list(); } - private static void _smokeCase56() throws Exception { + private static void _smokeCase86() throws Exception { AuthenticationExchangePersonalTokenParams params = AuthenticationExchangePersonalTokenParams.builder().personalToken("").build(); var authentication = client.authentication().exchangePersonalToken(params); } - private static void _smokeCase57() throws Exception { + private static void _smokeCase87() throws Exception { var authentication = client.authentication().listCurrentUser(); } + private static void _smokeCase88() throws Exception { + var sdk = client.sdks().list(); + } + + private static void _smokeCase89() throws Exception { + SdkListParams params = SdkListParams.builder().limit(1L).build(); + var sdk = client.sdks().list(params); + } + + private static void _smokeCase90() throws Exception { + SdkCreateParams params = + SdkCreateParams.builder() + .apiUid("xxxxx") + .languages(java.util.List.of(SdkCreateParams.Language.of("typescript"))) + .build(); + var sdk = client.sdks().create(params); + } + + private static void _smokeCase91() throws Exception { + SdkCreateParams params = + SdkCreateParams.builder() + .apiUid("xxxxx") + .languages(java.util.List.of(SdkCreateParams.Language.of("typescript"))) + .title("") + .slug("x") + .className("") + .config("") + .build(); + var sdk = client.sdks().create(params); + } + + private static void _smokeCase92() throws Exception { + SdkRetrieveParams params = SdkRetrieveParams.builder().uid("uidxx").build(); + var sdk = client.sdks().retrieve(params); + } + + private static void _smokeCase93() throws Exception { + SdkUpdateParams params = SdkUpdateParams.builder().uid("uidxx").build(); + var sdk = client.sdks().update(params); + } + + private static void _smokeCase94() throws Exception { + SdkUpdateParams params = + SdkUpdateParams.builder() + .uid("uidxx") + .title("") + .slug("x") + .isPrivate(false) + .config("") + .apiUid("") + .apiVersion("") + .build(); + var sdk = client.sdks().update(params); + } + + private static void _smokeCase95() throws Exception { + SdkDeleteParams params = SdkDeleteParams.builder().uid("uidxx").build(); + var sdk = client.sdks().delete(params); + } + + private static void _smokeCase96() throws Exception { + SdkBuildParams params = SdkBuildParams.builder().uid("uidxx").build(); + var sdk = client.sdks().build(params); + } + + private static void _smokeCase97() throws Exception { + SdkBuildParams params = + SdkBuildParams.builder() + .uid("uidxx") + .version("") + .languages(java.util.List.of(SdkBuildParams.Language.of("typescript"))) + .build(); + var sdk = client.sdks().build(params); + } + + private static void _smokeCase98() throws Exception { + com.scalar.models.sdks.versions.VersionCreateParams params = + com.scalar.models.sdks.versions.VersionCreateParams.builder() + .uid("uidxx") + .version("") + .apiVersion("") + .build(); + var version = client.sdks().versions().create(params); + } + + private static void _smokeCase99() throws Exception { + com.scalar.models.sdks.versions.VersionDeleteParams params = + com.scalar.models.sdks.versions.VersionDeleteParams.builder() + .uid("uidxx") + .version("version") + .build(); + var version = client.sdks().versions().delete(params); + } + + private static void _smokeCase100() throws Exception { + RepositoryLinkParams params = + RepositoryLinkParams.builder() + .uid("uidxx") + .language(RepositoryLinkParams.Language.of("typescript")) + .repositoryId(0L) + .baseBranch("") + .build(); + var repository = client.sdks().repositories().link(params); + } + + private static void _smokeCase101() throws Exception { + RepositoryLinkParams params = + RepositoryLinkParams.builder() + .uid("uidxx") + .language(RepositoryLinkParams.Language.of("typescript")) + .repositoryId(0L) + .baseBranch("") + .prereleaseType("") + .build(); + var repository = client.sdks().repositories().link(params); + } + + private static void _smokeCase102() throws Exception { + RepositoryUnlinkParams params = + RepositoryUnlinkParams.builder() + .uid("uidxx") + .language(RepositoryUnlinkParams.Language.of("typescript")) + .build(); + var repository = client.sdks().repositories().unlink(params); + } + + private static void _smokeCase103() throws Exception { + RepositoryUpdatePublishingParams params = + RepositoryUpdatePublishingParams.builder() + .uid("uidxx") + .language(RepositoryUpdatePublishingParams.Language.of("typescript")) + .publishOnMerge(false) + .build(); + var repository = client.sdks().repositories().updatePublishing(params); + } + + private static void _smokeCase104() throws Exception { + RepositoryUpdatePublishingParams params = + RepositoryUpdatePublishingParams.builder() + .uid("uidxx") + .language(RepositoryUpdatePublishingParams.Language.of("typescript")) + .publishOnMerge(false) + .authMethod(RepositoryUpdatePublishingParams.AuthMethod.of("oidc")) + .access(RepositoryUpdatePublishingParams.Access.of("public")) + .tag("") + .build(); + var repository = client.sdks().repositories().updatePublishing(params); + } + + private static void _smokeCase105() throws Exception { + var server = client.mcp().servers().list(); + } + + private static void _smokeCase106() throws Exception { + ServerCreateParams params = ServerCreateParams.builder().name("x").build(); + var server = client.mcp().servers().create(params); + } + + private static void _smokeCase107() throws Exception { + ServerCreateParams params = + ServerCreateParams.builder() + .name("x") + .slug("x") + .versionUids(java.util.List.of("")) + .projectUids(java.util.List.of("")) + .build(); + var server = client.mcp().servers().create(params); + } + + private static void _smokeCase108() throws Exception { + ServerRetrieveParams params = ServerRetrieveParams.builder().id("id").build(); + var server = client.mcp().servers().retrieve(params); + } + + private static void _smokeCase109() throws Exception { + ServerUpdateParams params = ServerUpdateParams.builder().id("id").build(); + var server = client.mcp().servers().update(params); + } + + private static void _smokeCase110() throws Exception { + ServerUpdateParams params = + ServerUpdateParams.builder() + .id("id") + .name("x") + .slug("x") + .autoAddOperations(false) + .operations(java.util.List.of("")) + .docsPages(java.util.List.of("")) + .build(); + var server = client.mcp().servers().update(params); + } + + private static void _smokeCase111() throws Exception { + ServerDeleteParams params = ServerDeleteParams.builder().id("id").build(); + var server = client.mcp().servers().delete(params); + } + + private static void _smokeCase112() throws Exception { + InstallationListParams params = InstallationListParams.builder().id("id").build(); + var installation = client.mcp().servers().installations().list(params); + } + + private static void _smokeCase113() throws Exception { + InstallationCreateParams params = + InstallationCreateParams.builder() + .id("id") + .name("x") + .documentAuth(InstallationCreateParams.DocumentAuth.builder().build()) + .build(); + var installation = client.mcp().servers().installations().create(params); + } + + private static void _smokeCase114() throws Exception { + InstallationCreateParams params = + InstallationCreateParams.builder() + .id("id") + .name("x") + .slug("x") + .documentAuth(InstallationCreateParams.DocumentAuth.builder().build()) + .build(); + var installation = client.mcp().servers().installations().create(params); + } + + private static void _smokeCase115() throws Exception { + InstallationRetrieveParams params = + InstallationRetrieveParams.builder().id("id").installationId("installationId").build(); + var installation = client.mcp().servers().installations().retrieve(params); + } + + private static void _smokeCase116() throws Exception { + InstallationUpdateParams params = + InstallationUpdateParams.builder().id("id").installationId("installationId").build(); + var installation = client.mcp().servers().installations().update(params); + } + + private static void _smokeCase117() throws Exception { + InstallationUpdateParams params = + InstallationUpdateParams.builder() + .id("id") + .installationId("installationId") + .name("x") + .slug("x") + .isPrivate(false) + .loginPortalUid("") + .documentAuth(InstallationUpdateParams.DocumentAuth.builder().build()) + .mcpVersion("") + .build(); + var installation = client.mcp().servers().installations().update(params); + } + + private static void _smokeCase118() throws Exception { + InstallationDeleteParams params = + InstallationDeleteParams.builder().id("id").installationId("installationId").build(); + var installation = client.mcp().servers().installations().delete(params); + } + + private static void _smokeCase119() throws Exception { + InstallationCreateAccessGroupParams params = + InstallationCreateAccessGroupParams.builder() + .id("id") + .installationId("installationId") + .accessGroupUid("xxxxx") + .build(); + var installation = client.mcp().servers().installations().createAccessGroup(params); + } + + private static void _smokeCase120() throws Exception { + InstallationDeleteAccessGroupParams params = + InstallationDeleteAccessGroupParams.builder() + .id("id") + .installationId("installationId") + .accessGroupUid("xxxxx") + .build(); + var installation = client.mcp().servers().installations().deleteAccessGroup(params); + } + + private static void _smokeCase121() throws Exception { + var oAuth = client.oAuth().oauthAuthorize(); + } + + private static void _smokeCase122() throws Exception { + OAuthOauthTokenParams params = OAuthOauthTokenParams.builder().grantType("").build(); + var oAuth = client.oAuth().oauthToken(params); + } + + private static void _smokeCase123() throws Exception { + OAuthOauthTokenParams params = + OAuthOauthTokenParams.builder() + .grantType("") + .clientId("") + .clientSecret("") + .code("") + .redirectUri("") + .codeVerifier("") + .refreshToken("") + .scope("") + .build(); + var oAuth = client.oAuth().oauthToken(params); + } + + private static void _smokeCase124() throws Exception { + OAuthOauthRevokeParams params = OAuthOauthRevokeParams.builder().token("").build(); + var oAuth = client.oAuth().oauthRevoke(params); + } + + private static void _smokeCase125() throws Exception { + OAuthOauthRevokeParams params = + OAuthOauthRevokeParams.builder() + .token("") + .tokenTypeHint("") + .clientId("") + .clientSecret("") + .build(); + var oAuth = client.oAuth().oauthRevoke(params); + } + + private static void _smokeCase126() throws Exception { + var oAuth = client.oAuth().oauthAuthorizationServerMetadata(); + } + private static final List cases = List.of( new SmokeCase("listAllApiDocuments", "GET", "/v1/apis", "", SmokeTest::_smokeCase0), @@ -734,76 +1319,292 @@ private static void _smokeCase57() throws Exception { new SmokeCase("create", "POST", "/v1/login-portals", "", SmokeTest::_smokeCase31), new SmokeCase("list", "GET", "/v1/login-portals", "", SmokeTest::_smokeCase32), new SmokeCase( - "listRulesets", "GET", "/v1/rulesets/{namespace}", "", SmokeTest::_smokeCase33), + "create", "POST", "/v1/access-groups", "required params", SmokeTest::_smokeCase33), + new SmokeCase( + "create", "POST", "/v1/access-groups", "all params", SmokeTest::_smokeCase34), + new SmokeCase("retrieve", "GET", "/v1/access-groups/{slug}", "", SmokeTest::_smokeCase35), + new SmokeCase( + "update", + "PATCH", + "/v1/access-groups/{slug}", + "required params", + SmokeTest::_smokeCase36), + new SmokeCase( + "update", "PATCH", "/v1/access-groups/{slug}", "all params", SmokeTest::_smokeCase37), + new SmokeCase( + "delete", "DELETE", "/v1/access-groups/{slug}", "", SmokeTest::_smokeCase38), + new SmokeCase( + "create", "POST", "/v1/access-groups/{slug}/domains", "", SmokeTest::_smokeCase39), + new SmokeCase( + "delete", "DELETE", "/v1/access-groups/{slug}/domains", "", SmokeTest::_smokeCase40), + new SmokeCase( + "listRulesets", "GET", "/v1/rulesets/{namespace}", "", SmokeTest::_smokeCase41), new SmokeCase( "createRuleset", "POST", "/v1/rulesets/{namespace}", "required params", - SmokeTest::_smokeCase34), + SmokeTest::_smokeCase42), new SmokeCase( "createRuleset", "POST", "/v1/rulesets/{namespace}", "all params", - SmokeTest::_smokeCase35), + SmokeTest::_smokeCase43), new SmokeCase( "updateRuleset", "PATCH", "/v1/rulesets/{namespace}/{slug}", "required params", - SmokeTest::_smokeCase36), + SmokeTest::_smokeCase44), new SmokeCase( "updateRuleset", "PATCH", "/v1/rulesets/{namespace}/{slug}", "all params", - SmokeTest::_smokeCase37), + SmokeTest::_smokeCase45), new SmokeCase( "deleteRuleset", "DELETE", "/v1/rulesets/{namespace}/{slug}", "", - SmokeTest::_smokeCase38), + SmokeTest::_smokeCase46), new SmokeCase( "retrieveRulesetDocument", "GET", "/v1/rulesets/{namespace}/{slug}", "", - SmokeTest::_smokeCase39), + SmokeTest::_smokeCase47), new SmokeCase( "createRulesetAccessGroup", "POST", "/v1/rulesets/{namespace}/{slug}/access-group", "", - SmokeTest::_smokeCase40), + SmokeTest::_smokeCase48), new SmokeCase( "deleteRulesetAccessGroup", "DELETE", "/v1/rulesets/{namespace}/{slug}/access-group", "", - SmokeTest::_smokeCase41), - new SmokeCase("list", "GET", "/v1/themes", "", SmokeTest::_smokeCase42), - new SmokeCase("create", "POST", "/v1/themes", "required params", SmokeTest::_smokeCase43), - new SmokeCase("create", "POST", "/v1/themes", "all params", SmokeTest::_smokeCase44), + SmokeTest::_smokeCase49), + new SmokeCase("list", "GET", "/v1/themes", "", SmokeTest::_smokeCase50), + new SmokeCase("create", "POST", "/v1/themes", "required params", SmokeTest::_smokeCase51), + new SmokeCase("create", "POST", "/v1/themes", "all params", SmokeTest::_smokeCase52), + new SmokeCase( + "update", "PATCH", "/v1/themes/{slug}", "required params", SmokeTest::_smokeCase53), + new SmokeCase( + "update", "PATCH", "/v1/themes/{slug}", "all params", SmokeTest::_smokeCase54), + new SmokeCase("replaceDocument", "PUT", "/v1/themes/{slug}", "", SmokeTest::_smokeCase55), + new SmokeCase("delete", "DELETE", "/v1/themes/{slug}", "", SmokeTest::_smokeCase56), + new SmokeCase("retrieve", "GET", "/v1/themes/{slug}", "", SmokeTest::_smokeCase57), + new SmokeCase("list", "GET", "/v1/teams", "", SmokeTest::_smokeCase58), + new SmokeCase("list", "GET", "/v1/teams/members", "", SmokeTest::_smokeCase59), + new SmokeCase("update", "PATCH", "/v1/teams/members/{uid}", "", SmokeTest::_smokeCase60), + new SmokeCase("delete", "DELETE", "/v1/teams/members/{uid}", "", SmokeTest::_smokeCase61), + new SmokeCase("member", "POST", "/v1/teams/invites", "", SmokeTest::_smokeCase62), + new SmokeCase("resend", "PATCH", "/v1/teams/invites/{uid}", "", SmokeTest::_smokeCase63), + new SmokeCase("cancel", "DELETE", "/v1/teams/invites/{uid}", "", SmokeTest::_smokeCase64), + new SmokeCase("listGuides", "GET", "/v1/guides", "", SmokeTest::_smokeCase65), + new SmokeCase( + "createGuide", "POST", "/v1/guides", "required params", SmokeTest::_smokeCase66), + new SmokeCase("createGuide", "POST", "/v1/guides", "all params", SmokeTest::_smokeCase67), new SmokeCase( - "update", "PATCH", "/v1/themes/{slug}", "required params", SmokeTest::_smokeCase45), + "publishGuide", "POST", "/v1/guides/{slug}/publish", "", SmokeTest::_smokeCase68), new SmokeCase( - "update", "PATCH", "/v1/themes/{slug}", "all params", SmokeTest::_smokeCase46), - new SmokeCase("replaceDocument", "PUT", "/v1/themes/{slug}", "", SmokeTest::_smokeCase47), - new SmokeCase("delete", "DELETE", "/v1/themes/{slug}", "", SmokeTest::_smokeCase48), - new SmokeCase("retrieve", "GET", "/v1/themes/{slug}", "", SmokeTest::_smokeCase49), - new SmokeCase("list", "GET", "/v1/teams", "", SmokeTest::_smokeCase50), - new SmokeCase("listGuides", "GET", "/v1/guides", "", SmokeTest::_smokeCase51), + "listProjects", "GET", "/v1/docs", "required params", SmokeTest::_smokeCase69), + new SmokeCase("listProjects", "GET", "/v1/docs", "all params", SmokeTest::_smokeCase70), new SmokeCase( - "createGuide", "POST", "/v1/guides", "required params", SmokeTest::_smokeCase52), - new SmokeCase("createGuide", "POST", "/v1/guides", "all params", SmokeTest::_smokeCase53), + "createProject", "POST", "/v1/docs", "required params", SmokeTest::_smokeCase71), + new SmokeCase("createProject", "POST", "/v1/docs", "all params", SmokeTest::_smokeCase72), + new SmokeCase("retrieveProject", "GET", "/v1/docs/{slug}", "", SmokeTest::_smokeCase73), new SmokeCase( - "publishGuide", "POST", "/v1/guides/{slug}/publish", "", SmokeTest::_smokeCase54), - new SmokeCase("list", "GET", "/v1/namespaces", "", SmokeTest::_smokeCase55), + "updateProject", + "PATCH", + "/v1/docs/{slug}", + "required params", + SmokeTest::_smokeCase74), + new SmokeCase( + "updateProject", "PATCH", "/v1/docs/{slug}", "all params", SmokeTest::_smokeCase75), + new SmokeCase("deleteProject", "DELETE", "/v1/docs/{slug}", "", SmokeTest::_smokeCase76), new SmokeCase( - "exchangePersonalToken", "POST", "/v1/auth/exchange", "", SmokeTest::_smokeCase56), - new SmokeCase("listCurrentUser", "GET", "/v1/auth/me", "", SmokeTest::_smokeCase57)); + "publishProject", + "POST", + "/v1/docs/{slug}/publish", + "required params", + SmokeTest::_smokeCase77), + new SmokeCase( + "publishProject", + "POST", + "/v1/docs/{slug}/publish", + "all params", + SmokeTest::_smokeCase78), + new SmokeCase( + "listProjectConfig", + "GET", + "/v1/docs/{slug}/config", + "required params", + SmokeTest::_smokeCase79), + new SmokeCase( + "listProjectConfig", + "GET", + "/v1/docs/{slug}/config", + "all params", + SmokeTest::_smokeCase80), + new SmokeCase( + "updateProjectConfig", + "PUT", + "/v1/docs/{slug}/config", + "required params", + SmokeTest::_smokeCase81), + new SmokeCase( + "updateProjectConfig", + "PUT", + "/v1/docs/{slug}/config", + "all params", + SmokeTest::_smokeCase82), + new SmokeCase( + "listProjectDomain", "GET", "/v1/docs/{slug}/domain", "", SmokeTest::_smokeCase83), + new SmokeCase( + "listProjectDomainStatus", + "GET", + "/v1/docs/{slug}/domain/status", + "", + SmokeTest::_smokeCase84), + new SmokeCase("list", "GET", "/v1/namespaces", "", SmokeTest::_smokeCase85), + new SmokeCase( + "exchangePersonalToken", "POST", "/v1/auth/exchange", "", SmokeTest::_smokeCase86), + new SmokeCase("listCurrentUser", "GET", "/v1/auth/me", "", SmokeTest::_smokeCase87), + new SmokeCase("list", "GET", "/v1/sdks", "required params", SmokeTest::_smokeCase88), + new SmokeCase("list", "GET", "/v1/sdks", "all params", SmokeTest::_smokeCase89), + new SmokeCase("create", "POST", "/v1/sdks", "required params", SmokeTest::_smokeCase90), + new SmokeCase("create", "POST", "/v1/sdks", "all params", SmokeTest::_smokeCase91), + new SmokeCase("retrieve", "GET", "/v1/sdks/{uid}", "", SmokeTest::_smokeCase92), + new SmokeCase( + "update", "PATCH", "/v1/sdks/{uid}", "required params", SmokeTest::_smokeCase93), + new SmokeCase("update", "PATCH", "/v1/sdks/{uid}", "all params", SmokeTest::_smokeCase94), + new SmokeCase("delete", "DELETE", "/v1/sdks/{uid}", "", SmokeTest::_smokeCase95), + new SmokeCase( + "build", "POST", "/v1/sdks/{uid}/build", "required params", SmokeTest::_smokeCase96), + new SmokeCase( + "build", "POST", "/v1/sdks/{uid}/build", "all params", SmokeTest::_smokeCase97), + new SmokeCase("create", "POST", "/v1/sdks/{uid}/versions", "", SmokeTest::_smokeCase98), + new SmokeCase( + "delete", "DELETE", "/v1/sdks/{uid}/versions/{version}", "", SmokeTest::_smokeCase99), + new SmokeCase( + "link", + "POST", + "/v1/sdks/{uid}/repositories", + "required params", + SmokeTest::_smokeCase100), + new SmokeCase( + "link", + "POST", + "/v1/sdks/{uid}/repositories", + "all params", + SmokeTest::_smokeCase101), + new SmokeCase( + "unlink", + "DELETE", + "/v1/sdks/{uid}/repositories/{language}", + "", + SmokeTest::_smokeCase102), + new SmokeCase( + "updatePublishing", + "POST", + "/v1/sdks/{uid}/repositories/{language}/publishing", + "required params", + SmokeTest::_smokeCase103), + new SmokeCase( + "updatePublishing", + "POST", + "/v1/sdks/{uid}/repositories/{language}/publishing", + "all params", + SmokeTest::_smokeCase104), + new SmokeCase("list", "GET", "/v1/mcp/servers", "", SmokeTest::_smokeCase105), + new SmokeCase( + "create", "POST", "/v1/mcp/servers", "required params", SmokeTest::_smokeCase106), + new SmokeCase( + "create", "POST", "/v1/mcp/servers", "all params", SmokeTest::_smokeCase107), + new SmokeCase("retrieve", "GET", "/v1/mcp/servers/{id}", "", SmokeTest::_smokeCase108), + new SmokeCase( + "update", + "PATCH", + "/v1/mcp/servers/{id}", + "required params", + SmokeTest::_smokeCase109), + new SmokeCase( + "update", "PATCH", "/v1/mcp/servers/{id}", "all params", SmokeTest::_smokeCase110), + new SmokeCase("delete", "DELETE", "/v1/mcp/servers/{id}", "", SmokeTest::_smokeCase111), + new SmokeCase( + "list", "GET", "/v1/mcp/servers/{id}/installations", "", SmokeTest::_smokeCase112), + new SmokeCase( + "create", + "POST", + "/v1/mcp/servers/{id}/installations", + "required params", + SmokeTest::_smokeCase113), + new SmokeCase( + "create", + "POST", + "/v1/mcp/servers/{id}/installations", + "all params", + SmokeTest::_smokeCase114), + new SmokeCase( + "retrieve", + "GET", + "/v1/mcp/servers/{id}/installations/{installationId}", + "", + SmokeTest::_smokeCase115), + new SmokeCase( + "update", + "PATCH", + "/v1/mcp/servers/{id}/installations/{installationId}", + "required params", + SmokeTest::_smokeCase116), + new SmokeCase( + "update", + "PATCH", + "/v1/mcp/servers/{id}/installations/{installationId}", + "all params", + SmokeTest::_smokeCase117), + new SmokeCase( + "delete", + "DELETE", + "/v1/mcp/servers/{id}/installations/{installationId}", + "", + SmokeTest::_smokeCase118), + new SmokeCase( + "createAccessGroup", + "POST", + "/v1/mcp/servers/{id}/installations/{installationId}/access-group", + "", + SmokeTest::_smokeCase119), + new SmokeCase( + "deleteAccessGroup", + "DELETE", + "/v1/mcp/servers/{id}/installations/{installationId}/access-group", + "", + SmokeTest::_smokeCase120), + new SmokeCase( + "oauthAuthorize", "GET", "/v1/oauth/authorize", "", SmokeTest::_smokeCase121), + new SmokeCase( + "oauthToken", "POST", "/v1/oauth/token", "required params", SmokeTest::_smokeCase122), + new SmokeCase( + "oauthToken", "POST", "/v1/oauth/token", "all params", SmokeTest::_smokeCase123), + new SmokeCase( + "oauthRevoke", + "POST", + "/v1/oauth/revoke", + "required params", + SmokeTest::_smokeCase124), + new SmokeCase( + "oauthRevoke", "POST", "/v1/oauth/revoke", "all params", SmokeTest::_smokeCase125), + new SmokeCase( + "oauthAuthorizationServerMetadata", + "GET", + "/.well-known/oauth-authorization-server", + "", + SmokeTest::_smokeCase126)); private static List selectedCases() { String filter = System.getenv("SCALAR_SMOKE_FILTER"); From 0d0a8f14a335b0ee8fc4b933bfef086d36035621 Mon Sep 17 00:00:00 2001 From: scalarbot Date: Fri, 2 Oct 2026 16:33:14 +0000 Subject: [PATCH 4/6] feat(api)!: update property api_document.tags (+3 more changes) - Property `api_document.tags` type changed from `unknown` to `string`. - Property `managed_doc_version.tools` type changed from `Array` to `Array`. - Property `github_project.accessGroups` type changed from `unknown` to `string`. - Property `docs_project.accessGroups` type changed from `unknown` to `string`. BREAKING CHANGE: 4 breaking changes to the SDK surface. - Property `api_document.tags` type changed from `unknown` to `string`. - Property `managed_doc_version.tools` type changed from `Array` to `Array`. - Property `github_project.accessGroups` type changed from `unknown` to `string`. - Property `docs_project.accessGroups` type changed from `unknown` to `string`. Build: OocRChcN6mN9IwfcNU6zh --- api.md | 289 +++-- .../accessGroups/AccessGroupCreateParams.kt | 42 +- .../accessGroups/AccessGroupCreateResponse.kt | 54 +- .../AccessGroupRetrieveResponse.kt | 54 +- .../com/scalar/models/registry/ApiDocument.kt | 26 +- .../scalar/models/scalarDocs/DocsProject.kt | 27 +- .../scalar/models/scalarDocs/GithubProject.kt | 27 +- .../proguard/ProGuardCompatibilityTest.kt | 3 +- scalar-sdk.manifest.json | 1151 ++++++++++++++++- tests/smoke-test.java | 532 ++++---- 10 files changed, 1692 insertions(+), 513 deletions(-) diff --git a/api.md b/api.md index 2fc0860..5918aa4 100644 --- a/api.md +++ b/api.md @@ -175,7 +175,7 @@ ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); RegistryListApiDocumentsParams params = - RegistryListApiDocumentsParams.builder().namespace("namespace").build(); + RegistryListApiDocumentsParams.builder().namespace("acme").build(); var registry = client.registry().listApiDocuments(params); System.out.println(registry); @@ -200,11 +200,13 @@ ScalarClient client = RegistryCreateApiDocumentParams params = RegistryCreateApiDocumentParams.builder() - .namespace("namespace") - .title("") - .version("x") - .slug("") - .document("") + .namespace("acme") + .title("Acme API") + .version("1.2.0") + .slug("acme-api") + .document( + "{\"openapi\":\"3.1.0\",\"info\":{\"title\":\"Acme" + + " API\",\"version\":\"1.2.0\"},\"paths\":{}}") .build(); var registry = client.registry().createApiDocument(params); @@ -228,7 +230,7 @@ ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); RegistryUpdateApiDocumentParams params = - RegistryUpdateApiDocumentParams.builder().namespace("namespace").slug("slug").build(); + RegistryUpdateApiDocumentParams.builder().namespace("acme").slug("acme-api").build(); var registry = client.registry().updateApiDocument(params); System.out.println(registry); @@ -251,7 +253,7 @@ ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); RegistryDeleteApiDocumentParams params = - RegistryDeleteApiDocumentParams.builder().namespace("namespace").slug("slug").build(); + RegistryDeleteApiDocumentParams.builder().namespace("acme").slug("acme-api").build(); var registry = client.registry().deleteApiDocument(params); System.out.println(registry); @@ -275,9 +277,9 @@ ScalarClient client = RegistryRetrieveApiDocumentVersionParams params = RegistryRetrieveApiDocumentVersionParams.builder() - .namespace("namespace") - .slug("slug") - .semver("semver") + .namespace("acme") + .slug("acme-api") + .semver("1.2.0") .build(); var registry = client.registry().retrieveApiDocumentVersion(params); @@ -303,10 +305,12 @@ ScalarClient client = RegistryUpdateApiDocumentVersionParams params = RegistryUpdateApiDocumentVersionParams.builder() - .namespace("namespace") - .slug("slug") - .semver("semver") - .document("") + .namespace("acme") + .slug("acme-api") + .semver("1.2.0") + .document( + "{\"openapi\":\"3.1.0\",\"info\":{\"title\":\"Acme" + + " API\",\"version\":\"1.2.0\"},\"paths\":{}}") .build(); var registry = client.registry().updateApiDocumentVersion(params); @@ -331,9 +335,9 @@ ScalarClient client = RegistryDeleteApiDocumentVersionParams params = RegistryDeleteApiDocumentVersionParams.builder() - .namespace("namespace") - .slug("slug") - .semver("semver") + .namespace("acme") + .slug("acme-api") + .semver("1.2.0") .build(); var registry = client.registry().deleteApiDocumentVersion(params); @@ -359,9 +363,9 @@ ScalarClient client = RegistryListApiDocumentVersionMetadataParams params = RegistryListApiDocumentVersionMetadataParams.builder() - .namespace("namespace") - .slug("slug") - .semver("semver") + .namespace("acme") + .slug("acme-api") + .semver("1.2.0") .build(); var registry = client.registry().listApiDocumentVersionMetadata(params); @@ -387,10 +391,12 @@ ScalarClient client = RegistryCreateApiDocumentVersionParams params = RegistryCreateApiDocumentVersionParams.builder() - .namespace("namespace") - .slug("slug") - .version("x") - .document("") + .namespace("acme") + .slug("acme-api") + .version("1.2.0") + .document( + "{\"openapi\":\"3.1.0\",\"info\":{\"title\":\"Acme" + + " API\",\"version\":\"1.2.0\"},\"paths\":{}}") .build(); var registry = client.registry().createApiDocumentVersion(params); @@ -416,9 +422,9 @@ ScalarClient client = RegistryCreateApiDocumentAccessGroupParams params = RegistryCreateApiDocumentAccessGroupParams.builder() - .namespace("namespace") - .slug("slug") - .accessGroup(AccessGroup.builder().accessGroupSlug("x").build()) + .namespace("acme") + .slug("acme-api") + .accessGroup(AccessGroup.builder().accessGroupSlug("acme-api").build()) .build(); var registry = client.registry().createApiDocumentAccessGroup(params); @@ -444,9 +450,9 @@ ScalarClient client = RegistryDeleteApiDocumentAccessGroupParams params = RegistryDeleteApiDocumentAccessGroupParams.builder() - .namespace("namespace") - .slug("slug") - .accessGroup(AccessGroup.builder().accessGroupSlug("x").build()) + .namespace("acme") + .slug("acme-api") + .accessGroup(AccessGroup.builder().accessGroupSlug("acme-api").build()) .build(); var registry = client.registry().deleteApiDocumentAccessGroup(params); @@ -474,7 +480,7 @@ import com.scalar.models.schemas.SchemaListParams; ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); -SchemaListParams params = SchemaListParams.builder().namespace("namespace").build(); +SchemaListParams params = SchemaListParams.builder().namespace("acme").build(); var schema = client.schemas().list(params); System.out.println(schema); @@ -499,11 +505,12 @@ ScalarClient client = SchemaCreateParams params = SchemaCreateParams.builder() - .namespace("namespace") - .title("") - .version("x") - .slug("") - .document("") + .namespace("acme") + .title("Customer") + .version("1.2.0") + .slug("customer") + .document( + "{\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\",\"examples\":[\"Acme\"]}}}") .build(); var schema = client.schemas().create(params); @@ -527,7 +534,7 @@ ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); SchemaUpdateParams params = - SchemaUpdateParams.builder().namespace("namespace").slug("slug").build(); + SchemaUpdateParams.builder().namespace("acme").slug("customer").build(); var schema = client.schemas().update(params); System.out.println(schema); @@ -550,7 +557,7 @@ ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); SchemaDeleteParams params = - SchemaDeleteParams.builder().namespace("namespace").slug("slug").build(); + SchemaDeleteParams.builder().namespace("acme").slug("customer").build(); var schema = client.schemas().delete(params); System.out.println(schema); @@ -577,11 +584,7 @@ ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); VersionRetrieveParams params = - VersionRetrieveParams.builder() - .namespace("namespace") - .slug("slug") - .semver("semver") - .build(); + VersionRetrieveParams.builder().namespace("acme").slug("customer").semver("1.2.0").build(); var version = client.schemas().version().retrieve(params); System.out.println(version); @@ -604,7 +607,7 @@ ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); VersionDeleteParams params = - VersionDeleteParams.builder().namespace("namespace").slug("slug").semver("semver").build(); + VersionDeleteParams.builder().namespace("acme").slug("customer").semver("1.2.0").build(); var version = client.schemas().version().delete(params); System.out.println(version); @@ -629,10 +632,11 @@ ScalarClient client = VersionCreateParams params = VersionCreateParams.builder() - .namespace("namespace") - .slug("slug") - .version("x") - .document("") + .namespace("acme") + .slug("customer") + .version("1.2.0") + .document( + "{\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\",\"examples\":[\"Acme\"]}}}") .build(); var version = client.schemas().version().create(params); @@ -662,9 +666,9 @@ ScalarClient client = AccessGroupCreateParams params = AccessGroupCreateParams.builder() - .namespace("namespace") - .slug("slug") - .accessGroup(AccessGroup.builder().accessGroupSlug("x").build()) + .namespace("acme") + .slug("customer") + .accessGroup(AccessGroup.builder().accessGroupSlug("acme-api").build()) .build(); var accessGroup = client.schemas().accessGroup().create(params); @@ -690,9 +694,9 @@ ScalarClient client = AccessGroupDeleteParams params = AccessGroupDeleteParams.builder() - .namespace("namespace") - .slug("slug") - .accessGroup(AccessGroup.builder().accessGroupSlug("x").build()) + .namespace("acme") + .slug("customer") + .accessGroup(AccessGroup.builder().accessGroupSlug("acme-api").build()) .build(); var accessGroup = client.schemas().accessGroup().delete(params); @@ -720,7 +724,8 @@ import com.scalar.models.loginPortals.LoginPortalRetrieveParams; ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); -LoginPortalRetrieveParams params = LoginPortalRetrieveParams.builder().slug("slug").build(); +LoginPortalRetrieveParams params = + LoginPortalRetrieveParams.builder().slug("acme-login").build(); var loginPortal = client.loginPortals().retrieve(params); System.out.println(loginPortal); @@ -742,7 +747,7 @@ import com.scalar.models.loginPortals.LoginPortalUpdateParams; ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); -LoginPortalUpdateParams params = LoginPortalUpdateParams.builder().slug("slug").build(); +LoginPortalUpdateParams params = LoginPortalUpdateParams.builder().slug("acme-login").build(); var loginPortal = client.loginPortals().update(params); System.out.println(loginPortal); @@ -764,7 +769,7 @@ import com.scalar.models.loginPortals.LoginPortalDeleteParams; ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); -LoginPortalDeleteParams params = LoginPortalDeleteParams.builder().slug("slug").build(); +LoginPortalDeleteParams params = LoginPortalDeleteParams.builder().slug("acme-login").build(); var loginPortal = client.loginPortals().delete(params); System.out.println(loginPortal); @@ -791,8 +796,8 @@ ScalarClient client = LoginPortalCreateParams params = LoginPortalCreateParams.builder() - .title("") - .slug("") + .title("Acme Private Documentation") + .slug("acme-login") .email( LoginPortalEmail.builder() .logo("") @@ -893,7 +898,7 @@ import com.scalar.models.accessGroups.AccessGroupRetrieveParams; ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); -AccessGroupRetrieveParams params = AccessGroupRetrieveParams.builder().slug("slug").build(); +AccessGroupRetrieveParams params = AccessGroupRetrieveParams.builder().slug("acme-api").build(); var accessGroup = client.accessGroups().retrieve(params); System.out.println(accessGroup); @@ -915,7 +920,7 @@ import com.scalar.models.accessGroups.AccessGroupUpdateParams; ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); -AccessGroupUpdateParams params = AccessGroupUpdateParams.builder().pathSlug("pathSlug").build(); +AccessGroupUpdateParams params = AccessGroupUpdateParams.builder().pathSlug("acme-api").build(); var accessGroup = client.accessGroups().update(params); System.out.println(accessGroup); @@ -937,7 +942,7 @@ import com.scalar.models.accessGroups.AccessGroupDeleteParams; ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); -AccessGroupDeleteParams params = AccessGroupDeleteParams.builder().slug("slug").build(); +AccessGroupDeleteParams params = AccessGroupDeleteParams.builder().slug("acme-api").build(); var accessGroup = client.accessGroups().delete(params); System.out.println(accessGroup); @@ -963,7 +968,8 @@ import com.scalar.models.accessGroups.domains.DomainCreateParams; ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); -DomainCreateParams params = DomainCreateParams.builder().slug("slug").domain("").build(); +DomainCreateParams params = + DomainCreateParams.builder().slug("acme-api").domain("example.com").build(); var domain = client.accessGroups().domains().create(params); System.out.println(domain); @@ -985,7 +991,8 @@ import com.scalar.models.accessGroups.domains.DomainDeleteParams; ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); -DomainDeleteParams params = DomainDeleteParams.builder().slug("slug").domain("").build(); +DomainDeleteParams params = + DomainDeleteParams.builder().slug("acme-api").domain("example.com").build(); var domain = client.accessGroups().domains().delete(params); System.out.println(domain); @@ -1012,7 +1019,7 @@ import com.scalar.models.rules.RuleListRulesetsParams; ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); -RuleListRulesetsParams params = RuleListRulesetsParams.builder().namespace("namespace").build(); +RuleListRulesetsParams params = RuleListRulesetsParams.builder().namespace("acme").build(); var rule = client.rules().listRulesets(params); System.out.println(rule); @@ -1037,10 +1044,10 @@ ScalarClient client = RuleCreateRulesetParams params = RuleCreateRulesetParams.builder() - .namespace("namespace") - .title("") - .slug("") - .document("") + .namespace("acme") + .title("Acme API Rules") + .slug("acme-rules") + .document("extends: [\"spectral:oas\"]\nrules:\n info-contact: warn\n") .build(); var rule = client.rules().createRuleset(params); @@ -1064,10 +1071,7 @@ ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); RuleUpdateRulesetParams params = - RuleUpdateRulesetParams.builder() - .pathNamespace("pathNamespace") - .pathSlug("pathSlug") - .build(); + RuleUpdateRulesetParams.builder().pathNamespace("acme").pathSlug("acme-rules").build(); var rule = client.rules().updateRuleset(params); System.out.println(rule); @@ -1090,7 +1094,7 @@ ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); RuleDeleteRulesetParams params = - RuleDeleteRulesetParams.builder().namespace("namespace").slug("slug").build(); + RuleDeleteRulesetParams.builder().namespace("acme").slug("acme-rules").build(); var rule = client.rules().deleteRuleset(params); System.out.println(rule); @@ -1113,7 +1117,7 @@ ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); RuleRetrieveRulesetDocumentParams params = - RuleRetrieveRulesetDocumentParams.builder().namespace("namespace").slug("slug").build(); + RuleRetrieveRulesetDocumentParams.builder().namespace("acme").slug("acme-rules").build(); var rule = client.rules().retrieveRulesetDocument(params); System.out.println(rule); @@ -1138,9 +1142,9 @@ ScalarClient client = RuleCreateRulesetAccessGroupParams params = RuleCreateRulesetAccessGroupParams.builder() - .namespace("namespace") - .slug("slug") - .accessGroup(AccessGroup.builder().accessGroupSlug("x").build()) + .namespace("acme") + .slug("acme-rules") + .accessGroup(AccessGroup.builder().accessGroupSlug("acme-api").build()) .build(); var rule = client.rules().createRulesetAccessGroup(params); @@ -1166,9 +1170,9 @@ ScalarClient client = RuleDeleteRulesetAccessGroupParams params = RuleDeleteRulesetAccessGroupParams.builder() - .namespace("namespace") - .slug("slug") - .accessGroup(AccessGroup.builder().accessGroupSlug("x").build()) + .namespace("acme") + .slug("acme-rules") + .accessGroup(AccessGroup.builder().accessGroupSlug("acme-api").build()) .build(); var rule = client.rules().deleteRulesetAccessGroup(params); @@ -1217,7 +1221,12 @@ import com.scalar.models.themes.ThemeCreateParams; ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); -ThemeCreateParams params = ThemeCreateParams.builder().name("").slug("").document("").build(); +ThemeCreateParams params = + ThemeCreateParams.builder() + .name("Acme Theme") + .slug("acme-theme") + .document(":root { --scalar-color-1: #1f2937; }") + .build(); var theme = client.themes().create(params); System.out.println(theme); @@ -1239,7 +1248,7 @@ import com.scalar.models.themes.ThemeUpdateParams; ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); -ThemeUpdateParams params = ThemeUpdateParams.builder().slug("slug").build(); +ThemeUpdateParams params = ThemeUpdateParams.builder().slug("acme-theme").build(); var theme = client.themes().update(params); System.out.println(theme); @@ -1262,7 +1271,10 @@ ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); ThemeReplaceDocumentParams params = - ThemeReplaceDocumentParams.builder().slug("slug").document("").build(); + ThemeReplaceDocumentParams.builder() + .slug("acme-theme") + .document(":root { --scalar-color-1: #1f2937; }") + .build(); var theme = client.themes().replaceDocument(params); System.out.println(theme); @@ -1284,7 +1296,7 @@ import com.scalar.models.themes.ThemeDeleteParams; ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); -ThemeDeleteParams params = ThemeDeleteParams.builder().slug("slug").build(); +ThemeDeleteParams params = ThemeDeleteParams.builder().slug("acme-theme").build(); var theme = client.themes().delete(params); System.out.println(theme); @@ -1306,7 +1318,7 @@ import com.scalar.models.themes.ThemeRetrieveParams; ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); -ThemeRetrieveParams params = ThemeRetrieveParams.builder().slug("slug").build(); +ThemeRetrieveParams params = ThemeRetrieveParams.builder().slug("acme-theme").build(); var theme = client.themes().retrieve(params); System.out.println(theme); @@ -1379,7 +1391,8 @@ import com.scalar.models.teams.members.MemberUpdateParams; ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); -MemberUpdateParams params = MemberUpdateParams.builder().uid("uidxx").role(Role.OWNER).build(); +MemberUpdateParams params = + MemberUpdateParams.builder().uid("UakgbKJ5m9gl0JDMbcJqL").role(Role.OWNER).build(); var member = client.teams().members().update(params); System.out.println(member); @@ -1401,7 +1414,7 @@ import com.scalar.models.teams.members.MemberDeleteParams; ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); -MemberDeleteParams params = MemberDeleteParams.builder().uid("uidxx").build(); +MemberDeleteParams params = MemberDeleteParams.builder().uid("UakgbKJ5m9gl0JDMbcJqL").build(); var member = client.teams().members().delete(params); System.out.println(member); @@ -1429,7 +1442,7 @@ ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); InviteMemberParams params = - InviteMemberParams.builder().email("user@example.com").role(Role.OWNER).build(); + InviteMemberParams.builder().email("alex@example.com").role(Role.OWNER).build(); var invite = client.teams().invites().member(params); System.out.println(invite); @@ -1451,7 +1464,7 @@ import com.scalar.models.teams.invites.InviteResendParams; ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); -InviteResendParams params = InviteResendParams.builder().uid("uidxx").build(); +InviteResendParams params = InviteResendParams.builder().uid("UakgbKJ5m9gl0JDMbcJqL").build(); var invite = client.teams().invites().resend(params); System.out.println(invite); @@ -1473,7 +1486,7 @@ import com.scalar.models.teams.invites.InviteCancelParams; ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); -InviteCancelParams params = InviteCancelParams.builder().uid("uidxx").build(); +InviteCancelParams params = InviteCancelParams.builder().uid("UakgbKJ5m9gl0JDMbcJqL").build(); var invite = client.teams().invites().cancel(params); System.out.println(invite); @@ -1523,7 +1536,7 @@ ScalarClient client = ScalarDocCreateGuideParams params = ScalarDocCreateGuideParams.builder() - .name("") + .name("Acme Documentation") .isPrivate(false) .allowedUsers(java.util.List.of()) .allowedDomains(java.util.List.of()) @@ -1550,7 +1563,8 @@ import com.scalar.models.scalarDocs.ScalarDocPublishGuideParams; ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); -ScalarDocPublishGuideParams params = ScalarDocPublishGuideParams.builder().slug("slug").build(); +ScalarDocPublishGuideParams params = + ScalarDocPublishGuideParams.builder().slug("acme-docs").build(); var scalarDoc = client.scalarDocs().publishGuide(params); System.out.println(scalarDoc); @@ -1596,7 +1610,7 @@ ScalarClient client = ScalarDocCreateProjectParams params = ScalarDocCreateProjectParams.builder() - .name("") + .name("Acme Documentation") .provider(ScalarDocCreateProjectParams.Provider.of("forgejo")) .build(); var scalarDoc = client.scalarDocs().createProject(params); @@ -1622,7 +1636,7 @@ ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); ScalarDocRetrieveProjectParams params = - ScalarDocRetrieveProjectParams.builder().slug("slug").build(); + ScalarDocRetrieveProjectParams.builder().slug("acme-docs").build(); var scalarDoc = client.scalarDocs().retrieveProject(params); System.out.println(scalarDoc); @@ -1645,7 +1659,7 @@ ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); ScalarDocUpdateProjectParams params = - ScalarDocUpdateProjectParams.builder().slug("slug").build(); + ScalarDocUpdateProjectParams.builder().slug("acme-docs").build(); var scalarDoc = client.scalarDocs().updateProject(params); System.out.println(scalarDoc); @@ -1668,7 +1682,7 @@ ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); ScalarDocDeleteProjectParams params = - ScalarDocDeleteProjectParams.builder().slug("slug").build(); + ScalarDocDeleteProjectParams.builder().slug("acme-docs").build(); var scalarDoc = client.scalarDocs().deleteProject(params); System.out.println(scalarDoc); @@ -1692,7 +1706,7 @@ ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); ScalarDocPublishProjectParams params = - ScalarDocPublishProjectParams.builder().slug("slug").build(); + ScalarDocPublishProjectParams.builder().slug("acme-docs").build(); var scalarDoc = client.scalarDocs().publishProject(params); System.out.println(scalarDoc); @@ -1716,7 +1730,7 @@ ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); ScalarDocListProjectConfigParams params = - ScalarDocListProjectConfigParams.builder().slug("slug").build(); + ScalarDocListProjectConfigParams.builder().slug("acme-docs").build(); var scalarDoc = client.scalarDocs().listProjectConfig(params); System.out.println(scalarDoc); @@ -1740,7 +1754,10 @@ ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); ScalarDocUpdateProjectConfigParams params = - ScalarDocUpdateProjectConfigParams.builder().slug("slug").content("").build(); + ScalarDocUpdateProjectConfigParams.builder() + .slug("acme-docs") + .content("{\"name\":\"Acme Documentation\"}") + .build(); var scalarDoc = client.scalarDocs().updateProjectConfig(params); System.out.println(scalarDoc); @@ -1764,7 +1781,7 @@ ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); ScalarDocListProjectDomainParams params = - ScalarDocListProjectDomainParams.builder().slug("slug").build(); + ScalarDocListProjectDomainParams.builder().slug("acme-docs").build(); var scalarDoc = client.scalarDocs().listProjectDomain(params); System.out.println(scalarDoc); @@ -1788,7 +1805,7 @@ ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); ScalarDocListProjectDomainStatusParams params = - ScalarDocListProjectDomainStatusParams.builder().slug("slug").build(); + ScalarDocListProjectDomainStatusParams.builder().slug("acme-docs").build(); var scalarDoc = client.scalarDocs().listProjectDomainStatus(params); System.out.println(scalarDoc); @@ -1840,7 +1857,9 @@ ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); AuthenticationExchangePersonalTokenParams params = - AuthenticationExchangePersonalTokenParams.builder().personalToken("").build(); + AuthenticationExchangePersonalTokenParams.builder() + .personalToken("scalar_example_personal_token") + .build(); var authentication = client.authentication().exchangePersonalToken(params); System.out.println(authentication); @@ -1911,7 +1930,7 @@ ScalarClient client = SdkCreateParams params = SdkCreateParams.builder() - .apiUid("xxxxx") + .apiUid("UakgbKJ5m9gl0JDMbcJqL") .languages(java.util.List.of(SdkCreateParams.Language.of("typescript"))) .build(); var sdk = client.sdks().create(params); @@ -1936,7 +1955,7 @@ import com.scalar.models.sdks.SdkRetrieveParams; ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); -SdkRetrieveParams params = SdkRetrieveParams.builder().uid("uidxx").build(); +SdkRetrieveParams params = SdkRetrieveParams.builder().uid("UakgbKJ5m9gl0JDMbcJqL").build(); var sdk = client.sdks().retrieve(params); System.out.println(sdk); @@ -1958,7 +1977,7 @@ import com.scalar.models.sdks.SdkUpdateParams; ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); -SdkUpdateParams params = SdkUpdateParams.builder().uid("uidxx").build(); +SdkUpdateParams params = SdkUpdateParams.builder().uid("UakgbKJ5m9gl0JDMbcJqL").build(); var sdk = client.sdks().update(params); System.out.println(sdk); @@ -1980,7 +1999,7 @@ import com.scalar.models.sdks.SdkDeleteParams; ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); -SdkDeleteParams params = SdkDeleteParams.builder().uid("uidxx").build(); +SdkDeleteParams params = SdkDeleteParams.builder().uid("UakgbKJ5m9gl0JDMbcJqL").build(); var sdk = client.sdks().delete(params); System.out.println(sdk); @@ -2003,7 +2022,7 @@ import com.scalar.models.sdks.SdkBuildParams; ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); -SdkBuildParams params = SdkBuildParams.builder().uid("uidxx").build(); +SdkBuildParams params = SdkBuildParams.builder().uid("UakgbKJ5m9gl0JDMbcJqL").build(); var sdk = client.sdks().build(params); System.out.println(sdk); @@ -2030,7 +2049,11 @@ ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); VersionCreateParams params = - VersionCreateParams.builder().uid("uidxx").version("").apiVersion("").build(); + VersionCreateParams.builder() + .uid("UakgbKJ5m9gl0JDMbcJqL") + .version("1.2.0") + .apiVersion("1.2.0") + .build(); var version = client.sdks().versions().create(params); System.out.println(version); @@ -2053,7 +2076,7 @@ ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); VersionDeleteParams params = - VersionDeleteParams.builder().uid("uidxx").version("version").build(); + VersionDeleteParams.builder().uid("UakgbKJ5m9gl0JDMbcJqL").version("1.2.0").build(); var version = client.sdks().versions().delete(params); System.out.println(version); @@ -2082,10 +2105,10 @@ ScalarClient client = RepositoryLinkParams params = RepositoryLinkParams.builder() - .uid("uidxx") + .uid("UakgbKJ5m9gl0JDMbcJqL") .language(RepositoryLinkParams.Language.of("typescript")) - .repositoryId(0L) - .baseBranch("") + .repositoryId(123456789L) + .baseBranch("main") .build(); var repository = client.sdks().repositories().link(params); @@ -2110,7 +2133,7 @@ ScalarClient client = RepositoryUnlinkParams params = RepositoryUnlinkParams.builder() - .uid("uidxx") + .uid("UakgbKJ5m9gl0JDMbcJqL") .language(RepositoryUnlinkParams.Language.of("typescript")) .build(); var repository = client.sdks().repositories().unlink(params); @@ -2136,9 +2159,9 @@ ScalarClient client = RepositoryUpdatePublishingParams params = RepositoryUpdatePublishingParams.builder() - .uid("uidxx") + .uid("UakgbKJ5m9gl0JDMbcJqL") .language(RepositoryUpdatePublishingParams.Language.of("typescript")) - .publishOnMerge(false) + .publishOnMerge(true) .build(); var repository = client.sdks().repositories().updatePublishing(params); @@ -2189,7 +2212,7 @@ import com.scalar.models.mcp.servers.ServerCreateParams; ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); -ServerCreateParams params = ServerCreateParams.builder().name("x").build(); +ServerCreateParams params = ServerCreateParams.builder().name("Acme MCP").build(); var server = client.mcp().servers().create(params); System.out.println(server); @@ -2212,7 +2235,7 @@ import com.scalar.models.mcp.servers.ServerRetrieveParams; ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); -ServerRetrieveParams params = ServerRetrieveParams.builder().id("id").build(); +ServerRetrieveParams params = ServerRetrieveParams.builder().id("42").build(); var server = client.mcp().servers().retrieve(params); System.out.println(server); @@ -2235,7 +2258,7 @@ import com.scalar.models.mcp.servers.ServerUpdateParams; ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); -ServerUpdateParams params = ServerUpdateParams.builder().id("id").build(); +ServerUpdateParams params = ServerUpdateParams.builder().id("42").build(); var server = client.mcp().servers().update(params); System.out.println(server); @@ -2257,7 +2280,7 @@ import com.scalar.models.mcp.servers.ServerDeleteParams; ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); -ServerDeleteParams params = ServerDeleteParams.builder().id("id").build(); +ServerDeleteParams params = ServerDeleteParams.builder().id("42").build(); var server = client.mcp().servers().delete(params); System.out.println(server); @@ -2284,7 +2307,7 @@ import com.scalar.models.mcp.servers.installations.InstallationListParams; ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); -InstallationListParams params = InstallationListParams.builder().id("id").build(); +InstallationListParams params = InstallationListParams.builder().id("42").build(); var installation = client.mcp().servers().installations().list(params); System.out.println(installation); @@ -2309,8 +2332,8 @@ ScalarClient client = InstallationCreateParams params = InstallationCreateParams.builder() - .id("id") - .name("x") + .id("42") + .name("Acme MCP") .documentAuth(InstallationCreateParams.DocumentAuth.builder().build()) .build(); var installation = client.mcp().servers().installations().create(params); @@ -2336,7 +2359,7 @@ ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); InstallationRetrieveParams params = - InstallationRetrieveParams.builder().id("id").installationId("installationId").build(); + InstallationRetrieveParams.builder().id("42").installationId("84").build(); var installation = client.mcp().servers().installations().retrieve(params); System.out.println(installation); @@ -2360,7 +2383,7 @@ ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); InstallationUpdateParams params = - InstallationUpdateParams.builder().id("id").installationId("installationId").build(); + InstallationUpdateParams.builder().id("42").installationId("84").build(); var installation = client.mcp().servers().installations().update(params); System.out.println(installation); @@ -2383,7 +2406,7 @@ ScalarClient client = ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); InstallationDeleteParams params = - InstallationDeleteParams.builder().id("id").installationId("installationId").build(); + InstallationDeleteParams.builder().id("42").installationId("84").build(); var installation = client.mcp().servers().installations().delete(params); System.out.println(installation); @@ -2407,9 +2430,9 @@ ScalarClient client = InstallationCreateAccessGroupParams params = InstallationCreateAccessGroupParams.builder() - .id("id") - .installationId("installationId") - .accessGroupUid("xxxxx") + .id("42") + .installationId("84") + .accessGroupUid("UakgbKJ5m9gl0JDMbcJqL") .build(); var installation = client.mcp().servers().installations().createAccessGroup(params); @@ -2434,9 +2457,9 @@ ScalarClient client = InstallationDeleteAccessGroupParams params = InstallationDeleteAccessGroupParams.builder() - .id("id") - .installationId("installationId") - .accessGroupUid("xxxxx") + .id("42") + .installationId("84") + .accessGroupUid("UakgbKJ5m9gl0JDMbcJqL") .build(); var installation = client.mcp().servers().installations().deleteAccessGroup(params); diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupCreateParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupCreateParams.kt index 4f8a40c..0fd7a67 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupCreateParams.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupCreateParams.kt @@ -17,7 +17,6 @@ import com.scalar.errors.ScalarInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional -import kotlin.jvm.optionals.getOrNull /** * Create a group for the current team. Requires docs edit permission and the access groups billing @@ -46,7 +45,7 @@ private constructor( * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun allowedDomains(): Optional = body.allowedDomains() + fun allowedDomains(): Optional = body.allowedDomains() /** * Returns the raw JSON value of [name]. @@ -67,7 +66,7 @@ private constructor( * * Unlike [allowedDomains], this method doesn't throw if the JSON field has an unexpected type. */ - fun _allowedDomains(): JsonField = body._allowedDomains() + fun _allowedDomains(): JsonField = body._allowedDomains() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -132,21 +131,16 @@ private constructor( */ fun slug(slug: JsonField) = apply { body.slug(slug) } - fun allowedDomains(allowedDomains: Any?) = apply { body.allowedDomains(allowedDomains) } - - /** Alias for calling [Builder.allowedDomains] with `allowedDomains.orElse(null)`. */ - fun allowedDomains(allowedDomains: Optional) = apply { - body.allowedDomains(allowedDomains.getOrNull()) - } + fun allowedDomains(allowedDomains: String) = apply { body.allowedDomains(allowedDomains) } /** * Sets [Builder.allowedDomains] to an arbitrary JSON value. * - * You should usually call [Builder.allowedDomains] with a well-typed [Any] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. + * You should usually call [Builder.allowedDomains] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun allowedDomains(allowedDomains: JsonField) = apply { + fun allowedDomains(allowedDomains: JsonField) = apply { body.allowedDomains(allowedDomains) } @@ -291,7 +285,7 @@ private constructor( private constructor( private val name: JsonField, private val slug: JsonField, - private val allowedDomains: JsonField, + private val allowedDomains: JsonField, private val additionalProperties: MutableMap, ) { @@ -301,7 +295,7 @@ private constructor( @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), @JsonProperty("allowedDomains") @ExcludeMissing - allowedDomains: JsonField = JsonMissing.of(), + allowedDomains: JsonField = JsonMissing.of(), ) : this(name, slug, allowedDomains, mutableMapOf()) /** @@ -320,7 +314,7 @@ private constructor( * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun allowedDomains(): Optional = allowedDomains.getOptional("allowedDomains") + fun allowedDomains(): Optional = allowedDomains.getOptional("allowedDomains") /** * Returns the raw JSON value of [name]. @@ -344,7 +338,7 @@ private constructor( */ @JsonProperty("allowedDomains") @ExcludeMissing - fun _allowedDomains(): JsonField = allowedDomains + fun _allowedDomains(): JsonField = allowedDomains @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -369,7 +363,7 @@ private constructor( private var name: JsonField = JsonMissing.of() private var slug: JsonField = JsonMissing.of() - private var allowedDomains: JsonField = JsonMissing.of() + private var allowedDomains: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -402,21 +396,17 @@ private constructor( */ fun slug(slug: JsonField) = apply { this.slug = slug } - fun allowedDomains(allowedDomains: Any?) = - allowedDomains(JsonField.ofNullable(allowedDomains)) - - /** Alias for calling [Builder.allowedDomains] with `allowedDomains.orElse(null)`. */ - fun allowedDomains(allowedDomains: Optional) = - allowedDomains(allowedDomains.getOrNull()) + fun allowedDomains(allowedDomains: String) = + allowedDomains(JsonField.of(allowedDomains)) /** * Sets [Builder.allowedDomains] to an arbitrary JSON value. * - * You should usually call [Builder.allowedDomains] with a well-typed [Any] value + * You should usually call [Builder.allowedDomains] with a well-typed [String] value * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun allowedDomains(allowedDomains: JsonField) = apply { + fun allowedDomains(allowedDomains: JsonField) = apply { this.allowedDomains = allowedDomains } diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupCreateResponse.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupCreateResponse.kt index ce77e94..e02dd07 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupCreateResponse.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupCreateResponse.kt @@ -14,8 +14,6 @@ import com.scalar.core.checkRequired import com.scalar.errors.ScalarInvalidDataException import java.util.Collections import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull class AccessGroupCreateResponse @JsonCreator(mode = JsonCreator.Mode.DISABLED) @@ -23,8 +21,8 @@ private constructor( private val uid: JsonField, private val name: JsonField, private val slug: JsonField, - private val allowedDomains: JsonField, - private val allowedEmails: JsonField, + private val allowedDomains: JsonField, + private val allowedEmails: JsonField, private val additionalProperties: MutableMap, ) { @@ -35,10 +33,10 @@ private constructor( @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), @JsonProperty("allowedDomains") @ExcludeMissing - allowedDomains: JsonField = JsonMissing.of(), + allowedDomains: JsonField = JsonMissing.of(), @JsonProperty("allowedEmails") @ExcludeMissing - allowedEmails: JsonField = JsonMissing.of(), + allowedEmails: JsonField = JsonMissing.of(), ) : this(uid, name, slug, allowedDomains, allowedEmails, mutableMapOf()) /** @@ -60,16 +58,16 @@ private constructor( fun slug(): String = slug.getRequired("slug") /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun allowedDomains(): Optional = allowedDomains.getOptional("allowedDomains") + fun allowedDomains(): String = allowedDomains.getRequired("allowedDomains") /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun allowedEmails(): Optional = allowedEmails.getOptional("allowedEmails") + fun allowedEmails(): String = allowedEmails.getRequired("allowedEmails") /** * Returns the raw JSON value of [uid]. @@ -99,7 +97,7 @@ private constructor( */ @JsonProperty("allowedDomains") @ExcludeMissing - fun _allowedDomains(): JsonField = allowedDomains + fun _allowedDomains(): JsonField = allowedDomains /** * Returns the raw JSON value of [allowedEmails]. @@ -108,7 +106,7 @@ private constructor( */ @JsonProperty("allowedEmails") @ExcludeMissing - fun _allowedEmails(): JsonField = allowedEmails + fun _allowedEmails(): JsonField = allowedEmails @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -145,8 +143,8 @@ private constructor( private var uid: JsonField? = null private var name: JsonField? = null private var slug: JsonField? = null - private var allowedDomains: JsonField? = null - private var allowedEmails: JsonField? = null + private var allowedDomains: JsonField? = null + private var allowedEmails: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -189,37 +187,29 @@ private constructor( */ fun slug(slug: JsonField) = apply { this.slug = slug } - fun allowedDomains(allowedDomains: Any?) = - allowedDomains(JsonField.ofNullable(allowedDomains)) - - /** Alias for calling [Builder.allowedDomains] with `allowedDomains.orElse(null)`. */ - fun allowedDomains(allowedDomains: Optional) = - allowedDomains(allowedDomains.getOrNull()) + fun allowedDomains(allowedDomains: String) = allowedDomains(JsonField.of(allowedDomains)) /** * Sets [Builder.allowedDomains] to an arbitrary JSON value. * - * You should usually call [Builder.allowedDomains] with a well-typed [Any] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. + * You should usually call [Builder.allowedDomains] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun allowedDomains(allowedDomains: JsonField) = apply { + fun allowedDomains(allowedDomains: JsonField) = apply { this.allowedDomains = allowedDomains } - fun allowedEmails(allowedEmails: Any?) = allowedEmails(JsonField.ofNullable(allowedEmails)) - - /** Alias for calling [Builder.allowedEmails] with `allowedEmails.orElse(null)`. */ - fun allowedEmails(allowedEmails: Optional) = allowedEmails(allowedEmails.getOrNull()) + fun allowedEmails(allowedEmails: String) = allowedEmails(JsonField.of(allowedEmails)) /** * Sets [Builder.allowedEmails] to an arbitrary JSON value. * - * You should usually call [Builder.allowedEmails] with a well-typed [Any] value instead. + * You should usually call [Builder.allowedEmails] with a well-typed [String] value instead. * This method is primarily for setting the field to an undocumented or not yet supported * value. */ - fun allowedEmails(allowedEmails: JsonField) = apply { + fun allowedEmails(allowedEmails: JsonField) = apply { this.allowedEmails = allowedEmails } diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupRetrieveResponse.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupRetrieveResponse.kt index 0c2d013..0d7a98c 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupRetrieveResponse.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupRetrieveResponse.kt @@ -14,8 +14,6 @@ import com.scalar.core.checkRequired import com.scalar.errors.ScalarInvalidDataException import java.util.Collections import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull class AccessGroupRetrieveResponse @JsonCreator(mode = JsonCreator.Mode.DISABLED) @@ -23,8 +21,8 @@ private constructor( private val uid: JsonField, private val name: JsonField, private val slug: JsonField, - private val allowedDomains: JsonField, - private val allowedEmails: JsonField, + private val allowedDomains: JsonField, + private val allowedEmails: JsonField, private val additionalProperties: MutableMap, ) { @@ -35,10 +33,10 @@ private constructor( @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), @JsonProperty("allowedDomains") @ExcludeMissing - allowedDomains: JsonField = JsonMissing.of(), + allowedDomains: JsonField = JsonMissing.of(), @JsonProperty("allowedEmails") @ExcludeMissing - allowedEmails: JsonField = JsonMissing.of(), + allowedEmails: JsonField = JsonMissing.of(), ) : this(uid, name, slug, allowedDomains, allowedEmails, mutableMapOf()) /** @@ -60,16 +58,16 @@ private constructor( fun slug(): String = slug.getRequired("slug") /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun allowedDomains(): Optional = allowedDomains.getOptional("allowedDomains") + fun allowedDomains(): String = allowedDomains.getRequired("allowedDomains") /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun allowedEmails(): Optional = allowedEmails.getOptional("allowedEmails") + fun allowedEmails(): String = allowedEmails.getRequired("allowedEmails") /** * Returns the raw JSON value of [uid]. @@ -99,7 +97,7 @@ private constructor( */ @JsonProperty("allowedDomains") @ExcludeMissing - fun _allowedDomains(): JsonField = allowedDomains + fun _allowedDomains(): JsonField = allowedDomains /** * Returns the raw JSON value of [allowedEmails]. @@ -108,7 +106,7 @@ private constructor( */ @JsonProperty("allowedEmails") @ExcludeMissing - fun _allowedEmails(): JsonField = allowedEmails + fun _allowedEmails(): JsonField = allowedEmails @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -145,8 +143,8 @@ private constructor( private var uid: JsonField? = null private var name: JsonField? = null private var slug: JsonField? = null - private var allowedDomains: JsonField? = null - private var allowedEmails: JsonField? = null + private var allowedDomains: JsonField? = null + private var allowedEmails: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -189,37 +187,29 @@ private constructor( */ fun slug(slug: JsonField) = apply { this.slug = slug } - fun allowedDomains(allowedDomains: Any?) = - allowedDomains(JsonField.ofNullable(allowedDomains)) - - /** Alias for calling [Builder.allowedDomains] with `allowedDomains.orElse(null)`. */ - fun allowedDomains(allowedDomains: Optional) = - allowedDomains(allowedDomains.getOrNull()) + fun allowedDomains(allowedDomains: String) = allowedDomains(JsonField.of(allowedDomains)) /** * Sets [Builder.allowedDomains] to an arbitrary JSON value. * - * You should usually call [Builder.allowedDomains] with a well-typed [Any] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. + * You should usually call [Builder.allowedDomains] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun allowedDomains(allowedDomains: JsonField) = apply { + fun allowedDomains(allowedDomains: JsonField) = apply { this.allowedDomains = allowedDomains } - fun allowedEmails(allowedEmails: Any?) = allowedEmails(JsonField.ofNullable(allowedEmails)) - - /** Alias for calling [Builder.allowedEmails] with `allowedEmails.orElse(null)`. */ - fun allowedEmails(allowedEmails: Optional) = allowedEmails(allowedEmails.getOrNull()) + fun allowedEmails(allowedEmails: String) = allowedEmails(JsonField.of(allowedEmails)) /** * Sets [Builder.allowedEmails] to an arbitrary JSON value. * - * You should usually call [Builder.allowedEmails] with a well-typed [Any] value instead. + * You should usually call [Builder.allowedEmails] with a well-typed [String] value instead. * This method is primarily for setting the field to an undocumented or not yet supported * value. */ - fun allowedEmails(allowedEmails: JsonField) = apply { + fun allowedEmails(allowedEmails: JsonField) = apply { this.allowedEmails = allowedEmails } diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/registry/ApiDocument.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/registry/ApiDocument.kt index 5c70063..b900b48 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/models/registry/ApiDocument.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/registry/ApiDocument.kt @@ -17,7 +17,6 @@ import com.scalar.errors.ScalarInvalidDataException import com.scalar.models.ManagedDocVersion import java.util.Collections import java.util.Objects -import java.util.Optional import kotlin.jvm.optionals.getOrNull class ApiDocument @@ -30,7 +29,7 @@ private constructor( private val description: JsonField, private val namespace: JsonField, private val isPrivate: JsonField, - private val tags: JsonField, + private val tags: JsonField, private val versions: JsonField>, private val additionalProperties: MutableMap, ) { @@ -46,7 +45,7 @@ private constructor( description: JsonField = JsonMissing.of(), @JsonProperty("namespace") @ExcludeMissing namespace: JsonField = JsonMissing.of(), @JsonProperty("isPrivate") @ExcludeMissing isPrivate: JsonField = JsonMissing.of(), - @JsonProperty("tags") @ExcludeMissing tags: JsonField = JsonMissing.of(), + @JsonProperty("tags") @ExcludeMissing tags: JsonField = JsonMissing.of(), @JsonProperty("versions") @ExcludeMissing versions: JsonField> = JsonMissing.of(), @@ -106,10 +105,10 @@ private constructor( fun isPrivate(): Boolean = isPrivate.getRequired("isPrivate") /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun tags(): Optional = tags.getOptional("tags") + fun tags(): String = tags.getRequired("tags") /** * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is @@ -171,7 +170,7 @@ private constructor( * * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("tags") @ExcludeMissing fun _tags(): JsonField = tags + @JsonProperty("tags") @ExcludeMissing fun _tags(): JsonField = tags /** * Returns the raw JSON value of [versions]. @@ -225,7 +224,7 @@ private constructor( private var description: JsonField? = null private var namespace: JsonField? = null private var isPrivate: JsonField? = null - private var tags: JsonField? = null + private var tags: JsonField? = null private var versions: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -316,18 +315,15 @@ private constructor( */ fun isPrivate(isPrivate: JsonField) = apply { this.isPrivate = isPrivate } - fun tags(tags: Any?) = tags(JsonField.ofNullable(tags)) - - /** Alias for calling [Builder.tags] with `tags.orElse(null)`. */ - fun tags(tags: Optional) = tags(tags.getOrNull()) + fun tags(tags: String) = tags(JsonField.of(tags)) /** * Sets [Builder.tags] to an arbitrary JSON value. * - * You should usually call [Builder.tags] with a well-typed [Any] value instead. This method - * is primarily for setting the field to an undocumented or not yet supported value. + * You should usually call [Builder.tags] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ - fun tags(tags: JsonField) = apply { this.tags = tags } + fun tags(tags: JsonField) = apply { this.tags = tags } fun versions(versions: List) = versions(JsonField.of(versions)) diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/DocsProject.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/DocsProject.kt index de6efcc..e7b2da3 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/DocsProject.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/DocsProject.kt @@ -24,7 +24,7 @@ private constructor( private val name: JsonField, private val slug: JsonField, private val isPrivate: JsonField, - private val accessGroups: JsonField, + private val accessGroups: JsonField, private val loginPortalUid: JsonField, private val activeThemeId: JsonField, private val agentEnabled: JsonField, @@ -42,7 +42,7 @@ private constructor( @JsonProperty("isPrivate") @ExcludeMissing isPrivate: JsonField = JsonMissing.of(), @JsonProperty("accessGroups") @ExcludeMissing - accessGroups: JsonField = JsonMissing.of(), + accessGroups: JsonField = JsonMissing.of(), @JsonProperty("loginPortalUid") @ExcludeMissing loginPortalUid: JsonField = JsonMissing.of(), @@ -101,10 +101,10 @@ private constructor( fun isPrivate(): Boolean = isPrivate.getRequired("isPrivate") /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun accessGroups(): Optional = accessGroups.getOptional("accessGroups") + fun accessGroups(): String = accessGroups.getRequired("accessGroups") /** * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is @@ -175,7 +175,9 @@ private constructor( * * Unlike [accessGroups], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("accessGroups") @ExcludeMissing fun _accessGroups(): JsonField = accessGroups + @JsonProperty("accessGroups") + @ExcludeMissing + fun _accessGroups(): JsonField = accessGroups /** * Returns the raw JSON value of [loginPortalUid]. @@ -274,7 +276,7 @@ private constructor( private var name: JsonField? = null private var slug: JsonField? = null private var isPrivate: JsonField? = null - private var accessGroups: JsonField? = null + private var accessGroups: JsonField? = null private var loginPortalUid: JsonField? = null private var activeThemeId: JsonField? = null private var agentEnabled: JsonField? = null @@ -340,19 +342,18 @@ private constructor( */ fun isPrivate(isPrivate: JsonField) = apply { this.isPrivate = isPrivate } - fun accessGroups(accessGroups: Any?) = accessGroups(JsonField.ofNullable(accessGroups)) - - /** Alias for calling [Builder.accessGroups] with `accessGroups.orElse(null)`. */ - fun accessGroups(accessGroups: Optional) = accessGroups(accessGroups.getOrNull()) + fun accessGroups(accessGroups: String) = accessGroups(JsonField.of(accessGroups)) /** * Sets [Builder.accessGroups] to an arbitrary JSON value. * - * You should usually call [Builder.accessGroups] with a well-typed [Any] value instead. + * You should usually call [Builder.accessGroups] with a well-typed [String] value instead. * This method is primarily for setting the field to an undocumented or not yet supported * value. */ - fun accessGroups(accessGroups: JsonField) = apply { this.accessGroups = accessGroups } + fun accessGroups(accessGroups: JsonField) = apply { + this.accessGroups = accessGroups + } fun loginPortalUid(loginPortalUid: String) = loginPortalUid(JsonField.of(loginPortalUid)) diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/GithubProject.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/GithubProject.kt index 63bf32b..292ec10 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/GithubProject.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/GithubProject.kt @@ -34,7 +34,7 @@ private constructor( private val isPrivate: JsonField, private val agentEnabled: JsonField, private val analyticsEnabled: JsonField, - private val accessGroups: JsonField, + private val accessGroups: JsonField, private val slug: JsonField, private val publishStatus: JsonField, private val publishMessage: JsonField, @@ -78,7 +78,7 @@ private constructor( analyticsEnabled: JsonField = JsonMissing.of(), @JsonProperty("accessGroups") @ExcludeMissing - accessGroups: JsonField = JsonMissing.of(), + accessGroups: JsonField = JsonMissing.of(), @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), @JsonProperty("publishStatus") @ExcludeMissing @@ -198,10 +198,10 @@ private constructor( fun analyticsEnabled(): Boolean = analyticsEnabled.getRequired("analyticsEnabled") /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun accessGroups(): Optional = accessGroups.getOptional("accessGroups") + fun accessGroups(): String = accessGroups.getRequired("accessGroups") /** * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is @@ -349,7 +349,9 @@ private constructor( * * Unlike [accessGroups], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("accessGroups") @ExcludeMissing fun _accessGroups(): JsonField = accessGroups + @JsonProperty("accessGroups") + @ExcludeMissing + fun _accessGroups(): JsonField = accessGroups /** * Returns the raw JSON value of [slug]. @@ -443,7 +445,7 @@ private constructor( private var isPrivate: JsonField? = null private var agentEnabled: JsonField? = null private var analyticsEnabled: JsonField? = null - private var accessGroups: JsonField? = null + private var accessGroups: JsonField? = null private var slug: JsonField? = null private var publishStatus: JsonField? = null private var publishMessage: JsonField? = null @@ -662,19 +664,18 @@ private constructor( this.analyticsEnabled = analyticsEnabled } - fun accessGroups(accessGroups: Any?) = accessGroups(JsonField.ofNullable(accessGroups)) - - /** Alias for calling [Builder.accessGroups] with `accessGroups.orElse(null)`. */ - fun accessGroups(accessGroups: Optional) = accessGroups(accessGroups.getOrNull()) + fun accessGroups(accessGroups: String) = accessGroups(JsonField.of(accessGroups)) /** * Sets [Builder.accessGroups] to an arbitrary JSON value. * - * You should usually call [Builder.accessGroups] with a well-typed [Any] value instead. + * You should usually call [Builder.accessGroups] with a well-typed [String] value instead. * This method is primarily for setting the field to an undocumented or not yet supported * value. */ - fun accessGroups(accessGroups: JsonField) = apply { this.accessGroups = accessGroups } + fun accessGroups(accessGroups: JsonField) = apply { + this.accessGroups = accessGroups + } fun slug(slug: String) = slug(JsonField.of(slug)) diff --git a/scalar-java-proguard-test/src/test/kotlin/com/scalar/proguard/ProGuardCompatibilityTest.kt b/scalar-java-proguard-test/src/test/kotlin/com/scalar/proguard/ProGuardCompatibilityTest.kt index bc8f1cc..6937839 100644 --- a/scalar-java-proguard-test/src/test/kotlin/com/scalar/proguard/ProGuardCompatibilityTest.kt +++ b/scalar-java-proguard-test/src/test/kotlin/com/scalar/proguard/ProGuardCompatibilityTest.kt @@ -67,7 +67,8 @@ internal class ProGuardCompatibilityTest { @Test fun value400Roundtrips() { - val value400 = Value400.builder().message("").code("").build() + val value400 = + Value400.builder().message("Invalid request parameters.").code("bad-request").build() val value400Json = jsonMapper().writeValueAsString(value400) assertEquals( diff --git a/scalar-sdk.manifest.json b/scalar-sdk.manifest.json index a3e3a29..37aebde 100644 --- a/scalar-sdk.manifest.json +++ b/scalar-sdk.manifest.json @@ -46,6 +46,15 @@ "source": "400", "publicAliases": [], "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": { + "message": "Invalid request parameters.", + "code": "bad-request" + } + }, "type": { "kind": "object", "properties": [ @@ -78,6 +87,15 @@ "source": "401", "publicAliases": [], "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": { + "message": "Invalid authentication token.", + "code": "unauthorized" + } + }, "type": { "kind": "object", "properties": [ @@ -110,6 +128,15 @@ "source": "403", "publicAliases": [], "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": { + "message": "You do not have permission to access this resource.", + "code": "forbidden" + } + }, "type": { "kind": "object", "properties": [ @@ -142,6 +169,15 @@ "source": "404", "publicAliases": [], "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": { + "message": "Resource not found.", + "code": "not-found" + } + }, "type": { "kind": "object", "properties": [ @@ -174,6 +210,15 @@ "source": "422", "publicAliases": [], "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": { + "message": "The request body contains invalid values.", + "code": "invalid-payload" + } + }, "type": { "kind": "object", "properties": [ @@ -206,6 +251,15 @@ "source": "500", "publicAliases": [], "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": { + "message": "An unexpected error occurred.", + "code": "unknown" + } + }, "type": { "kind": "object", "properties": [ @@ -246,6 +300,12 @@ "publicName": "uid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "ref", "name": "nanoid" @@ -256,6 +316,12 @@ "publicName": "version", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "1.2.0" + }, "type": { "kind": "ref", "name": "version" @@ -266,6 +332,12 @@ "publicName": "title", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Acme API" + }, "type": { "kind": "primitive", "type": "string", @@ -279,6 +351,12 @@ "publicName": "slug", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme-api" + }, "type": { "kind": "ref", "name": "slug" @@ -289,6 +367,12 @@ "publicName": "description", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "API for managing Acme products and orders." + }, "type": { "kind": "primitive", "type": "string" @@ -299,6 +383,12 @@ "publicName": "namespace", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme" + }, "type": { "kind": "ref", "name": "namespace" @@ -309,6 +399,12 @@ "publicName": "isPrivate", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": false + }, "type": { "kind": "primitive", "type": "boolean" @@ -319,8 +415,18 @@ "publicName": "tags", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": [ + "products", + "orders" + ] + }, "type": { - "kind": "unknown" + "kind": "primitive", + "type": "string" } }, { @@ -345,6 +451,12 @@ "source": "nanoid", "publicAliases": [], "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "primitive", "type": "string", @@ -358,6 +470,12 @@ "source": "version", "publicAliases": [], "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "1.2.0" + }, "type": { "kind": "primitive", "type": "string", @@ -371,6 +489,12 @@ "source": "slug", "publicAliases": [], "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme-api" + }, "type": { "kind": "primitive", "type": "string", @@ -386,6 +510,12 @@ "source": "namespace", "publicAliases": [], "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme" + }, "type": { "kind": "primitive", "type": "string", @@ -409,6 +539,12 @@ "publicName": "uid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "ref", "name": "nanoid" @@ -419,6 +555,12 @@ "publicName": "createdAt", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": 1735689600000 + }, "type": { "kind": "primitive", "type": "number" @@ -429,6 +571,12 @@ "publicName": "version", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "1.2.0" + }, "type": { "kind": "ref", "name": "version" @@ -439,6 +587,12 @@ "publicName": "upgraded", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": false + }, "type": { "kind": "primitive", "type": "boolean" @@ -449,6 +603,12 @@ "publicName": "endpointCount", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": 12 + }, "type": { "kind": "union", "variants": [ @@ -471,6 +631,12 @@ "publicName": "embedStatus", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "complete" + }, "type": { "kind": "union", "variants": [ @@ -500,6 +666,15 @@ "publicName": "tags", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": [ + "products", + "orders" + ] + }, "type": { "kind": "array", "items": { @@ -523,6 +698,12 @@ "publicName": "path", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "/products" + }, "type": { "kind": "primitive", "type": "string" @@ -572,6 +753,12 @@ "publicName": "yamlSha", "required": false, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789" + }, "type": { "kind": "primitive", "type": "string" @@ -582,6 +769,12 @@ "publicName": "jsonSha", "required": false, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" + }, "type": { "kind": "primitive", "type": "string" @@ -646,6 +839,12 @@ "publicName": "accessGroupSlug", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme-api" + }, "type": { "kind": "ref", "name": "slug" @@ -668,6 +867,12 @@ "publicName": "uid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "ref", "name": "nanoid" @@ -678,6 +883,12 @@ "publicName": "title", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Acme API" + }, "type": { "kind": "primitive", "type": "string", @@ -691,6 +902,12 @@ "publicName": "description", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "API for managing Acme products and orders." + }, "type": { "kind": "primitive", "type": "string" @@ -701,6 +918,12 @@ "publicName": "slug", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme-api" + }, "type": { "kind": "ref", "name": "slug" @@ -711,6 +934,12 @@ "publicName": "namespace", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme" + }, "type": { "kind": "ref", "name": "namespace" @@ -721,6 +950,12 @@ "publicName": "isPrivate", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": false + }, "type": { "kind": "primitive", "type": "boolean" @@ -756,6 +991,12 @@ "publicName": "uid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "ref", "name": "nanoid" @@ -766,6 +1007,12 @@ "publicName": "createdAt", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": 1735689600 + }, "type": { "kind": "ref", "name": "timestamp" @@ -776,6 +1023,12 @@ "publicName": "updatedAt", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": 1735689600 + }, "type": { "kind": "ref", "name": "timestamp" @@ -786,6 +1039,12 @@ "publicName": "version", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "1.2.0" + }, "type": { "kind": "ref", "name": "version" @@ -796,6 +1055,12 @@ "publicName": "yamlSha", "required": false, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789" + }, "type": { "kind": "primitive", "type": "string", @@ -809,6 +1074,12 @@ "publicName": "jsonSha", "required": false, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" + }, "type": { "kind": "primitive", "type": "string", @@ -826,6 +1097,12 @@ "source": "timestamp", "publicAliases": [], "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": 1735689600 + }, "type": { "kind": "primitive", "type": "integer", @@ -848,6 +1125,12 @@ "publicName": "uid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "ref", "name": "nanoid" @@ -870,6 +1153,12 @@ "publicName": "logo", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "\"Acme\"" + }, "type": { "kind": "primitive", "type": "string" @@ -880,6 +1169,12 @@ "publicName": "logoSize", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "100" + }, "type": { "kind": "primitive", "type": "string" @@ -890,6 +1185,12 @@ "publicName": "buttonText", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Access documentation" + }, "type": { "kind": "primitive", "type": "string", @@ -903,6 +1204,12 @@ "publicName": "message", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Click to access Acme private API documentation." + }, "type": { "kind": "primitive", "type": "string", @@ -916,6 +1223,12 @@ "publicName": "title", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Acme API" + }, "type": { "kind": "primitive", "type": "string", @@ -929,6 +1242,12 @@ "publicName": "mainColor", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "#1f2937" + }, "type": { "kind": "primitive", "type": "string", @@ -942,6 +1261,12 @@ "publicName": "mainBackground", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "#f9fafb" + }, "type": { "kind": "primitive", "type": "string", @@ -955,6 +1280,12 @@ "publicName": "cardColor", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "#1f2937" + }, "type": { "kind": "primitive", "type": "string", @@ -968,6 +1299,12 @@ "publicName": "cardBackground", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "#ffffff" + }, "type": { "kind": "primitive", "type": "string", @@ -981,6 +1318,12 @@ "publicName": "buttonColor", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "#ffffff" + }, "type": { "kind": "primitive", "type": "string", @@ -994,6 +1337,12 @@ "publicName": "buttonBackground", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "#2563eb" + }, "type": { "kind": "primitive", "type": "string", @@ -1019,6 +1368,12 @@ "publicName": "title", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Acme API" + }, "type": { "kind": "primitive", "type": "string", @@ -1032,6 +1387,12 @@ "publicName": "description", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Sign in with your work email to access Acme documentation." + }, "type": { "kind": "primitive", "type": "string", @@ -1045,6 +1406,12 @@ "publicName": "head", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "" + }, "type": { "kind": "primitive", "type": "string" @@ -1055,6 +1422,12 @@ "publicName": "script", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "document.documentElement.dataset.company = \"acme\";" + }, "type": { "kind": "primitive", "type": "string" @@ -1065,6 +1438,12 @@ "publicName": "theme", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "TakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "primitive", "type": "string" @@ -1075,6 +1454,12 @@ "publicName": "companyName", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Acme" + }, "type": { "kind": "primitive", "type": "string", @@ -1088,6 +1473,12 @@ "publicName": "logo", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "\"Acme\"" + }, "type": { "kind": "primitive", "type": "string" @@ -1098,6 +1489,12 @@ "publicName": "logoURL", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "https://example.com" + }, "type": { "kind": "primitive", "type": "string" @@ -1108,6 +1505,12 @@ "publicName": "favicon", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "https://example.com/favicon.ico" + }, "type": { "kind": "primitive", "type": "string" @@ -1118,6 +1521,12 @@ "publicName": "termsLink", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "https://example.com/terms" + }, "type": { "kind": "primitive", "type": "string" @@ -1128,6 +1537,12 @@ "publicName": "privacyLink", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "https://example.com/privacy" + }, "type": { "kind": "primitive", "type": "string" @@ -1138,6 +1553,12 @@ "publicName": "formTitle", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Sign in to Acme Documentation" + }, "type": { "kind": "primitive", "type": "string", @@ -1151,6 +1572,12 @@ "publicName": "formDescription", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Sign in with your work email to access Acme documentation." + }, "type": { "kind": "primitive", "type": "string", @@ -1164,6 +1591,12 @@ "publicName": "formImage", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "https://example.com/login-banner.png" + }, "type": { "kind": "primitive", "type": "string" @@ -1186,6 +1619,12 @@ "publicName": "uid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "ref", "name": "nanoid" @@ -1196,6 +1635,12 @@ "publicName": "title", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Acme API" + }, "type": { "kind": "primitive", "type": "string", @@ -1209,6 +1654,12 @@ "publicName": "slug", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme-api" + }, "type": { "kind": "ref", "name": "slug" @@ -1223,6 +1674,12 @@ "source": "access_group_name", "publicAliases": [], "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Engineering" + }, "type": { "kind": "primitive", "type": "string", @@ -1236,6 +1693,12 @@ "source": "email_domain", "publicAliases": [], "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "example.com" + }, "type": { "kind": "primitive", "type": "string", @@ -1258,6 +1721,12 @@ "publicName": "uid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "ref", "name": "nanoid" @@ -1268,6 +1737,12 @@ "publicName": "title", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Acme API" + }, "type": { "kind": "primitive", "type": "string", @@ -1281,6 +1756,12 @@ "publicName": "description", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "API for managing Acme products and orders." + }, "type": { "kind": "primitive", "type": "string" @@ -1291,6 +1772,12 @@ "publicName": "slug", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme-api" + }, "type": { "kind": "ref", "name": "slug" @@ -1301,6 +1788,12 @@ "publicName": "namespace", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme" + }, "type": { "kind": "ref", "name": "namespace" @@ -1311,6 +1804,12 @@ "publicName": "isPrivate", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": false + }, "type": { "kind": "primitive", "type": "boolean" @@ -1333,6 +1832,12 @@ "publicName": "uid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "ref", "name": "nanoid" @@ -1343,6 +1848,12 @@ "publicName": "name", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Acme Theme" + }, "type": { "kind": "primitive", "type": "string" @@ -1353,6 +1864,12 @@ "publicName": "description", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Custom colors for Acme documentation." + }, "type": { "kind": "primitive", "type": "string" @@ -1363,6 +1880,12 @@ "publicName": "slug", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme-theme" + }, "type": { "kind": "ref", "name": "slug" @@ -1385,6 +1908,12 @@ "publicName": "uid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "ref", "name": "nanoid" @@ -1395,6 +1924,12 @@ "publicName": "name", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Acme API" + }, "type": { "kind": "ref", "name": "team_name" @@ -1405,6 +1940,12 @@ "publicName": "imageUri", "required": false, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "https://example.com/alex.png" + }, "type": { "kind": "ref", "name": "team_image" @@ -1415,6 +1956,12 @@ "publicName": "slug", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme-api" + }, "type": { "kind": "ref", "name": "slug" @@ -1425,6 +1972,12 @@ "publicName": "theme", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "default" + }, "type": { "kind": "primitive", "type": "string" @@ -1439,6 +1992,12 @@ "source": "team_name", "publicAliases": [], "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Acme" + }, "type": { "kind": "primitive", "type": "string" @@ -1449,6 +2008,12 @@ "source": "team_image", "publicAliases": [], "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "https://example.com/logo.svg" + }, "type": { "kind": "primitive", "type": "string" @@ -1467,6 +2032,12 @@ "publicName": "uid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "ref", "name": "nanoid" @@ -1487,6 +2058,12 @@ "publicName": "displayName", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Alex Morgan" + }, "type": { "kind": "primitive", "type": "string" @@ -1497,6 +2074,12 @@ "publicName": "imageUri", "required": false, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "https://example.com/alex.png" + }, "type": { "kind": "primitive", "type": "string" @@ -1546,6 +2129,12 @@ "publicName": "uid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "ref", "name": "nanoid" @@ -1556,6 +2145,12 @@ "publicName": "email", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "alex@example.com" + }, "type": { "kind": "ref", "name": "email" @@ -1576,6 +2171,12 @@ "publicName": "expires", "required": false, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": 1735776000 + }, "type": { "kind": "primitive", "type": "number" @@ -1590,6 +2191,12 @@ "source": "email", "publicAliases": [], "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "alex@example.com" + }, "type": { "kind": "primitive", "type": "string", @@ -1612,6 +2219,12 @@ "publicName": "uid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "ref", "name": "nanoid" @@ -1622,6 +2235,12 @@ "publicName": "createdAt", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": 1735689600 + }, "type": { "kind": "ref", "name": "timestamp" @@ -1632,6 +2251,12 @@ "publicName": "updatedAt", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": 1735689600 + }, "type": { "kind": "ref", "name": "timestamp" @@ -1642,6 +2267,12 @@ "publicName": "name", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Acme Documentation" + }, "type": { "kind": "primitive", "type": "string" @@ -1670,6 +2301,12 @@ "publicName": "lastPublished", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": 1735689600 + }, "type": { "kind": "union", "variants": [ @@ -1688,6 +2325,12 @@ "publicName": "lastPublishedUid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "PakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "union", "variants": [ @@ -1706,6 +2349,12 @@ "publicName": "loginPortalUid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "LakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "primitive", "type": "string" @@ -1716,6 +2365,12 @@ "publicName": "userInfoHookUrl", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "https://example.com/hooks/user-info" + }, "type": { "kind": "primitive", "type": "string" @@ -1726,6 +2381,12 @@ "publicName": "activeThemeId", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "TakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "primitive", "type": "string" @@ -1736,6 +2397,12 @@ "publicName": "typesenseId", "required": false, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": 42 + }, "type": { "kind": "primitive", "type": "number" @@ -1746,6 +2413,12 @@ "publicName": "isPrivate", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": false + }, "type": { "kind": "primitive", "type": "boolean" @@ -1756,6 +2429,12 @@ "publicName": "agentEnabled", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": true + }, "type": { "kind": "primitive", "type": "boolean" @@ -1766,6 +2445,12 @@ "publicName": "analyticsEnabled", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": true + }, "type": { "kind": "primitive", "type": "boolean" @@ -1776,8 +2461,17 @@ "publicName": "accessGroups", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": [ + "UakgbKJ5m9gl0JDMbcJqL" + ] + }, "type": { - "kind": "unknown" + "kind": "primitive", + "type": "string" } }, { @@ -1785,6 +2479,12 @@ "publicName": "slug", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme-api" + }, "type": { "kind": "ref", "name": "slug" @@ -1795,6 +2495,12 @@ "publicName": "publishStatus", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "published" + }, "type": { "kind": "primitive", "type": "string" @@ -1805,6 +2511,12 @@ "publicName": "publishMessage", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Documentation published successfully." + }, "type": { "kind": "primitive", "type": "string" @@ -1845,6 +2557,12 @@ "publicName": "uid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "primitive", "type": "string" @@ -1855,6 +2573,12 @@ "publicName": "domain", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "docs.example.com" + }, "type": { "kind": "primitive", "type": "string" @@ -1865,6 +2589,12 @@ "publicName": "publishedAt", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": 1735689600 + }, "type": { "kind": "ref", "name": "timestamp" @@ -1887,6 +2617,12 @@ "publicName": "linkedBy", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "primitive", "type": "string" @@ -1897,6 +2633,12 @@ "publicName": "id", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": 123456789 + }, "type": { "kind": "primitive", "type": "number" @@ -1907,6 +2649,12 @@ "publicName": "name", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Acme Documentation" + }, "type": { "kind": "primitive", "type": "string", @@ -1920,6 +2668,12 @@ "publicName": "configPath", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "scalar.config.json" + }, "type": { "kind": "primitive", "type": "string" @@ -1930,6 +2684,12 @@ "publicName": "branch", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "main" + }, "type": { "kind": "primitive", "type": "string" @@ -1940,6 +2700,12 @@ "publicName": "publishOnMerge", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": true + }, "type": { "kind": "primitive", "type": "boolean" @@ -1950,6 +2716,12 @@ "publicName": "publishPreviews", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": true + }, "type": { "kind": "primitive", "type": "boolean" @@ -1960,6 +2732,12 @@ "publicName": "prComments", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": true + }, "type": { "kind": "primitive", "type": "boolean" @@ -1970,6 +2748,12 @@ "publicName": "expired", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": false + }, "type": { "kind": "primitive", "type": "boolean" @@ -1992,6 +2776,12 @@ "publicName": "uid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "ref", "name": "nanoid" @@ -2002,6 +2792,12 @@ "publicName": "name", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Acme API" + }, "type": { "kind": "ref", "name": "team_name" @@ -2012,6 +2808,12 @@ "publicName": "imageUri", "required": false, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "https://example.com/alex.png" + }, "type": { "kind": "ref", "name": "team_image" @@ -2034,6 +2836,12 @@ "publicName": "uid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "ref", "name": "nanoid" @@ -2044,6 +2852,12 @@ "publicName": "createdAt", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": 1735689600 + }, "type": { "kind": "ref", "name": "timestamp" @@ -2054,6 +2868,12 @@ "publicName": "updatedAt", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": 1735689600 + }, "type": { "kind": "ref", "name": "timestamp" @@ -2064,6 +2884,12 @@ "publicName": "email", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "alex@example.com" + }, "type": { "kind": "ref", "name": "email" @@ -2074,6 +2900,12 @@ "publicName": "theme", "required": false, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "default" + }, "type": { "kind": "primitive", "type": "string" @@ -2084,6 +2916,12 @@ "publicName": "activeTeamId", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "GakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "union", "variants": [ @@ -2102,6 +2940,12 @@ "publicName": "hasGithub", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": true + }, "type": { "kind": "primitive", "type": "boolean" @@ -2137,6 +2981,12 @@ "publicName": "uid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "ref", "name": "nanoid" @@ -2147,6 +2997,12 @@ "publicName": "title", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Acme API" + }, "type": { "kind": "primitive", "type": "string", @@ -2160,6 +3016,12 @@ "publicName": "slug", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme-api" + }, "type": { "kind": "ref", "name": "slug" @@ -2170,6 +3032,12 @@ "publicName": "namespace", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme" + }, "type": { "kind": "ref", "name": "namespace" @@ -2180,6 +3048,12 @@ "publicName": "description", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "API for managing Acme products and orders." + }, "type": { "kind": "primitive", "type": "string" @@ -2190,6 +3064,12 @@ "publicName": "isPrivate", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": false + }, "type": { "kind": "primitive", "type": "boolean" @@ -2200,6 +3080,12 @@ "publicName": "apiUid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "union", "variants": [ @@ -2218,6 +3104,12 @@ "publicName": "apiVersion", "required": false, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "1.2.0" + }, "type": { "kind": "union", "variants": [ @@ -2236,6 +3128,12 @@ "publicName": "currentVersion", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "1.2.0" + }, "type": { "kind": "ref", "name": "version" @@ -2284,6 +3182,12 @@ "publicName": "language", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "typescript" + }, "type": { "kind": "enum", "values": [ @@ -2338,6 +3242,12 @@ "publicName": "slug", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme-sdk" + }, "type": { "kind": "ref", "name": "slug" @@ -2360,6 +3270,12 @@ "publicName": "version", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "1.2.0" + }, "type": { "kind": "ref", "name": "version" @@ -2370,6 +3286,12 @@ "publicName": "apiVersion", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "1.2.0" + }, "type": { "kind": "ref", "name": "version" @@ -2380,6 +3302,12 @@ "publicName": "status", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "published" + }, "type": { "kind": "enum", "values": [ @@ -2401,6 +3329,14 @@ "publicName": "languages", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": [ + "typescript" + ] + }, "type": { "kind": "array", "items": { @@ -2458,6 +3394,12 @@ "publicName": "publishedAt", "required": false, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": 1735689600 + }, "type": { "kind": "ref", "name": "timestamp" @@ -2468,6 +3410,12 @@ "publicName": "createdAt", "required": false, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": 1735689600 + }, "type": { "kind": "ref", "name": "timestamp" @@ -2490,6 +3438,12 @@ "publicName": "uid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "ref", "name": "nanoid" @@ -2500,6 +3454,12 @@ "publicName": "name", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Acme Documentation" + }, "type": { "kind": "primitive", "type": "string" @@ -2510,6 +3470,12 @@ "publicName": "slug", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme-api" + }, "type": { "kind": "ref", "name": "slug" @@ -2520,6 +3486,12 @@ "publicName": "isPrivate", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": false + }, "type": { "kind": "primitive", "type": "boolean" @@ -2530,8 +3502,17 @@ "publicName": "accessGroups", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": [ + "UakgbKJ5m9gl0JDMbcJqL" + ] + }, "type": { - "kind": "unknown" + "kind": "primitive", + "type": "string" } }, { @@ -2539,6 +3520,12 @@ "publicName": "loginPortalUid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "LakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "primitive", "type": "string" @@ -2549,6 +3536,12 @@ "publicName": "activeThemeId", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "TakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "primitive", "type": "string" @@ -2559,6 +3552,12 @@ "publicName": "agentEnabled", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": true + }, "type": { "kind": "primitive", "type": "boolean" @@ -2569,6 +3568,12 @@ "publicName": "analyticsEnabled", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": true + }, "type": { "kind": "primitive", "type": "boolean" @@ -2579,6 +3584,12 @@ "publicName": "lastPublished", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": 1735689600 + }, "type": { "kind": "union", "variants": [ @@ -2597,6 +3608,12 @@ "publicName": "publishStatus", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "published" + }, "type": { "kind": "primitive", "type": "string" @@ -2619,6 +3636,12 @@ "publicName": "id", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "42" + }, "type": { "kind": "primitive", "type": "string" @@ -2629,6 +3652,12 @@ "publicName": "name", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Acme API" + }, "type": { "kind": "primitive", "type": "string" @@ -2639,6 +3668,12 @@ "publicName": "slug", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme-api" + }, "type": { "kind": "ref", "name": "slug" @@ -2649,6 +3684,12 @@ "publicName": "autoAddOperations", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": true + }, "type": { "kind": "primitive", "type": "boolean" @@ -2659,6 +3700,12 @@ "publicName": "createdAt", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "2025-01-01T00:00:00.000Z" + }, "type": { "kind": "primitive", "type": "string" @@ -2669,6 +3716,12 @@ "publicName": "updatedAt", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "2025-01-01T00:00:00.000Z" + }, "type": { "kind": "primitive", "type": "string" @@ -2691,6 +3744,12 @@ "publicName": "id", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "42" + }, "type": { "kind": "primitive", "type": "string" @@ -2701,6 +3760,12 @@ "publicName": "mcpServerId", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "42" + }, "type": { "kind": "primitive", "type": "string" @@ -2711,6 +3776,12 @@ "publicName": "name", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Acme API" + }, "type": { "kind": "primitive", "type": "string" @@ -2721,6 +3792,12 @@ "publicName": "slug", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme-api" + }, "type": { "kind": "ref", "name": "slug" @@ -2731,6 +3808,12 @@ "publicName": "isPrivate", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": false + }, "type": { "kind": "primitive", "type": "boolean" @@ -2741,6 +3824,14 @@ "publicName": "accessGroups", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": [ + "UakgbKJ5m9gl0JDMbcJqL" + ] + }, "type": { "kind": "array", "items": { @@ -2754,6 +3845,12 @@ "publicName": "loginPortalUid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "LakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "union", "variants": [ @@ -2772,6 +3869,12 @@ "publicName": "mcpVersion", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "1.2.0" + }, "type": { "kind": "union", "variants": [ @@ -2790,6 +3893,12 @@ "publicName": "piiRedactionEnabled", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": true + }, "type": { "kind": "primitive", "type": "boolean" @@ -2800,6 +3909,12 @@ "publicName": "credentialRedactionEnabled", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": true + }, "type": { "kind": "primitive", "type": "boolean" @@ -2822,6 +3937,12 @@ "publicName": "id", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "42" + }, "type": { "kind": "primitive", "type": "string" @@ -2832,6 +3953,12 @@ "publicName": "name", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Acme API" + }, "type": { "kind": "primitive", "type": "string" @@ -2842,6 +3969,12 @@ "publicName": "slug", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme-api" + }, "type": { "kind": "ref", "name": "slug" @@ -2852,6 +3985,12 @@ "publicName": "isPrivate", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": false + }, "type": { "kind": "primitive", "type": "boolean" @@ -2862,6 +4001,12 @@ "publicName": "mcpVersion", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "1.2.0" + }, "type": { "kind": "union", "variants": [ diff --git a/tests/smoke-test.java b/tests/smoke-test.java index b648e11..a897051 100644 --- a/tests/smoke-test.java +++ b/tests/smoke-test.java @@ -121,18 +121,20 @@ private static void _smokeCase0() throws Exception { private static void _smokeCase1() throws Exception { RegistryListApiDocumentsParams params = - RegistryListApiDocumentsParams.builder().namespace("namespace").build(); + RegistryListApiDocumentsParams.builder().namespace("acme").build(); var registry = client.registry().listApiDocuments(params); } private static void _smokeCase2() throws Exception { RegistryCreateApiDocumentParams params = RegistryCreateApiDocumentParams.builder() - .namespace("namespace") - .title("") - .version("x") - .slug("") - .document("") + .namespace("acme") + .title("Acme API") + .version("1.2.0") + .slug("acme-api") + .document( + "{\"openapi\":\"3.1.0\",\"info\":{\"title\":\"Acme" + + " API\",\"version\":\"1.2.0\"},\"paths\":{}}") .build(); var registry = client.registry().createApiDocument(params); } @@ -140,49 +142,51 @@ private static void _smokeCase2() throws Exception { private static void _smokeCase3() throws Exception { RegistryCreateApiDocumentParams params = RegistryCreateApiDocumentParams.builder() - .namespace("namespace") - .title("") - .description("") - .version("x") - .slug("") - .ruleset("") + .namespace("acme") + .title("Acme API") + .description("API for managing Acme products and orders.") + .version("1.2.0") + .slug("acme-api") + .ruleset("extends: [\"spectral:oas\"]") .isPrivate(false) - .document("") + .document( + "{\"openapi\":\"3.1.0\",\"info\":{\"title\":\"Acme" + + " API\",\"version\":\"1.2.0\"},\"paths\":{}}") .build(); var registry = client.registry().createApiDocument(params); } private static void _smokeCase4() throws Exception { RegistryUpdateApiDocumentParams params = - RegistryUpdateApiDocumentParams.builder().namespace("namespace").slug("slug").build(); + RegistryUpdateApiDocumentParams.builder().namespace("acme").slug("acme-api").build(); var registry = client.registry().updateApiDocument(params); } private static void _smokeCase5() throws Exception { RegistryUpdateApiDocumentParams params = RegistryUpdateApiDocumentParams.builder() - .namespace("namespace") - .slug("slug") - .title("") - .description("") + .namespace("acme") + .slug("acme-api") + .title("Acme API") + .description("API for managing Acme products and orders.") .isPrivate(false) - .ruleset("") + .ruleset("extends: [\"spectral:oas\"]") .build(); var registry = client.registry().updateApiDocument(params); } private static void _smokeCase6() throws Exception { RegistryDeleteApiDocumentParams params = - RegistryDeleteApiDocumentParams.builder().namespace("namespace").slug("slug").build(); + RegistryDeleteApiDocumentParams.builder().namespace("acme").slug("acme-api").build(); var registry = client.registry().deleteApiDocument(params); } private static void _smokeCase7() throws Exception { RegistryRetrieveApiDocumentVersionParams params = RegistryRetrieveApiDocumentVersionParams.builder() - .namespace("namespace") - .slug("slug") - .semver("semver") + .namespace("acme") + .slug("acme-api") + .semver("1.2.0") .build(); var registry = client.registry().retrieveApiDocumentVersion(params); } @@ -190,10 +194,12 @@ private static void _smokeCase7() throws Exception { private static void _smokeCase8() throws Exception { RegistryUpdateApiDocumentVersionParams params = RegistryUpdateApiDocumentVersionParams.builder() - .namespace("namespace") - .slug("slug") - .semver("semver") - .document("") + .namespace("acme") + .slug("acme-api") + .semver("1.2.0") + .document( + "{\"openapi\":\"3.1.0\",\"info\":{\"title\":\"Acme" + + " API\",\"version\":\"1.2.0\"},\"paths\":{}}") .build(); var registry = client.registry().updateApiDocumentVersion(params); } @@ -201,9 +207,9 @@ private static void _smokeCase8() throws Exception { private static void _smokeCase9() throws Exception { RegistryDeleteApiDocumentVersionParams params = RegistryDeleteApiDocumentVersionParams.builder() - .namespace("namespace") - .slug("slug") - .semver("semver") + .namespace("acme") + .slug("acme-api") + .semver("1.2.0") .build(); var registry = client.registry().deleteApiDocumentVersion(params); } @@ -211,9 +217,9 @@ private static void _smokeCase9() throws Exception { private static void _smokeCase10() throws Exception { RegistryListApiDocumentVersionMetadataParams params = RegistryListApiDocumentVersionMetadataParams.builder() - .namespace("namespace") - .slug("slug") - .semver("semver") + .namespace("acme") + .slug("acme-api") + .semver("1.2.0") .build(); var registry = client.registry().listApiDocumentVersionMetadata(params); } @@ -221,10 +227,12 @@ private static void _smokeCase10() throws Exception { private static void _smokeCase11() throws Exception { RegistryCreateApiDocumentVersionParams params = RegistryCreateApiDocumentVersionParams.builder() - .namespace("namespace") - .slug("slug") - .version("x") - .document("") + .namespace("acme") + .slug("acme-api") + .version("1.2.0") + .document( + "{\"openapi\":\"3.1.0\",\"info\":{\"title\":\"Acme" + + " API\",\"version\":\"1.2.0\"},\"paths\":{}}") .build(); var registry = client.registry().createApiDocumentVersion(params); } @@ -232,10 +240,12 @@ private static void _smokeCase11() throws Exception { private static void _smokeCase12() throws Exception { RegistryCreateApiDocumentVersionParams params = RegistryCreateApiDocumentVersionParams.builder() - .namespace("namespace") - .slug("slug") - .version("x") - .document("") + .namespace("acme") + .slug("acme-api") + .version("1.2.0") + .document( + "{\"openapi\":\"3.1.0\",\"info\":{\"title\":\"Acme" + + " API\",\"version\":\"1.2.0\"},\"paths\":{}}") .force(false) .build(); var registry = client.registry().createApiDocumentVersion(params); @@ -244,9 +254,9 @@ private static void _smokeCase12() throws Exception { private static void _smokeCase13() throws Exception { RegistryCreateApiDocumentAccessGroupParams params = RegistryCreateApiDocumentAccessGroupParams.builder() - .namespace("namespace") - .slug("slug") - .accessGroup(AccessGroup.builder().accessGroupSlug("x").build()) + .namespace("acme") + .slug("acme-api") + .accessGroup(AccessGroup.builder().accessGroupSlug("acme-api").build()) .build(); var registry = client.registry().createApiDocumentAccessGroup(params); } @@ -254,26 +264,27 @@ private static void _smokeCase13() throws Exception { private static void _smokeCase14() throws Exception { RegistryDeleteApiDocumentAccessGroupParams params = RegistryDeleteApiDocumentAccessGroupParams.builder() - .namespace("namespace") - .slug("slug") - .accessGroup(AccessGroup.builder().accessGroupSlug("x").build()) + .namespace("acme") + .slug("acme-api") + .accessGroup(AccessGroup.builder().accessGroupSlug("acme-api").build()) .build(); var registry = client.registry().deleteApiDocumentAccessGroup(params); } private static void _smokeCase15() throws Exception { - SchemaListParams params = SchemaListParams.builder().namespace("namespace").build(); + SchemaListParams params = SchemaListParams.builder().namespace("acme").build(); var schema = client.schemas().list(params); } private static void _smokeCase16() throws Exception { SchemaCreateParams params = SchemaCreateParams.builder() - .namespace("namespace") - .title("") - .version("x") - .slug("") - .document("") + .namespace("acme") + .title("Customer") + .version("1.2.0") + .slug("customer") + .document( + "{\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\",\"examples\":[\"Acme\"]}}}") .build(); var schema = client.schemas().create(params); } @@ -281,30 +292,31 @@ private static void _smokeCase16() throws Exception { private static void _smokeCase17() throws Exception { SchemaCreateParams params = SchemaCreateParams.builder() - .namespace("namespace") - .title("") - .description("") - .version("x") - .slug("") + .namespace("acme") + .title("Customer") + .description("API for managing Acme products and orders.") + .version("1.2.0") + .slug("customer") .isPrivate(false) - .document("") + .document( + "{\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\",\"examples\":[\"Acme\"]}}}") .build(); var schema = client.schemas().create(params); } private static void _smokeCase18() throws Exception { SchemaUpdateParams params = - SchemaUpdateParams.builder().namespace("namespace").slug("slug").build(); + SchemaUpdateParams.builder().namespace("acme").slug("customer").build(); var schema = client.schemas().update(params); } private static void _smokeCase19() throws Exception { SchemaUpdateParams params = SchemaUpdateParams.builder() - .namespace("namespace") - .slug("slug") - .title("") - .description("") + .namespace("acme") + .slug("customer") + .title("Customer") + .description("API for managing Acme products and orders.") .isPrivate(false) .build(); var schema = client.schemas().update(params); @@ -312,26 +324,22 @@ private static void _smokeCase19() throws Exception { private static void _smokeCase20() throws Exception { SchemaDeleteParams params = - SchemaDeleteParams.builder().namespace("namespace").slug("slug").build(); + SchemaDeleteParams.builder().namespace("acme").slug("customer").build(); var schema = client.schemas().delete(params); } private static void _smokeCase21() throws Exception { VersionRetrieveParams params = - VersionRetrieveParams.builder() - .namespace("namespace") - .slug("slug") - .semver("semver") - .build(); + VersionRetrieveParams.builder().namespace("acme").slug("customer").semver("1.2.0").build(); var version = client.schemas().version().retrieve(params); } private static void _smokeCase22() throws Exception { com.scalar.models.schemas.version.VersionDeleteParams params = com.scalar.models.schemas.version.VersionDeleteParams.builder() - .namespace("namespace") - .slug("slug") - .semver("semver") + .namespace("acme") + .slug("customer") + .semver("1.2.0") .build(); var version = client.schemas().version().delete(params); } @@ -339,10 +347,11 @@ private static void _smokeCase22() throws Exception { private static void _smokeCase23() throws Exception { com.scalar.models.schemas.version.VersionCreateParams params = com.scalar.models.schemas.version.VersionCreateParams.builder() - .namespace("namespace") - .slug("slug") - .version("x") - .document("") + .namespace("acme") + .slug("customer") + .version("1.2.0") + .document( + "{\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\",\"examples\":[\"Acme\"]}}}") .build(); var version = client.schemas().version().create(params); } @@ -350,10 +359,11 @@ private static void _smokeCase23() throws Exception { private static void _smokeCase24() throws Exception { com.scalar.models.schemas.version.VersionCreateParams params = com.scalar.models.schemas.version.VersionCreateParams.builder() - .namespace("namespace") - .slug("slug") - .version("x") - .document("") + .namespace("acme") + .slug("customer") + .version("1.2.0") + .document( + "{\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\",\"examples\":[\"Acme\"]}}}") .force(false) .build(); var version = client.schemas().version().create(params); @@ -367,9 +377,9 @@ private static void _smokeCase25() throws Exception { .accessGroup .AccessGroupCreateParams .builder() - .namespace("namespace") - .slug("slug") - .accessGroup(AccessGroup.builder().accessGroupSlug("x").build()) + .namespace("acme") + .slug("customer") + .accessGroup(AccessGroup.builder().accessGroupSlug("acme-api").build()) .build(); var accessGroup = client.schemas().accessGroup().create(params); } @@ -382,39 +392,43 @@ private static void _smokeCase26() throws Exception { .accessGroup .AccessGroupDeleteParams .builder() - .namespace("namespace") - .slug("slug") - .accessGroup(AccessGroup.builder().accessGroupSlug("x").build()) + .namespace("acme") + .slug("customer") + .accessGroup(AccessGroup.builder().accessGroupSlug("acme-api").build()) .build(); var accessGroup = client.schemas().accessGroup().delete(params); } private static void _smokeCase27() throws Exception { - LoginPortalRetrieveParams params = LoginPortalRetrieveParams.builder().slug("slug").build(); + LoginPortalRetrieveParams params = + LoginPortalRetrieveParams.builder().slug("acme-login").build(); var loginPortal = client.loginPortals().retrieve(params); } private static void _smokeCase28() throws Exception { - LoginPortalUpdateParams params = LoginPortalUpdateParams.builder().slug("slug").build(); + LoginPortalUpdateParams params = LoginPortalUpdateParams.builder().slug("acme-login").build(); var loginPortal = client.loginPortals().update(params); } private static void _smokeCase29() throws Exception { LoginPortalUpdateParams params = - LoginPortalUpdateParams.builder().slug("slug").title("").build(); + LoginPortalUpdateParams.builder() + .slug("acme-login") + .title("Acme Private Documentation") + .build(); var loginPortal = client.loginPortals().update(params); } private static void _smokeCase30() throws Exception { - LoginPortalDeleteParams params = LoginPortalDeleteParams.builder().slug("slug").build(); + LoginPortalDeleteParams params = LoginPortalDeleteParams.builder().slug("acme-login").build(); var loginPortal = client.loginPortals().delete(params); } private static void _smokeCase31() throws Exception { LoginPortalCreateParams params = LoginPortalCreateParams.builder() - .title("") - .slug("") + .title("Acme Private Documentation") + .slug("acme-login") .email( LoginPortalEmail.builder() .logo("") @@ -465,57 +479,63 @@ private static void _smokeCase34() throws Exception { .accessGroups .AccessGroupCreateParams .builder() - .name("") - .slug("x") - .allowedDomains("value") + .name("Engineering") + .slug("acme-api") + .allowedDomains("example.com") .build(); var accessGroup = client.accessGroups().create(params); } private static void _smokeCase35() throws Exception { - AccessGroupRetrieveParams params = AccessGroupRetrieveParams.builder().slug("slug").build(); + AccessGroupRetrieveParams params = AccessGroupRetrieveParams.builder().slug("acme-api").build(); var accessGroup = client.accessGroups().retrieve(params); } private static void _smokeCase36() throws Exception { - AccessGroupUpdateParams params = AccessGroupUpdateParams.builder().pathSlug("pathSlug").build(); + AccessGroupUpdateParams params = AccessGroupUpdateParams.builder().pathSlug("acme-api").build(); var accessGroup = client.accessGroups().update(params); } private static void _smokeCase37() throws Exception { AccessGroupUpdateParams params = - AccessGroupUpdateParams.builder().pathSlug("pathSlug").name("").bodySlug("x").build(); + AccessGroupUpdateParams.builder() + .pathSlug("acme-api") + .name("Engineering") + .bodySlug("acme-api") + .build(); var accessGroup = client.accessGroups().update(params); } private static void _smokeCase38() throws Exception { com.scalar.models.accessGroups.AccessGroupDeleteParams params = - com.scalar.models.accessGroups.AccessGroupDeleteParams.builder().slug("slug").build(); + com.scalar.models.accessGroups.AccessGroupDeleteParams.builder().slug("acme-api").build(); var accessGroup = client.accessGroups().delete(params); } private static void _smokeCase39() throws Exception { - DomainCreateParams params = DomainCreateParams.builder().slug("slug").domain("").build(); + DomainCreateParams params = + DomainCreateParams.builder().slug("acme-api").domain("example.com").build(); var domain = client.accessGroups().domains().create(params); } private static void _smokeCase40() throws Exception { - DomainDeleteParams params = DomainDeleteParams.builder().slug("slug").domain("").build(); + DomainDeleteParams params = + DomainDeleteParams.builder().slug("acme-api").domain("example.com").build(); var domain = client.accessGroups().domains().delete(params); } private static void _smokeCase41() throws Exception { - RuleListRulesetsParams params = RuleListRulesetsParams.builder().namespace("namespace").build(); + RuleListRulesetsParams params = RuleListRulesetsParams.builder().namespace("acme").build(); var rule = client.rules().listRulesets(params); } private static void _smokeCase42() throws Exception { RuleCreateRulesetParams params = RuleCreateRulesetParams.builder() - .namespace("namespace") - .title("") - .slug("") - .document("") + .namespace("acme") + .title("Acme API Rules") + .slug("acme-rules") + .document("extends: [\"spectral:oas\"]\nrules:\n info-contact: warn\n") .build(); var rule = client.rules().createRuleset(params); } @@ -523,34 +543,31 @@ private static void _smokeCase42() throws Exception { private static void _smokeCase43() throws Exception { RuleCreateRulesetParams params = RuleCreateRulesetParams.builder() - .namespace("namespace") - .title("") - .description("") - .slug("") + .namespace("acme") + .title("Acme API Rules") + .description("API for managing Acme products and orders.") + .slug("acme-rules") .isPrivate(false) - .document("") + .document("extends: [\"spectral:oas\"]\nrules:\n info-contact: warn\n") .build(); var rule = client.rules().createRuleset(params); } private static void _smokeCase44() throws Exception { RuleUpdateRulesetParams params = - RuleUpdateRulesetParams.builder() - .pathNamespace("pathNamespace") - .pathSlug("pathSlug") - .build(); + RuleUpdateRulesetParams.builder().pathNamespace("acme").pathSlug("acme-rules").build(); var rule = client.rules().updateRuleset(params); } private static void _smokeCase45() throws Exception { RuleUpdateRulesetParams params = RuleUpdateRulesetParams.builder() - .pathNamespace("pathNamespace") - .pathSlug("pathSlug") - .bodyNamespace("") - .bodySlug("") - .title("") - .description("") + .pathNamespace("acme") + .pathSlug("acme-rules") + .bodyNamespace("acme") + .bodySlug("acme-rules") + .title("Acme API Rules") + .description("API for managing Acme products and orders.") .isPrivate(false) .build(); var rule = client.rules().updateRuleset(params); @@ -558,22 +575,22 @@ private static void _smokeCase45() throws Exception { private static void _smokeCase46() throws Exception { RuleDeleteRulesetParams params = - RuleDeleteRulesetParams.builder().namespace("namespace").slug("slug").build(); + RuleDeleteRulesetParams.builder().namespace("acme").slug("acme-rules").build(); var rule = client.rules().deleteRuleset(params); } private static void _smokeCase47() throws Exception { RuleRetrieveRulesetDocumentParams params = - RuleRetrieveRulesetDocumentParams.builder().namespace("namespace").slug("slug").build(); + RuleRetrieveRulesetDocumentParams.builder().namespace("acme").slug("acme-rules").build(); var rule = client.rules().retrieveRulesetDocument(params); } private static void _smokeCase48() throws Exception { RuleCreateRulesetAccessGroupParams params = RuleCreateRulesetAccessGroupParams.builder() - .namespace("namespace") - .slug("slug") - .accessGroup(AccessGroup.builder().accessGroupSlug("x").build()) + .namespace("acme") + .slug("acme-rules") + .accessGroup(AccessGroup.builder().accessGroupSlug("acme-api").build()) .build(); var rule = client.rules().createRulesetAccessGroup(params); } @@ -581,9 +598,9 @@ private static void _smokeCase48() throws Exception { private static void _smokeCase49() throws Exception { RuleDeleteRulesetAccessGroupParams params = RuleDeleteRulesetAccessGroupParams.builder() - .namespace("namespace") - .slug("slug") - .accessGroup(AccessGroup.builder().accessGroupSlug("x").build()) + .namespace("acme") + .slug("acme-rules") + .accessGroup(AccessGroup.builder().accessGroupSlug("acme-api").build()) .build(); var rule = client.rules().deleteRulesetAccessGroup(params); } @@ -593,40 +610,57 @@ private static void _smokeCase50() throws Exception { } private static void _smokeCase51() throws Exception { - ThemeCreateParams params = ThemeCreateParams.builder().name("").slug("").document("").build(); + ThemeCreateParams params = + ThemeCreateParams.builder() + .name("Acme Theme") + .slug("acme-theme") + .document(":root { --scalar-color-1: #1f2937; }") + .build(); var theme = client.themes().create(params); } private static void _smokeCase52() throws Exception { ThemeCreateParams params = - ThemeCreateParams.builder().name("").description("").slug("").document("").build(); + ThemeCreateParams.builder() + .name("Acme Theme") + .description("API for managing Acme products and orders.") + .slug("acme-theme") + .document(":root { --scalar-color-1: #1f2937; }") + .build(); var theme = client.themes().create(params); } private static void _smokeCase53() throws Exception { - ThemeUpdateParams params = ThemeUpdateParams.builder().slug("slug").build(); + ThemeUpdateParams params = ThemeUpdateParams.builder().slug("acme-theme").build(); var theme = client.themes().update(params); } private static void _smokeCase54() throws Exception { ThemeUpdateParams params = - ThemeUpdateParams.builder().slug("slug").name("").description("").build(); + ThemeUpdateParams.builder() + .slug("acme-theme") + .name("Acme Theme") + .description("API for managing Acme products and orders.") + .build(); var theme = client.themes().update(params); } private static void _smokeCase55() throws Exception { ThemeReplaceDocumentParams params = - ThemeReplaceDocumentParams.builder().slug("slug").document("").build(); + ThemeReplaceDocumentParams.builder() + .slug("acme-theme") + .document(":root { --scalar-color-1: #1f2937; }") + .build(); var theme = client.themes().replaceDocument(params); } private static void _smokeCase56() throws Exception { - ThemeDeleteParams params = ThemeDeleteParams.builder().slug("slug").build(); + ThemeDeleteParams params = ThemeDeleteParams.builder().slug("acme-theme").build(); var theme = client.themes().delete(params); } private static void _smokeCase57() throws Exception { - ThemeRetrieveParams params = ThemeRetrieveParams.builder().slug("slug").build(); + ThemeRetrieveParams params = ThemeRetrieveParams.builder().slug("acme-theme").build(); var theme = client.themes().retrieve(params); } @@ -639,28 +673,29 @@ private static void _smokeCase59() throws Exception { } private static void _smokeCase60() throws Exception { - MemberUpdateParams params = MemberUpdateParams.builder().uid("uidxx").role(Role.OWNER).build(); + MemberUpdateParams params = + MemberUpdateParams.builder().uid("UakgbKJ5m9gl0JDMbcJqL").role(Role.OWNER).build(); var member = client.teams().members().update(params); } private static void _smokeCase61() throws Exception { - MemberDeleteParams params = MemberDeleteParams.builder().uid("uidxx").build(); + MemberDeleteParams params = MemberDeleteParams.builder().uid("UakgbKJ5m9gl0JDMbcJqL").build(); var member = client.teams().members().delete(params); } private static void _smokeCase62() throws Exception { InviteMemberParams params = - InviteMemberParams.builder().email("user@example.com").role(Role.OWNER).build(); + InviteMemberParams.builder().email("alex@example.com").role(Role.OWNER).build(); var invite = client.teams().invites().member(params); } private static void _smokeCase63() throws Exception { - InviteResendParams params = InviteResendParams.builder().uid("uidxx").build(); + InviteResendParams params = InviteResendParams.builder().uid("UakgbKJ5m9gl0JDMbcJqL").build(); var invite = client.teams().invites().resend(params); } private static void _smokeCase64() throws Exception { - InviteCancelParams params = InviteCancelParams.builder().uid("uidxx").build(); + InviteCancelParams params = InviteCancelParams.builder().uid("UakgbKJ5m9gl0JDMbcJqL").build(); var invite = client.teams().invites().cancel(params); } @@ -671,7 +706,7 @@ private static void _smokeCase65() throws Exception { private static void _smokeCase66() throws Exception { ScalarDocCreateGuideParams params = ScalarDocCreateGuideParams.builder() - .name("") + .name("Acme Documentation") .isPrivate(false) .allowedUsers(java.util.List.of()) .allowedDomains(java.util.List.of()) @@ -682,8 +717,8 @@ private static void _smokeCase66() throws Exception { private static void _smokeCase67() throws Exception { ScalarDocCreateGuideParams params = ScalarDocCreateGuideParams.builder() - .name("") - .slug("x") + .name("Acme Documentation") + .slug("acme-api") .isPrivate(false) .allowedUsers(java.util.List.of()) .allowedDomains(java.util.List.of()) @@ -692,7 +727,8 @@ private static void _smokeCase67() throws Exception { } private static void _smokeCase68() throws Exception { - ScalarDocPublishGuideParams params = ScalarDocPublishGuideParams.builder().slug("slug").build(); + ScalarDocPublishGuideParams params = + ScalarDocPublishGuideParams.builder().slug("acme-docs").build(); var scalarDoc = client.scalarDocs().publishGuide(params); } @@ -701,14 +737,14 @@ private static void _smokeCase69() throws Exception { } private static void _smokeCase70() throws Exception { - ScalarDocListProjectsParams params = ScalarDocListProjectsParams.builder().limit(1L).build(); + ScalarDocListProjectsParams params = ScalarDocListProjectsParams.builder().limit(20L).build(); var scalarDoc = client.scalarDocs().listProjects(params); } private static void _smokeCase71() throws Exception { ScalarDocCreateProjectParams params = ScalarDocCreateProjectParams.builder() - .name("") + .name("Acme Documentation") .provider(ScalarDocCreateProjectParams.Provider.of("forgejo")) .build(); var scalarDoc = client.scalarDocs().createProject(params); @@ -717,20 +753,20 @@ private static void _smokeCase71() throws Exception { private static void _smokeCase72() throws Exception { ScalarDocCreateProjectParams params = ScalarDocCreateProjectParams.builder() - .name("") - .slug("x") + .name("Acme Documentation") + .slug("acme-api") .isPrivate(false) - .blank(false) + .blank(true) .provider(ScalarDocCreateProjectParams.Provider.of("forgejo")) .githubRepository( ScalarDocCreateProjectParams.GithubRepository.builder() - .installationId(0L) - .repoId(0L) + .installationId(84L) + .repoId(123456789L) .build()) .bitbucketRepository( ScalarDocCreateProjectParams.BitbucketRepository.builder() - .workspaceUuid("") - .repoUuid("") + .workspaceUuid("{12345678-1234-4234-8234-123456789abc}") + .repoUuid("{abcdef01-1234-4234-8234-123456789abc}") .build()) .build(); var scalarDoc = client.scalarDocs().createProject(params); @@ -738,94 +774,98 @@ private static void _smokeCase72() throws Exception { private static void _smokeCase73() throws Exception { ScalarDocRetrieveProjectParams params = - ScalarDocRetrieveProjectParams.builder().slug("slug").build(); + ScalarDocRetrieveProjectParams.builder().slug("acme-docs").build(); var scalarDoc = client.scalarDocs().retrieveProject(params); } private static void _smokeCase74() throws Exception { ScalarDocUpdateProjectParams params = - ScalarDocUpdateProjectParams.builder().slug("slug").build(); + ScalarDocUpdateProjectParams.builder().slug("acme-docs").build(); var scalarDoc = client.scalarDocs().updateProject(params); } private static void _smokeCase75() throws Exception { ScalarDocUpdateProjectParams params = ScalarDocUpdateProjectParams.builder() - .slug("slug") - .name("") + .slug("acme-docs") + .name("Acme Documentation") .isPrivate(false) - .accessGroups(java.util.List.of("xxxxx")) - .loginPortalUid(ScalarDocUpdateProjectParams.LoginPortalUid.ofNanoid("xxxxx")) - .activeThemeId("xxxxx") - .agentEnabled(false) - .analyticsEnabled(false) + .accessGroups(java.util.List.of("UakgbKJ5m9gl0JDMbcJqL")) + .loginPortalUid( + ScalarDocUpdateProjectParams.LoginPortalUid.ofNanoid("UakgbKJ5m9gl0JDMbcJqL")) + .activeThemeId("UakgbKJ5m9gl0JDMbcJqL") + .agentEnabled(true) + .analyticsEnabled(true) .build(); var scalarDoc = client.scalarDocs().updateProject(params); } private static void _smokeCase76() throws Exception { ScalarDocDeleteProjectParams params = - ScalarDocDeleteProjectParams.builder().slug("slug").build(); + ScalarDocDeleteProjectParams.builder().slug("acme-docs").build(); var scalarDoc = client.scalarDocs().deleteProject(params); } private static void _smokeCase77() throws Exception { ScalarDocPublishProjectParams params = - ScalarDocPublishProjectParams.builder().slug("slug").build(); + ScalarDocPublishProjectParams.builder().slug("acme-docs").build(); var scalarDoc = client.scalarDocs().publishProject(params); } private static void _smokeCase78() throws Exception { ScalarDocPublishProjectParams params = ScalarDocPublishProjectParams.builder() - .slug("slug") - .commitSha("") + .slug("acme-docs") + .commitSha("0123456789abcdef0123456789abcdef01234567") .preview(false) - .configPath("") + .configPath("scalar.config.json") .build(); var scalarDoc = client.scalarDocs().publishProject(params); } private static void _smokeCase79() throws Exception { ScalarDocListProjectConfigParams params = - ScalarDocListProjectConfigParams.builder().slug("slug").build(); + ScalarDocListProjectConfigParams.builder().slug("acme-docs").build(); var scalarDoc = client.scalarDocs().listProjectConfig(params); } private static void _smokeCase80() throws Exception { ScalarDocListProjectConfigParams params = - ScalarDocListProjectConfigParams.builder().slug("slug").ref("ref").build(); + ScalarDocListProjectConfigParams.builder().slug("acme-docs").ref("main").build(); var scalarDoc = client.scalarDocs().listProjectConfig(params); } private static void _smokeCase81() throws Exception { ScalarDocUpdateProjectConfigParams params = - ScalarDocUpdateProjectConfigParams.builder().slug("slug").content("").build(); + ScalarDocUpdateProjectConfigParams.builder() + .slug("acme-docs") + .content("{\"name\":\"Acme Documentation\"}") + .build(); var scalarDoc = client.scalarDocs().updateProjectConfig(params); } private static void _smokeCase82() throws Exception { ScalarDocUpdateProjectConfigParams params = ScalarDocUpdateProjectConfigParams.builder() - .slug("slug") - .content("") - .ref("") - .baseToken("") - .message("") - .path("") + .slug("acme-docs") + .content("{\"name\":\"Acme Documentation\"}") + .ref("main") + .baseToken("example-edit-token") + .message("Update documentation configuration") + .path("scalar.config.json") .build(); var scalarDoc = client.scalarDocs().updateProjectConfig(params); } private static void _smokeCase83() throws Exception { ScalarDocListProjectDomainParams params = - ScalarDocListProjectDomainParams.builder().slug("slug").build(); + ScalarDocListProjectDomainParams.builder().slug("acme-docs").build(); var scalarDoc = client.scalarDocs().listProjectDomain(params); } private static void _smokeCase84() throws Exception { ScalarDocListProjectDomainStatusParams params = - ScalarDocListProjectDomainStatusParams.builder().slug("slug").build(); + ScalarDocListProjectDomainStatusParams.builder().slug("acme-docs").build(); var scalarDoc = client.scalarDocs().listProjectDomainStatus(params); } @@ -835,7 +875,9 @@ private static void _smokeCase85() throws Exception { private static void _smokeCase86() throws Exception { AuthenticationExchangePersonalTokenParams params = - AuthenticationExchangePersonalTokenParams.builder().personalToken("").build(); + AuthenticationExchangePersonalTokenParams.builder() + .personalToken("scalar_example_personal_token") + .build(); var authentication = client.authentication().exchangePersonalToken(params); } @@ -848,14 +890,14 @@ private static void _smokeCase88() throws Exception { } private static void _smokeCase89() throws Exception { - SdkListParams params = SdkListParams.builder().limit(1L).build(); + SdkListParams params = SdkListParams.builder().limit(20L).build(); var sdk = client.sdks().list(params); } private static void _smokeCase90() throws Exception { SdkCreateParams params = SdkCreateParams.builder() - .apiUid("xxxxx") + .apiUid("UakgbKJ5m9gl0JDMbcJqL") .languages(java.util.List.of(SdkCreateParams.Language.of("typescript"))) .build(); var sdk = client.sdks().create(params); @@ -864,34 +906,34 @@ private static void _smokeCase90() throws Exception { private static void _smokeCase91() throws Exception { SdkCreateParams params = SdkCreateParams.builder() - .apiUid("xxxxx") + .apiUid("UakgbKJ5m9gl0JDMbcJqL") .languages(java.util.List.of(SdkCreateParams.Language.of("typescript"))) - .title("") - .slug("x") - .className("") - .config("") + .title("Acme SDK") + .slug("acme-api") + .className("Acme") + .config("{\"targets\":{\"typescript\":{\"packageName\":\"@acme/sdk\"}}}") .build(); var sdk = client.sdks().create(params); } private static void _smokeCase92() throws Exception { - SdkRetrieveParams params = SdkRetrieveParams.builder().uid("uidxx").build(); + SdkRetrieveParams params = SdkRetrieveParams.builder().uid("UakgbKJ5m9gl0JDMbcJqL").build(); var sdk = client.sdks().retrieve(params); } private static void _smokeCase93() throws Exception { - SdkUpdateParams params = SdkUpdateParams.builder().uid("uidxx").build(); + SdkUpdateParams params = SdkUpdateParams.builder().uid("UakgbKJ5m9gl0JDMbcJqL").build(); var sdk = client.sdks().update(params); } private static void _smokeCase94() throws Exception { SdkUpdateParams params = SdkUpdateParams.builder() - .uid("uidxx") - .title("") - .slug("x") + .uid("UakgbKJ5m9gl0JDMbcJqL") + .title("Acme SDK") + .slug("acme-api") .isPrivate(false) - .config("") + .config("{\"targets\":{\"typescript\":{\"packageName\":\"@acme/sdk\"}}}") .apiUid("") .apiVersion("") .build(); @@ -899,20 +941,20 @@ private static void _smokeCase94() throws Exception { } private static void _smokeCase95() throws Exception { - SdkDeleteParams params = SdkDeleteParams.builder().uid("uidxx").build(); + SdkDeleteParams params = SdkDeleteParams.builder().uid("UakgbKJ5m9gl0JDMbcJqL").build(); var sdk = client.sdks().delete(params); } private static void _smokeCase96() throws Exception { - SdkBuildParams params = SdkBuildParams.builder().uid("uidxx").build(); + SdkBuildParams params = SdkBuildParams.builder().uid("UakgbKJ5m9gl0JDMbcJqL").build(); var sdk = client.sdks().build(params); } private static void _smokeCase97() throws Exception { SdkBuildParams params = SdkBuildParams.builder() - .uid("uidxx") - .version("") + .uid("UakgbKJ5m9gl0JDMbcJqL") + .version("1.2.0") .languages(java.util.List.of(SdkBuildParams.Language.of("typescript"))) .build(); var sdk = client.sdks().build(params); @@ -921,9 +963,9 @@ private static void _smokeCase97() throws Exception { private static void _smokeCase98() throws Exception { com.scalar.models.sdks.versions.VersionCreateParams params = com.scalar.models.sdks.versions.VersionCreateParams.builder() - .uid("uidxx") - .version("") - .apiVersion("") + .uid("UakgbKJ5m9gl0JDMbcJqL") + .version("1.2.0") + .apiVersion("1.2.0") .build(); var version = client.sdks().versions().create(params); } @@ -931,8 +973,8 @@ private static void _smokeCase98() throws Exception { private static void _smokeCase99() throws Exception { com.scalar.models.sdks.versions.VersionDeleteParams params = com.scalar.models.sdks.versions.VersionDeleteParams.builder() - .uid("uidxx") - .version("version") + .uid("UakgbKJ5m9gl0JDMbcJqL") + .version("1.2.0") .build(); var version = client.sdks().versions().delete(params); } @@ -940,10 +982,10 @@ private static void _smokeCase99() throws Exception { private static void _smokeCase100() throws Exception { RepositoryLinkParams params = RepositoryLinkParams.builder() - .uid("uidxx") + .uid("UakgbKJ5m9gl0JDMbcJqL") .language(RepositoryLinkParams.Language.of("typescript")) - .repositoryId(0L) - .baseBranch("") + .repositoryId(123456789L) + .baseBranch("main") .build(); var repository = client.sdks().repositories().link(params); } @@ -951,11 +993,11 @@ private static void _smokeCase100() throws Exception { private static void _smokeCase101() throws Exception { RepositoryLinkParams params = RepositoryLinkParams.builder() - .uid("uidxx") + .uid("UakgbKJ5m9gl0JDMbcJqL") .language(RepositoryLinkParams.Language.of("typescript")) - .repositoryId(0L) - .baseBranch("") - .prereleaseType("") + .repositoryId(123456789L) + .baseBranch("main") + .prereleaseType("beta") .build(); var repository = client.sdks().repositories().link(params); } @@ -963,7 +1005,7 @@ private static void _smokeCase101() throws Exception { private static void _smokeCase102() throws Exception { RepositoryUnlinkParams params = RepositoryUnlinkParams.builder() - .uid("uidxx") + .uid("UakgbKJ5m9gl0JDMbcJqL") .language(RepositoryUnlinkParams.Language.of("typescript")) .build(); var repository = client.sdks().repositories().unlink(params); @@ -972,9 +1014,9 @@ private static void _smokeCase102() throws Exception { private static void _smokeCase103() throws Exception { RepositoryUpdatePublishingParams params = RepositoryUpdatePublishingParams.builder() - .uid("uidxx") + .uid("UakgbKJ5m9gl0JDMbcJqL") .language(RepositoryUpdatePublishingParams.Language.of("typescript")) - .publishOnMerge(false) + .publishOnMerge(true) .build(); var repository = client.sdks().repositories().updatePublishing(params); } @@ -982,12 +1024,12 @@ private static void _smokeCase103() throws Exception { private static void _smokeCase104() throws Exception { RepositoryUpdatePublishingParams params = RepositoryUpdatePublishingParams.builder() - .uid("uidxx") + .uid("UakgbKJ5m9gl0JDMbcJqL") .language(RepositoryUpdatePublishingParams.Language.of("typescript")) - .publishOnMerge(false) + .publishOnMerge(true) .authMethod(RepositoryUpdatePublishingParams.AuthMethod.of("oidc")) .access(RepositoryUpdatePublishingParams.Access.of("public")) - .tag("") + .tag("latest") .build(); var repository = client.sdks().repositories().updatePublishing(params); } @@ -997,15 +1039,15 @@ private static void _smokeCase105() throws Exception { } private static void _smokeCase106() throws Exception { - ServerCreateParams params = ServerCreateParams.builder().name("x").build(); + ServerCreateParams params = ServerCreateParams.builder().name("Acme MCP").build(); var server = client.mcp().servers().create(params); } private static void _smokeCase107() throws Exception { ServerCreateParams params = ServerCreateParams.builder() - .name("x") - .slug("x") + .name("Acme MCP") + .slug("acme-api") .versionUids(java.util.List.of("")) .projectUids(java.util.List.of("")) .build(); @@ -1013,22 +1055,22 @@ private static void _smokeCase107() throws Exception { } private static void _smokeCase108() throws Exception { - ServerRetrieveParams params = ServerRetrieveParams.builder().id("id").build(); + ServerRetrieveParams params = ServerRetrieveParams.builder().id("42").build(); var server = client.mcp().servers().retrieve(params); } private static void _smokeCase109() throws Exception { - ServerUpdateParams params = ServerUpdateParams.builder().id("id").build(); + ServerUpdateParams params = ServerUpdateParams.builder().id("42").build(); var server = client.mcp().servers().update(params); } private static void _smokeCase110() throws Exception { ServerUpdateParams params = ServerUpdateParams.builder() - .id("id") - .name("x") - .slug("x") - .autoAddOperations(false) + .id("42") + .name("Acme MCP") + .slug("acme-api") + .autoAddOperations(true) .operations(java.util.List.of("")) .docsPages(java.util.List.of("")) .build(); @@ -1036,20 +1078,20 @@ private static void _smokeCase110() throws Exception { } private static void _smokeCase111() throws Exception { - ServerDeleteParams params = ServerDeleteParams.builder().id("id").build(); + ServerDeleteParams params = ServerDeleteParams.builder().id("42").build(); var server = client.mcp().servers().delete(params); } private static void _smokeCase112() throws Exception { - InstallationListParams params = InstallationListParams.builder().id("id").build(); + InstallationListParams params = InstallationListParams.builder().id("42").build(); var installation = client.mcp().servers().installations().list(params); } private static void _smokeCase113() throws Exception { InstallationCreateParams params = InstallationCreateParams.builder() - .id("id") - .name("x") + .id("42") + .name("Acme MCP") .documentAuth(InstallationCreateParams.DocumentAuth.builder().build()) .build(); var installation = client.mcp().servers().installations().create(params); @@ -1058,9 +1100,9 @@ private static void _smokeCase113() throws Exception { private static void _smokeCase114() throws Exception { InstallationCreateParams params = InstallationCreateParams.builder() - .id("id") - .name("x") - .slug("x") + .id("42") + .name("Acme MCP") + .slug("acme-api") .documentAuth(InstallationCreateParams.DocumentAuth.builder().build()) .build(); var installation = client.mcp().servers().installations().create(params); @@ -1068,23 +1110,23 @@ private static void _smokeCase114() throws Exception { private static void _smokeCase115() throws Exception { InstallationRetrieveParams params = - InstallationRetrieveParams.builder().id("id").installationId("installationId").build(); + InstallationRetrieveParams.builder().id("42").installationId("84").build(); var installation = client.mcp().servers().installations().retrieve(params); } private static void _smokeCase116() throws Exception { InstallationUpdateParams params = - InstallationUpdateParams.builder().id("id").installationId("installationId").build(); + InstallationUpdateParams.builder().id("42").installationId("84").build(); var installation = client.mcp().servers().installations().update(params); } private static void _smokeCase117() throws Exception { InstallationUpdateParams params = InstallationUpdateParams.builder() - .id("id") - .installationId("installationId") - .name("x") - .slug("x") + .id("42") + .installationId("84") + .name("Acme MCP") + .slug("acme-api") .isPrivate(false) .loginPortalUid("") .documentAuth(InstallationUpdateParams.DocumentAuth.builder().build()) @@ -1095,16 +1137,16 @@ private static void _smokeCase117() throws Exception { private static void _smokeCase118() throws Exception { InstallationDeleteParams params = - InstallationDeleteParams.builder().id("id").installationId("installationId").build(); + InstallationDeleteParams.builder().id("42").installationId("84").build(); var installation = client.mcp().servers().installations().delete(params); } private static void _smokeCase119() throws Exception { InstallationCreateAccessGroupParams params = InstallationCreateAccessGroupParams.builder() - .id("id") - .installationId("installationId") - .accessGroupUid("xxxxx") + .id("42") + .installationId("84") + .accessGroupUid("UakgbKJ5m9gl0JDMbcJqL") .build(); var installation = client.mcp().servers().installations().createAccessGroup(params); } @@ -1112,9 +1154,9 @@ private static void _smokeCase119() throws Exception { private static void _smokeCase120() throws Exception { InstallationDeleteAccessGroupParams params = InstallationDeleteAccessGroupParams.builder() - .id("id") - .installationId("installationId") - .accessGroupUid("xxxxx") + .id("42") + .installationId("84") + .accessGroupUid("UakgbKJ5m9gl0JDMbcJqL") .build(); var installation = client.mcp().servers().installations().deleteAccessGroup(params); } From 8f312641dd13dba604c46eb7e9400410a6fff274 Mon Sep 17 00:00:00 2001 From: scalarbot Date: Fri, 2 Oct 2026 20:37:08 +0000 Subject: [PATCH 5/6] feat(api)!: remove operation oAuth.oauthAuthorize (+9 more changes) - Removed operation `oAuth.oauthAuthorize` (`GET /v1/oauth/authorize`). - Removed operation `oAuth.oauthToken` (`POST /v1/oauth/token`). - Removed operation `oAuth.oauthRevoke` (`POST /v1/oauth/revoke`). - Removed operation `oAuth.oauthAuthorizationServerMetadata` (`GET /.well-known/oauth-authorization-server`). - Removed schema `oauth_token`. - Removed schema `oauth_scope`. - Removed schema `oauth_error`. - Removed schema `oauth_token_request`. - Removed schema `oauth_revoke_request`. - Removed schema `oauth_authorization_server_metadata`. BREAKING CHANGE: 10 breaking changes to the SDK surface. - Removed operation `oAuth.oauthAuthorize` (`GET /v1/oauth/authorize`). - Removed operation `oAuth.oauthToken` (`POST /v1/oauth/token`). - Removed operation `oAuth.oauthRevoke` (`POST /v1/oauth/revoke`). - Removed operation `oAuth.oauthAuthorizationServerMetadata` (`GET /.well-known/oauth-authorization-server`). - Removed schema `oauth_token`. - Removed schema `oauth_scope`. - Removed schema `oauth_error`. - Removed schema `oauth_token_request`. - Removed schema `oauth_revoke_request`. - Removed schema `oauth_authorization_server_metadata`. Build: w6bqazrWFLzxx6FciQhkz --- .claude/skills/scalar-java-sdk/SKILL.md | 2 +- README.md | 4 +- SKILL.md | 2 +- api.md | 96 - .../client/okhttp/ScalarOkHttpClient.kt | 4 - .../client/okhttp/ScalarOkHttpClientAsync.kt | 4 - .../kotlin/com/scalar/client/ScalarClient.kt | 7 - .../com/scalar/client/ScalarClientAsync.kt | 7 - .../scalar/client/ScalarClientAsyncImpl.kt | 16 - .../com/scalar/client/ScalarClientImpl.kt | 14 - .../kotlin/com/scalar/core/ClientOptions.kt | 12 +- ...hOauthAuthorizationServerMetadataParams.kt | 182 - .../models/oAuth/OAuthOauthAuthorizeParams.kt | 177 - .../models/oAuth/OAuthOauthRevokeParams.kt | 620 -- .../models/oAuth/OAuthOauthTokenParams.kt | 883 --- .../models/oAuth/OAuthOauthTokenResponse.kt | 232 - .../oAuth/OauthAuthorizationServerMetadata.kt | 719 -- .../com/scalar/models/oAuth/OauthError.kt | 223 - .../com/scalar/models/oAuth/OauthScope.kt | 144 - .../com/scalar/models/oAuth/OauthToken.kt | 339 - .../services/async/OAuthServiceAsync.kt | 209 - .../services/async/OAuthServiceAsyncImpl.kt | 201 - .../scalar/services/blocking/OAuthService.kt | 211 - .../services/blocking/OAuthServiceImpl.kt | 186 - .../proguard/ProGuardCompatibilityTest.kt | 1 - scalar-sdk.manifest.json | 6896 +++++++---------- tests/smoke-test.java | 68 +- 27 files changed, 2901 insertions(+), 8558 deletions(-) delete mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthAuthorizationServerMetadataParams.kt delete mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthAuthorizeParams.kt delete mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthRevokeParams.kt delete mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthTokenParams.kt delete mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthTokenResponse.kt delete mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OauthAuthorizationServerMetadata.kt delete mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OauthError.kt delete mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OauthScope.kt delete mode 100644 scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OauthToken.kt delete mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/async/OAuthServiceAsync.kt delete mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/async/OAuthServiceAsyncImpl.kt delete mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/blocking/OAuthService.kt delete mode 100644 scalar-java-core/src/main/kotlin/com/scalar/services/blocking/OAuthServiceImpl.kt diff --git a/.claude/skills/scalar-java-sdk/SKILL.md b/.claude/skills/scalar-java-sdk/SKILL.md index 798ef8b..a56c598 100644 --- a/.claude/skills/scalar-java-sdk/SKILL.md +++ b/.claude/skills/scalar-java-sdk/SKILL.md @@ -26,7 +26,7 @@ ScalarClient client = Provide credentials using the options below. Environment variables are read automatically when the target runtime supports them: - `bearerAuth` (env: `BEARER_AUTH`) — Credential for the BearerAuth client option. -- `oAuth2` (env: `SCALAR_O_AUTH2`) — Authorization code with PKCE (S256), for apps acting on behalf of a Scalar user. Each scope implies the weaker ones. +- `oAuth2` (env: `SCALAR_OAUTH_TOKEN`) — Authorization code with PKCE (S256), for apps acting on behalf of a Scalar user. Each scope implies the weaker ones. ## Calling operations diff --git a/README.md b/README.md index d25418f..f22abc0 100644 --- a/README.md +++ b/README.md @@ -202,7 +202,7 @@ Pass credentials to the generated client constructor. Environment variables are | Option | Type | Default | Description | | --- | --- | --- | --- | | `bearerAuth` | `string \| provider` | - | Credential for the BearerAuth client option. Defaults to BEARER_AUTH. | -| `oAuth2` | `string \| provider` | - | Authorization code with PKCE (S256), for apps acting on behalf of a Scalar user. Each scope implies the weaker ones. Defaults to SCALAR_O_AUTH2. | +| `oAuth2` | `string \| provider` | - | Authorization code with PKCE (S256), for apps acting on behalf of a Scalar user. Each scope implies the weaker ones. Defaults to SCALAR_OAUTH_TOKEN. | Declared schemes: @@ -250,7 +250,7 @@ ScalarClient client = | Option | Type | Default | Description | | --- | --- | --- | --- | | `bearerAuth` | `String` | `System.getenv("BEARER_AUTH")` | Credential for the BearerAuth client option. | -| `oAuth2` | `String` | `System.getenv("SCALAR_O_AUTH2")` | Authorization code with PKCE (S256), for apps acting on behalf of a Scalar user. Each scope implies the weaker ones. | +| `oAuth2` | `String` | `System.getenv("SCALAR_OAUTH_TOKEN")` | Authorization code with PKCE (S256), for apps acting on behalf of a Scalar user. Each scope implies the weaker ones. | | `baseUrl` | `String` | - | Override the default API base URL. | | `putHeader` | `(String, String) -> Builder` | - | Set a header sent with every request. | | `putQueryParam` | `(String, String) -> Builder` | - | Set a query parameter sent with every request. | diff --git a/SKILL.md b/SKILL.md index 85a5904..c1aab38 100644 --- a/SKILL.md +++ b/SKILL.md @@ -26,7 +26,7 @@ ScalarClient client = Provide credentials using the options below. Environment variables are read automatically when the target runtime supports them: - `bearerAuth` (env: `BEARER_AUTH`) — Credential for the BearerAuth client option. -- `oAuth2` (env: `SCALAR_O_AUTH2`) — Authorization code with PKCE (S256), for apps acting on behalf of a Scalar user. Each scope implies the weaker ones. +- `oAuth2` (env: `SCALAR_OAUTH_TOKEN`) — Authorization code with PKCE (S256), for apps acting on behalf of a Scalar user. Each scope implies the weaker ones. ## Calling operations diff --git a/api.md b/api.md index 5918aa4..df9ffdc 100644 --- a/api.md +++ b/api.md @@ -116,11 +116,6 @@ Complete reference of every operation, grouped by resource. See [the README](./R - [Delete an installation](#delete-an-installation) - [Add an access group](#add-an-access-group) - [Remove an access group](#remove-an-access-group) -- [`OAuth`](#oauth) - - [Start an OAuth authorization](#start-an-oauth-authorization) - - [Exchange a code or refresh token](#exchange-a-code-or-refresh-token) - - [Revoke a refresh token](#revoke-a-refresh-token) - - [Authorization server metadata](#authorization-server-metadata) ## Setup @@ -2465,94 +2460,3 @@ var installation = client.mcp().servers().installations().deleteAccessGroup(para System.out.println(installation); ``` - -## `OAuth` - -OAuth - -### Start an OAuth authorization - -Authorization endpoint (RFC 6749 §4.1.1 with PKCE, RFC 7636). Validates the request and sends the user to the Scalar dashboard to approve it; the user returns to `redirect_uri` with a `code` to exchange at the token endpoint. Only `response_type=code` with `code_challenge_method=S256` is supported. - -| Direction | Type | -| --- | --- | -| Request | [`OAuthOauthAuthorizeParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthAuthorizeParams.kt) | - -```java -import com.scalar.client.ScalarClient; -import com.scalar.client.okhttp.ScalarOkHttpClient; - -ScalarClient client = - ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); - -var oAuth = client.oAuth().oauthAuthorize(); - -System.out.println(oAuth); -``` - -### Exchange a code or refresh token - -Token endpoint (RFC 6749 §4.1.3 and §6). Accepts `application/x-www-form-urlencoded`. Confidential clients authenticate with HTTP Basic or `client_secret` in the body; public clients send `client_id` alone. The `authorization_code` grant needs `code`, `redirect_uri` and `code_verifier`; the `refresh_token` grant needs `refresh_token` and may narrow `scope`. - -| Direction | Type | -| --- | --- | -| Request | [`OAuthOauthTokenParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthTokenParams.kt) | -| Response | [`OAuthOauthTokenResponse`](./scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthTokenResponse.kt) | - -```java -import com.scalar.client.ScalarClient; -import com.scalar.client.okhttp.ScalarOkHttpClient; -import com.scalar.models.oAuth.OAuthOauthTokenParams; - -ScalarClient client = - ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); - -OAuthOauthTokenParams params = OAuthOauthTokenParams.builder().grantType("").build(); -var oAuth = client.oAuth().oauthToken(params); - -System.out.println(oAuth); -``` - -### Revoke a refresh token - -Revocation endpoint (RFC 7009). Revokes the refresh token and every token issued alongside it. The client authenticates as it does at the token endpoint. Responds 200 whether or not the token was live, as the RFC requires. - -| Direction | Type | -| --- | --- | -| Request | [`OAuthOauthRevokeParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthRevokeParams.kt) | -| Response | [`OauthError?`](./scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OauthError.kt) | - -```java -import com.scalar.client.ScalarClient; -import com.scalar.client.okhttp.ScalarOkHttpClient; -import com.scalar.models.oAuth.OAuthOauthRevokeParams; - -ScalarClient client = - ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); - -OAuthOauthRevokeParams params = OAuthOauthRevokeParams.builder().token("").build(); -var oAuth = client.oAuth().oauthRevoke(params); - -System.out.println(oAuth); -``` - -### Authorization server metadata - -Discovery document for OAuth clients (RFC 8414): where the endpoints are and what they support. - -| Direction | Type | -| --- | --- | -| Request | [`OAuthOauthAuthorizationServerMetadataParams`](./scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthAuthorizationServerMetadataParams.kt) | -| Response | [`OauthAuthorizationServerMetadata`](./scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OauthAuthorizationServerMetadata.kt) | - -```java -import com.scalar.client.ScalarClient; -import com.scalar.client.okhttp.ScalarOkHttpClient; - -ScalarClient client = - ScalarOkHttpClient.builder().bearerAuth(System.getenv("BEARER_AUTH")).build(); - -var oAuth = client.oAuth().oauthAuthorizationServerMetadata(); - -System.out.println(oAuth); -``` diff --git a/scalar-java-client-okhttp/src/main/kotlin/com/scalar/client/okhttp/ScalarOkHttpClient.kt b/scalar-java-client-okhttp/src/main/kotlin/com/scalar/client/okhttp/ScalarOkHttpClient.kt index 06a7eae..9c4ce98 100644 --- a/scalar-java-client-okhttp/src/main/kotlin/com/scalar/client/okhttp/ScalarOkHttpClient.kt +++ b/scalar-java-client-okhttp/src/main/kotlin/com/scalar/client/okhttp/ScalarOkHttpClient.kt @@ -299,10 +299,6 @@ class ScalarOkHttpClient private constructor() { /** Alias for calling [Builder.bearerAuth] with `bearerAuth.orElse(null)`. */ fun bearerAuth(bearerAuth: Optional) = bearerAuth(bearerAuth.getOrNull()) - /** - * Authorization code with PKCE (S256), for apps acting on behalf of a Scalar user. Each - * scope implies the weaker ones. - */ fun oAuth2(oAuth2: String?) = apply { clientOptions.oAuth2(oAuth2) } /** Alias for calling [Builder.oAuth2] with `oAuth2.orElse(null)`. */ diff --git a/scalar-java-client-okhttp/src/main/kotlin/com/scalar/client/okhttp/ScalarOkHttpClientAsync.kt b/scalar-java-client-okhttp/src/main/kotlin/com/scalar/client/okhttp/ScalarOkHttpClientAsync.kt index de911cc..d7b5455 100644 --- a/scalar-java-client-okhttp/src/main/kotlin/com/scalar/client/okhttp/ScalarOkHttpClientAsync.kt +++ b/scalar-java-client-okhttp/src/main/kotlin/com/scalar/client/okhttp/ScalarOkHttpClientAsync.kt @@ -299,10 +299,6 @@ class ScalarOkHttpClientAsync private constructor() { /** Alias for calling [Builder.bearerAuth] with `bearerAuth.orElse(null)`. */ fun bearerAuth(bearerAuth: Optional) = bearerAuth(bearerAuth.getOrNull()) - /** - * Authorization code with PKCE (S256), for apps acting on behalf of a Scalar user. Each - * scope implies the weaker ones. - */ fun oAuth2(oAuth2: String?) = apply { clientOptions.oAuth2(oAuth2) } /** Alias for calling [Builder.oAuth2] with `oAuth2.orElse(null)`. */ diff --git a/scalar-java-core/src/main/kotlin/com/scalar/client/ScalarClient.kt b/scalar-java-core/src/main/kotlin/com/scalar/client/ScalarClient.kt index c49cf0e..35a4b73 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/client/ScalarClient.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/client/ScalarClient.kt @@ -8,7 +8,6 @@ import com.scalar.services.blocking.AuthenticationService import com.scalar.services.blocking.LoginPortalService import com.scalar.services.blocking.McpService import com.scalar.services.blocking.NamespaceService -import com.scalar.services.blocking.OAuthService import com.scalar.services.blocking.RegistryService import com.scalar.services.blocking.RuleService import com.scalar.services.blocking.ScalarDocService @@ -89,9 +88,6 @@ interface ScalarClient { fun mcp(): McpService - /** OAuth */ - fun oAuth(): OAuthService - /** * Closes this client, relinquishing any underlying resources. * @@ -149,8 +145,5 @@ interface ScalarClient { fun sdks(): SdkService.WithRawResponse fun mcp(): McpService.WithRawResponse - - /** OAuth */ - fun oAuth(): OAuthService.WithRawResponse } } diff --git a/scalar-java-core/src/main/kotlin/com/scalar/client/ScalarClientAsync.kt b/scalar-java-core/src/main/kotlin/com/scalar/client/ScalarClientAsync.kt index bdfdcfa..47cecd4 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/client/ScalarClientAsync.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/client/ScalarClientAsync.kt @@ -8,7 +8,6 @@ import com.scalar.services.async.AuthenticationServiceAsync import com.scalar.services.async.LoginPortalServiceAsync import com.scalar.services.async.McpServiceAsync import com.scalar.services.async.NamespaceServiceAsync -import com.scalar.services.async.OAuthServiceAsync import com.scalar.services.async.RegistryServiceAsync import com.scalar.services.async.RuleServiceAsync import com.scalar.services.async.ScalarDocServiceAsync @@ -89,9 +88,6 @@ interface ScalarClientAsync { fun mcp(): McpServiceAsync - /** OAuth */ - fun oAuth(): OAuthServiceAsync - /** * Closes this client, relinquishing any underlying resources. * @@ -151,8 +147,5 @@ interface ScalarClientAsync { fun sdks(): SdkServiceAsync.WithRawResponse fun mcp(): McpServiceAsync.WithRawResponse - - /** OAuth */ - fun oAuth(): OAuthServiceAsync.WithRawResponse } } diff --git a/scalar-java-core/src/main/kotlin/com/scalar/client/ScalarClientAsyncImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/client/ScalarClientAsyncImpl.kt index ade5e83..e813fbb 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/client/ScalarClientAsyncImpl.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/client/ScalarClientAsyncImpl.kt @@ -14,8 +14,6 @@ import com.scalar.services.async.McpServiceAsync import com.scalar.services.async.McpServiceAsyncImpl import com.scalar.services.async.NamespaceServiceAsync import com.scalar.services.async.NamespaceServiceAsyncImpl -import com.scalar.services.async.OAuthServiceAsync -import com.scalar.services.async.OAuthServiceAsyncImpl import com.scalar.services.async.RegistryServiceAsync import com.scalar.services.async.RegistryServiceAsyncImpl import com.scalar.services.async.RuleServiceAsync @@ -89,10 +87,6 @@ class ScalarClientAsyncImpl(private val clientOptions: ClientOptions) : ScalarCl private val mcp: McpServiceAsync by lazy { McpServiceAsyncImpl(clientOptionsWithUserAgent) } - private val oAuth: OAuthServiceAsync by lazy { - OAuthServiceAsyncImpl(clientOptionsWithUserAgent) - } - override fun sync(): ScalarClient = sync override fun withRawResponse(): ScalarClientAsync.WithRawResponse = withRawResponse @@ -135,9 +129,6 @@ class ScalarClientAsyncImpl(private val clientOptions: ClientOptions) : ScalarCl override fun mcp(): McpServiceAsync = mcp - /** OAuth */ - override fun oAuth(): OAuthServiceAsync = oAuth - override fun close() = clientOptions.close() class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : @@ -191,10 +182,6 @@ class ScalarClientAsyncImpl(private val clientOptions: ClientOptions) : ScalarCl McpServiceAsyncImpl.WithRawResponseImpl(clientOptions) } - private val oAuth: OAuthServiceAsync.WithRawResponse by lazy { - OAuthServiceAsyncImpl.WithRawResponseImpl(clientOptions) - } - override fun withOptions( modifier: Consumer ): ScalarClientAsync.WithRawResponse = @@ -236,8 +223,5 @@ class ScalarClientAsyncImpl(private val clientOptions: ClientOptions) : ScalarCl override fun sdks(): SdkServiceAsync.WithRawResponse = sdks override fun mcp(): McpServiceAsync.WithRawResponse = mcp - - /** OAuth */ - override fun oAuth(): OAuthServiceAsync.WithRawResponse = oAuth } } diff --git a/scalar-java-core/src/main/kotlin/com/scalar/client/ScalarClientImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/client/ScalarClientImpl.kt index b7360f7..6e40e50 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/client/ScalarClientImpl.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/client/ScalarClientImpl.kt @@ -14,8 +14,6 @@ import com.scalar.services.blocking.McpService import com.scalar.services.blocking.McpServiceImpl import com.scalar.services.blocking.NamespaceService import com.scalar.services.blocking.NamespaceServiceImpl -import com.scalar.services.blocking.OAuthService -import com.scalar.services.blocking.OAuthServiceImpl import com.scalar.services.blocking.RegistryService import com.scalar.services.blocking.RegistryServiceImpl import com.scalar.services.blocking.RuleService @@ -85,8 +83,6 @@ class ScalarClientImpl(private val clientOptions: ClientOptions) : ScalarClient private val mcp: McpService by lazy { McpServiceImpl(clientOptionsWithUserAgent) } - private val oAuth: OAuthService by lazy { OAuthServiceImpl(clientOptionsWithUserAgent) } - override fun async(): ScalarClientAsync = async override fun withRawResponse(): ScalarClient.WithRawResponse = withRawResponse @@ -129,9 +125,6 @@ class ScalarClientImpl(private val clientOptions: ClientOptions) : ScalarClient override fun mcp(): McpService = mcp - /** OAuth */ - override fun oAuth(): OAuthService = oAuth - override fun close() = clientOptions.close() class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : @@ -185,10 +178,6 @@ class ScalarClientImpl(private val clientOptions: ClientOptions) : ScalarClient McpServiceImpl.WithRawResponseImpl(clientOptions) } - private val oAuth: OAuthService.WithRawResponse by lazy { - OAuthServiceImpl.WithRawResponseImpl(clientOptions) - } - override fun withOptions( modifier: Consumer ): ScalarClient.WithRawResponse = @@ -230,8 +219,5 @@ class ScalarClientImpl(private val clientOptions: ClientOptions) : ScalarClient override fun sdks(): SdkService.WithRawResponse = sdks override fun mcp(): McpService.WithRawResponse = mcp - - /** OAuth */ - override fun oAuth(): OAuthService.WithRawResponse = oAuth } } diff --git a/scalar-java-core/src/main/kotlin/com/scalar/core/ClientOptions.kt b/scalar-java-core/src/main/kotlin/com/scalar/core/ClientOptions.kt index 76d0ea7..cbf13b5 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/core/ClientOptions.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/core/ClientOptions.kt @@ -138,10 +138,6 @@ private constructor( fun bearerAuth(): Optional = Optional.ofNullable(bearerAuth) - /** - * Authorization code with PKCE (S256), for apps acting on behalf of a Scalar user. Each scope - * implies the weaker ones. - */ fun oAuth2(): Optional = Optional.ofNullable(oAuth2) fun toBuilder() = Builder().from(this) @@ -341,10 +337,6 @@ private constructor( /** Alias for calling [Builder.bearerAuth] with `bearerAuth.orElse(null)`. */ fun bearerAuth(bearerAuth: Optional) = bearerAuth(bearerAuth.getOrNull()) - /** - * Authorization code with PKCE (S256), for apps acting on behalf of a Scalar user. Each - * scope implies the weaker ones. - */ fun oAuth2(oAuth2: String?) = apply { this.oAuth2 = oAuth2 } /** Alias for calling [Builder.oAuth2] with `oAuth2.orElse(null)`. */ @@ -440,7 +432,7 @@ private constructor( * |Setter |System property |Environment variable|Required|Default value | * |------------|-------------------|--------------------|--------|-----------------------------| * |`bearerAuth`|`scalar.bearerAuth`|`BEARER_AUTH` |false |- | - * |`oAuth2` |`scalar.oAuth2` |`SCALAR_O_AUTH2` |false |- | + * |`oAuth2` |`scalar.oauthToken`|`SCALAR_OAUTH_TOKEN`|false |- | * |`baseUrl` |`scalar.baseUrl` |`SCALAR_BASE_URL` |true |`"https://access.scalar.com"`| * * System properties take precedence over environment variables. @@ -453,7 +445,7 @@ private constructor( (System.getProperty("scalar.bearerAuth") ?: System.getenv("BEARER_AUTH"))?.let { bearerAuth(it) } - (System.getProperty("scalar.oAuth2") ?: System.getenv("SCALAR_O_AUTH2"))?.let { + (System.getProperty("scalar.oauthToken") ?: System.getenv("SCALAR_OAUTH_TOKEN"))?.let { oAuth2(it) } System.getenv("SCALAR_CUSTOM_HEADERS")?.let { customHeadersEnv -> diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthAuthorizationServerMetadataParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthAuthorizationServerMetadataParams.kt deleted file mode 100644 index 8aabf6c..0000000 --- a/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthAuthorizationServerMetadataParams.kt +++ /dev/null @@ -1,182 +0,0 @@ -// File generated by Scalar SDK Generator. DO NOT EDIT. - -package com.scalar.models.oAuth - -import com.scalar.core.Params -import com.scalar.core.http.Headers -import com.scalar.core.http.QueryParams -import java.util.Objects - -/** - * Discovery document for OAuth clients (RFC 8414): where the endpoints are and what they support. - */ -class OAuthOauthAuthorizationServerMetadataParams -private constructor( - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun none(): OAuthOauthAuthorizationServerMetadataParams = builder().build() - - /** - * Returns a mutable builder for constructing an instance of - * [OAuthOauthAuthorizationServerMetadataParams]. - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [OAuthOauthAuthorizationServerMetadataParams]. */ - class Builder internal constructor() { - - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from( - oAuthOauthAuthorizationServerMetadataParams: OAuthOauthAuthorizationServerMetadataParams - ) = apply { - additionalHeaders = - oAuthOauthAuthorizationServerMetadataParams.additionalHeaders.toBuilder() - additionalQueryParams = - oAuthOauthAuthorizationServerMetadataParams.additionalQueryParams.toBuilder() - } - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [OAuthOauthAuthorizationServerMetadataParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): OAuthOauthAuthorizationServerMetadataParams = - OAuthOauthAuthorizationServerMetadataParams( - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is OAuthOauthAuthorizationServerMetadataParams && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = Objects.hash(additionalHeaders, additionalQueryParams) - - override fun toString() = - "OAuthOauthAuthorizationServerMetadataParams{additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthAuthorizeParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthAuthorizeParams.kt deleted file mode 100644 index befaac0..0000000 --- a/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthAuthorizeParams.kt +++ /dev/null @@ -1,177 +0,0 @@ -// File generated by Scalar SDK Generator. DO NOT EDIT. - -package com.scalar.models.oAuth - -import com.scalar.core.Params -import com.scalar.core.http.Headers -import com.scalar.core.http.QueryParams -import java.util.Objects - -/** - * Authorization endpoint (RFC 6749 §4.1.1 with PKCE, RFC 7636). Validates the request and sends the - * user to the Scalar dashboard to approve it; the user returns to `redirect_uri` with a `code` to - * exchange at the token endpoint. Only `response_type=code` with `code_challenge_method=S256` is - * supported. - */ -class OAuthOauthAuthorizeParams -private constructor( - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun none(): OAuthOauthAuthorizeParams = builder().build() - - /** - * Returns a mutable builder for constructing an instance of [OAuthOauthAuthorizeParams]. - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [OAuthOauthAuthorizeParams]. */ - class Builder internal constructor() { - - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(oAuthOauthAuthorizeParams: OAuthOauthAuthorizeParams) = apply { - additionalHeaders = oAuthOauthAuthorizeParams.additionalHeaders.toBuilder() - additionalQueryParams = oAuthOauthAuthorizeParams.additionalQueryParams.toBuilder() - } - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [OAuthOauthAuthorizeParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): OAuthOauthAuthorizeParams = - OAuthOauthAuthorizeParams(additionalHeaders.build(), additionalQueryParams.build()) - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is OAuthOauthAuthorizeParams && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = Objects.hash(additionalHeaders, additionalQueryParams) - - override fun toString() = - "OAuthOauthAuthorizeParams{additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthRevokeParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthRevokeParams.kt deleted file mode 100644 index 091c7f7..0000000 --- a/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthRevokeParams.kt +++ /dev/null @@ -1,620 +0,0 @@ -// File generated by Scalar SDK Generator. DO NOT EDIT. - -package com.scalar.models.oAuth - -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import com.scalar.core.ExcludeMissing -import com.scalar.core.JsonField -import com.scalar.core.JsonMissing -import com.scalar.core.JsonValue -import com.scalar.core.Params -import com.scalar.core.checkRequired -import com.scalar.core.http.Headers -import com.scalar.core.http.QueryParams -import com.scalar.errors.ScalarInvalidDataException -import java.util.Collections -import java.util.Objects -import java.util.Optional - -/** - * Revocation endpoint (RFC 7009). Revokes the refresh token and every token issued alongside it. - * The client authenticates as it does at the token endpoint. Responds 200 whether or not the token - * was live, as the RFC requires. - */ -class OAuthOauthRevokeParams -private constructor( - private val body: Body, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun token(): String = body.token() - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun tokenTypeHint(): Optional = body.tokenTypeHint() - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun clientId(): Optional = body.clientId() - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun clientSecret(): Optional = body.clientSecret() - - /** - * Returns the raw JSON value of [token]. - * - * Unlike [token], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _token(): JsonField = body._token() - - /** - * Returns the raw JSON value of [tokenTypeHint]. - * - * Unlike [tokenTypeHint], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _tokenTypeHint(): JsonField = body._tokenTypeHint() - - /** - * Returns the raw JSON value of [clientId]. - * - * Unlike [clientId], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _clientId(): JsonField = body._clientId() - - /** - * Returns the raw JSON value of [clientSecret]. - * - * Unlike [clientSecret], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _clientSecret(): JsonField = body._clientSecret() - - fun _additionalBodyProperties(): Map = body._additionalProperties() - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [OAuthOauthRevokeParams]. - * - * The following fields are required: - * ```kotlin - * .token() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [OAuthOauthRevokeParams]. */ - class Builder internal constructor() { - - private var body: Body.Builder = Body.builder() - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(oAuthOauthRevokeParams: OAuthOauthRevokeParams) = apply { - body = oAuthOauthRevokeParams.body.toBuilder() - additionalHeaders = oAuthOauthRevokeParams.additionalHeaders.toBuilder() - additionalQueryParams = oAuthOauthRevokeParams.additionalQueryParams.toBuilder() - } - - /** - * Sets the entire request body. - * - * This is generally only useful if you are already constructing the body separately. - * Otherwise, it's more convenient to use the top-level setters instead: - * - [token] - * - [tokenTypeHint] - * - [clientId] - * - [clientSecret] - */ - fun body(body: Body) = apply { this.body = body.toBuilder() } - - fun token(token: String) = apply { body.token(token) } - - /** - * Sets [Builder.token] to an arbitrary JSON value. - * - * You should usually call [Builder.token] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun token(token: JsonField) = apply { body.token(token) } - - fun tokenTypeHint(tokenTypeHint: String) = apply { body.tokenTypeHint(tokenTypeHint) } - - /** - * Sets [Builder.tokenTypeHint] to an arbitrary JSON value. - * - * You should usually call [Builder.tokenTypeHint] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun tokenTypeHint(tokenTypeHint: JsonField) = apply { - body.tokenTypeHint(tokenTypeHint) - } - - fun clientId(clientId: String) = apply { body.clientId(clientId) } - - /** - * Sets [Builder.clientId] to an arbitrary JSON value. - * - * You should usually call [Builder.clientId] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun clientId(clientId: JsonField) = apply { body.clientId(clientId) } - - fun clientSecret(clientSecret: String) = apply { body.clientSecret(clientSecret) } - - /** - * Sets [Builder.clientSecret] to an arbitrary JSON value. - * - * You should usually call [Builder.clientSecret] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun clientSecret(clientSecret: JsonField) = apply { - body.clientSecret(clientSecret) - } - - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - body.additionalProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - body.putAdditionalProperty(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - body.putAllAdditionalProperties(additionalBodyProperties) - } - - fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } - - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - body.removeAllAdditionalProperties(keys) - } - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [OAuthOauthRevokeParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```kotlin - * .token() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): OAuthOauthRevokeParams = - OAuthOauthRevokeParams( - body.build(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - fun _body(): Body = body - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - class Body - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val token: JsonField, - private val tokenTypeHint: JsonField, - private val clientId: JsonField, - private val clientSecret: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), - @JsonProperty("token_type_hint") - @ExcludeMissing - tokenTypeHint: JsonField = JsonMissing.of(), - @JsonProperty("client_id") - @ExcludeMissing - clientId: JsonField = JsonMissing.of(), - @JsonProperty("client_secret") - @ExcludeMissing - clientSecret: JsonField = JsonMissing.of(), - ) : this(token, tokenTypeHint, clientId, clientSecret, mutableMapOf()) - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun token(): String = token.getRequired("token") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun tokenTypeHint(): Optional = tokenTypeHint.getOptional("token_type_hint") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun clientId(): Optional = clientId.getOptional("client_id") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun clientSecret(): Optional = clientSecret.getOptional("client_secret") - - /** - * Returns the raw JSON value of [token]. - * - * Unlike [token], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("token") @ExcludeMissing fun _token(): JsonField = token - - /** - * Returns the raw JSON value of [tokenTypeHint]. - * - * Unlike [tokenTypeHint], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("token_type_hint") - @ExcludeMissing - fun _tokenTypeHint(): JsonField = tokenTypeHint - - /** - * Returns the raw JSON value of [clientId]. - * - * Unlike [clientId], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("client_id") @ExcludeMissing fun _clientId(): JsonField = clientId - - /** - * Returns the raw JSON value of [clientSecret]. - * - * Unlike [clientSecret], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("client_secret") - @ExcludeMissing - fun _clientSecret(): JsonField = clientSecret - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [Body]. - * - * The following fields are required: - * ```kotlin - * .token() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Body]. */ - class Builder internal constructor() { - - private var token: JsonField? = null - private var tokenTypeHint: JsonField = JsonMissing.of() - private var clientId: JsonField = JsonMissing.of() - private var clientSecret: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(body: Body) = apply { - token = body.token - tokenTypeHint = body.tokenTypeHint - clientId = body.clientId - clientSecret = body.clientSecret - additionalProperties = body.additionalProperties.toMutableMap() - } - - fun token(token: String) = token(JsonField.of(token)) - - /** - * Sets [Builder.token] to an arbitrary JSON value. - * - * You should usually call [Builder.token] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun token(token: JsonField) = apply { this.token = token } - - fun tokenTypeHint(tokenTypeHint: String) = tokenTypeHint(JsonField.of(tokenTypeHint)) - - /** - * Sets [Builder.tokenTypeHint] to an arbitrary JSON value. - * - * You should usually call [Builder.tokenTypeHint] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun tokenTypeHint(tokenTypeHint: JsonField) = apply { - this.tokenTypeHint = tokenTypeHint - } - - fun clientId(clientId: String) = clientId(JsonField.of(clientId)) - - /** - * Sets [Builder.clientId] to an arbitrary JSON value. - * - * You should usually call [Builder.clientId] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun clientId(clientId: JsonField) = apply { this.clientId = clientId } - - fun clientSecret(clientSecret: String) = clientSecret(JsonField.of(clientSecret)) - - /** - * Sets [Builder.clientSecret] to an arbitrary JSON value. - * - * You should usually call [Builder.clientSecret] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun clientSecret(clientSecret: JsonField) = apply { - this.clientSecret = clientSecret - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Body]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```kotlin - * .token() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Body = - Body( - checkRequired("token", token), - tokenTypeHint, - clientId, - clientSecret, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws ScalarInvalidDataException if any value type in this object doesn't match its - * expected type. - */ - fun validate(): Body = apply { - if (validated) { - return@apply - } - - token() - tokenTypeHint() - clientId() - clientSecret() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ScalarInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (token.asKnown().isPresent) 1 else 0) + - (if (tokenTypeHint.asKnown().isPresent) 1 else 0) + - (if (clientId.asKnown().isPresent) 1 else 0) + - (if (clientSecret.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Body && - token == other.token && - tokenTypeHint == other.tokenTypeHint && - clientId == other.clientId && - clientSecret == other.clientSecret && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(token, tokenTypeHint, clientId, clientSecret, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Body{token=$token, tokenTypeHint=$tokenTypeHint, clientId=$clientId, clientSecret=$clientSecret, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is OAuthOauthRevokeParams && - body == other.body && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = Objects.hash(body, additionalHeaders, additionalQueryParams) - - override fun toString() = - "OAuthOauthRevokeParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthTokenParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthTokenParams.kt deleted file mode 100644 index 73d2e79..0000000 --- a/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthTokenParams.kt +++ /dev/null @@ -1,883 +0,0 @@ -// File generated by Scalar SDK Generator. DO NOT EDIT. - -package com.scalar.models.oAuth - -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import com.scalar.core.ExcludeMissing -import com.scalar.core.JsonField -import com.scalar.core.JsonMissing -import com.scalar.core.JsonValue -import com.scalar.core.Params -import com.scalar.core.checkRequired -import com.scalar.core.http.Headers -import com.scalar.core.http.QueryParams -import com.scalar.errors.ScalarInvalidDataException -import java.util.Collections -import java.util.Objects -import java.util.Optional - -/** - * Token endpoint (RFC 6749 §4.1.3 and §6). Accepts `application/x-www-form-urlencoded`. - * Confidential clients authenticate with HTTP Basic or `client_secret` in the body; public clients - * send `client_id` alone. The `authorization_code` grant needs `code`, `redirect_uri` and - * `code_verifier`; the `refresh_token` grant needs `refresh_token` and may narrow `scope`. - */ -class OAuthOauthTokenParams -private constructor( - private val body: Body, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun grantType(): String = body.grantType() - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun clientId(): Optional = body.clientId() - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun clientSecret(): Optional = body.clientSecret() - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun code(): Optional = body.code() - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun redirectUri(): Optional = body.redirectUri() - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun codeVerifier(): Optional = body.codeVerifier() - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun refreshToken(): Optional = body.refreshToken() - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun scope(): Optional = body.scope() - - /** - * Returns the raw JSON value of [grantType]. - * - * Unlike [grantType], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _grantType(): JsonField = body._grantType() - - /** - * Returns the raw JSON value of [clientId]. - * - * Unlike [clientId], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _clientId(): JsonField = body._clientId() - - /** - * Returns the raw JSON value of [clientSecret]. - * - * Unlike [clientSecret], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _clientSecret(): JsonField = body._clientSecret() - - /** - * Returns the raw JSON value of [code]. - * - * Unlike [code], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _code(): JsonField = body._code() - - /** - * Returns the raw JSON value of [redirectUri]. - * - * Unlike [redirectUri], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _redirectUri(): JsonField = body._redirectUri() - - /** - * Returns the raw JSON value of [codeVerifier]. - * - * Unlike [codeVerifier], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _codeVerifier(): JsonField = body._codeVerifier() - - /** - * Returns the raw JSON value of [refreshToken]. - * - * Unlike [refreshToken], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _refreshToken(): JsonField = body._refreshToken() - - /** - * Returns the raw JSON value of [scope]. - * - * Unlike [scope], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _scope(): JsonField = body._scope() - - fun _additionalBodyProperties(): Map = body._additionalProperties() - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [OAuthOauthTokenParams]. - * - * The following fields are required: - * ```kotlin - * .grantType() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [OAuthOauthTokenParams]. */ - class Builder internal constructor() { - - private var body: Body.Builder = Body.builder() - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(oAuthOauthTokenParams: OAuthOauthTokenParams) = apply { - body = oAuthOauthTokenParams.body.toBuilder() - additionalHeaders = oAuthOauthTokenParams.additionalHeaders.toBuilder() - additionalQueryParams = oAuthOauthTokenParams.additionalQueryParams.toBuilder() - } - - /** - * Sets the entire request body. - * - * This is generally only useful if you are already constructing the body separately. - * Otherwise, it's more convenient to use the top-level setters instead: - * - [grantType] - * - [clientId] - * - [clientSecret] - * - [code] - * - [redirectUri] - * - etc. - */ - fun body(body: Body) = apply { this.body = body.toBuilder() } - - fun grantType(grantType: String) = apply { body.grantType(grantType) } - - /** - * Sets [Builder.grantType] to an arbitrary JSON value. - * - * You should usually call [Builder.grantType] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun grantType(grantType: JsonField) = apply { body.grantType(grantType) } - - fun clientId(clientId: String) = apply { body.clientId(clientId) } - - /** - * Sets [Builder.clientId] to an arbitrary JSON value. - * - * You should usually call [Builder.clientId] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun clientId(clientId: JsonField) = apply { body.clientId(clientId) } - - fun clientSecret(clientSecret: String) = apply { body.clientSecret(clientSecret) } - - /** - * Sets [Builder.clientSecret] to an arbitrary JSON value. - * - * You should usually call [Builder.clientSecret] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun clientSecret(clientSecret: JsonField) = apply { - body.clientSecret(clientSecret) - } - - fun code(code: String) = apply { body.code(code) } - - /** - * Sets [Builder.code] to an arbitrary JSON value. - * - * You should usually call [Builder.code] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun code(code: JsonField) = apply { body.code(code) } - - fun redirectUri(redirectUri: String) = apply { body.redirectUri(redirectUri) } - - /** - * Sets [Builder.redirectUri] to an arbitrary JSON value. - * - * You should usually call [Builder.redirectUri] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun redirectUri(redirectUri: JsonField) = apply { body.redirectUri(redirectUri) } - - fun codeVerifier(codeVerifier: String) = apply { body.codeVerifier(codeVerifier) } - - /** - * Sets [Builder.codeVerifier] to an arbitrary JSON value. - * - * You should usually call [Builder.codeVerifier] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun codeVerifier(codeVerifier: JsonField) = apply { - body.codeVerifier(codeVerifier) - } - - fun refreshToken(refreshToken: String) = apply { body.refreshToken(refreshToken) } - - /** - * Sets [Builder.refreshToken] to an arbitrary JSON value. - * - * You should usually call [Builder.refreshToken] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun refreshToken(refreshToken: JsonField) = apply { - body.refreshToken(refreshToken) - } - - fun scope(scope: String) = apply { body.scope(scope) } - - /** - * Sets [Builder.scope] to an arbitrary JSON value. - * - * You should usually call [Builder.scope] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun scope(scope: JsonField) = apply { body.scope(scope) } - - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - body.additionalProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - body.putAdditionalProperty(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - body.putAllAdditionalProperties(additionalBodyProperties) - } - - fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } - - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - body.removeAllAdditionalProperties(keys) - } - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [OAuthOauthTokenParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```kotlin - * .grantType() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): OAuthOauthTokenParams = - OAuthOauthTokenParams( - body.build(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - fun _body(): Body = body - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - class Body - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val grantType: JsonField, - private val clientId: JsonField, - private val clientSecret: JsonField, - private val code: JsonField, - private val redirectUri: JsonField, - private val codeVerifier: JsonField, - private val refreshToken: JsonField, - private val scope: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("grant_type") - @ExcludeMissing - grantType: JsonField = JsonMissing.of(), - @JsonProperty("client_id") - @ExcludeMissing - clientId: JsonField = JsonMissing.of(), - @JsonProperty("client_secret") - @ExcludeMissing - clientSecret: JsonField = JsonMissing.of(), - @JsonProperty("code") @ExcludeMissing code: JsonField = JsonMissing.of(), - @JsonProperty("redirect_uri") - @ExcludeMissing - redirectUri: JsonField = JsonMissing.of(), - @JsonProperty("code_verifier") - @ExcludeMissing - codeVerifier: JsonField = JsonMissing.of(), - @JsonProperty("refresh_token") - @ExcludeMissing - refreshToken: JsonField = JsonMissing.of(), - @JsonProperty("scope") @ExcludeMissing scope: JsonField = JsonMissing.of(), - ) : this( - grantType, - clientId, - clientSecret, - code, - redirectUri, - codeVerifier, - refreshToken, - scope, - mutableMapOf(), - ) - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun grantType(): String = grantType.getRequired("grant_type") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun clientId(): Optional = clientId.getOptional("client_id") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun clientSecret(): Optional = clientSecret.getOptional("client_secret") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun code(): Optional = code.getOptional("code") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun redirectUri(): Optional = redirectUri.getOptional("redirect_uri") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun codeVerifier(): Optional = codeVerifier.getOptional("code_verifier") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun refreshToken(): Optional = refreshToken.getOptional("refresh_token") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun scope(): Optional = scope.getOptional("scope") - - /** - * Returns the raw JSON value of [grantType]. - * - * Unlike [grantType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("grant_type") @ExcludeMissing fun _grantType(): JsonField = grantType - - /** - * Returns the raw JSON value of [clientId]. - * - * Unlike [clientId], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("client_id") @ExcludeMissing fun _clientId(): JsonField = clientId - - /** - * Returns the raw JSON value of [clientSecret]. - * - * Unlike [clientSecret], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("client_secret") - @ExcludeMissing - fun _clientSecret(): JsonField = clientSecret - - /** - * Returns the raw JSON value of [code]. - * - * Unlike [code], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("code") @ExcludeMissing fun _code(): JsonField = code - - /** - * Returns the raw JSON value of [redirectUri]. - * - * Unlike [redirectUri], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("redirect_uri") - @ExcludeMissing - fun _redirectUri(): JsonField = redirectUri - - /** - * Returns the raw JSON value of [codeVerifier]. - * - * Unlike [codeVerifier], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("code_verifier") - @ExcludeMissing - fun _codeVerifier(): JsonField = codeVerifier - - /** - * Returns the raw JSON value of [refreshToken]. - * - * Unlike [refreshToken], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("refresh_token") - @ExcludeMissing - fun _refreshToken(): JsonField = refreshToken - - /** - * Returns the raw JSON value of [scope]. - * - * Unlike [scope], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("scope") @ExcludeMissing fun _scope(): JsonField = scope - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [Body]. - * - * The following fields are required: - * ```kotlin - * .grantType() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Body]. */ - class Builder internal constructor() { - - private var grantType: JsonField? = null - private var clientId: JsonField = JsonMissing.of() - private var clientSecret: JsonField = JsonMissing.of() - private var code: JsonField = JsonMissing.of() - private var redirectUri: JsonField = JsonMissing.of() - private var codeVerifier: JsonField = JsonMissing.of() - private var refreshToken: JsonField = JsonMissing.of() - private var scope: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(body: Body) = apply { - grantType = body.grantType - clientId = body.clientId - clientSecret = body.clientSecret - code = body.code - redirectUri = body.redirectUri - codeVerifier = body.codeVerifier - refreshToken = body.refreshToken - scope = body.scope - additionalProperties = body.additionalProperties.toMutableMap() - } - - fun grantType(grantType: String) = grantType(JsonField.of(grantType)) - - /** - * Sets [Builder.grantType] to an arbitrary JSON value. - * - * You should usually call [Builder.grantType] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun grantType(grantType: JsonField) = apply { this.grantType = grantType } - - fun clientId(clientId: String) = clientId(JsonField.of(clientId)) - - /** - * Sets [Builder.clientId] to an arbitrary JSON value. - * - * You should usually call [Builder.clientId] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun clientId(clientId: JsonField) = apply { this.clientId = clientId } - - fun clientSecret(clientSecret: String) = clientSecret(JsonField.of(clientSecret)) - - /** - * Sets [Builder.clientSecret] to an arbitrary JSON value. - * - * You should usually call [Builder.clientSecret] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun clientSecret(clientSecret: JsonField) = apply { - this.clientSecret = clientSecret - } - - fun code(code: String) = code(JsonField.of(code)) - - /** - * Sets [Builder.code] to an arbitrary JSON value. - * - * You should usually call [Builder.code] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun code(code: JsonField) = apply { this.code = code } - - fun redirectUri(redirectUri: String) = redirectUri(JsonField.of(redirectUri)) - - /** - * Sets [Builder.redirectUri] to an arbitrary JSON value. - * - * You should usually call [Builder.redirectUri] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun redirectUri(redirectUri: JsonField) = apply { - this.redirectUri = redirectUri - } - - fun codeVerifier(codeVerifier: String) = codeVerifier(JsonField.of(codeVerifier)) - - /** - * Sets [Builder.codeVerifier] to an arbitrary JSON value. - * - * You should usually call [Builder.codeVerifier] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun codeVerifier(codeVerifier: JsonField) = apply { - this.codeVerifier = codeVerifier - } - - fun refreshToken(refreshToken: String) = refreshToken(JsonField.of(refreshToken)) - - /** - * Sets [Builder.refreshToken] to an arbitrary JSON value. - * - * You should usually call [Builder.refreshToken] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun refreshToken(refreshToken: JsonField) = apply { - this.refreshToken = refreshToken - } - - fun scope(scope: String) = scope(JsonField.of(scope)) - - /** - * Sets [Builder.scope] to an arbitrary JSON value. - * - * You should usually call [Builder.scope] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun scope(scope: JsonField) = apply { this.scope = scope } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Body]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```kotlin - * .grantType() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Body = - Body( - checkRequired("grantType", grantType), - clientId, - clientSecret, - code, - redirectUri, - codeVerifier, - refreshToken, - scope, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws ScalarInvalidDataException if any value type in this object doesn't match its - * expected type. - */ - fun validate(): Body = apply { - if (validated) { - return@apply - } - - grantType() - clientId() - clientSecret() - code() - redirectUri() - codeVerifier() - refreshToken() - scope() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ScalarInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (grantType.asKnown().isPresent) 1 else 0) + - (if (clientId.asKnown().isPresent) 1 else 0) + - (if (clientSecret.asKnown().isPresent) 1 else 0) + - (if (code.asKnown().isPresent) 1 else 0) + - (if (redirectUri.asKnown().isPresent) 1 else 0) + - (if (codeVerifier.asKnown().isPresent) 1 else 0) + - (if (refreshToken.asKnown().isPresent) 1 else 0) + - (if (scope.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Body && - grantType == other.grantType && - clientId == other.clientId && - clientSecret == other.clientSecret && - code == other.code && - redirectUri == other.redirectUri && - codeVerifier == other.codeVerifier && - refreshToken == other.refreshToken && - scope == other.scope && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - grantType, - clientId, - clientSecret, - code, - redirectUri, - codeVerifier, - refreshToken, - scope, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Body{grantType=$grantType, clientId=$clientId, clientSecret=$clientSecret, code=$code, redirectUri=$redirectUri, codeVerifier=$codeVerifier, refreshToken=$refreshToken, scope=$scope, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is OAuthOauthTokenParams && - body == other.body && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = Objects.hash(body, additionalHeaders, additionalQueryParams) - - override fun toString() = - "OAuthOauthTokenParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthTokenResponse.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthTokenResponse.kt deleted file mode 100644 index 6f94887..0000000 --- a/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OAuthOauthTokenResponse.kt +++ /dev/null @@ -1,232 +0,0 @@ -// File generated by Scalar SDK Generator. DO NOT EDIT. - -package com.scalar.models.oAuth - -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.scalar.core.BaseDeserializer -import com.scalar.core.BaseSerializer -import com.scalar.core.JsonValue -import com.scalar.core.allMaxBy -import com.scalar.core.getOrThrow -import com.scalar.errors.ScalarInvalidDataException -import java.util.Objects -import java.util.Optional - -@JsonDeserialize(using = OAuthOauthTokenResponse.Deserializer::class) -@JsonSerialize(using = OAuthOauthTokenResponse.Serializer::class) -class OAuthOauthTokenResponse -private constructor( - private val token: OauthToken? = null, - private val error: OauthError? = null, - private val _json: JsonValue? = null, -) { - - fun token(): Optional = Optional.ofNullable(token) - - fun error(): Optional = Optional.ofNullable(error) - - fun isToken(): Boolean = token != null - - fun isError(): Boolean = error != null - - fun asToken(): OauthToken = token.getOrThrow("token") - - fun asError(): OauthError = error.getOrThrow("error") - - fun _json(): Optional = Optional.ofNullable(_json) - - /** - * Maps this instance's current variant to a value of type [T] using the given [visitor]. - * - * Note that this method is _not_ forwards compatible with new variants from the API, unless - * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the - * SDK gracefully, consider overriding [Visitor.unknown]: - * ```java - * import com.scalar.core.JsonValue; - * import java.util.Optional; - * - * Optional result = - * oAuthOauthTokenResponse.accept( - * new OAuthOauthTokenResponse.Visitor>() { - * @Override - * public Optional visitToken(OauthToken token) { - * return Optional.of(token.toString()); - * } - * - * // ... - * - * @Override - * public Optional unknown(JsonValue json) { - * // Or inspect the `json`. - * return Optional.empty(); - * } - * }); - * ``` - * - * @throws ScalarInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and - * the current variant is unknown. - */ - fun accept(visitor: Visitor): T = - when { - token != null -> visitor.visitToken(token) - error != null -> visitor.visitError(error) - else -> visitor.unknown(_json) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws ScalarInvalidDataException if any value type in this object doesn't match its - * expected type. - */ - fun validate(): OAuthOauthTokenResponse = apply { - if (validated) { - return@apply - } - - accept( - object : Visitor { - override fun visitToken(token: OauthToken) { - token.validate() - } - - override fun visitError(error: OauthError) { - error.validate() - } - } - ) - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ScalarInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - accept( - object : Visitor { - override fun visitToken(token: OauthToken) = token.validity() - - override fun visitError(error: OauthError) = error.validity() - - override fun unknown(json: JsonValue?) = 0 - } - ) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is OAuthOauthTokenResponse && token == other.token && error == other.error - } - - override fun hashCode(): Int = Objects.hash(token, error) - - override fun toString(): String = - when { - token != null -> "OAuthOauthTokenResponse{token=$token}" - error != null -> "OAuthOauthTokenResponse{error=$error}" - _json != null -> "OAuthOauthTokenResponse{_unknown=$_json}" - else -> throw IllegalStateException("Invalid OAuthOauthTokenResponse") - } - - companion object { - - @JvmStatic fun ofToken(token: OauthToken) = OAuthOauthTokenResponse(token = token) - - @JvmStatic fun ofError(error: OauthError) = OAuthOauthTokenResponse(error = error) - } - - /** - * An interface that defines how to map each variant of [OAuthOauthTokenResponse] to a value of - * type [T]. - */ - interface Visitor { - - fun visitToken(token: OauthToken): T - - fun visitError(error: OauthError): T - - /** - * Maps an unknown variant of [OAuthOauthTokenResponse] to a value of type [T]. - * - * An instance of [OAuthOauthTokenResponse] can contain an unknown variant if it was - * deserialized from data that doesn't match any known variant. For example, if the SDK is - * on an older version than the API, then the API may respond with new variants that the SDK - * is unaware of. - * - * @throws ScalarInvalidDataException in the default implementation. - */ - fun unknown(json: JsonValue?): T { - throw ScalarInvalidDataException("Unknown OAuthOauthTokenResponse: $json") - } - } - - internal class Deserializer : - BaseDeserializer(OAuthOauthTokenResponse::class) { - - override fun ObjectCodec.deserialize(node: JsonNode): OAuthOauthTokenResponse { - val json = JsonValue.fromJsonNode(node) - - val bestMatches = - sequenceOf( - tryDeserialize(node, jacksonTypeRef())?.let { - OAuthOauthTokenResponse(token = it, _json = json) - }, - tryDeserialize(node, jacksonTypeRef())?.let { - OAuthOauthTokenResponse(error = it, _json = json) - }, - ) - .filterNotNull() - .allMaxBy { it.validity() } - .toList() - return when (bestMatches.size) { - // This can happen if what we're deserializing is completely incompatible with all - // the possible variants (e.g. deserializing from boolean). - 0 -> OAuthOauthTokenResponse(_json = json) - 1 -> bestMatches.single() - // If there's more than one match with the highest validity, then use the first - // completely valid match, or simply the first match if none are completely valid. - else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first() - } - } - } - - internal class Serializer : - BaseSerializer(OAuthOauthTokenResponse::class) { - - override fun serialize( - value: OAuthOauthTokenResponse, - generator: JsonGenerator, - provider: SerializerProvider, - ) { - when { - value.token != null -> generator.writeObject(value.token) - value.error != null -> generator.writeObject(value.error) - value._json != null -> generator.writeObject(value._json) - else -> throw IllegalStateException("Invalid OAuthOauthTokenResponse") - } - } - } -} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OauthAuthorizationServerMetadata.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OauthAuthorizationServerMetadata.kt deleted file mode 100644 index 7b467b1..0000000 --- a/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OauthAuthorizationServerMetadata.kt +++ /dev/null @@ -1,719 +0,0 @@ -// File generated by Scalar SDK Generator. DO NOT EDIT. - -package com.scalar.models.oAuth - -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import com.scalar.core.ExcludeMissing -import com.scalar.core.JsonField -import com.scalar.core.JsonMissing -import com.scalar.core.JsonValue -import com.scalar.core.checkKnown -import com.scalar.core.checkRequired -import com.scalar.core.toImmutable -import com.scalar.errors.ScalarInvalidDataException -import java.util.Collections -import java.util.Objects -import kotlin.jvm.optionals.getOrNull - -class OauthAuthorizationServerMetadata -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val issuer: JsonField, - private val authorizationEndpoint: JsonField, - private val tokenEndpoint: JsonField, - private val revocationEndpoint: JsonField, - private val responseTypesSupported: JsonField>, - private val grantTypesSupported: JsonField>, - private val codeChallengeMethodsSupported: JsonField>, - private val tokenEndpointAuthMethodsSupported: JsonField>, - private val revocationEndpointAuthMethodsSupported: JsonField>, - private val scopesSupported: JsonField>, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("issuer") @ExcludeMissing issuer: JsonField = JsonMissing.of(), - @JsonProperty("authorization_endpoint") - @ExcludeMissing - authorizationEndpoint: JsonField = JsonMissing.of(), - @JsonProperty("token_endpoint") - @ExcludeMissing - tokenEndpoint: JsonField = JsonMissing.of(), - @JsonProperty("revocation_endpoint") - @ExcludeMissing - revocationEndpoint: JsonField = JsonMissing.of(), - @JsonProperty("response_types_supported") - @ExcludeMissing - responseTypesSupported: JsonField> = JsonMissing.of(), - @JsonProperty("grant_types_supported") - @ExcludeMissing - grantTypesSupported: JsonField> = JsonMissing.of(), - @JsonProperty("code_challenge_methods_supported") - @ExcludeMissing - codeChallengeMethodsSupported: JsonField> = JsonMissing.of(), - @JsonProperty("token_endpoint_auth_methods_supported") - @ExcludeMissing - tokenEndpointAuthMethodsSupported: JsonField> = JsonMissing.of(), - @JsonProperty("revocation_endpoint_auth_methods_supported") - @ExcludeMissing - revocationEndpointAuthMethodsSupported: JsonField> = JsonMissing.of(), - @JsonProperty("scopes_supported") - @ExcludeMissing - scopesSupported: JsonField> = JsonMissing.of(), - ) : this( - issuer, - authorizationEndpoint, - tokenEndpoint, - revocationEndpoint, - responseTypesSupported, - grantTypesSupported, - codeChallengeMethodsSupported, - tokenEndpointAuthMethodsSupported, - revocationEndpointAuthMethodsSupported, - scopesSupported, - mutableMapOf(), - ) - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun issuer(): String = issuer.getRequired("issuer") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun authorizationEndpoint(): String = - authorizationEndpoint.getRequired("authorization_endpoint") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun tokenEndpoint(): String = tokenEndpoint.getRequired("token_endpoint") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun revocationEndpoint(): String = revocationEndpoint.getRequired("revocation_endpoint") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun responseTypesSupported(): List = - responseTypesSupported.getRequired("response_types_supported") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun grantTypesSupported(): List = - grantTypesSupported.getRequired("grant_types_supported") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun codeChallengeMethodsSupported(): List = - codeChallengeMethodsSupported.getRequired("code_challenge_methods_supported") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun tokenEndpointAuthMethodsSupported(): List = - tokenEndpointAuthMethodsSupported.getRequired("token_endpoint_auth_methods_supported") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun revocationEndpointAuthMethodsSupported(): List = - revocationEndpointAuthMethodsSupported.getRequired( - "revocation_endpoint_auth_methods_supported" - ) - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun scopesSupported(): List = scopesSupported.getRequired("scopes_supported") - - /** - * Returns the raw JSON value of [issuer]. - * - * Unlike [issuer], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("issuer") @ExcludeMissing fun _issuer(): JsonField = issuer - - /** - * Returns the raw JSON value of [authorizationEndpoint]. - * - * Unlike [authorizationEndpoint], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("authorization_endpoint") - @ExcludeMissing - fun _authorizationEndpoint(): JsonField = authorizationEndpoint - - /** - * Returns the raw JSON value of [tokenEndpoint]. - * - * Unlike [tokenEndpoint], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("token_endpoint") - @ExcludeMissing - fun _tokenEndpoint(): JsonField = tokenEndpoint - - /** - * Returns the raw JSON value of [revocationEndpoint]. - * - * Unlike [revocationEndpoint], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("revocation_endpoint") - @ExcludeMissing - fun _revocationEndpoint(): JsonField = revocationEndpoint - - /** - * Returns the raw JSON value of [responseTypesSupported]. - * - * Unlike [responseTypesSupported], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("response_types_supported") - @ExcludeMissing - fun _responseTypesSupported(): JsonField> = responseTypesSupported - - /** - * Returns the raw JSON value of [grantTypesSupported]. - * - * Unlike [grantTypesSupported], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("grant_types_supported") - @ExcludeMissing - fun _grantTypesSupported(): JsonField> = grantTypesSupported - - /** - * Returns the raw JSON value of [codeChallengeMethodsSupported]. - * - * Unlike [codeChallengeMethodsSupported], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("code_challenge_methods_supported") - @ExcludeMissing - fun _codeChallengeMethodsSupported(): JsonField> = codeChallengeMethodsSupported - - /** - * Returns the raw JSON value of [tokenEndpointAuthMethodsSupported]. - * - * Unlike [tokenEndpointAuthMethodsSupported], this method doesn't throw if the JSON field has - * an unexpected type. - */ - @JsonProperty("token_endpoint_auth_methods_supported") - @ExcludeMissing - fun _tokenEndpointAuthMethodsSupported(): JsonField> = - tokenEndpointAuthMethodsSupported - - /** - * Returns the raw JSON value of [revocationEndpointAuthMethodsSupported]. - * - * Unlike [revocationEndpointAuthMethodsSupported], this method doesn't throw if the JSON field - * has an unexpected type. - */ - @JsonProperty("revocation_endpoint_auth_methods_supported") - @ExcludeMissing - fun _revocationEndpointAuthMethodsSupported(): JsonField> = - revocationEndpointAuthMethodsSupported - - /** - * Returns the raw JSON value of [scopesSupported]. - * - * Unlike [scopesSupported], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("scopes_supported") - @ExcludeMissing - fun _scopesSupported(): JsonField> = scopesSupported - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of - * [OauthAuthorizationServerMetadata]. - * - * The following fields are required: - * ```kotlin - * .issuer() - * .authorizationEndpoint() - * .tokenEndpoint() - * .revocationEndpoint() - * .responseTypesSupported() - * .grantTypesSupported() - * .codeChallengeMethodsSupported() - * .tokenEndpointAuthMethodsSupported() - * .revocationEndpointAuthMethodsSupported() - * .scopesSupported() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [OauthAuthorizationServerMetadata]. */ - class Builder internal constructor() { - - private var issuer: JsonField? = null - private var authorizationEndpoint: JsonField? = null - private var tokenEndpoint: JsonField? = null - private var revocationEndpoint: JsonField? = null - private var responseTypesSupported: JsonField>? = null - private var grantTypesSupported: JsonField>? = null - private var codeChallengeMethodsSupported: JsonField>? = null - private var tokenEndpointAuthMethodsSupported: JsonField>? = null - private var revocationEndpointAuthMethodsSupported: JsonField>? = null - private var scopesSupported: JsonField>? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(oauthAuthorizationServerMetadata: OauthAuthorizationServerMetadata) = - apply { - issuer = oauthAuthorizationServerMetadata.issuer - authorizationEndpoint = oauthAuthorizationServerMetadata.authorizationEndpoint - tokenEndpoint = oauthAuthorizationServerMetadata.tokenEndpoint - revocationEndpoint = oauthAuthorizationServerMetadata.revocationEndpoint - responseTypesSupported = - oauthAuthorizationServerMetadata.responseTypesSupported.map { - it.toMutableList() - } - grantTypesSupported = - oauthAuthorizationServerMetadata.grantTypesSupported.map { it.toMutableList() } - codeChallengeMethodsSupported = - oauthAuthorizationServerMetadata.codeChallengeMethodsSupported.map { - it.toMutableList() - } - tokenEndpointAuthMethodsSupported = - oauthAuthorizationServerMetadata.tokenEndpointAuthMethodsSupported.map { - it.toMutableList() - } - revocationEndpointAuthMethodsSupported = - oauthAuthorizationServerMetadata.revocationEndpointAuthMethodsSupported.map { - it.toMutableList() - } - scopesSupported = - oauthAuthorizationServerMetadata.scopesSupported.map { it.toMutableList() } - additionalProperties = - oauthAuthorizationServerMetadata.additionalProperties.toMutableMap() - } - - fun issuer(issuer: String) = issuer(JsonField.of(issuer)) - - /** - * Sets [Builder.issuer] to an arbitrary JSON value. - * - * You should usually call [Builder.issuer] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun issuer(issuer: JsonField) = apply { this.issuer = issuer } - - fun authorizationEndpoint(authorizationEndpoint: String) = - authorizationEndpoint(JsonField.of(authorizationEndpoint)) - - /** - * Sets [Builder.authorizationEndpoint] to an arbitrary JSON value. - * - * You should usually call [Builder.authorizationEndpoint] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun authorizationEndpoint(authorizationEndpoint: JsonField) = apply { - this.authorizationEndpoint = authorizationEndpoint - } - - fun tokenEndpoint(tokenEndpoint: String) = tokenEndpoint(JsonField.of(tokenEndpoint)) - - /** - * Sets [Builder.tokenEndpoint] to an arbitrary JSON value. - * - * You should usually call [Builder.tokenEndpoint] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun tokenEndpoint(tokenEndpoint: JsonField) = apply { - this.tokenEndpoint = tokenEndpoint - } - - fun revocationEndpoint(revocationEndpoint: String) = - revocationEndpoint(JsonField.of(revocationEndpoint)) - - /** - * Sets [Builder.revocationEndpoint] to an arbitrary JSON value. - * - * You should usually call [Builder.revocationEndpoint] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun revocationEndpoint(revocationEndpoint: JsonField) = apply { - this.revocationEndpoint = revocationEndpoint - } - - fun responseTypesSupported(responseTypesSupported: List) = - responseTypesSupported(JsonField.of(responseTypesSupported)) - - /** - * Sets [Builder.responseTypesSupported] to an arbitrary JSON value. - * - * You should usually call [Builder.responseTypesSupported] with a well-typed `List` - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun responseTypesSupported(responseTypesSupported: JsonField>) = apply { - this.responseTypesSupported = responseTypesSupported.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [Builder.responseTypesSupported]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addResponseTypesSupported(responseTypesSupported: String) = apply { - this.responseTypesSupported = - (this.responseTypesSupported ?: JsonField.of(mutableListOf())).also { - checkKnown("responseTypesSupported", it).add(responseTypesSupported) - } - } - - fun grantTypesSupported(grantTypesSupported: List) = - grantTypesSupported(JsonField.of(grantTypesSupported)) - - /** - * Sets [Builder.grantTypesSupported] to an arbitrary JSON value. - * - * You should usually call [Builder.grantTypesSupported] with a well-typed `List` - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun grantTypesSupported(grantTypesSupported: JsonField>) = apply { - this.grantTypesSupported = grantTypesSupported.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [Builder.grantTypesSupported]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addGrantTypesSupported(grantTypesSupported: String) = apply { - this.grantTypesSupported = - (this.grantTypesSupported ?: JsonField.of(mutableListOf())).also { - checkKnown("grantTypesSupported", it).add(grantTypesSupported) - } - } - - fun codeChallengeMethodsSupported(codeChallengeMethodsSupported: List) = - codeChallengeMethodsSupported(JsonField.of(codeChallengeMethodsSupported)) - - /** - * Sets [Builder.codeChallengeMethodsSupported] to an arbitrary JSON value. - * - * You should usually call [Builder.codeChallengeMethodsSupported] with a well-typed - * `List` value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun codeChallengeMethodsSupported(codeChallengeMethodsSupported: JsonField>) = - apply { - this.codeChallengeMethodsSupported = codeChallengeMethodsSupported.map { - it.toMutableList() - } - } - - /** - * Adds a single [String] to [Builder.codeChallengeMethodsSupported]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addCodeChallengeMethodsSupported(codeChallengeMethodsSupported: String) = apply { - this.codeChallengeMethodsSupported = - (this.codeChallengeMethodsSupported ?: JsonField.of(mutableListOf())).also { - checkKnown("codeChallengeMethodsSupported", it) - .add(codeChallengeMethodsSupported) - } - } - - fun tokenEndpointAuthMethodsSupported(tokenEndpointAuthMethodsSupported: List) = - tokenEndpointAuthMethodsSupported(JsonField.of(tokenEndpointAuthMethodsSupported)) - - /** - * Sets [Builder.tokenEndpointAuthMethodsSupported] to an arbitrary JSON value. - * - * You should usually call [Builder.tokenEndpointAuthMethodsSupported] with a well-typed - * `List` value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun tokenEndpointAuthMethodsSupported( - tokenEndpointAuthMethodsSupported: JsonField> - ) = apply { - this.tokenEndpointAuthMethodsSupported = tokenEndpointAuthMethodsSupported.map { - it.toMutableList() - } - } - - /** - * Adds a single [String] to [Builder.tokenEndpointAuthMethodsSupported]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addTokenEndpointAuthMethodsSupported(tokenEndpointAuthMethodsSupported: String) = - apply { - this.tokenEndpointAuthMethodsSupported = - (this.tokenEndpointAuthMethodsSupported ?: JsonField.of(mutableListOf())).also { - checkKnown("tokenEndpointAuthMethodsSupported", it) - .add(tokenEndpointAuthMethodsSupported) - } - } - - fun revocationEndpointAuthMethodsSupported( - revocationEndpointAuthMethodsSupported: List - ) = - revocationEndpointAuthMethodsSupported( - JsonField.of(revocationEndpointAuthMethodsSupported) - ) - - /** - * Sets [Builder.revocationEndpointAuthMethodsSupported] to an arbitrary JSON value. - * - * You should usually call [Builder.revocationEndpointAuthMethodsSupported] with a - * well-typed `List` value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. - */ - fun revocationEndpointAuthMethodsSupported( - revocationEndpointAuthMethodsSupported: JsonField> - ) = apply { - this.revocationEndpointAuthMethodsSupported = - revocationEndpointAuthMethodsSupported.map { - it.toMutableList() - } - } - - /** - * Adds a single [String] to [Builder.revocationEndpointAuthMethodsSupported]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addRevocationEndpointAuthMethodsSupported( - revocationEndpointAuthMethodsSupported: String - ) = apply { - this.revocationEndpointAuthMethodsSupported = - (this.revocationEndpointAuthMethodsSupported ?: JsonField.of(mutableListOf())) - .also { - checkKnown("revocationEndpointAuthMethodsSupported", it) - .add(revocationEndpointAuthMethodsSupported) - } - } - - fun scopesSupported(scopesSupported: List) = - scopesSupported(JsonField.of(scopesSupported)) - - /** - * Sets [Builder.scopesSupported] to an arbitrary JSON value. - * - * You should usually call [Builder.scopesSupported] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun scopesSupported(scopesSupported: JsonField>) = apply { - this.scopesSupported = scopesSupported.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [Builder.scopesSupported]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addScopesSupported(scopesSupported: String) = apply { - this.scopesSupported = - (this.scopesSupported ?: JsonField.of(mutableListOf())).also { - checkKnown("scopesSupported", it).add(scopesSupported) - } - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [OauthAuthorizationServerMetadata]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```kotlin - * .issuer() - * .authorizationEndpoint() - * .tokenEndpoint() - * .revocationEndpoint() - * .responseTypesSupported() - * .grantTypesSupported() - * .codeChallengeMethodsSupported() - * .tokenEndpointAuthMethodsSupported() - * .revocationEndpointAuthMethodsSupported() - * .scopesSupported() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): OauthAuthorizationServerMetadata = - OauthAuthorizationServerMetadata( - checkRequired("issuer", issuer), - checkRequired("authorizationEndpoint", authorizationEndpoint), - checkRequired("tokenEndpoint", tokenEndpoint), - checkRequired("revocationEndpoint", revocationEndpoint), - checkRequired("responseTypesSupported", responseTypesSupported).map { - it.toImmutable() - }, - checkRequired("grantTypesSupported", grantTypesSupported).map { it.toImmutable() }, - checkRequired("codeChallengeMethodsSupported", codeChallengeMethodsSupported).map { - it.toImmutable() - }, - checkRequired( - "tokenEndpointAuthMethodsSupported", - tokenEndpointAuthMethodsSupported, - ) - .map { it.toImmutable() }, - checkRequired( - "revocationEndpointAuthMethodsSupported", - revocationEndpointAuthMethodsSupported, - ) - .map { it.toImmutable() }, - checkRequired("scopesSupported", scopesSupported).map { it.toImmutable() }, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws ScalarInvalidDataException if any value type in this object doesn't match its - * expected type. - */ - fun validate(): OauthAuthorizationServerMetadata = apply { - if (validated) { - return@apply - } - - issuer() - authorizationEndpoint() - tokenEndpoint() - revocationEndpoint() - responseTypesSupported() - grantTypesSupported() - codeChallengeMethodsSupported() - tokenEndpointAuthMethodsSupported() - revocationEndpointAuthMethodsSupported() - scopesSupported() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ScalarInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (issuer.asKnown().isPresent) 1 else 0) + - (if (authorizationEndpoint.asKnown().isPresent) 1 else 0) + - (if (tokenEndpoint.asKnown().isPresent) 1 else 0) + - (if (revocationEndpoint.asKnown().isPresent) 1 else 0) + - (responseTypesSupported.asKnown().getOrNull()?.size ?: 0) + - (grantTypesSupported.asKnown().getOrNull()?.size ?: 0) + - (codeChallengeMethodsSupported.asKnown().getOrNull()?.size ?: 0) + - (tokenEndpointAuthMethodsSupported.asKnown().getOrNull()?.size ?: 0) + - (revocationEndpointAuthMethodsSupported.asKnown().getOrNull()?.size ?: 0) + - (scopesSupported.asKnown().getOrNull()?.size ?: 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is OauthAuthorizationServerMetadata && - issuer == other.issuer && - authorizationEndpoint == other.authorizationEndpoint && - tokenEndpoint == other.tokenEndpoint && - revocationEndpoint == other.revocationEndpoint && - responseTypesSupported == other.responseTypesSupported && - grantTypesSupported == other.grantTypesSupported && - codeChallengeMethodsSupported == other.codeChallengeMethodsSupported && - tokenEndpointAuthMethodsSupported == other.tokenEndpointAuthMethodsSupported && - revocationEndpointAuthMethodsSupported == - other.revocationEndpointAuthMethodsSupported && - scopesSupported == other.scopesSupported && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - issuer, - authorizationEndpoint, - tokenEndpoint, - revocationEndpoint, - responseTypesSupported, - grantTypesSupported, - codeChallengeMethodsSupported, - tokenEndpointAuthMethodsSupported, - revocationEndpointAuthMethodsSupported, - scopesSupported, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "OauthAuthorizationServerMetadata{issuer=$issuer, authorizationEndpoint=$authorizationEndpoint, tokenEndpoint=$tokenEndpoint, revocationEndpoint=$revocationEndpoint, responseTypesSupported=$responseTypesSupported, grantTypesSupported=$grantTypesSupported, codeChallengeMethodsSupported=$codeChallengeMethodsSupported, tokenEndpointAuthMethodsSupported=$tokenEndpointAuthMethodsSupported, revocationEndpointAuthMethodsSupported=$revocationEndpointAuthMethodsSupported, scopesSupported=$scopesSupported, additionalProperties=$additionalProperties}" -} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OauthError.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OauthError.kt deleted file mode 100644 index 0b46beb..0000000 --- a/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OauthError.kt +++ /dev/null @@ -1,223 +0,0 @@ -// File generated by Scalar SDK Generator. DO NOT EDIT. - -package com.scalar.models.oAuth - -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import com.scalar.core.ExcludeMissing -import com.scalar.core.JsonField -import com.scalar.core.JsonMissing -import com.scalar.core.JsonValue -import com.scalar.core.checkRequired -import com.scalar.errors.ScalarInvalidDataException -import java.util.Collections -import java.util.Objects -import java.util.Optional - -class OauthError -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val error: JsonField, - private val errorDescription: JsonField, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("error") @ExcludeMissing error: JsonField = JsonMissing.of(), - @JsonProperty("error_description") - @ExcludeMissing - errorDescription: JsonField = JsonMissing.of(), - ) : this(error, errorDescription, mutableMapOf()) - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun error(): String = error.getRequired("error") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun errorDescription(): Optional = errorDescription.getOptional("error_description") - - /** - * Returns the raw JSON value of [error]. - * - * Unlike [error], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("error") @ExcludeMissing fun _error(): JsonField = error - - /** - * Returns the raw JSON value of [errorDescription]. - * - * Unlike [errorDescription], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("error_description") - @ExcludeMissing - fun _errorDescription(): JsonField = errorDescription - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [OauthError]. - * - * The following fields are required: - * ```kotlin - * .error() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [OauthError]. */ - class Builder internal constructor() { - - private var error: JsonField? = null - private var errorDescription: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(oauthError: OauthError) = apply { - error = oauthError.error - errorDescription = oauthError.errorDescription - additionalProperties = oauthError.additionalProperties.toMutableMap() - } - - fun error(error: String) = error(JsonField.of(error)) - - /** - * Sets [Builder.error] to an arbitrary JSON value. - * - * You should usually call [Builder.error] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun error(error: JsonField) = apply { this.error = error } - - fun errorDescription(errorDescription: String) = - errorDescription(JsonField.of(errorDescription)) - - /** - * Sets [Builder.errorDescription] to an arbitrary JSON value. - * - * You should usually call [Builder.errorDescription] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun errorDescription(errorDescription: JsonField) = apply { - this.errorDescription = errorDescription - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [OauthError]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```kotlin - * .error() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): OauthError = - OauthError( - checkRequired("error", error), - errorDescription, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws ScalarInvalidDataException if any value type in this object doesn't match its - * expected type. - */ - fun validate(): OauthError = apply { - if (validated) { - return@apply - } - - error() - errorDescription() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ScalarInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (error.asKnown().isPresent) 1 else 0) + - (if (errorDescription.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is OauthError && - error == other.error && - errorDescription == other.errorDescription && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(error, errorDescription, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "OauthError{error=$error, errorDescription=$errorDescription, additionalProperties=$additionalProperties}" -} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OauthScope.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OauthScope.kt deleted file mode 100644 index 77e83e7..0000000 --- a/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OauthScope.kt +++ /dev/null @@ -1,144 +0,0 @@ -// File generated by Scalar SDK Generator. DO NOT EDIT. - -package com.scalar.models.oAuth - -import com.fasterxml.jackson.annotation.JsonCreator -import com.scalar.core.Enum -import com.scalar.core.JsonField -import com.scalar.errors.ScalarInvalidDataException - -class OauthScope @JsonCreator private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't match - * any known member, and you want to know that value. For example, if the SDK is on an older - * version than the API, then the API may respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val READ = of("read") - - @JvmField val WRITE = of("write") - - @JvmField val ADMIN = of("admin") - - @JvmStatic fun of(value: String) = OauthScope(JsonField.of(value)) - } - - /** An enum containing [OauthScope]'s known values. */ - enum class Known { - READ, - WRITE, - ADMIN, - } - - /** - * An enum containing [OauthScope]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [OauthScope] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the SDK - * is on an older version than the API, then the API may respond with new members that the SDK - * is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - READ, - WRITE, - ADMIN, - /** An enum member indicating that [OauthScope] was instantiated with an unknown value. */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] if - * the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you want to - * throw for the unknown case. - */ - fun value(): Value = - when (this) { - READ -> Value.READ - WRITE -> Value.WRITE - ADMIN -> Value.ADMIN - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and don't want - * to throw for the unknown case. - * - * @throws ScalarInvalidDataException if this class instance's value is a not a known member. - */ - fun known(): Known = - when (this) { - READ -> Known.READ - WRITE -> Known.WRITE - ADMIN -> Known.ADMIN - else -> throw ScalarInvalidDataException("Unknown OauthScope: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging and - * generally doesn't throw. - * - * @throws ScalarInvalidDataException if this class instance's value does not have the expected - * primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { ScalarInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws ScalarInvalidDataException if any value type in this object doesn't match its - * expected type. - */ - fun validate(): OauthScope = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ScalarInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is OauthScope && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() -} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OauthToken.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OauthToken.kt deleted file mode 100644 index fd95450..0000000 --- a/scalar-java-core/src/main/kotlin/com/scalar/models/oAuth/OauthToken.kt +++ /dev/null @@ -1,339 +0,0 @@ -// File generated by Scalar SDK Generator. DO NOT EDIT. - -package com.scalar.models.oAuth - -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import com.scalar.core.ExcludeMissing -import com.scalar.core.JsonField -import com.scalar.core.JsonMissing -import com.scalar.core.JsonValue -import com.scalar.core.checkRequired -import com.scalar.errors.ScalarInvalidDataException -import java.util.Collections -import java.util.Objects -import kotlin.jvm.optionals.getOrNull - -class OauthToken -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val accessToken: JsonField, - private val tokenType: JsonValue, - private val expiresIn: JsonField, - private val refreshToken: JsonField, - private val scope: JsonField, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("access_token") - @ExcludeMissing - accessToken: JsonField = JsonMissing.of(), - @JsonProperty("token_type") @ExcludeMissing tokenType: JsonValue = JsonMissing.of(), - @JsonProperty("expires_in") @ExcludeMissing expiresIn: JsonField = JsonMissing.of(), - @JsonProperty("refresh_token") - @ExcludeMissing - refreshToken: JsonField = JsonMissing.of(), - @JsonProperty("scope") @ExcludeMissing scope: JsonField = JsonMissing.of(), - ) : this(accessToken, tokenType, expiresIn, refreshToken, scope, mutableMapOf()) - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun accessToken(): String = accessToken.getRequired("access_token") - - /** - * Expected to always return the following: - * ```kotlin - * JsonValue.from("Bearer") - * ``` - * - * However, this method can be useful for debugging and logging (e.g. if the server responded - * with an unexpected value). - */ - @JsonProperty("token_type") @ExcludeMissing fun _tokenType(): JsonValue = tokenType - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun expiresIn(): Long = expiresIn.getRequired("expires_in") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun refreshToken(): String = refreshToken.getRequired("refresh_token") - - /** - * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun scope(): OauthScope = scope.getRequired("scope") - - /** - * Returns the raw JSON value of [accessToken]. - * - * Unlike [accessToken], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("access_token") - @ExcludeMissing - fun _accessToken(): JsonField = accessToken - - /** - * Returns the raw JSON value of [expiresIn]. - * - * Unlike [expiresIn], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("expires_in") @ExcludeMissing fun _expiresIn(): JsonField = expiresIn - - /** - * Returns the raw JSON value of [refreshToken]. - * - * Unlike [refreshToken], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("refresh_token") - @ExcludeMissing - fun _refreshToken(): JsonField = refreshToken - - /** - * Returns the raw JSON value of [scope]. - * - * Unlike [scope], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("scope") @ExcludeMissing fun _scope(): JsonField = scope - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [OauthToken]. - * - * The following fields are required: - * ```kotlin - * .accessToken() - * .expiresIn() - * .refreshToken() - * .scope() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [OauthToken]. */ - class Builder internal constructor() { - - private var accessToken: JsonField? = null - private var tokenType: JsonValue = JsonValue.from("Bearer") - private var expiresIn: JsonField? = null - private var refreshToken: JsonField? = null - private var scope: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(oauthToken: OauthToken) = apply { - accessToken = oauthToken.accessToken - tokenType = oauthToken.tokenType - expiresIn = oauthToken.expiresIn - refreshToken = oauthToken.refreshToken - scope = oauthToken.scope - additionalProperties = oauthToken.additionalProperties.toMutableMap() - } - - fun accessToken(accessToken: String) = accessToken(JsonField.of(accessToken)) - - /** - * Sets [Builder.accessToken] to an arbitrary JSON value. - * - * You should usually call [Builder.accessToken] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun accessToken(accessToken: JsonField) = apply { this.accessToken = accessToken } - - /** - * Sets the field to an arbitrary JSON value. - * - * It is usually unnecessary to call this method because the field defaults to the - * following: - * ```kotlin - * JsonValue.from("Bearer") - * ``` - * - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun tokenType(tokenType: JsonValue) = apply { this.tokenType = tokenType } - - fun expiresIn(expiresIn: Long) = expiresIn(JsonField.of(expiresIn)) - - /** - * Sets [Builder.expiresIn] to an arbitrary JSON value. - * - * You should usually call [Builder.expiresIn] with a well-typed [Long] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun expiresIn(expiresIn: JsonField) = apply { this.expiresIn = expiresIn } - - fun refreshToken(refreshToken: String) = refreshToken(JsonField.of(refreshToken)) - - /** - * Sets [Builder.refreshToken] to an arbitrary JSON value. - * - * You should usually call [Builder.refreshToken] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun refreshToken(refreshToken: JsonField) = apply { - this.refreshToken = refreshToken - } - - fun scope(scope: OauthScope) = scope(JsonField.of(scope)) - - /** - * Sets [Builder.scope] to an arbitrary JSON value. - * - * You should usually call [Builder.scope] with a well-typed [OauthScope] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun scope(scope: JsonField) = apply { this.scope = scope } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [OauthToken]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```kotlin - * .accessToken() - * .expiresIn() - * .refreshToken() - * .scope() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): OauthToken = - OauthToken( - checkRequired("accessToken", accessToken), - tokenType, - checkRequired("expiresIn", expiresIn), - checkRequired("refreshToken", refreshToken), - checkRequired("scope", scope), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws ScalarInvalidDataException if any value type in this object doesn't match its - * expected type. - */ - fun validate(): OauthToken = apply { - if (validated) { - return@apply - } - - accessToken() - _tokenType().let { - if (it != JsonValue.from("Bearer")) { - throw ScalarInvalidDataException("'tokenType' is invalid, received $it") - } - } - expiresIn() - refreshToken() - scope().validate() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ScalarInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (accessToken.asKnown().isPresent) 1 else 0) + - tokenType.let { if (it == JsonValue.from("Bearer")) 1 else 0 } + - (if (expiresIn.asKnown().isPresent) 1 else 0) + - (if (refreshToken.asKnown().isPresent) 1 else 0) + - (scope.asKnown().getOrNull()?.validity() ?: 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is OauthToken && - accessToken == other.accessToken && - tokenType == other.tokenType && - expiresIn == other.expiresIn && - refreshToken == other.refreshToken && - scope == other.scope && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - accessToken, - tokenType, - expiresIn, - refreshToken, - scope, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "OauthToken{accessToken=$accessToken, tokenType=$tokenType, expiresIn=$expiresIn, refreshToken=$refreshToken, scope=$scope, additionalProperties=$additionalProperties}" -} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/OAuthServiceAsync.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/OAuthServiceAsync.kt deleted file mode 100644 index 16f1d72..0000000 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/async/OAuthServiceAsync.kt +++ /dev/null @@ -1,209 +0,0 @@ -// File generated by Scalar SDK Generator. DO NOT EDIT. - -package com.scalar.services.async - -import com.scalar.core.ClientOptions -import com.scalar.core.RequestOptions -import com.scalar.core.http.HttpResponseFor -import com.scalar.models.oAuth.OAuthOauthAuthorizationServerMetadataParams -import com.scalar.models.oAuth.OAuthOauthAuthorizeParams -import com.scalar.models.oAuth.OAuthOauthRevokeParams -import com.scalar.models.oAuth.OAuthOauthTokenParams -import com.scalar.models.oAuth.OAuthOauthTokenResponse -import com.scalar.models.oAuth.OauthAuthorizationServerMetadata -import com.scalar.models.oAuth.OauthError -import java.util.concurrent.CompletableFuture -import java.util.function.Consumer - -/** OAuth */ -interface OAuthServiceAsync { - - /** - * Returns a view of this service that provides access to raw HTTP responses for each method. - */ - fun withRawResponse(): WithRawResponse - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions(modifier: Consumer): OAuthServiceAsync - - /** - * Discovery document for OAuth clients (RFC 8414): where the endpoints are and what they - * support. - */ - fun oauthAuthorizationServerMetadata(): CompletableFuture = - oauthAuthorizationServerMetadata(OAuthOauthAuthorizationServerMetadataParams.none()) - - /** @see oauthAuthorizationServerMetadata */ - fun oauthAuthorizationServerMetadata( - params: OAuthOauthAuthorizationServerMetadataParams = - OAuthOauthAuthorizationServerMetadataParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see oauthAuthorizationServerMetadata */ - fun oauthAuthorizationServerMetadata( - params: OAuthOauthAuthorizationServerMetadataParams - ): CompletableFuture = - oauthAuthorizationServerMetadata(params, RequestOptions.none()) - - /** @see oauthAuthorizationServerMetadata */ - fun oauthAuthorizationServerMetadata( - requestOptions: RequestOptions - ): CompletableFuture = - oauthAuthorizationServerMetadata( - OAuthOauthAuthorizationServerMetadataParams.none(), - requestOptions, - ) - - /** - * Authorization endpoint (RFC 6749 §4.1.1 with PKCE, RFC 7636). Validates the request and sends - * the user to the Scalar dashboard to approve it; the user returns to `redirect_uri` with a - * `code` to exchange at the token endpoint. Only `response_type=code` with - * `code_challenge_method=S256` is supported. - */ - fun oauthAuthorize(): CompletableFuture = oauthAuthorize(OAuthOauthAuthorizeParams.none()) - - /** @see oauthAuthorize */ - fun oauthAuthorize( - params: OAuthOauthAuthorizeParams = OAuthOauthAuthorizeParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see oauthAuthorize */ - fun oauthAuthorize(params: OAuthOauthAuthorizeParams): CompletableFuture = - oauthAuthorize(params, RequestOptions.none()) - - /** @see oauthAuthorize */ - fun oauthAuthorize(requestOptions: RequestOptions): CompletableFuture = - oauthAuthorize(OAuthOauthAuthorizeParams.none(), requestOptions) - - /** - * Revocation endpoint (RFC 7009). Revokes the refresh token and every token issued alongside - * it. The client authenticates as it does at the token endpoint. Responds 200 whether or not - * the token was live, as the RFC requires. - */ - fun oauthRevoke(params: OAuthOauthRevokeParams): CompletableFuture = - oauthRevoke(params, RequestOptions.none()) - - /** @see oauthRevoke */ - fun oauthRevoke( - params: OAuthOauthRevokeParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** - * Token endpoint (RFC 6749 §4.1.3 and §6). Accepts `application/x-www-form-urlencoded`. - * Confidential clients authenticate with HTTP Basic or `client_secret` in the body; public - * clients send `client_id` alone. The `authorization_code` grant needs `code`, `redirect_uri` - * and `code_verifier`; the `refresh_token` grant needs `refresh_token` and may narrow `scope`. - */ - fun oauthToken(params: OAuthOauthTokenParams): CompletableFuture = - oauthToken(params, RequestOptions.none()) - - /** @see oauthToken */ - fun oauthToken( - params: OAuthOauthTokenParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** A view of [OAuthServiceAsync] that provides access to raw HTTP responses for each method. */ - interface WithRawResponse { - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions( - modifier: Consumer - ): OAuthServiceAsync.WithRawResponse - - /** - * Returns a raw HTTP response for `get /.well-known/oauth-authorization-server`, but is - * otherwise the same as [OAuthServiceAsync.oauthAuthorizationServerMetadata]. - */ - fun oauthAuthorizationServerMetadata(): - CompletableFuture> = - oauthAuthorizationServerMetadata(OAuthOauthAuthorizationServerMetadataParams.none()) - - /** @see oauthAuthorizationServerMetadata */ - fun oauthAuthorizationServerMetadata( - params: OAuthOauthAuthorizationServerMetadataParams = - OAuthOauthAuthorizationServerMetadataParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see oauthAuthorizationServerMetadata */ - fun oauthAuthorizationServerMetadata( - params: OAuthOauthAuthorizationServerMetadataParams - ): CompletableFuture> = - oauthAuthorizationServerMetadata(params, RequestOptions.none()) - - /** @see oauthAuthorizationServerMetadata */ - fun oauthAuthorizationServerMetadata( - requestOptions: RequestOptions - ): CompletableFuture> = - oauthAuthorizationServerMetadata( - OAuthOauthAuthorizationServerMetadataParams.none(), - requestOptions, - ) - - /** - * Returns a raw HTTP response for `get /v1/oauth/authorize`, but is otherwise the same as - * [OAuthServiceAsync.oauthAuthorize]. - */ - fun oauthAuthorize(): CompletableFuture> = - oauthAuthorize(OAuthOauthAuthorizeParams.none()) - - /** @see oauthAuthorize */ - fun oauthAuthorize( - params: OAuthOauthAuthorizeParams = OAuthOauthAuthorizeParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see oauthAuthorize */ - fun oauthAuthorize( - params: OAuthOauthAuthorizeParams - ): CompletableFuture> = oauthAuthorize(params, RequestOptions.none()) - - /** @see oauthAuthorize */ - fun oauthAuthorize( - requestOptions: RequestOptions - ): CompletableFuture> = - oauthAuthorize(OAuthOauthAuthorizeParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `post /v1/oauth/revoke`, but is otherwise the same as - * [OAuthServiceAsync.oauthRevoke]. - */ - fun oauthRevoke( - params: OAuthOauthRevokeParams - ): CompletableFuture> = - oauthRevoke(params, RequestOptions.none()) - - /** @see oauthRevoke */ - fun oauthRevoke( - params: OAuthOauthRevokeParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** - * Returns a raw HTTP response for `post /v1/oauth/token`, but is otherwise the same as - * [OAuthServiceAsync.oauthToken]. - */ - fun oauthToken( - params: OAuthOauthTokenParams - ): CompletableFuture> = - oauthToken(params, RequestOptions.none()) - - /** @see oauthToken */ - fun oauthToken( - params: OAuthOauthTokenParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - } -} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/async/OAuthServiceAsyncImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/async/OAuthServiceAsyncImpl.kt deleted file mode 100644 index f0790a5..0000000 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/async/OAuthServiceAsyncImpl.kt +++ /dev/null @@ -1,201 +0,0 @@ -// File generated by Scalar SDK Generator. DO NOT EDIT. - -package com.scalar.services.async - -import com.scalar.core.ClientOptions -import com.scalar.core.RequestOptions -import com.scalar.core.handlers.errorBodyHandler -import com.scalar.core.handlers.errorHandler -import com.scalar.core.handlers.jsonHandler -import com.scalar.core.http.HttpMethod -import com.scalar.core.http.HttpRequest -import com.scalar.core.http.HttpResponse -import com.scalar.core.http.HttpResponse.Handler -import com.scalar.core.http.HttpResponseFor -import com.scalar.core.http.json -import com.scalar.core.http.parseable -import com.scalar.core.prepareAsync -import com.scalar.models.oAuth.OAuthOauthAuthorizationServerMetadataParams -import com.scalar.models.oAuth.OAuthOauthAuthorizeParams -import com.scalar.models.oAuth.OAuthOauthRevokeParams -import com.scalar.models.oAuth.OAuthOauthTokenParams -import com.scalar.models.oAuth.OAuthOauthTokenResponse -import com.scalar.models.oAuth.OauthAuthorizationServerMetadata -import com.scalar.models.oAuth.OauthError -import java.util.concurrent.CompletableFuture -import java.util.function.Consumer - -/** OAuth */ -class OAuthServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : - OAuthServiceAsync { - - private val withRawResponse: OAuthServiceAsync.WithRawResponse by lazy { - WithRawResponseImpl(clientOptions) - } - - override fun withRawResponse(): OAuthServiceAsync.WithRawResponse = withRawResponse - - override fun withOptions(modifier: Consumer): OAuthServiceAsync = - OAuthServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - - override fun oauthAuthorizationServerMetadata( - params: OAuthOauthAuthorizationServerMetadataParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // get /.well-known/oauth-authorization-server - withRawResponse().oauthAuthorizationServerMetadata(params, requestOptions).thenApply { - it.parse() - } - - override fun oauthAuthorize( - params: OAuthOauthAuthorizeParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // get /v1/oauth/authorize - withRawResponse().oauthAuthorize(params, requestOptions).thenApply { it.parse() } - - override fun oauthRevoke( - params: OAuthOauthRevokeParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // post /v1/oauth/revoke - withRawResponse().oauthRevoke(params, requestOptions).thenApply { it.parse() } - - override fun oauthToken( - params: OAuthOauthTokenParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // post /v1/oauth/token - withRawResponse().oauthToken(params, requestOptions).thenApply { it.parse() } - - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : - OAuthServiceAsync.WithRawResponse { - - private val errorHandler: Handler = - errorHandler(errorBodyHandler(clientOptions.jsonMapper)) - - override fun withOptions( - modifier: Consumer - ): OAuthServiceAsync.WithRawResponse = - OAuthServiceAsyncImpl.WithRawResponseImpl( - clientOptions.toBuilder().apply(modifier::accept).build() - ) - - private val oauthAuthorizationServerMetadataHandler: - Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun oauthAuthorizationServerMetadata( - params: OAuthOauthAuthorizationServerMetadataParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments(".well-known", "oauth-authorization-server") - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response - .use { oauthAuthorizationServerMetadataHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } - - private val oauthAuthorizeHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun oauthAuthorize( - params: OAuthOauthAuthorizeParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("v1", "oauth", "authorize") - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response.use { oauthAuthorizeHandler.handle(it) } - } - } - } - - private val oauthRevokeHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun oauthRevoke( - params: OAuthOauthRevokeParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("v1", "oauth", "revoke") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response - .use { oauthRevokeHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it?.validate() - } - } - } - } - } - - private val oauthTokenHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun oauthToken( - params: OAuthOauthTokenParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("v1", "oauth", "token") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response - .use { oauthTokenHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } - } -} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/OAuthService.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/OAuthService.kt deleted file mode 100644 index 5452d5b..0000000 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/OAuthService.kt +++ /dev/null @@ -1,211 +0,0 @@ -// File generated by Scalar SDK Generator. DO NOT EDIT. - -package com.scalar.services.blocking - -import com.google.errorprone.annotations.MustBeClosed -import com.scalar.core.ClientOptions -import com.scalar.core.RequestOptions -import com.scalar.core.http.HttpResponseFor -import com.scalar.models.oAuth.OAuthOauthAuthorizationServerMetadataParams -import com.scalar.models.oAuth.OAuthOauthAuthorizeParams -import com.scalar.models.oAuth.OAuthOauthRevokeParams -import com.scalar.models.oAuth.OAuthOauthTokenParams -import com.scalar.models.oAuth.OAuthOauthTokenResponse -import com.scalar.models.oAuth.OauthAuthorizationServerMetadata -import com.scalar.models.oAuth.OauthError -import java.util.function.Consumer - -/** OAuth */ -interface OAuthService { - - /** - * Returns a view of this service that provides access to raw HTTP responses for each method. - */ - fun withRawResponse(): WithRawResponse - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions(modifier: Consumer): OAuthService - - /** - * Discovery document for OAuth clients (RFC 8414): where the endpoints are and what they - * support. - */ - fun oauthAuthorizationServerMetadata(): OauthAuthorizationServerMetadata = - oauthAuthorizationServerMetadata(OAuthOauthAuthorizationServerMetadataParams.none()) - - /** @see oauthAuthorizationServerMetadata */ - fun oauthAuthorizationServerMetadata( - params: OAuthOauthAuthorizationServerMetadataParams = - OAuthOauthAuthorizationServerMetadataParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): OauthAuthorizationServerMetadata - - /** @see oauthAuthorizationServerMetadata */ - fun oauthAuthorizationServerMetadata( - params: OAuthOauthAuthorizationServerMetadataParams - ): OauthAuthorizationServerMetadata = - oauthAuthorizationServerMetadata(params, RequestOptions.none()) - - /** @see oauthAuthorizationServerMetadata */ - fun oauthAuthorizationServerMetadata( - requestOptions: RequestOptions - ): OauthAuthorizationServerMetadata = - oauthAuthorizationServerMetadata( - OAuthOauthAuthorizationServerMetadataParams.none(), - requestOptions, - ) - - /** - * Authorization endpoint (RFC 6749 §4.1.1 with PKCE, RFC 7636). Validates the request and sends - * the user to the Scalar dashboard to approve it; the user returns to `redirect_uri` with a - * `code` to exchange at the token endpoint. Only `response_type=code` with - * `code_challenge_method=S256` is supported. - */ - fun oauthAuthorize(): Any? = oauthAuthorize(OAuthOauthAuthorizeParams.none()) - - /** @see oauthAuthorize */ - fun oauthAuthorize( - params: OAuthOauthAuthorizeParams = OAuthOauthAuthorizeParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): Any? - - /** @see oauthAuthorize */ - fun oauthAuthorize(params: OAuthOauthAuthorizeParams): Any? = - oauthAuthorize(params, RequestOptions.none()) - - /** @see oauthAuthorize */ - fun oauthAuthorize(requestOptions: RequestOptions): Any? = - oauthAuthorize(OAuthOauthAuthorizeParams.none(), requestOptions) - - /** - * Revocation endpoint (RFC 7009). Revokes the refresh token and every token issued alongside - * it. The client authenticates as it does at the token endpoint. Responds 200 whether or not - * the token was live, as the RFC requires. - */ - fun oauthRevoke(params: OAuthOauthRevokeParams): OauthError? = - oauthRevoke(params, RequestOptions.none()) - - /** @see oauthRevoke */ - fun oauthRevoke( - params: OAuthOauthRevokeParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): OauthError? - - /** - * Token endpoint (RFC 6749 §4.1.3 and §6). Accepts `application/x-www-form-urlencoded`. - * Confidential clients authenticate with HTTP Basic or `client_secret` in the body; public - * clients send `client_id` alone. The `authorization_code` grant needs `code`, `redirect_uri` - * and `code_verifier`; the `refresh_token` grant needs `refresh_token` and may narrow `scope`. - */ - fun oauthToken(params: OAuthOauthTokenParams): OAuthOauthTokenResponse = - oauthToken(params, RequestOptions.none()) - - /** @see oauthToken */ - fun oauthToken( - params: OAuthOauthTokenParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): OAuthOauthTokenResponse - - /** A view of [OAuthService] that provides access to raw HTTP responses for each method. */ - interface WithRawResponse { - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions(modifier: Consumer): OAuthService.WithRawResponse - - /** - * Returns a raw HTTP response for `get /.well-known/oauth-authorization-server`, but is - * otherwise the same as [OAuthService.oauthAuthorizationServerMetadata]. - */ - @MustBeClosed - fun oauthAuthorizationServerMetadata(): HttpResponseFor = - oauthAuthorizationServerMetadata(OAuthOauthAuthorizationServerMetadataParams.none()) - - /** @see oauthAuthorizationServerMetadata */ - @MustBeClosed - fun oauthAuthorizationServerMetadata( - params: OAuthOauthAuthorizationServerMetadataParams = - OAuthOauthAuthorizationServerMetadataParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** @see oauthAuthorizationServerMetadata */ - @MustBeClosed - fun oauthAuthorizationServerMetadata( - params: OAuthOauthAuthorizationServerMetadataParams - ): HttpResponseFor = - oauthAuthorizationServerMetadata(params, RequestOptions.none()) - - /** @see oauthAuthorizationServerMetadata */ - @MustBeClosed - fun oauthAuthorizationServerMetadata( - requestOptions: RequestOptions - ): HttpResponseFor = - oauthAuthorizationServerMetadata( - OAuthOauthAuthorizationServerMetadataParams.none(), - requestOptions, - ) - - /** - * Returns a raw HTTP response for `get /v1/oauth/authorize`, but is otherwise the same as - * [OAuthService.oauthAuthorize]. - */ - @MustBeClosed - fun oauthAuthorize(): HttpResponseFor = - oauthAuthorize(OAuthOauthAuthorizeParams.none()) - - /** @see oauthAuthorize */ - @MustBeClosed - fun oauthAuthorize( - params: OAuthOauthAuthorizeParams = OAuthOauthAuthorizeParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** @see oauthAuthorize */ - @MustBeClosed - fun oauthAuthorize(params: OAuthOauthAuthorizeParams): HttpResponseFor = - oauthAuthorize(params, RequestOptions.none()) - - /** @see oauthAuthorize */ - @MustBeClosed - fun oauthAuthorize(requestOptions: RequestOptions): HttpResponseFor = - oauthAuthorize(OAuthOauthAuthorizeParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `post /v1/oauth/revoke`, but is otherwise the same as - * [OAuthService.oauthRevoke]. - */ - @MustBeClosed - fun oauthRevoke(params: OAuthOauthRevokeParams): HttpResponseFor = - oauthRevoke(params, RequestOptions.none()) - - /** @see oauthRevoke */ - @MustBeClosed - fun oauthRevoke( - params: OAuthOauthRevokeParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** - * Returns a raw HTTP response for `post /v1/oauth/token`, but is otherwise the same as - * [OAuthService.oauthToken]. - */ - @MustBeClosed - fun oauthToken(params: OAuthOauthTokenParams): HttpResponseFor = - oauthToken(params, RequestOptions.none()) - - /** @see oauthToken */ - @MustBeClosed - fun oauthToken( - params: OAuthOauthTokenParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - } -} diff --git a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/OAuthServiceImpl.kt b/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/OAuthServiceImpl.kt deleted file mode 100644 index bf2c8a9..0000000 --- a/scalar-java-core/src/main/kotlin/com/scalar/services/blocking/OAuthServiceImpl.kt +++ /dev/null @@ -1,186 +0,0 @@ -// File generated by Scalar SDK Generator. DO NOT EDIT. - -package com.scalar.services.blocking - -import com.scalar.core.ClientOptions -import com.scalar.core.RequestOptions -import com.scalar.core.handlers.errorBodyHandler -import com.scalar.core.handlers.errorHandler -import com.scalar.core.handlers.jsonHandler -import com.scalar.core.http.HttpMethod -import com.scalar.core.http.HttpRequest -import com.scalar.core.http.HttpResponse -import com.scalar.core.http.HttpResponse.Handler -import com.scalar.core.http.HttpResponseFor -import com.scalar.core.http.json -import com.scalar.core.http.parseable -import com.scalar.core.prepare -import com.scalar.models.oAuth.OAuthOauthAuthorizationServerMetadataParams -import com.scalar.models.oAuth.OAuthOauthAuthorizeParams -import com.scalar.models.oAuth.OAuthOauthRevokeParams -import com.scalar.models.oAuth.OAuthOauthTokenParams -import com.scalar.models.oAuth.OAuthOauthTokenResponse -import com.scalar.models.oAuth.OauthAuthorizationServerMetadata -import com.scalar.models.oAuth.OauthError -import java.util.function.Consumer - -/** OAuth */ -class OAuthServiceImpl internal constructor(private val clientOptions: ClientOptions) : - OAuthService { - - private val withRawResponse: OAuthService.WithRawResponse by lazy { - WithRawResponseImpl(clientOptions) - } - - override fun withRawResponse(): OAuthService.WithRawResponse = withRawResponse - - override fun withOptions(modifier: Consumer): OAuthService = - OAuthServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - - override fun oauthAuthorizationServerMetadata( - params: OAuthOauthAuthorizationServerMetadataParams, - requestOptions: RequestOptions, - ): OauthAuthorizationServerMetadata = - // get /.well-known/oauth-authorization-server - withRawResponse().oauthAuthorizationServerMetadata(params, requestOptions).parse() - - override fun oauthAuthorize( - params: OAuthOauthAuthorizeParams, - requestOptions: RequestOptions, - ): Any? = - // get /v1/oauth/authorize - withRawResponse().oauthAuthorize(params, requestOptions).parse() - - override fun oauthRevoke( - params: OAuthOauthRevokeParams, - requestOptions: RequestOptions, - ): OauthError? = - // post /v1/oauth/revoke - withRawResponse().oauthRevoke(params, requestOptions).parse() - - override fun oauthToken( - params: OAuthOauthTokenParams, - requestOptions: RequestOptions, - ): OAuthOauthTokenResponse = - // post /v1/oauth/token - withRawResponse().oauthToken(params, requestOptions).parse() - - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : - OAuthService.WithRawResponse { - - private val errorHandler: Handler = - errorHandler(errorBodyHandler(clientOptions.jsonMapper)) - - override fun withOptions( - modifier: Consumer - ): OAuthService.WithRawResponse = - OAuthServiceImpl.WithRawResponseImpl( - clientOptions.toBuilder().apply(modifier::accept).build() - ) - - private val oauthAuthorizationServerMetadataHandler: - Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun oauthAuthorizationServerMetadata( - params: OAuthOauthAuthorizationServerMetadataParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments(".well-known", "oauth-authorization-server") - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response - .use { oauthAuthorizationServerMetadataHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - - private val oauthAuthorizeHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun oauthAuthorize( - params: OAuthOauthAuthorizeParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("v1", "oauth", "authorize") - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response.use { oauthAuthorizeHandler.handle(it) } - } - } - - private val oauthRevokeHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun oauthRevoke( - params: OAuthOauthRevokeParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("v1", "oauth", "revoke") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response - .use { oauthRevokeHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it?.validate() - } - } - } - } - - private val oauthTokenHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun oauthToken( - params: OAuthOauthTokenParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("v1", "oauth", "token") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response - .use { oauthTokenHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } -} diff --git a/scalar-java-proguard-test/src/test/kotlin/com/scalar/proguard/ProGuardCompatibilityTest.kt b/scalar-java-proguard-test/src/test/kotlin/com/scalar/proguard/ProGuardCompatibilityTest.kt index 6937839..df86858 100644 --- a/scalar-java-proguard-test/src/test/kotlin/com/scalar/proguard/ProGuardCompatibilityTest.kt +++ b/scalar-java-proguard-test/src/test/kotlin/com/scalar/proguard/ProGuardCompatibilityTest.kt @@ -62,7 +62,6 @@ internal class ProGuardCompatibilityTest { assertNotNull(client.authentication()) assertNotNull(client.sdks()) assertNotNull(client.mcp()) - assertNotNull(client.oAuth()) } @Test diff --git a/scalar-sdk.manifest.json b/scalar-sdk.manifest.json index 37aebde..e34bbeb 100644 --- a/scalar-sdk.manifest.json +++ b/scalar-sdk.manifest.json @@ -4023,1604 +4023,78 @@ ], "additionalProperties": false } - }, - { - "name": "oauth_token", - "source": "oauth_token", - "publicAliases": [], - "deprecated": false, - "type": { - "kind": "object", - "properties": [ - { - "name": "access_token", - "publicName": "access_token", - "required": true, - "deprecated": false, - "type": { - "kind": "primitive", - "type": "string" - } - }, - { - "name": "token_type", - "publicName": "token_type", - "required": true, - "deprecated": false, - "type": { - "kind": "literal", - "value": "Bearer" - } - }, - { - "name": "expires_in", - "publicName": "expires_in", - "required": true, - "deprecated": false, - "type": { - "kind": "primitive", - "type": "integer", - "validation": { - "minimum": -9007199254740991, - "maximum": 9007199254740991 - } - } - }, - { - "name": "refresh_token", - "publicName": "refresh_token", - "required": true, - "deprecated": false, - "type": { - "kind": "primitive", - "type": "string" - } - }, - { - "name": "scope", - "publicName": "scope", - "required": true, - "deprecated": false, - "type": { - "kind": "ref", - "name": "oauth_scope" - } - } - ], - "additionalProperties": false - } - }, - { - "name": "oauth_scope", - "source": "oauth_scope", - "publicAliases": [], - "deprecated": false, - "type": { - "kind": "enum", - "values": [ - "read", - "write", - "admin" - ], - "names": [ - "Read", - "Write", - "Admin" - ], - "deprecations": [ - false, - false, - false - ] - } - }, - { - "name": "oauth_error", - "source": "oauth_error", - "publicAliases": [], - "deprecated": false, - "type": { - "kind": "object", - "properties": [ - { - "name": "error", - "publicName": "error", - "required": true, - "deprecated": false, - "type": { - "kind": "primitive", - "type": "string" - } - }, - { - "name": "error_description", - "publicName": "error_description", - "required": false, - "deprecated": false, - "type": { - "kind": "primitive", - "type": "string" - } - } - ], - "additionalProperties": false - } - }, - { - "name": "oauth_token_request", - "source": "oauth_token_request", - "publicAliases": [], - "deprecated": false, - "type": { - "kind": "object", - "properties": [ - { - "name": "grant_type", - "publicName": "grant_type", - "required": true, - "deprecated": false, - "type": { - "kind": "primitive", - "type": "string", - "validation": { - "maxLength": 64 - } - } - }, - { - "name": "client_id", - "publicName": "client_id", - "required": false, - "deprecated": false, - "type": { - "kind": "primitive", - "type": "string", - "validation": { - "maxLength": 256 - } - } - }, - { - "name": "client_secret", - "publicName": "client_secret", - "required": false, - "deprecated": false, - "type": { - "kind": "primitive", - "type": "string", - "validation": { - "maxLength": 256 - } - } - }, - { - "name": "code", - "publicName": "code", - "required": false, - "deprecated": false, - "type": { - "kind": "primitive", - "type": "string", - "validation": { - "maxLength": 256 - } - } - }, - { - "name": "redirect_uri", - "publicName": "redirect_uri", - "required": false, - "deprecated": false, - "type": { - "kind": "primitive", - "type": "string", - "validation": { - "maxLength": 2048 - } - } - }, - { - "name": "code_verifier", - "publicName": "code_verifier", - "required": false, - "deprecated": false, - "type": { - "kind": "primitive", - "type": "string", - "validation": { - "maxLength": 256 - } - } - }, - { - "name": "refresh_token", - "publicName": "refresh_token", - "required": false, - "deprecated": false, - "type": { - "kind": "primitive", - "type": "string", - "validation": { - "maxLength": 4096 - } - } - }, - { - "name": "scope", - "publicName": "scope", - "required": false, - "deprecated": false, - "type": { - "kind": "primitive", - "type": "string", - "validation": { - "maxLength": 256 - } - } - } - ], - "additionalProperties": false - } - }, - { - "name": "oauth_revoke_request", - "source": "oauth_revoke_request", - "publicAliases": [], - "deprecated": false, - "type": { - "kind": "object", - "properties": [ - { - "name": "token", - "publicName": "token", - "required": true, - "deprecated": false, - "type": { - "kind": "primitive", - "type": "string", - "validation": { - "maxLength": 4096 - } - } - }, - { - "name": "token_type_hint", - "publicName": "token_type_hint", - "required": false, - "deprecated": false, - "type": { - "kind": "primitive", - "type": "string", - "validation": { - "maxLength": 64 - } - } - }, - { - "name": "client_id", - "publicName": "client_id", - "required": false, - "deprecated": false, - "type": { - "kind": "primitive", - "type": "string", - "validation": { - "maxLength": 256 - } - } - }, - { - "name": "client_secret", - "publicName": "client_secret", - "required": false, - "deprecated": false, - "type": { - "kind": "primitive", - "type": "string", - "validation": { - "maxLength": 256 - } - } - } - ], - "additionalProperties": false - } - }, - { - "name": "oauth_authorization_server_metadata", - "source": "oauth_authorization_server_metadata", - "publicAliases": [], - "deprecated": false, - "type": { - "kind": "object", - "properties": [ - { - "name": "issuer", - "publicName": "issuer", - "required": true, - "deprecated": false, - "type": { - "kind": "primitive", - "type": "string" - } - }, - { - "name": "authorization_endpoint", - "publicName": "authorization_endpoint", - "required": true, - "deprecated": false, - "type": { - "kind": "primitive", - "type": "string" - } - }, - { - "name": "token_endpoint", - "publicName": "token_endpoint", - "required": true, - "deprecated": false, - "type": { - "kind": "primitive", - "type": "string" - } - }, - { - "name": "revocation_endpoint", - "publicName": "revocation_endpoint", - "required": true, - "deprecated": false, - "type": { - "kind": "primitive", - "type": "string" - } - }, - { - "name": "response_types_supported", - "publicName": "response_types_supported", - "required": true, - "deprecated": false, - "type": { - "kind": "array", - "items": { - "kind": "primitive", - "type": "string" - } - } - }, - { - "name": "grant_types_supported", - "publicName": "grant_types_supported", - "required": true, - "deprecated": false, - "type": { - "kind": "array", - "items": { - "kind": "primitive", - "type": "string" - } - } - }, - { - "name": "code_challenge_methods_supported", - "publicName": "code_challenge_methods_supported", - "required": true, - "deprecated": false, - "type": { - "kind": "array", - "items": { - "kind": "primitive", - "type": "string" - } - } - }, - { - "name": "token_endpoint_auth_methods_supported", - "publicName": "token_endpoint_auth_methods_supported", - "required": true, - "deprecated": false, - "type": { - "kind": "array", - "items": { - "kind": "primitive", - "type": "string" - } - } - }, - { - "name": "revocation_endpoint_auth_methods_supported", - "publicName": "revocation_endpoint_auth_methods_supported", - "required": true, - "deprecated": false, - "type": { - "kind": "array", - "items": { - "kind": "primitive", - "type": "string" - } - } - }, - { - "name": "scopes_supported", - "publicName": "scopes_supported", - "required": true, - "deprecated": false, - "type": { - "kind": "array", - "items": { - "kind": "primitive", - "type": "string" - } - } - } - ], - "additionalProperties": false - } - } - ], - "resources": [ - "registry", - "schemas", - "schemas.version", - "schemas.accessGroup", - "loginPortals", - "accessGroups", - "accessGroups.domains", - "rules", - "themes", - "teams", - "teams.members", - "teams.invites", - "scalarDocs", - "namespaces", - "authentication", - "sdks", - "sdks.versions", - "sdks.repositories", - "mcp", - "mcp.servers", - "mcp.servers.installations", - "oAuth" - ], - "publicResources": [ - "registry", - "schemas", - "schemas.version", - "schemas.accessGroup", - "loginPortals", - "accessGroups", - "accessGroups.domains", - "rules", - "themes", - "teams", - "teams.members", - "teams.invites", - "scalarDocs", - "namespaces", - "authentication", - "sdks", - "sdks.versions", - "sdks.repositories", - "mcp", - "mcp.servers", - "mcp.servers.installations", - "oAuth" - ], - "operations": [ - { - "resource": "registry", - "publicResource": "registry", - "operation": "listAllApiDocuments", - "publicOperation": "listAllApiDocuments", - "deprecated": false, - "method": "GET", - "path": "/v1/apis", - "pathParams": [], - "publicPathParams": [], - "queryParams": [], - "publicQueryParams": [], - "headerParams": [], - "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], - "pathParamDetails": [], - "queryParamDetails": [], - "headerParamDetails": [], - "cookieParams": [], - "publicCookieParams": [], - "cookieParamDetails": [], - "response": { - "status": "200", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ] - }, - "result": { - "successStatus": "200", - "errorStatuses": [ - "400", - "401", - "403", - "404", - "422", - "500" - ] - }, - "errorResponses": [ - { - "status": "400", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "400", - "publicAliases": [] - } - }, - { - "status": "401", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "401", - "publicAliases": [] - } - }, - { - "status": "403", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "403", - "publicAliases": [] - } - }, - { - "status": "404", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "404", - "publicAliases": [] - } - }, - { - "status": "422", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "422", - "publicAliases": [] - } - }, - { - "status": "500", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "500", - "publicAliases": [] - } - } - ], - "responseLinks": [], - "transport": "http" - }, - { - "resource": "registry", - "publicResource": "registry", - "operation": "listApiDocuments", - "publicOperation": "listApiDocuments", - "deprecated": false, - "method": "GET", - "path": "/v1/apis/{namespace}", - "pathParams": [ - "namespace" - ], - "publicPathParams": [ - "namespace" - ], - "queryParams": [], - "publicQueryParams": [], - "headerParams": [], - "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], - "pathParamDetails": [ - { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false - } - ], - "queryParamDetails": [], - "headerParamDetails": [], - "cookieParams": [], - "publicCookieParams": [], - "cookieParamDetails": [], - "paramsModel": { - "publicName": "RegistryListApiDocumentsParams" - }, - "response": { - "status": "200", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ] - }, - "result": { - "successStatus": "200", - "errorStatuses": [ - "400", - "401", - "403", - "404", - "422", - "500" - ] - }, - "errorResponses": [ - { - "status": "400", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "400", - "publicAliases": [] - } - }, - { - "status": "401", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "401", - "publicAliases": [] - } - }, - { - "status": "403", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "403", - "publicAliases": [] - } - }, - { - "status": "404", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "404", - "publicAliases": [] - } - }, - { - "status": "422", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "422", - "publicAliases": [] - } - }, - { - "status": "500", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "500", - "publicAliases": [] - } - } - ], - "responseLinks": [], - "transport": "http" - }, - { - "resource": "registry", - "publicResource": "registry", - "operation": "createApiDocument", - "publicOperation": "createApiDocument", - "deprecated": false, - "method": "POST", - "path": "/v1/apis/{namespace}", - "pathParams": [ - "namespace" - ], - "publicPathParams": [ - "namespace" - ], - "queryParams": [], - "publicQueryParams": [], - "headerParams": [], - "publicHeaderParams": [], - "bodyParams": [ - "title", - "description", - "version", - "slug", - "ruleset", - "isPrivate", - "document" - ], - "publicBodyParams": [ - "title", - "description", - "version", - "slug", - "ruleset", - "isPrivate", - "document" - ], - "bodyParamDetails": [ - { - "name": "title", - "required": true - }, - { - "name": "description", - "required": false - }, - { - "name": "version", - "required": true - }, - { - "name": "slug", - "required": true - }, - { - "name": "ruleset", - "required": false - }, - { - "name": "isPrivate", - "required": false - }, - { - "name": "document", - "required": true - } - ], - "pathParamDetails": [ - { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false - } - ], - "queryParamDetails": [], - "headerParamDetails": [], - "cookieParams": [], - "publicCookieParams": [], - "cookieParamDetails": [], - "paramsModel": { - "publicName": "RegistryCreateApiDocumentParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" - }, - "response": { - "status": "200", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ] - }, - "result": { - "successStatus": "200", - "errorStatuses": [ - "400", - "401", - "403", - "404", - "422", - "500" - ] - }, - "errorResponses": [ - { - "status": "400", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "400", - "publicAliases": [] - } - }, - { - "status": "401", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "401", - "publicAliases": [] - } - }, - { - "status": "403", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "403", - "publicAliases": [] - } - }, - { - "status": "404", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "404", - "publicAliases": [] - } - }, - { - "status": "422", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "422", - "publicAliases": [] - } - }, - { - "status": "500", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "500", - "publicAliases": [] - } - } - ], - "responseLinks": [], - "transport": "http" - }, - { - "resource": "registry", - "publicResource": "registry", - "operation": "updateApiDocument", - "publicOperation": "updateApiDocument", - "deprecated": false, - "method": "PATCH", - "path": "/v1/apis/{namespace}/{slug}", - "pathParams": [ - "namespace", - "slug" - ], - "publicPathParams": [ - "namespace", - "slug" - ], - "queryParams": [], - "publicQueryParams": [], - "headerParams": [], - "publicHeaderParams": [], - "bodyParams": [ - "title", - "description", - "isPrivate", - "ruleset" - ], - "publicBodyParams": [ - "title", - "description", - "isPrivate", - "ruleset" - ], - "bodyParamDetails": [ - { - "name": "title", - "required": false - }, - { - "name": "description", - "required": false - }, - { - "name": "isPrivate", - "required": false - }, - { - "name": "ruleset", - "required": false - } - ], - "pathParamDetails": [ - { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false - }, - { - "name": "slug", - "required": true, - "style": "simple", - "explode": false - } - ], - "queryParamDetails": [], - "headerParamDetails": [], - "cookieParams": [], - "publicCookieParams": [], - "cookieParamDetails": [], - "paramsModel": { - "publicName": "RegistryUpdateApiDocumentParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" - }, - "response": { - "status": "200", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ] - }, - "result": { - "successStatus": "200", - "errorStatuses": [ - "400", - "401", - "403", - "404", - "422", - "500" - ] - }, - "errorResponses": [ - { - "status": "400", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "400", - "publicAliases": [] - } - }, - { - "status": "401", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "401", - "publicAliases": [] - } - }, - { - "status": "403", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "403", - "publicAliases": [] - } - }, - { - "status": "404", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "404", - "publicAliases": [] - } - }, - { - "status": "422", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "422", - "publicAliases": [] - } - }, - { - "status": "500", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "500", - "publicAliases": [] - } - } - ], - "responseLinks": [], - "transport": "http" - }, - { - "resource": "registry", - "publicResource": "registry", - "operation": "deleteApiDocument", - "publicOperation": "deleteApiDocument", - "deprecated": false, - "method": "DELETE", - "path": "/v1/apis/{namespace}/{slug}", - "pathParams": [ - "namespace", - "slug" - ], - "publicPathParams": [ - "namespace", - "slug" - ], - "queryParams": [], - "publicQueryParams": [], - "headerParams": [], - "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], - "pathParamDetails": [ - { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false - }, - { - "name": "slug", - "required": true, - "style": "simple", - "explode": false - } - ], - "queryParamDetails": [], - "headerParamDetails": [], - "cookieParams": [], - "publicCookieParams": [], - "cookieParamDetails": [], - "paramsModel": { - "publicName": "RegistryDeleteApiDocumentParams" - }, - "response": { - "status": "200", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ] - }, - "result": { - "successStatus": "200", - "errorStatuses": [ - "400", - "401", - "403", - "404", - "422", - "500" - ] - }, - "errorResponses": [ - { - "status": "400", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "400", - "publicAliases": [] - } - }, - { - "status": "401", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "401", - "publicAliases": [] - } - }, - { - "status": "403", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "403", - "publicAliases": [] - } - }, - { - "status": "404", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "404", - "publicAliases": [] - } - }, - { - "status": "422", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "422", - "publicAliases": [] - } - }, - { - "status": "500", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "500", - "publicAliases": [] - } - } - ], - "responseLinks": [], - "transport": "http" - }, - { - "resource": "registry", - "publicResource": "registry", - "operation": "retrieveApiDocumentVersion", - "publicOperation": "retrieveApiDocumentVersion", - "deprecated": false, - "method": "GET", - "path": "/v1/apis/{namespace}/{slug}/version/{semver}", - "pathParams": [ - "namespace", - "slug", - "semver" - ], - "publicPathParams": [ - "namespace", - "slug", - "semver" - ], - "queryParams": [], - "publicQueryParams": [], - "headerParams": [], - "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], - "pathParamDetails": [ - { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false - }, - { - "name": "slug", - "required": true, - "style": "simple", - "explode": false - }, - { - "name": "semver", - "required": true, - "style": "simple", - "explode": false - } - ], - "queryParamDetails": [], - "headerParamDetails": [], - "cookieParams": [], - "publicCookieParams": [], - "cookieParamDetails": [], - "paramsModel": { - "publicName": "RegistryRetrieveApiDocumentVersionParams" - }, - "response": { - "status": "200", - "contentType": "text/plain", - "encoding": "text", - "contents": [ - { - "contentType": "text/plain", - "encoding": "text" - } - ] - }, - "result": { - "successStatus": "200", - "errorStatuses": [ - "400", - "401", - "403", - "404", - "422", - "500" - ] - }, - "errorResponses": [ - { - "status": "400", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "400", - "publicAliases": [] - } - }, - { - "status": "401", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "401", - "publicAliases": [] - } - }, - { - "status": "403", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "403", - "publicAliases": [] - } - }, - { - "status": "404", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "404", - "publicAliases": [] - } - }, - { - "status": "422", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "422", - "publicAliases": [] - } - }, - { - "status": "500", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "500", - "publicAliases": [] - } - } - ], - "responseLinks": [], - "transport": "http" - }, + } + ], + "resources": [ + "registry", + "schemas", + "schemas.version", + "schemas.accessGroup", + "loginPortals", + "accessGroups", + "accessGroups.domains", + "rules", + "themes", + "teams", + "teams.members", + "teams.invites", + "scalarDocs", + "namespaces", + "authentication", + "sdks", + "sdks.versions", + "sdks.repositories", + "mcp", + "mcp.servers", + "mcp.servers.installations" + ], + "publicResources": [ + "registry", + "schemas", + "schemas.version", + "schemas.accessGroup", + "loginPortals", + "accessGroups", + "accessGroups.domains", + "rules", + "themes", + "teams", + "teams.members", + "teams.invites", + "scalarDocs", + "namespaces", + "authentication", + "sdks", + "sdks.versions", + "sdks.repositories", + "mcp", + "mcp.servers", + "mcp.servers.installations" + ], + "operations": [ { "resource": "registry", "publicResource": "registry", - "operation": "updateApiDocumentVersion", - "publicOperation": "updateApiDocumentVersion", + "operation": "listAllApiDocuments", + "publicOperation": "listAllApiDocuments", "deprecated": false, - "method": "PATCH", - "path": "/v1/apis/{namespace}/{slug}/version/{semver}", - "pathParams": [ - "namespace", - "slug", - "semver" - ], - "publicPathParams": [ - "namespace", - "slug", - "semver" - ], + "method": "GET", + "path": "/v1/apis", + "pathParams": [], + "publicPathParams": [], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "document" - ], - "publicBodyParams": [ - "document" - ], - "bodyParamDetails": [ - { - "name": "document", - "required": true - } - ], - "pathParamDetails": [ - { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false - }, - { - "name": "slug", - "required": true, - "style": "simple", - "explode": false - }, - { - "name": "semver", - "required": true, - "style": "simple", - "explode": false - } - ], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], - "paramsModel": { - "publicName": "RegistryUpdateApiDocumentVersionParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" - }, "response": { "status": "200", "contentType": "application/json", @@ -5741,20 +4215,16 @@ { "resource": "registry", "publicResource": "registry", - "operation": "deleteApiDocumentVersion", - "publicOperation": "deleteApiDocumentVersion", + "operation": "listApiDocuments", + "publicOperation": "listApiDocuments", "deprecated": false, - "method": "DELETE", - "path": "/v1/apis/{namespace}/{slug}/version/{semver}", + "method": "GET", + "path": "/v1/apis/{namespace}", "pathParams": [ - "namespace", - "slug", - "semver" + "namespace" ], "publicPathParams": [ - "namespace", - "slug", - "semver" + "namespace" ], "queryParams": [], "publicQueryParams": [], @@ -5769,18 +4239,6 @@ "required": true, "style": "simple", "explode": false - }, - { - "name": "slug", - "required": true, - "style": "simple", - "explode": false - }, - { - "name": "semver", - "required": true, - "style": "simple", - "explode": false } ], "queryParamDetails": [], @@ -5789,7 +4247,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RegistryDeleteApiDocumentVersionParams" + "publicName": "RegistryListApiDocumentsParams" }, "response": { "status": "200", @@ -5911,43 +4369,72 @@ { "resource": "registry", "publicResource": "registry", - "operation": "listApiDocumentVersionMetadata", - "publicOperation": "listApiDocumentVersionMetadata", + "operation": "createApiDocument", + "publicOperation": "createApiDocument", "deprecated": false, - "method": "GET", - "path": "/v1/apis/{namespace}/{slug}/version/{semver}/metadata", + "method": "POST", + "path": "/v1/apis/{namespace}", "pathParams": [ - "namespace", - "slug", - "semver" + "namespace" ], "publicPathParams": [ - "namespace", - "slug", - "semver" + "namespace" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], - "pathParamDetails": [ + "bodyParams": [ + "title", + "description", + "version", + "slug", + "ruleset", + "isPrivate", + "document" + ], + "publicBodyParams": [ + "title", + "description", + "version", + "slug", + "ruleset", + "isPrivate", + "document" + ], + "bodyParamDetails": [ + { + "name": "title", + "required": true + }, { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false + "name": "description", + "required": false + }, + { + "name": "version", + "required": true }, { "name": "slug", - "required": true, - "style": "simple", - "explode": false + "required": true }, { - "name": "semver", + "name": "ruleset", + "required": false + }, + { + "name": "isPrivate", + "required": false + }, + { + "name": "document", + "required": true + } + ], + "pathParamDetails": [ + { + "name": "namespace", "required": true, "style": "simple", "explode": false @@ -5959,7 +4446,20 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RegistryListApiDocumentVersionMetadataParams" + "publicName": "RegistryCreateApiDocumentParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" }, "response": { "status": "200", @@ -5972,10 +4472,6 @@ } ] }, - "responseModel": { - "name": "managed_doc_version", - "publicAliases": [] - }, "result": { "successStatus": "200", "errorStatuses": [ @@ -6085,11 +4581,11 @@ { "resource": "registry", "publicResource": "registry", - "operation": "createApiDocumentVersion", - "publicOperation": "createApiDocumentVersion", + "operation": "updateApiDocument", + "publicOperation": "updateApiDocument", "deprecated": false, - "method": "POST", - "path": "/v1/apis/{namespace}/{slug}/version", + "method": "PATCH", + "path": "/v1/apis/{namespace}/{slug}", "pathParams": [ "namespace", "slug" @@ -6103,26 +4599,32 @@ "headerParams": [], "publicHeaderParams": [], "bodyParams": [ - "version", - "document", - "force" + "title", + "description", + "isPrivate", + "ruleset" ], "publicBodyParams": [ - "version", - "document", - "force" + "title", + "description", + "isPrivate", + "ruleset" ], "bodyParamDetails": [ { - "name": "version", - "required": true + "name": "title", + "required": false }, { - "name": "document", - "required": true + "name": "description", + "required": false }, { - "name": "force", + "name": "isPrivate", + "required": false + }, + { + "name": "ruleset", "required": false } ], @@ -6146,7 +4648,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RegistryCreateApiDocumentVersionParams" + "publicName": "RegistryUpdateApiDocumentParams" }, "requestBody": { "contentType": "application/json", @@ -6172,10 +4674,6 @@ } ] }, - "responseModel": { - "name": "managed_doc_version", - "publicAliases": [] - }, "result": { "successStatus": "200", "errorStatuses": [ @@ -6285,11 +4783,11 @@ { "resource": "registry", "publicResource": "registry", - "operation": "createApiDocumentAccessGroup", - "publicOperation": "createApiDocumentAccessGroup", + "operation": "deleteApiDocument", + "publicOperation": "deleteApiDocument", "deprecated": false, - "method": "POST", - "path": "/v1/apis/{namespace}/{slug}/access-group", + "method": "DELETE", + "path": "/v1/apis/{namespace}/{slug}", "pathParams": [ "namespace", "slug" @@ -6302,18 +4800,9 @@ "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "accessGroupSlug" - ], - "publicBodyParams": [ - "accessGroupSlug" - ], - "bodyParamDetails": [ - { - "name": "accessGroupSlug", - "required": true - } - ], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], "pathParamDetails": [ { "name": "namespace", @@ -6334,20 +4823,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RegistryCreateApiDocumentAccessGroupParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "RegistryDeleteApiDocumentParams" }, "response": { "status": "200", @@ -6469,35 +4945,28 @@ { "resource": "registry", "publicResource": "registry", - "operation": "deleteApiDocumentAccessGroup", - "publicOperation": "deleteApiDocumentAccessGroup", + "operation": "retrieveApiDocumentVersion", + "publicOperation": "retrieveApiDocumentVersion", "deprecated": false, - "method": "DELETE", - "path": "/v1/apis/{namespace}/{slug}/access-group", + "method": "GET", + "path": "/v1/apis/{namespace}/{slug}/version/{semver}", "pathParams": [ "namespace", - "slug" + "slug", + "semver" ], "publicPathParams": [ "namespace", - "slug" + "slug", + "semver" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "accessGroupSlug" - ], - "publicBodyParams": [ - "accessGroupSlug" - ], - "bodyParamDetails": [ - { - "name": "accessGroupSlug", - "required": true - } - ], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], "pathParamDetails": [ { "name": "namespace", @@ -6510,6 +4979,12 @@ "required": true, "style": "simple", "explode": false + }, + { + "name": "semver", + "required": true, + "style": "simple", + "explode": false } ], "queryParamDetails": [], @@ -6518,29 +4993,16 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RegistryDeleteApiDocumentAccessGroupParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "RegistryRetrieveApiDocumentVersionParams" }, "response": { "status": "200", - "contentType": "application/json", - "encoding": "json", + "contentType": "text/plain", + "encoding": "text", "contents": [ { - "contentType": "application/json", - "encoding": "json" + "contentType": "text/plain", + "encoding": "text" } ] }, @@ -6651,32 +5113,57 @@ "transport": "http" }, { - "resource": "schemas", - "publicResource": "schemas", - "operation": "list", - "publicOperation": "list", + "resource": "registry", + "publicResource": "registry", + "operation": "updateApiDocumentVersion", + "publicOperation": "updateApiDocumentVersion", "deprecated": false, - "method": "GET", - "path": "/v1/schemas/{namespace}", + "method": "PATCH", + "path": "/v1/apis/{namespace}/{slug}/version/{semver}", "pathParams": [ - "namespace" + "namespace", + "slug", + "semver" ], "publicPathParams": [ - "namespace" + "namespace", + "slug", + "semver" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], + "bodyParams": [ + "document" + ], + "publicBodyParams": [ + "document" + ], + "bodyParamDetails": [ + { + "name": "document", + "required": true + } + ], "pathParamDetails": [ { "name": "namespace", "required": true, "style": "simple", "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "semver", + "required": true, + "style": "simple", + "explode": false } ], "queryParamDetails": [], @@ -6685,7 +5172,20 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "SchemaListParams" + "publicName": "RegistryUpdateApiDocumentVersionParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" }, "response": { "status": "200", @@ -6802,71 +5302,48 @@ } ], "responseLinks": [], - "transport": "http" - }, - { - "resource": "schemas", - "publicResource": "schemas", - "operation": "create", - "publicOperation": "create", + "transport": "http" + }, + { + "resource": "registry", + "publicResource": "registry", + "operation": "deleteApiDocumentVersion", + "publicOperation": "deleteApiDocumentVersion", "deprecated": false, - "method": "POST", - "path": "/v1/schemas/{namespace}", + "method": "DELETE", + "path": "/v1/apis/{namespace}/{slug}/version/{semver}", "pathParams": [ - "namespace" + "namespace", + "slug", + "semver" ], "publicPathParams": [ - "namespace" + "namespace", + "slug", + "semver" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "title", - "description", - "version", - "slug", - "isPrivate", - "document" - ], - "publicBodyParams": [ - "title", - "description", - "version", - "slug", - "isPrivate", - "document" - ], - "bodyParamDetails": [ - { - "name": "title", - "required": true - }, - { - "name": "description", - "required": false - }, + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [ { - "name": "version", - "required": true + "name": "namespace", + "required": true, + "style": "simple", + "explode": false }, { "name": "slug", - "required": true - }, - { - "name": "isPrivate", - "required": false + "required": true, + "style": "simple", + "explode": false }, { - "name": "document", - "required": true - } - ], - "pathParamDetails": [ - { - "name": "namespace", + "name": "semver", "required": true, "style": "simple", "explode": false @@ -6878,20 +5355,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "SchemaCreateParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "RegistryDeleteApiDocumentVersionParams" }, "response": { "status": "200", @@ -6904,10 +5368,6 @@ } ] }, - "responseModel": { - "name": "uid", - "publicAliases": [] - }, "result": { "successStatus": "200", "errorStatuses": [ @@ -7015,49 +5475,30 @@ "transport": "http" }, { - "resource": "schemas", - "publicResource": "schemas", - "operation": "update", - "publicOperation": "update", + "resource": "registry", + "publicResource": "registry", + "operation": "listApiDocumentVersionMetadata", + "publicOperation": "listApiDocumentVersionMetadata", "deprecated": false, - "method": "PATCH", - "path": "/v1/schemas/{namespace}/{slug}", + "method": "GET", + "path": "/v1/apis/{namespace}/{slug}/version/{semver}/metadata", "pathParams": [ "namespace", - "slug" + "slug", + "semver" ], "publicPathParams": [ "namespace", - "slug" + "slug", + "semver" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "title", - "description", - "isPrivate" - ], - "publicBodyParams": [ - "title", - "description", - "isPrivate" - ], - "bodyParamDetails": [ - { - "name": "title", - "required": false - }, - { - "name": "description", - "required": false - }, - { - "name": "isPrivate", - "required": false - } - ], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], "pathParamDetails": [ { "name": "namespace", @@ -7070,6 +5511,12 @@ "required": true, "style": "simple", "explode": false + }, + { + "name": "semver", + "required": true, + "style": "simple", + "explode": false } ], "queryParamDetails": [], @@ -7078,20 +5525,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "SchemaUpdateParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "RegistryListApiDocumentVersionMetadataParams" }, "response": { "status": "200", @@ -7104,6 +5538,10 @@ } ] }, + "responseModel": { + "name": "managed_doc_version", + "publicAliases": [] + }, "result": { "successStatus": "200", "errorStatuses": [ @@ -7211,13 +5649,13 @@ "transport": "http" }, { - "resource": "schemas", - "publicResource": "schemas", - "operation": "delete", - "publicOperation": "delete", + "resource": "registry", + "publicResource": "registry", + "operation": "createApiDocumentVersion", + "publicOperation": "createApiDocumentVersion", "deprecated": false, - "method": "DELETE", - "path": "/v1/schemas/{namespace}/{slug}", + "method": "POST", + "path": "/v1/apis/{namespace}/{slug}/version", "pathParams": [ "namespace", "slug" @@ -7230,9 +5668,30 @@ "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], + "bodyParams": [ + "version", + "document", + "force" + ], + "publicBodyParams": [ + "version", + "document", + "force" + ], + "bodyParamDetails": [ + { + "name": "version", + "required": true + }, + { + "name": "document", + "required": true + }, + { + "name": "force", + "required": false + } + ], "pathParamDetails": [ { "name": "namespace", @@ -7253,7 +5712,20 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "SchemaDeleteParams" + "publicName": "RegistryCreateApiDocumentVersionParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" }, "response": { "status": "200", @@ -7266,6 +5738,10 @@ } ] }, + "responseModel": { + "name": "managed_doc_version", + "publicAliases": [] + }, "result": { "successStatus": "200", "errorStatuses": [ @@ -7373,45 +5849,46 @@ "transport": "http" }, { - "resource": "schemas.version", - "publicResource": "schemas.version", - "operation": "retrieve", - "publicOperation": "retrieve", + "resource": "registry", + "publicResource": "registry", + "operation": "createApiDocumentAccessGroup", + "publicOperation": "createApiDocumentAccessGroup", "deprecated": false, - "method": "GET", - "path": "/v1/schemas/{namespace}/{slug}/version/{semver}", + "method": "POST", + "path": "/v1/apis/{namespace}/{slug}/access-group", "pathParams": [ "namespace", - "slug", - "semver" + "slug" ], "publicPathParams": [ "namespace", - "slug", - "semver" + "slug" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], - "pathParamDetails": [ + "bodyParams": [ + "accessGroupSlug" + ], + "publicBodyParams": [ + "accessGroupSlug" + ], + "bodyParamDetails": [ { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false - }, + "name": "accessGroupSlug", + "required": true + } + ], + "pathParamDetails": [ { - "name": "slug", + "name": "namespace", "required": true, "style": "simple", "explode": false }, { - "name": "semver", + "name": "slug", "required": true, "style": "simple", "explode": false @@ -7423,16 +5900,29 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "VersionRetrieveParams" + "publicName": "RegistryCreateApiDocumentAccessGroupParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" }, "response": { "status": "200", - "contentType": "text/plain", - "encoding": "text", + "contentType": "application/json", + "encoding": "json", "contents": [ { - "contentType": "text/plain", - "encoding": "text" + "contentType": "application/json", + "encoding": "json" } ] }, @@ -7543,30 +6033,37 @@ "transport": "http" }, { - "resource": "schemas.version", - "publicResource": "schemas.version", - "operation": "delete", - "publicOperation": "delete", + "resource": "registry", + "publicResource": "registry", + "operation": "deleteApiDocumentAccessGroup", + "publicOperation": "deleteApiDocumentAccessGroup", "deprecated": false, "method": "DELETE", - "path": "/v1/schemas/{namespace}/{slug}/version/{semver}", + "path": "/v1/apis/{namespace}/{slug}/access-group", "pathParams": [ "namespace", - "slug", - "semver" + "slug" ], "publicPathParams": [ "namespace", - "slug", - "semver" + "slug" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], + "bodyParams": [ + "accessGroupSlug" + ], + "publicBodyParams": [ + "accessGroupSlug" + ], + "bodyParamDetails": [ + { + "name": "accessGroupSlug", + "required": true + } + ], "pathParamDetails": [ { "name": "namespace", @@ -7579,12 +6076,6 @@ "required": true, "style": "simple", "explode": false - }, - { - "name": "semver", - "required": true, - "style": "simple", - "explode": false } ], "queryParamDetails": [], @@ -7593,7 +6084,20 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "VersionDeleteParams" + "publicName": "RegistryDeleteApiDocumentAccessGroupParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" }, "response": { "status": "200", @@ -7713,61 +6217,32 @@ "transport": "http" }, { - "resource": "schemas.version", - "publicResource": "schemas.version", - "operation": "create", - "publicOperation": "create", + "resource": "schemas", + "publicResource": "schemas", + "operation": "list", + "publicOperation": "list", "deprecated": false, - "method": "POST", - "path": "/v1/schemas/{namespace}/{slug}/version", + "method": "GET", + "path": "/v1/schemas/{namespace}", "pathParams": [ - "namespace", - "slug" + "namespace" ], "publicPathParams": [ - "namespace", - "slug" + "namespace" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "version", - "document", - "force" - ], - "publicBodyParams": [ - "version", - "document", - "force" - ], - "bodyParamDetails": [ - { - "name": "version", - "required": true - }, - { - "name": "document", - "required": true - }, - { - "name": "force", - "required": false - } - ], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], "pathParamDetails": [ { "name": "namespace", "required": true, "style": "simple", "explode": false - }, - { - "name": "slug", - "required": true, - "style": "simple", - "explode": false } ], "queryParamDetails": [], @@ -7776,20 +6251,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "VersionCreateParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "SchemaListParams" }, "response": { "status": "200", @@ -7909,34 +6371,62 @@ "transport": "http" }, { - "resource": "schemas.accessGroup", - "publicResource": "schemas.accessGroup", + "resource": "schemas", + "publicResource": "schemas", "operation": "create", "publicOperation": "create", "deprecated": false, "method": "POST", - "path": "/v1/schemas/{namespace}/{slug}/access-group", + "path": "/v1/schemas/{namespace}", "pathParams": [ - "namespace", - "slug" + "namespace" ], "publicPathParams": [ - "namespace", - "slug" + "namespace" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], "bodyParams": [ - "accessGroupSlug" + "title", + "description", + "version", + "slug", + "isPrivate", + "document" ], "publicBodyParams": [ - "accessGroupSlug" + "title", + "description", + "version", + "slug", + "isPrivate", + "document" ], "bodyParamDetails": [ { - "name": "accessGroupSlug", + "name": "title", + "required": true + }, + { + "name": "description", + "required": false + }, + { + "name": "version", + "required": true + }, + { + "name": "slug", + "required": true + }, + { + "name": "isPrivate", + "required": false + }, + { + "name": "document", "required": true } ], @@ -7946,12 +6436,6 @@ "required": true, "style": "simple", "explode": false - }, - { - "name": "slug", - "required": true, - "style": "simple", - "explode": false } ], "queryParamDetails": [], @@ -7960,7 +6444,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "AccessGroupCreateParams" + "publicName": "SchemaCreateParams" }, "requestBody": { "contentType": "application/json", @@ -7986,6 +6470,10 @@ } ] }, + "responseModel": { + "name": "uid", + "publicAliases": [] + }, "result": { "successStatus": "200", "errorStatuses": [ @@ -8093,13 +6581,13 @@ "transport": "http" }, { - "resource": "schemas.accessGroup", - "publicResource": "schemas.accessGroup", - "operation": "delete", - "publicOperation": "delete", + "resource": "schemas", + "publicResource": "schemas", + "operation": "update", + "publicOperation": "update", "deprecated": false, - "method": "DELETE", - "path": "/v1/schemas/{namespace}/{slug}/access-group", + "method": "PATCH", + "path": "/v1/schemas/{namespace}/{slug}", "pathParams": [ "namespace", "slug" @@ -8113,15 +6601,27 @@ "headerParams": [], "publicHeaderParams": [], "bodyParams": [ - "accessGroupSlug" + "title", + "description", + "isPrivate" ], "publicBodyParams": [ - "accessGroupSlug" + "title", + "description", + "isPrivate" ], "bodyParamDetails": [ { - "name": "accessGroupSlug", - "required": true + "name": "title", + "required": false + }, + { + "name": "description", + "required": false + }, + { + "name": "isPrivate", + "required": false } ], "pathParamDetails": [ @@ -8144,7 +6644,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "AccessGroupDeleteParams" + "publicName": "SchemaUpdateParams" }, "requestBody": { "contentType": "application/json", @@ -8277,17 +6777,19 @@ "transport": "http" }, { - "resource": "loginPortals", - "publicResource": "loginPortals", - "operation": "retrieve", - "publicOperation": "retrieve", + "resource": "schemas", + "publicResource": "schemas", + "operation": "delete", + "publicOperation": "delete", "deprecated": false, - "method": "GET", - "path": "/v1/login-portals/{slug}", + "method": "DELETE", + "path": "/v1/schemas/{namespace}/{slug}", "pathParams": [ + "namespace", "slug" ], "publicPathParams": [ + "namespace", "slug" ], "queryParams": [], @@ -8298,6 +6800,12 @@ "publicBodyParams": [], "bodyParamDetails": [], "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, { "name": "slug", "required": true, @@ -8311,7 +6819,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "LoginPortalRetrieveParams" + "publicName": "SchemaDeleteParams" }, "response": { "status": "200", @@ -8431,41 +6939,48 @@ "transport": "http" }, { - "resource": "loginPortals", - "publicResource": "loginPortals", - "operation": "update", - "publicOperation": "update", + "resource": "schemas.version", + "publicResource": "schemas.version", + "operation": "retrieve", + "publicOperation": "retrieve", "deprecated": false, - "method": "PATCH", - "path": "/v1/login-portals/{slug}", + "method": "GET", + "path": "/v1/schemas/{namespace}/{slug}/version/{semver}", "pathParams": [ - "slug" + "namespace", + "slug", + "semver" ], "publicPathParams": [ - "slug" + "namespace", + "slug", + "semver" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "title" - ], - "publicBodyParams": [ - "title" - ], - "bodyParamDetails": [ - { - "name": "title", - "required": false - } - ], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, { "name": "slug", "required": true, "style": "simple", "explode": false + }, + { + "name": "semver", + "required": true, + "style": "simple", + "explode": false } ], "queryParamDetails": [], @@ -8474,29 +6989,16 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "LoginPortalUpdateParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "VersionRetrieveParams" }, "response": { "status": "200", - "contentType": "application/json", - "encoding": "json", + "contentType": "text/plain", + "encoding": "text", "contents": [ { - "contentType": "application/json", - "encoding": "json" + "contentType": "text/plain", + "encoding": "text" } ] }, @@ -8607,18 +7109,22 @@ "transport": "http" }, { - "resource": "loginPortals", - "publicResource": "loginPortals", + "resource": "schemas.version", + "publicResource": "schemas.version", "operation": "delete", "publicOperation": "delete", "deprecated": false, "method": "DELETE", - "path": "/v1/login-portals/{slug}", + "path": "/v1/schemas/{namespace}/{slug}/version/{semver}", "pathParams": [ - "slug" + "namespace", + "slug", + "semver" ], "publicPathParams": [ - "slug" + "namespace", + "slug", + "semver" ], "queryParams": [], "publicQueryParams": [], @@ -8628,11 +7134,23 @@ "publicBodyParams": [], "bodyParamDetails": [], "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, { "name": "slug", "required": true, "style": "simple", "explode": false + }, + { + "name": "semver", + "required": true, + "style": "simple", + "explode": false } ], "queryParamDetails": [], @@ -8641,7 +7159,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "LoginPortalDeleteParams" + "publicName": "VersionDeleteParams" }, "response": { "status": "200", @@ -8761,57 +7279,70 @@ "transport": "http" }, { - "resource": "loginPortals", - "publicResource": "loginPortals", + "resource": "schemas.version", + "publicResource": "schemas.version", "operation": "create", "publicOperation": "create", "deprecated": false, "method": "POST", - "path": "/v1/login-portals", - "pathParams": [], - "publicPathParams": [], + "path": "/v1/schemas/{namespace}/{slug}/version", + "pathParams": [ + "namespace", + "slug" + ], + "publicPathParams": [ + "namespace", + "slug" + ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], "bodyParams": [ - "title", - "slug", - "email", - "page" + "version", + "document", + "force" ], "publicBodyParams": [ - "title", - "slug", - "email", - "page" + "version", + "document", + "force" ], "bodyParamDetails": [ { - "name": "title", + "name": "version", "required": true }, { - "name": "slug", + "name": "document", "required": true }, { - "name": "email", - "required": true + "name": "force", + "required": false + } + ], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false }, { - "name": "page", - "required": true + "name": "slug", + "required": true, + "style": "simple", + "explode": false } ], - "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "LoginPortalCreateParams" + "publicName": "VersionCreateParams" }, "requestBody": { "contentType": "application/json", @@ -8837,10 +7368,6 @@ } ] }, - "responseModel": { - "name": "uid", - "publicAliases": [] - }, "result": { "successStatus": "200", "errorStatuses": [ @@ -8948,28 +7475,72 @@ "transport": "http" }, { - "resource": "loginPortals", - "publicResource": "loginPortals", - "operation": "list", - "publicOperation": "list", + "resource": "schemas.accessGroup", + "publicResource": "schemas.accessGroup", + "operation": "create", + "publicOperation": "create", "deprecated": false, - "method": "GET", - "path": "/v1/login-portals", - "pathParams": [], - "publicPathParams": [], + "method": "POST", + "path": "/v1/schemas/{namespace}/{slug}/access-group", + "pathParams": [ + "namespace", + "slug" + ], + "publicPathParams": [ + "namespace", + "slug" + ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], - "pathParamDetails": [], + "bodyParams": [ + "accessGroupSlug" + ], + "publicBodyParams": [ + "accessGroupSlug" + ], + "bodyParamDetails": [ + { + "name": "accessGroupSlug", + "required": true + } + ], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], + "paramsModel": { + "publicName": "AccessGroupCreateParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, "response": { "status": "200", "contentType": "application/json", @@ -9088,51 +7659,58 @@ "transport": "http" }, { - "resource": "accessGroups", - "publicResource": "accessGroups", - "operation": "create", - "publicOperation": "create", + "resource": "schemas.accessGroup", + "publicResource": "schemas.accessGroup", + "operation": "delete", + "publicOperation": "delete", "deprecated": false, - "method": "POST", - "path": "/v1/access-groups", - "pathParams": [], - "publicPathParams": [], + "method": "DELETE", + "path": "/v1/schemas/{namespace}/{slug}/access-group", + "pathParams": [ + "namespace", + "slug" + ], + "publicPathParams": [ + "namespace", + "slug" + ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "name", - "slug", - "allowedDomains" + "bodyParams": [ + "accessGroupSlug" ], "publicBodyParams": [ - "name", - "slug", - "allowedDomains" + "accessGroupSlug" ], "bodyParamDetails": [ { - "name": "name", - "required": false - }, + "name": "accessGroupSlug", + "required": true + } + ], + "pathParamDetails": [ { - "name": "slug", - "required": false + "name": "namespace", + "required": true, + "style": "simple", + "explode": false }, { - "name": "allowedDomains", - "required": false + "name": "slug", + "required": true, + "style": "simple", + "explode": false } ], - "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "AccessGroupCreateParams" + "publicName": "AccessGroupDeleteParams" }, "requestBody": { "contentType": "application/json", @@ -9265,13 +7843,13 @@ "transport": "http" }, { - "resource": "accessGroups", - "publicResource": "accessGroups", + "resource": "loginPortals", + "publicResource": "loginPortals", "operation": "retrieve", "publicOperation": "retrieve", "deprecated": false, "method": "GET", - "path": "/v1/access-groups/{slug}", + "path": "/v1/login-portals/{slug}", "pathParams": [ "slug" ], @@ -9299,7 +7877,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "AccessGroupRetrieveParams" + "publicName": "LoginPortalRetrieveParams" }, "response": { "status": "200", @@ -9419,13 +7997,13 @@ "transport": "http" }, { - "resource": "accessGroups", - "publicResource": "accessGroups", + "resource": "loginPortals", + "publicResource": "loginPortals", "operation": "update", "publicOperation": "update", "deprecated": false, "method": "PATCH", - "path": "/v1/access-groups/{slug}", + "path": "/v1/login-portals/{slug}", "pathParams": [ "slug" ], @@ -9437,20 +8015,14 @@ "headerParams": [], "publicHeaderParams": [], "bodyParams": [ - "name", - "slug" + "title" ], "publicBodyParams": [ - "name", - "slug" + "title" ], "bodyParamDetails": [ { - "name": "name", - "required": false - }, - { - "name": "slug", + "name": "title", "required": false } ], @@ -9468,7 +8040,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "AccessGroupUpdateParams" + "publicName": "LoginPortalUpdateParams" }, "requestBody": { "contentType": "application/json", @@ -9601,13 +8173,13 @@ "transport": "http" }, { - "resource": "accessGroups", - "publicResource": "accessGroups", + "resource": "loginPortals", + "publicResource": "loginPortals", "operation": "delete", "publicOperation": "delete", "deprecated": false, "method": "DELETE", - "path": "/v1/access-groups/{slug}", + "path": "/v1/login-portals/{slug}", "pathParams": [ "slug" ], @@ -9635,7 +8207,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "AccessGroupDeleteParams" + "publicName": "LoginPortalDeleteParams" }, "response": { "status": "200", @@ -9755,64 +8327,215 @@ "transport": "http" }, { - "resource": "accessGroups.domains", - "publicResource": "accessGroups.domains", + "resource": "loginPortals", + "publicResource": "loginPortals", "operation": "create", "publicOperation": "create", "deprecated": false, "method": "POST", - "path": "/v1/access-groups/{slug}/domains", - "pathParams": [ - "slug" - ], - "publicPathParams": [ - "slug" - ], + "path": "/v1/login-portals", + "pathParams": [], + "publicPathParams": [], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], "bodyParams": [ - "domain" + "title", + "slug", + "email", + "page" ], "publicBodyParams": [ - "domain" + "title", + "slug", + "email", + "page" ], "bodyParamDetails": [ { - "name": "domain", + "name": "title", + "required": true + }, + { + "name": "slug", + "required": true + }, + { + "name": "email", + "required": true + }, + { + "name": "page", "required": true } ], - "pathParamDetails": [ + "pathParamDetails": [], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "LoginPortalCreateParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "responseModel": { + "name": "uid", + "publicAliases": [] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ { - "name": "slug", - "required": true, - "style": "simple", - "explode": false + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } } ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "loginPortals", + "publicResource": "loginPortals", + "operation": "list", + "publicOperation": "list", + "deprecated": false, + "method": "GET", + "path": "/v1/login-portals", + "pathParams": [], + "publicPathParams": [], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], - "paramsModel": { - "publicName": "DomainCreateParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" - }, "response": { "status": "200", "contentType": "application/json", @@ -9931,50 +8654,51 @@ "transport": "http" }, { - "resource": "accessGroups.domains", - "publicResource": "accessGroups.domains", - "operation": "delete", - "publicOperation": "delete", + "resource": "accessGroups", + "publicResource": "accessGroups", + "operation": "create", + "publicOperation": "create", "deprecated": false, - "method": "DELETE", - "path": "/v1/access-groups/{slug}/domains", - "pathParams": [ - "slug" - ], - "publicPathParams": [ - "slug" - ], + "method": "POST", + "path": "/v1/access-groups", + "pathParams": [], + "publicPathParams": [], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], "bodyParams": [ - "domain" + "name", + "slug", + "allowedDomains" ], "publicBodyParams": [ - "domain" + "name", + "slug", + "allowedDomains" ], "bodyParamDetails": [ { - "name": "domain", - "required": true - } - ], - "pathParamDetails": [ + "name": "name", + "required": false + }, { "name": "slug", - "required": true, - "style": "simple", - "explode": false + "required": false + }, + { + "name": "allowedDomains", + "required": false } ], + "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "DomainDeleteParams" + "publicName": "AccessGroupCreateParams" }, "requestBody": { "contentType": "application/json", @@ -10107,18 +8831,18 @@ "transport": "http" }, { - "resource": "rules", - "publicResource": "rules", - "operation": "listRulesets", - "publicOperation": "listRulesets", + "resource": "accessGroups", + "publicResource": "accessGroups", + "operation": "retrieve", + "publicOperation": "retrieve", "deprecated": false, "method": "GET", - "path": "/v1/rulesets/{namespace}", + "path": "/v1/access-groups/{slug}", "pathParams": [ - "namespace" + "slug" ], "publicPathParams": [ - "namespace" + "slug" ], "queryParams": [], "publicQueryParams": [], @@ -10129,7 +8853,7 @@ "bodyParamDetails": [], "pathParamDetails": [ { - "name": "namespace", + "name": "slug", "required": true, "style": "simple", "explode": false @@ -10141,7 +8865,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RuleListRulesetsParams" + "publicName": "AccessGroupRetrieveParams" }, "response": { "status": "200", @@ -10261,62 +8985,44 @@ "transport": "http" }, { - "resource": "rules", - "publicResource": "rules", - "operation": "createRuleset", - "publicOperation": "createRuleset", + "resource": "accessGroups", + "publicResource": "accessGroups", + "operation": "update", + "publicOperation": "update", "deprecated": false, - "method": "POST", - "path": "/v1/rulesets/{namespace}", + "method": "PATCH", + "path": "/v1/access-groups/{slug}", "pathParams": [ - "namespace" + "slug" ], "publicPathParams": [ - "namespace" + "slug" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], "bodyParams": [ - "title", - "description", - "slug", - "isPrivate", - "document" + "name", + "slug" ], "publicBodyParams": [ - "title", - "description", - "slug", - "isPrivate", - "document" + "name", + "slug" ], "bodyParamDetails": [ { - "name": "title", - "required": true - }, - { - "name": "description", + "name": "name", "required": false }, { "name": "slug", - "required": true - }, - { - "name": "isPrivate", "required": false - }, - { - "name": "document", - "required": true } ], "pathParamDetails": [ { - "name": "namespace", + "name": "slug", "required": true, "style": "simple", "explode": false @@ -10328,7 +9034,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RuleCreateRulesetParams" + "publicName": "AccessGroupUpdateParams" }, "requestBody": { "contentType": "application/json", @@ -10354,10 +9060,6 @@ } ] }, - "responseModel": { - "name": "uid", - "publicAliases": [] - }, "result": { "successStatus": "200", "errorStatuses": [ @@ -10465,68 +9167,27 @@ "transport": "http" }, { - "resource": "rules", - "publicResource": "rules", - "operation": "updateRuleset", - "publicOperation": "updateRuleset", + "resource": "accessGroups", + "publicResource": "accessGroups", + "operation": "delete", + "publicOperation": "delete", "deprecated": false, - "method": "PATCH", - "path": "/v1/rulesets/{namespace}/{slug}", + "method": "DELETE", + "path": "/v1/access-groups/{slug}", "pathParams": [ - "namespace", "slug" ], "publicPathParams": [ - "namespace", "slug" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "namespace", - "slug", - "title", - "description", - "isPrivate" - ], - "publicBodyParams": [ - "namespace", - "slug", - "title", - "description", - "isPrivate" - ], - "bodyParamDetails": [ - { - "name": "namespace", - "required": false - }, - { - "name": "slug", - "required": false - }, - { - "name": "title", - "required": false - }, - { - "name": "description", - "required": false - }, - { - "name": "isPrivate", - "required": false - } - ], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], "pathParamDetails": [ - { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false - }, { "name": "slug", "required": true, @@ -10540,20 +9201,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RuleUpdateRulesetParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "AccessGroupDeleteParams" }, "response": { "status": "200", @@ -10673,35 +9321,36 @@ "transport": "http" }, { - "resource": "rules", - "publicResource": "rules", - "operation": "deleteRuleset", - "publicOperation": "deleteRuleset", + "resource": "accessGroups.domains", + "publicResource": "accessGroups.domains", + "operation": "create", + "publicOperation": "create", "deprecated": false, - "method": "DELETE", - "path": "/v1/rulesets/{namespace}/{slug}", + "method": "POST", + "path": "/v1/access-groups/{slug}/domains", "pathParams": [ - "namespace", "slug" ], "publicPathParams": [ - "namespace", "slug" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], - "pathParamDetails": [ + "bodyParams": [ + "domain" + ], + "publicBodyParams": [ + "domain" + ], + "bodyParamDetails": [ { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false - }, + "name": "domain", + "required": true + } + ], + "pathParamDetails": [ { "name": "slug", "required": true, @@ -10715,7 +9364,20 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RuleDeleteRulesetParams" + "publicName": "DomainCreateParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" }, "response": { "status": "200", @@ -10835,35 +9497,36 @@ "transport": "http" }, { - "resource": "rules", - "publicResource": "rules", - "operation": "retrieveRulesetDocument", - "publicOperation": "retrieveRulesetDocument", + "resource": "accessGroups.domains", + "publicResource": "accessGroups.domains", + "operation": "delete", + "publicOperation": "delete", "deprecated": false, - "method": "GET", - "path": "/v1/rulesets/{namespace}/{slug}", + "method": "DELETE", + "path": "/v1/access-groups/{slug}/domains", "pathParams": [ - "namespace", "slug" ], "publicPathParams": [ - "namespace", "slug" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], - "pathParamDetails": [ + "bodyParams": [ + "domain" + ], + "publicBodyParams": [ + "domain" + ], + "bodyParamDetails": [ { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false - }, + "name": "domain", + "required": true + } + ], + "pathParamDetails": [ { "name": "slug", "required": true, @@ -10877,16 +9540,29 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RuleRetrieveRulesetDocumentParams" + "publicName": "DomainDeleteParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" }, "response": { "status": "200", - "contentType": "text/plain", - "encoding": "text", + "contentType": "application/json", + "encoding": "json", "contents": [ { - "contentType": "text/plain", - "encoding": "text" + "contentType": "application/json", + "encoding": "json" } ] }, @@ -10999,47 +9675,30 @@ { "resource": "rules", "publicResource": "rules", - "operation": "createRulesetAccessGroup", - "publicOperation": "createRulesetAccessGroup", + "operation": "listRulesets", + "publicOperation": "listRulesets", "deprecated": false, - "method": "POST", - "path": "/v1/rulesets/{namespace}/{slug}/access-group", + "method": "GET", + "path": "/v1/rulesets/{namespace}", "pathParams": [ - "namespace", - "slug" + "namespace" ], "publicPathParams": [ - "namespace", - "slug" + "namespace" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "accessGroupSlug" - ], - "publicBodyParams": [ - "accessGroupSlug" - ], - "bodyParamDetails": [ - { - "name": "accessGroupSlug", - "required": true - } - ], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], "pathParamDetails": [ { "name": "namespace", "required": true, "style": "simple", "explode": false - }, - { - "name": "slug", - "required": true, - "style": "simple", - "explode": false } ], "queryParamDetails": [], @@ -11048,20 +9707,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RuleCreateRulesetAccessGroupParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "RuleListRulesetsParams" }, "response": { "status": "200", @@ -11183,32 +9829,54 @@ { "resource": "rules", "publicResource": "rules", - "operation": "deleteRulesetAccessGroup", - "publicOperation": "deleteRulesetAccessGroup", + "operation": "createRuleset", + "publicOperation": "createRuleset", "deprecated": false, - "method": "DELETE", - "path": "/v1/rulesets/{namespace}/{slug}/access-group", + "method": "POST", + "path": "/v1/rulesets/{namespace}", "pathParams": [ - "namespace", - "slug" + "namespace" ], "publicPathParams": [ - "namespace", - "slug" + "namespace" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], "bodyParams": [ - "accessGroupSlug" + "title", + "description", + "slug", + "isPrivate", + "document" ], "publicBodyParams": [ - "accessGroupSlug" + "title", + "description", + "slug", + "isPrivate", + "document" ], "bodyParamDetails": [ { - "name": "accessGroupSlug", + "name": "title", + "required": true + }, + { + "name": "description", + "required": false + }, + { + "name": "slug", + "required": true + }, + { + "name": "isPrivate", + "required": false + }, + { + "name": "document", "required": true } ], @@ -11218,12 +9886,6 @@ "required": true, "style": "simple", "explode": false - }, - { - "name": "slug", - "required": true, - "style": "simple", - "explode": false } ], "queryParamDetails": [], @@ -11232,7 +9894,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RuleDeleteRulesetAccessGroupParams" + "publicName": "RuleCreateRulesetParams" }, "requestBody": { "contentType": "application/json", @@ -11258,6 +9920,10 @@ } ] }, + "responseModel": { + "name": "uid", + "publicAliases": [] + }, "result": { "successStatus": "200", "errorStatuses": [ @@ -11346,47 +10012,115 @@ } }, { - "status": "500", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "500", - "publicAliases": [] - } + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "rules", + "publicResource": "rules", + "operation": "updateRuleset", + "publicOperation": "updateRuleset", + "deprecated": false, + "method": "PATCH", + "path": "/v1/rulesets/{namespace}/{slug}", + "pathParams": [ + "namespace", + "slug" + ], + "publicPathParams": [ + "namespace", + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "namespace", + "slug", + "title", + "description", + "isPrivate" + ], + "publicBodyParams": [ + "namespace", + "slug", + "title", + "description", + "isPrivate" + ], + "bodyParamDetails": [ + { + "name": "namespace", + "required": false + }, + { + "name": "slug", + "required": false + }, + { + "name": "title", + "required": false + }, + { + "name": "description", + "required": false + }, + { + "name": "isPrivate", + "required": false + } + ], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false } ], - "responseLinks": [], - "transport": "http" - }, - { - "resource": "themes", - "publicResource": "themes", - "operation": "list", - "publicOperation": "list", - "deprecated": false, - "method": "GET", - "path": "/v1/themes", - "pathParams": [], - "publicPathParams": [], - "queryParams": [], - "publicQueryParams": [], - "headerParams": [], - "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], - "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], + "paramsModel": { + "publicName": "RuleUpdateRulesetParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, "response": { "status": "200", "contentType": "application/json", @@ -11505,70 +10239,49 @@ "transport": "http" }, { - "resource": "themes", - "publicResource": "themes", - "operation": "create", - "publicOperation": "create", + "resource": "rules", + "publicResource": "rules", + "operation": "deleteRuleset", + "publicOperation": "deleteRuleset", "deprecated": false, - "method": "POST", - "path": "/v1/themes", - "pathParams": [], - "publicPathParams": [], + "method": "DELETE", + "path": "/v1/rulesets/{namespace}/{slug}", + "pathParams": [ + "namespace", + "slug" + ], + "publicPathParams": [ + "namespace", + "slug" + ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "name", - "description", - "slug", - "document" - ], - "publicBodyParams": [ - "name", - "description", - "slug", - "document" - ], - "bodyParamDetails": [ - { - "name": "name", - "required": true - }, + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [ { - "name": "description", - "required": false + "name": "namespace", + "required": true, + "style": "simple", + "explode": false }, { "name": "slug", - "required": true - }, - { - "name": "document", - "required": true + "required": true, + "style": "simple", + "explode": false } ], - "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "ThemeCreateParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "RuleDeleteRulesetParams" }, "response": { "status": "200", @@ -11581,10 +10294,6 @@ } ] }, - "responseModel": { - "name": "uid", - "publicAliases": [] - }, "result": { "successStatus": "200", "errorStatuses": [ @@ -11692,42 +10401,35 @@ "transport": "http" }, { - "resource": "themes", - "publicResource": "themes", - "operation": "update", - "publicOperation": "update", + "resource": "rules", + "publicResource": "rules", + "operation": "retrieveRulesetDocument", + "publicOperation": "retrieveRulesetDocument", "deprecated": false, - "method": "PATCH", - "path": "/v1/themes/{slug}", + "method": "GET", + "path": "/v1/rulesets/{namespace}/{slug}", "pathParams": [ + "namespace", "slug" ], "publicPathParams": [ + "namespace", "slug" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "name", - "description" - ], - "publicBodyParams": [ - "name", - "description" - ], - "bodyParamDetails": [ + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [ { - "name": "name", - "required": false + "name": "namespace", + "required": true, + "style": "simple", + "explode": false }, - { - "name": "description", - "required": false - } - ], - "pathParamDetails": [ { "name": "slug", "required": true, @@ -11741,29 +10443,16 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "ThemeUpdateParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "RuleRetrieveRulesetDocumentParams" }, "response": { "status": "200", - "contentType": "application/json", - "encoding": "json", + "contentType": "text/plain", + "encoding": "text", "contents": [ { - "contentType": "application/json", - "encoding": "json" + "contentType": "text/plain", + "encoding": "text" } ] }, @@ -11874,17 +10563,19 @@ "transport": "http" }, { - "resource": "themes", - "publicResource": "themes", - "operation": "replaceDocument", - "publicOperation": "replaceDocument", + "resource": "rules", + "publicResource": "rules", + "operation": "createRulesetAccessGroup", + "publicOperation": "createRulesetAccessGroup", "deprecated": false, - "method": "PUT", - "path": "/v1/themes/{slug}", + "method": "POST", + "path": "/v1/rulesets/{namespace}/{slug}/access-group", "pathParams": [ + "namespace", "slug" ], "publicPathParams": [ + "namespace", "slug" ], "queryParams": [], @@ -11892,18 +10583,24 @@ "headerParams": [], "publicHeaderParams": [], "bodyParams": [ - "document" + "accessGroupSlug" ], "publicBodyParams": [ - "document" + "accessGroupSlug" ], "bodyParamDetails": [ { - "name": "document", + "name": "accessGroupSlug", "required": true } ], "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, { "name": "slug", "required": true, @@ -11917,7 +10614,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "ThemeReplaceDocumentParams" + "publicName": "RuleCreateRulesetAccessGroupParams" }, "requestBody": { "contentType": "application/json", @@ -12050,27 +10747,44 @@ "transport": "http" }, { - "resource": "themes", - "publicResource": "themes", - "operation": "delete", - "publicOperation": "delete", + "resource": "rules", + "publicResource": "rules", + "operation": "deleteRulesetAccessGroup", + "publicOperation": "deleteRulesetAccessGroup", "deprecated": false, "method": "DELETE", - "path": "/v1/themes/{slug}", + "path": "/v1/rulesets/{namespace}/{slug}/access-group", "pathParams": [ + "namespace", "slug" ], "publicPathParams": [ + "namespace", "slug" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], + "bodyParams": [ + "accessGroupSlug" + ], + "publicBodyParams": [ + "accessGroupSlug" + ], + "bodyParamDetails": [ + { + "name": "accessGroupSlug", + "required": true + } + ], "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, { "name": "slug", "required": true, @@ -12084,7 +10798,20 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "ThemeDeleteParams" + "publicName": "RuleDeleteRulesetAccessGroupParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" }, "response": { "status": "200", @@ -12206,17 +10933,13 @@ { "resource": "themes", "publicResource": "themes", - "operation": "retrieve", - "publicOperation": "retrieve", + "operation": "list", + "publicOperation": "list", "deprecated": false, "method": "GET", - "path": "/v1/themes/{slug}", - "pathParams": [ - "slug" - ], - "publicPathParams": [ - "slug" - ], + "path": "/v1/themes", + "pathParams": [], + "publicPathParams": [], "queryParams": [], "publicQueryParams": [], "headerParams": [], @@ -12224,30 +10947,20 @@ "bodyParams": [], "publicBodyParams": [], "bodyParamDetails": [], - "pathParamDetails": [ - { - "name": "slug", - "required": true, - "style": "simple", - "explode": false - } - ], + "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], - "paramsModel": { - "publicName": "ThemeRetrieveParams" - }, "response": { "status": "200", - "contentType": "text/plain", - "encoding": "text", + "contentType": "application/json", + "encoding": "json", "contents": [ { - "contentType": "text/plain", - "encoding": "text" + "contentType": "application/json", + "encoding": "json" } ] }, @@ -12358,28 +11071,71 @@ "transport": "http" }, { - "resource": "teams", - "publicResource": "teams", - "operation": "list", - "publicOperation": "list", + "resource": "themes", + "publicResource": "themes", + "operation": "create", + "publicOperation": "create", "deprecated": false, - "method": "GET", - "path": "/v1/teams", + "method": "POST", + "path": "/v1/themes", "pathParams": [], "publicPathParams": [], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], + "bodyParams": [ + "name", + "description", + "slug", + "document" + ], + "publicBodyParams": [ + "name", + "description", + "slug", + "document" + ], + "bodyParamDetails": [ + { + "name": "name", + "required": true + }, + { + "name": "description", + "required": false + }, + { + "name": "slug", + "required": true + }, + { + "name": "document", + "required": true + } + ], "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], + "paramsModel": { + "publicName": "ThemeCreateParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, "response": { "status": "200", "contentType": "application/json", @@ -12391,6 +11147,10 @@ } ] }, + "responseModel": { + "name": "uid", + "publicAliases": [] + }, "result": { "successStatus": "200", "errorStatuses": [ @@ -12498,28 +11258,70 @@ "transport": "http" }, { - "resource": "teams.members", - "publicResource": "teams.members", - "operation": "list", - "publicOperation": "list", + "resource": "themes", + "publicResource": "themes", + "operation": "update", + "publicOperation": "update", "deprecated": false, - "method": "GET", - "path": "/v1/teams/members", - "pathParams": [], - "publicPathParams": [], + "method": "PATCH", + "path": "/v1/themes/{slug}", + "pathParams": [ + "slug" + ], + "publicPathParams": [ + "slug" + ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], - "pathParamDetails": [], + "bodyParams": [ + "name", + "description" + ], + "publicBodyParams": [ + "name", + "description" + ], + "bodyParamDetails": [ + { + "name": "name", + "required": false + }, + { + "name": "description", + "required": false + } + ], + "pathParamDetails": [ + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], + "paramsModel": { + "publicName": "ThemeUpdateParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, "response": { "status": "200", "contentType": "application/json", @@ -12638,38 +11440,38 @@ "transport": "http" }, { - "resource": "teams.members", - "publicResource": "teams.members", - "operation": "update", - "publicOperation": "update", + "resource": "themes", + "publicResource": "themes", + "operation": "replaceDocument", + "publicOperation": "replaceDocument", "deprecated": false, - "method": "PATCH", - "path": "/v1/teams/members/{uid}", + "method": "PUT", + "path": "/v1/themes/{slug}", "pathParams": [ - "uid" + "slug" ], "publicPathParams": [ - "uid" + "slug" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], "bodyParams": [ - "role" + "document" ], "publicBodyParams": [ - "role" + "document" ], "bodyParamDetails": [ { - "name": "role", + "name": "document", "required": true } ], "pathParamDetails": [ { - "name": "uid", + "name": "slug", "required": true, "style": "simple", "explode": false @@ -12681,7 +11483,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "MemberUpdateParams" + "publicName": "ThemeReplaceDocumentParams" }, "requestBody": { "contentType": "application/json", @@ -12814,18 +11616,18 @@ "transport": "http" }, { - "resource": "teams.members", - "publicResource": "teams.members", + "resource": "themes", + "publicResource": "themes", "operation": "delete", "publicOperation": "delete", "deprecated": false, "method": "DELETE", - "path": "/v1/teams/members/{uid}", + "path": "/v1/themes/{slug}", "pathParams": [ - "uid" + "slug" ], "publicPathParams": [ - "uid" + "slug" ], "queryParams": [], "publicQueryParams": [], @@ -12836,7 +11638,7 @@ "bodyParamDetails": [], "pathParamDetails": [ { - "name": "uid", + "name": "slug", "required": true, "style": "simple", "explode": false @@ -12848,7 +11650,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "MemberDeleteParams" + "publicName": "ThemeDeleteParams" }, "response": { "status": "200", @@ -12968,67 +11770,50 @@ "transport": "http" }, { - "resource": "teams.invites", - "publicResource": "teams.invites", - "operation": "member", - "publicOperation": "member", + "resource": "themes", + "publicResource": "themes", + "operation": "retrieve", + "publicOperation": "retrieve", "deprecated": false, - "method": "POST", - "path": "/v1/teams/invites", - "pathParams": [], - "publicPathParams": [], + "method": "GET", + "path": "/v1/themes/{slug}", + "pathParams": [ + "slug" + ], + "publicPathParams": [ + "slug" + ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "email", - "role" - ], - "publicBodyParams": [ - "email", - "role" - ], - "bodyParamDetails": [ - { - "name": "email", - "required": true - }, + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [ { - "name": "role", - "required": true + "name": "slug", + "required": true, + "style": "simple", + "explode": false } ], - "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "InviteMemberParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "ThemeRetrieveParams" }, "response": { "status": "200", - "contentType": "application/json", - "encoding": "json", + "contentType": "text/plain", + "encoding": "text", "contents": [ { - "contentType": "application/json", - "encoding": "json" + "contentType": "text/plain", + "encoding": "text" } ] }, @@ -13139,19 +11924,15 @@ "transport": "http" }, { - "resource": "teams.invites", - "publicResource": "teams.invites", - "operation": "resend", - "publicOperation": "resend", + "resource": "teams", + "publicResource": "teams", + "operation": "list", + "publicOperation": "list", "deprecated": false, - "method": "PATCH", - "path": "/v1/teams/invites/{uid}", - "pathParams": [ - "uid" - ], - "publicPathParams": [ - "uid" - ], + "method": "GET", + "path": "/v1/teams", + "pathParams": [], + "publicPathParams": [], "queryParams": [], "publicQueryParams": [], "headerParams": [], @@ -13159,22 +11940,12 @@ "bodyParams": [], "publicBodyParams": [], "bodyParamDetails": [], - "pathParamDetails": [ - { - "name": "uid", - "required": true, - "style": "simple", - "explode": false - } - ], + "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], - "paramsModel": { - "publicName": "InviteResendParams" - }, "response": { "status": "200", "contentType": "application/json", @@ -13293,19 +12064,15 @@ "transport": "http" }, { - "resource": "teams.invites", - "publicResource": "teams.invites", - "operation": "cancel", - "publicOperation": "cancel", + "resource": "teams.members", + "publicResource": "teams.members", + "operation": "list", + "publicOperation": "list", "deprecated": false, - "method": "DELETE", - "path": "/v1/teams/invites/{uid}", - "pathParams": [ - "uid" - ], - "publicPathParams": [ - "uid" - ], + "method": "GET", + "path": "/v1/teams/members", + "pathParams": [], + "publicPathParams": [], "queryParams": [], "publicQueryParams": [], "headerParams": [], @@ -13313,22 +12080,12 @@ "bodyParams": [], "publicBodyParams": [], "bodyParamDetails": [], - "pathParamDetails": [ - { - "name": "uid", - "required": true, - "style": "simple", - "explode": false - } - ], + "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], - "paramsModel": { - "publicName": "InviteCancelParams" - }, "response": { "status": "200", "contentType": "application/json", @@ -13447,28 +12204,64 @@ "transport": "http" }, { - "resource": "scalarDocs", - "publicResource": "scalarDocs", - "operation": "listGuides", - "publicOperation": "listGuides", + "resource": "teams.members", + "publicResource": "teams.members", + "operation": "update", + "publicOperation": "update", "deprecated": false, - "method": "GET", - "path": "/v1/guides", - "pathParams": [], - "publicPathParams": [], + "method": "PATCH", + "path": "/v1/teams/members/{uid}", + "pathParams": [ + "uid" + ], + "publicPathParams": [ + "uid" + ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], - "pathParamDetails": [], + "bodyParams": [ + "role" + ], + "publicBodyParams": [ + "role" + ], + "bodyParamDetails": [ + { + "name": "role", + "required": true + } + ], + "pathParamDetails": [ + { + "name": "uid", + "required": true, + "style": "simple", + "explode": false + } + ], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], + "paramsModel": { + "publicName": "MemberUpdateParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, "response": { "status": "200", "contentType": "application/json", @@ -13587,76 +12380,41 @@ "transport": "http" }, { - "resource": "scalarDocs", - "publicResource": "scalarDocs", - "operation": "createGuide", - "publicOperation": "createGuide", + "resource": "teams.members", + "publicResource": "teams.members", + "operation": "delete", + "publicOperation": "delete", "deprecated": false, - "method": "POST", - "path": "/v1/guides", - "pathParams": [], - "publicPathParams": [], + "method": "DELETE", + "path": "/v1/teams/members/{uid}", + "pathParams": [ + "uid" + ], + "publicPathParams": [ + "uid" + ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "name", - "slug", - "isPrivate", - "allowedUsers", - "allowedDomains" - ], - "publicBodyParams": [ - "name", - "slug", - "isPrivate", - "allowedUsers", - "allowedDomains" - ], - "bodyParamDetails": [ - { - "name": "name", - "required": true - }, - { - "name": "slug", - "required": false - }, - { - "name": "isPrivate", - "required": true - }, - { - "name": "allowedUsers", - "required": true - }, + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [ { - "name": "allowedDomains", - "required": true + "name": "uid", + "required": true, + "style": "simple", + "explode": false } ], - "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "ScalarDocCreateGuideParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "MemberDeleteParams" }, "response": { "status": "200", @@ -13776,41 +12534,58 @@ "transport": "http" }, { - "resource": "scalarDocs", - "publicResource": "scalarDocs", - "operation": "publishGuide", - "publicOperation": "publishGuide", + "resource": "teams.invites", + "publicResource": "teams.invites", + "operation": "member", + "publicOperation": "member", "deprecated": false, "method": "POST", - "path": "/v1/guides/{slug}/publish", - "pathParams": [ - "slug" - ], - "publicPathParams": [ - "slug" - ], + "path": "/v1/teams/invites", + "pathParams": [], + "publicPathParams": [], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], - "pathParamDetails": [ + "bodyParams": [ + "email", + "role" + ], + "publicBodyParams": [ + "email", + "role" + ], + "bodyParamDetails": [ { - "name": "slug", - "required": true, - "style": "simple", - "explode": false + "name": "email", + "required": true + }, + { + "name": "role", + "required": true } ], + "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "ScalarDocPublishGuideParams" + "publicName": "InviteMemberParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" }, "response": { "status": "200", @@ -13930,41 +12705,41 @@ "transport": "http" }, { - "resource": "scalarDocs", - "publicResource": "scalarDocs", - "operation": "listProjects", - "publicOperation": "listProjects", + "resource": "teams.invites", + "publicResource": "teams.invites", + "operation": "resend", + "publicOperation": "resend", "deprecated": false, - "method": "GET", - "path": "/v1/docs", - "pathParams": [], - "publicPathParams": [], - "queryParams": [ - "limit" + "method": "PATCH", + "path": "/v1/teams/invites/{uid}", + "pathParams": [ + "uid" ], - "publicQueryParams": [ - "limit" + "publicPathParams": [ + "uid" ], + "queryParams": [], + "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], "bodyParams": [], "publicBodyParams": [], "bodyParamDetails": [], - "pathParamDetails": [], - "queryParamDetails": [ + "pathParamDetails": [ { - "name": "limit", - "required": false, - "style": "form", - "explode": true + "name": "uid", + "required": true, + "style": "simple", + "explode": false } ], + "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "ScalarDocListProjectsParams" + "publicName": "InviteResendParams" }, "response": { "status": "200", @@ -14084,88 +12859,41 @@ "transport": "http" }, { - "resource": "scalarDocs", - "publicResource": "scalarDocs", - "operation": "createProject", - "publicOperation": "createProject", + "resource": "teams.invites", + "publicResource": "teams.invites", + "operation": "cancel", + "publicOperation": "cancel", "deprecated": false, - "method": "POST", - "path": "/v1/docs", - "pathParams": [], - "publicPathParams": [], + "method": "DELETE", + "path": "/v1/teams/invites/{uid}", + "pathParams": [ + "uid" + ], + "publicPathParams": [ + "uid" + ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "name", - "slug", - "isPrivate", - "blank", - "provider", - "githubRepository", - "bitbucketRepository" - ], - "publicBodyParams": [ - "name", - "slug", - "isPrivate", - "blank", - "provider", - "githubRepository", - "bitbucketRepository" - ], - "bodyParamDetails": [ - { - "name": "name", - "required": true - }, - { - "name": "slug", - "required": false - }, - { - "name": "isPrivate", - "required": false - }, - { - "name": "blank", - "required": false - }, - { - "name": "provider", - "required": true - }, - { - "name": "githubRepository", - "required": false - }, + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [ { - "name": "bitbucketRepository", - "required": false + "name": "uid", + "required": true, + "style": "simple", + "explode": false } ], - "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "ScalarDocCreateProjectParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "InviteCancelParams" }, "response": { "status": "200", @@ -14178,10 +12906,6 @@ } ] }, - "responseModel": { - "name": "docs_project", - "publicAliases": [] - }, "result": { "successStatus": "200", "errorStatuses": [ @@ -14291,17 +13015,13 @@ { "resource": "scalarDocs", "publicResource": "scalarDocs", - "operation": "retrieveProject", - "publicOperation": "retrieveProject", + "operation": "listGuides", + "publicOperation": "listGuides", "deprecated": false, "method": "GET", - "path": "/v1/docs/{slug}", - "pathParams": [ - "slug" - ], - "publicPathParams": [ - "slug" - ], + "path": "/v1/guides", + "pathParams": [], + "publicPathParams": [], "queryParams": [], "publicQueryParams": [], "headerParams": [], @@ -14309,22 +13029,12 @@ "bodyParams": [], "publicBodyParams": [], "bodyParamDetails": [], - "pathParamDetails": [ - { - "name": "slug", - "required": true, - "style": "simple", - "explode": false - } - ], + "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], - "paramsModel": { - "publicName": "ScalarDocRetrieveProjectParams" - }, "response": { "status": "200", "contentType": "application/json", @@ -14336,10 +13046,6 @@ } ] }, - "responseModel": { - "name": "docs_project", - "publicAliases": [] - }, "result": { "successStatus": "200", "errorStatuses": [ @@ -14449,84 +13155,61 @@ { "resource": "scalarDocs", "publicResource": "scalarDocs", - "operation": "updateProject", - "publicOperation": "updateProject", + "operation": "createGuide", + "publicOperation": "createGuide", "deprecated": false, - "method": "PATCH", - "path": "/v1/docs/{slug}", - "pathParams": [ - "slug" - ], - "publicPathParams": [ - "slug" - ], + "method": "POST", + "path": "/v1/guides", + "pathParams": [], + "publicPathParams": [], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], "bodyParams": [ "name", + "slug", "isPrivate", - "accessGroups", - "loginPortalUid", - "activeThemeId", - "agentEnabled", - "analyticsEnabled" + "allowedUsers", + "allowedDomains" ], "publicBodyParams": [ "name", + "slug", "isPrivate", - "accessGroups", - "loginPortalUid", - "activeThemeId", - "agentEnabled", - "analyticsEnabled" + "allowedUsers", + "allowedDomains" ], "bodyParamDetails": [ { "name": "name", - "required": false - }, - { - "name": "isPrivate", - "required": false - }, - { - "name": "accessGroups", - "required": false + "required": true }, { - "name": "loginPortalUid", + "name": "slug", "required": false }, { - "name": "activeThemeId", - "required": false + "name": "isPrivate", + "required": true }, { - "name": "agentEnabled", - "required": false + "name": "allowedUsers", + "required": true }, { - "name": "analyticsEnabled", - "required": false - } - ], - "pathParamDetails": [ - { - "name": "slug", - "required": true, - "style": "simple", - "explode": false + "name": "allowedDomains", + "required": true } ], + "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "ScalarDocUpdateProjectParams" + "publicName": "ScalarDocCreateGuideParams" }, "requestBody": { "contentType": "application/json", @@ -14661,11 +13344,11 @@ { "resource": "scalarDocs", "publicResource": "scalarDocs", - "operation": "deleteProject", - "publicOperation": "deleteProject", + "operation": "publishGuide", + "publicOperation": "publishGuide", "deprecated": false, - "method": "DELETE", - "path": "/v1/docs/{slug}", + "method": "POST", + "path": "/v1/guides/{slug}/publish", "pathParams": [ "slug" ], @@ -14693,7 +13376,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "ScalarDocDeleteProjectParams" + "publicName": "ScalarDocPublishGuideParams" }, "response": { "status": "200", @@ -14815,73 +13498,39 @@ { "resource": "scalarDocs", "publicResource": "scalarDocs", - "operation": "publishProject", - "publicOperation": "publishProject", + "operation": "listProjects", + "publicOperation": "listProjects", "deprecated": false, - "method": "POST", - "path": "/v1/docs/{slug}/publish", - "pathParams": [ - "slug" + "method": "GET", + "path": "/v1/docs", + "pathParams": [], + "publicPathParams": [], + "queryParams": [ + "limit" ], - "publicPathParams": [ - "slug" + "publicQueryParams": [ + "limit" ], - "queryParams": [], - "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "commitSha", - "preview", - "configPath" - ], - "publicBodyParams": [ - "commitSha", - "preview", - "configPath" - ], - "bodyParamDetails": [ - { - "name": "commitSha", - "required": false - }, - { - "name": "preview", - "required": false - }, - { - "name": "configPath", - "required": false - } - ], - "pathParamDetails": [ + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [], + "queryParamDetails": [ { - "name": "slug", - "required": true, - "style": "simple", - "explode": false + "name": "limit", + "required": false, + "style": "form", + "explode": true } ], - "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "ScalarDocPublishProjectParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "ScalarDocListProjectsParams" }, "response": { "status": "200", @@ -15003,50 +13652,86 @@ { "resource": "scalarDocs", "publicResource": "scalarDocs", - "operation": "listProjectConfig", - "publicOperation": "listProjectConfig", + "operation": "createProject", + "publicOperation": "createProject", "deprecated": false, - "method": "GET", - "path": "/v1/docs/{slug}/config", - "pathParams": [ - "slug" - ], - "publicPathParams": [ - "slug" - ], - "queryParams": [ - "ref" - ], - "publicQueryParams": [ - "ref" - ], + "method": "POST", + "path": "/v1/docs", + "pathParams": [], + "publicPathParams": [], + "queryParams": [], + "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], - "pathParamDetails": [ + "bodyParams": [ + "name", + "slug", + "isPrivate", + "blank", + "provider", + "githubRepository", + "bitbucketRepository" + ], + "publicBodyParams": [ + "name", + "slug", + "isPrivate", + "blank", + "provider", + "githubRepository", + "bitbucketRepository" + ], + "bodyParamDetails": [ + { + "name": "name", + "required": true + }, { "name": "slug", - "required": true, - "style": "simple", - "explode": false - } - ], - "queryParamDetails": [ + "required": false + }, { - "name": "ref", - "required": false, - "style": "form", - "explode": true + "name": "isPrivate", + "required": false + }, + { + "name": "blank", + "required": false + }, + { + "name": "provider", + "required": true + }, + { + "name": "githubRepository", + "required": false + }, + { + "name": "bitbucketRepository", + "required": false } ], + "pathParamDetails": [], + "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "ScalarDocListProjectConfigParams" + "publicName": "ScalarDocCreateProjectParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" }, "response": { "status": "200", @@ -15059,6 +13744,10 @@ } ] }, + "responseModel": { + "name": "docs_project", + "publicAliases": [] + }, "result": { "successStatus": "200", "errorStatuses": [ @@ -15151,74 +13840,41 @@ "contentType": "application/json", "encoding": "json", "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "500", - "publicAliases": [] - } - } - ], - "responseLinks": [], - "transport": "http" - }, - { - "resource": "scalarDocs", - "publicResource": "scalarDocs", - "operation": "updateProjectConfig", - "publicOperation": "updateProjectConfig", - "deprecated": false, - "method": "PUT", - "path": "/v1/docs/{slug}/config", - "pathParams": [ - "slug" - ], - "publicPathParams": [ - "slug" - ], - "queryParams": [], - "publicQueryParams": [], - "headerParams": [], - "publicHeaderParams": [], - "bodyParams": [ - "content", - "ref", - "baseToken", - "message", - "path" - ], - "publicBodyParams": [ - "content", - "ref", - "baseToken", - "message", - "path" - ], - "bodyParamDetails": [ - { - "name": "content", - "required": true - }, - { - "name": "ref", - "required": false - }, - { - "name": "baseToken", - "required": false - }, - { - "name": "message", - "required": false - }, - { - "name": "path", - "required": false + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } } ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "scalarDocs", + "publicResource": "scalarDocs", + "operation": "retrieveProject", + "publicOperation": "retrieveProject", + "deprecated": false, + "method": "GET", + "path": "/v1/docs/{slug}", + "pathParams": [ + "slug" + ], + "publicPathParams": [ + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], "pathParamDetails": [ { "name": "slug", @@ -15233,20 +13889,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "ScalarDocUpdateProjectConfigParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "ScalarDocRetrieveProjectParams" }, "response": { "status": "200", @@ -15259,6 +13902,10 @@ } ] }, + "responseModel": { + "name": "docs_project", + "publicAliases": [] + }, "result": { "successStatus": "200", "errorStatuses": [ @@ -15368,11 +14015,11 @@ { "resource": "scalarDocs", "publicResource": "scalarDocs", - "operation": "listProjectDomain", - "publicOperation": "listProjectDomain", + "operation": "updateProject", + "publicOperation": "updateProject", "deprecated": false, - "method": "GET", - "path": "/v1/docs/{slug}/domain", + "method": "PATCH", + "path": "/v1/docs/{slug}", "pathParams": [ "slug" ], @@ -15383,9 +14030,54 @@ "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], + "bodyParams": [ + "name", + "isPrivate", + "accessGroups", + "loginPortalUid", + "activeThemeId", + "agentEnabled", + "analyticsEnabled" + ], + "publicBodyParams": [ + "name", + "isPrivate", + "accessGroups", + "loginPortalUid", + "activeThemeId", + "agentEnabled", + "analyticsEnabled" + ], + "bodyParamDetails": [ + { + "name": "name", + "required": false + }, + { + "name": "isPrivate", + "required": false + }, + { + "name": "accessGroups", + "required": false + }, + { + "name": "loginPortalUid", + "required": false + }, + { + "name": "activeThemeId", + "required": false + }, + { + "name": "agentEnabled", + "required": false + }, + { + "name": "analyticsEnabled", + "required": false + } + ], "pathParamDetails": [ { "name": "slug", @@ -15400,7 +14092,20 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "ScalarDocListProjectDomainParams" + "publicName": "ScalarDocUpdateProjectParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" }, "response": { "status": "200", @@ -15522,11 +14227,11 @@ { "resource": "scalarDocs", "publicResource": "scalarDocs", - "operation": "listProjectDomainStatus", - "publicOperation": "listProjectDomainStatus", + "operation": "deleteProject", + "publicOperation": "deleteProject", "deprecated": false, - "method": "GET", - "path": "/v1/docs/{slug}/domain/status", + "method": "DELETE", + "path": "/v1/docs/{slug}", "pathParams": [ "slug" ], @@ -15554,7 +14259,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "ScalarDocListProjectDomainStatusParams" + "publicName": "ScalarDocDeleteProjectParams" }, "response": { "status": "200", @@ -15674,28 +14379,76 @@ "transport": "http" }, { - "resource": "namespaces", - "publicResource": "namespaces", - "operation": "list", - "publicOperation": "list", + "resource": "scalarDocs", + "publicResource": "scalarDocs", + "operation": "publishProject", + "publicOperation": "publishProject", "deprecated": false, - "method": "GET", - "path": "/v1/namespaces", - "pathParams": [], - "publicPathParams": [], + "method": "POST", + "path": "/v1/docs/{slug}/publish", + "pathParams": [ + "slug" + ], + "publicPathParams": [ + "slug" + ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], - "pathParamDetails": [], + "bodyParams": [ + "commitSha", + "preview", + "configPath" + ], + "publicBodyParams": [ + "commitSha", + "preview", + "configPath" + ], + "bodyParamDetails": [ + { + "name": "commitSha", + "required": false + }, + { + "name": "preview", + "required": false + }, + { + "name": "configPath", + "required": false + } + ], + "pathParamDetails": [ + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], + "paramsModel": { + "publicName": "ScalarDocPublishProjectParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, "response": { "status": "200", "contentType": "application/json", @@ -15814,52 +14567,52 @@ "transport": "http" }, { - "resource": "authentication", - "publicResource": "authentication", - "operation": "exchangePersonalToken", - "publicOperation": "exchangePersonalToken", + "resource": "scalarDocs", + "publicResource": "scalarDocs", + "operation": "listProjectConfig", + "publicOperation": "listProjectConfig", "deprecated": false, - "method": "POST", - "path": "/v1/auth/exchange", - "pathParams": [], - "publicPathParams": [], - "queryParams": [], - "publicQueryParams": [], + "method": "GET", + "path": "/v1/docs/{slug}/config", + "pathParams": [ + "slug" + ], + "publicPathParams": [ + "slug" + ], + "queryParams": [ + "ref" + ], + "publicQueryParams": [ + "ref" + ], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "personalToken" - ], - "publicBodyParams": [ - "personalToken" + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [ + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } ], - "bodyParamDetails": [ + "queryParamDetails": [ { - "name": "personalToken", - "required": true + "name": "ref", + "required": false, + "style": "form", + "explode": true } ], - "pathParamDetails": [], - "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "AuthenticationExchangePersonalTokenParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "ScalarDocListProjectConfigParams" }, "response": { "status": "200", @@ -15979,28 +14732,88 @@ "transport": "http" }, { - "resource": "authentication", - "publicResource": "authentication", - "operation": "listCurrentUser", - "publicOperation": "listCurrentUser", + "resource": "scalarDocs", + "publicResource": "scalarDocs", + "operation": "updateProjectConfig", + "publicOperation": "updateProjectConfig", "deprecated": false, - "method": "GET", - "path": "/v1/auth/me", - "pathParams": [], - "publicPathParams": [], + "method": "PUT", + "path": "/v1/docs/{slug}/config", + "pathParams": [ + "slug" + ], + "publicPathParams": [ + "slug" + ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], - "pathParamDetails": [], + "bodyParams": [ + "content", + "ref", + "baseToken", + "message", + "path" + ], + "publicBodyParams": [ + "content", + "ref", + "baseToken", + "message", + "path" + ], + "bodyParamDetails": [ + { + "name": "content", + "required": true + }, + { + "name": "ref", + "required": false + }, + { + "name": "baseToken", + "required": false + }, + { + "name": "message", + "required": false + }, + { + "name": "path", + "required": false + } + ], + "pathParamDetails": [ + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], + "paramsModel": { + "publicName": "ScalarDocUpdateProjectConfigParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, "response": { "status": "200", "contentType": "application/json", @@ -16012,10 +14825,6 @@ } ] }, - "responseModel": { - "name": "user", - "publicAliases": [] - }, "result": { "successStatus": "200", "errorStatuses": [ @@ -16123,41 +14932,41 @@ "transport": "http" }, { - "resource": "sdks", - "publicResource": "sdks", - "operation": "list", - "publicOperation": "list", + "resource": "scalarDocs", + "publicResource": "scalarDocs", + "operation": "listProjectDomain", + "publicOperation": "listProjectDomain", "deprecated": false, "method": "GET", - "path": "/v1/sdks", - "pathParams": [], - "publicPathParams": [], - "queryParams": [ - "limit" + "path": "/v1/docs/{slug}/domain", + "pathParams": [ + "slug" ], - "publicQueryParams": [ - "limit" + "publicPathParams": [ + "slug" ], + "queryParams": [], + "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], "bodyParams": [], "publicBodyParams": [], "bodyParamDetails": [], - "pathParamDetails": [], - "queryParamDetails": [ + "pathParamDetails": [ { - "name": "limit", - "required": false, - "style": "form", - "explode": true + "name": "slug", + "required": true, + "style": "simple", + "explode": false } ], + "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "SdkListParams" + "publicName": "ScalarDocListProjectDomainParams" }, "response": { "status": "200", @@ -16277,82 +15086,41 @@ "transport": "http" }, { - "resource": "sdks", - "publicResource": "sdks", - "operation": "create", - "publicOperation": "create", + "resource": "scalarDocs", + "publicResource": "scalarDocs", + "operation": "listProjectDomainStatus", + "publicOperation": "listProjectDomainStatus", "deprecated": false, - "method": "POST", - "path": "/v1/sdks", - "pathParams": [], - "publicPathParams": [], + "method": "GET", + "path": "/v1/docs/{slug}/domain/status", + "pathParams": [ + "slug" + ], + "publicPathParams": [ + "slug" + ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "apiUid", - "languages", - "title", - "slug", - "className", - "config" - ], - "publicBodyParams": [ - "apiUid", - "languages", - "title", - "slug", - "className", - "config" - ], - "bodyParamDetails": [ - { - "name": "apiUid", - "required": true - }, - { - "name": "languages", - "required": true - }, - { - "name": "title", - "required": false - }, + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [ { "name": "slug", - "required": false - }, - { - "name": "className", - "required": false - }, - { - "name": "config", - "required": false + "required": true, + "style": "simple", + "explode": false } ], - "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "SdkCreateParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "ScalarDocListProjectDomainStatusParams" }, "response": { "status": "200", @@ -16365,10 +15133,6 @@ } ] }, - "responseModel": { - "name": "uid", - "publicAliases": [] - }, "result": { "successStatus": "200", "errorStatuses": [ @@ -16476,42 +15240,28 @@ "transport": "http" }, { - "resource": "sdks", - "publicResource": "sdks", - "operation": "retrieve", - "publicOperation": "retrieve", + "resource": "namespaces", + "publicResource": "namespaces", + "operation": "list", + "publicOperation": "list", "deprecated": false, "method": "GET", - "path": "/v1/sdks/{uid}", - "pathParams": [ - "uid" - ], - "publicPathParams": [ - "uid" - ], + "path": "/v1/namespaces", + "pathParams": [], + "publicPathParams": [], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], "bodyParams": [], "publicBodyParams": [], - "bodyParamDetails": [], - "pathParamDetails": [ - { - "name": "uid", - "required": true, - "style": "simple", - "explode": false - } - ], + "bodyParamDetails": [], + "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], - "paramsModel": { - "publicName": "SdkRetrieveParams" - }, "response": { "status": "200", "contentType": "application/json", @@ -16523,10 +15273,6 @@ } ] }, - "responseModel": { - "name": "sdk", - "publicAliases": [] - }, "result": { "successStatus": "200", "errorStatuses": [ @@ -16634,80 +15380,39 @@ "transport": "http" }, { - "resource": "sdks", - "publicResource": "sdks", - "operation": "update", - "publicOperation": "update", + "resource": "authentication", + "publicResource": "authentication", + "operation": "exchangePersonalToken", + "publicOperation": "exchangePersonalToken", "deprecated": false, - "method": "PATCH", - "path": "/v1/sdks/{uid}", - "pathParams": [ - "uid" - ], - "publicPathParams": [ - "uid" - ], + "method": "POST", + "path": "/v1/auth/exchange", + "pathParams": [], + "publicPathParams": [], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], "bodyParams": [ - "title", - "slug", - "isPrivate", - "config", - "apiUid", - "apiVersion" + "personalToken" ], "publicBodyParams": [ - "title", - "slug", - "isPrivate", - "config", - "apiUid", - "apiVersion" + "personalToken" ], "bodyParamDetails": [ { - "name": "title", - "required": false - }, - { - "name": "slug", - "required": false - }, - { - "name": "isPrivate", - "required": false - }, - { - "name": "config", - "required": false - }, - { - "name": "apiUid", - "required": false - }, - { - "name": "apiVersion", - "required": false - } - ], - "pathParamDetails": [ - { - "name": "uid", - "required": true, - "style": "simple", - "explode": false + "name": "personalToken", + "required": true } ], + "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "SdkUpdateParams" + "publicName": "AuthenticationExchangePersonalTokenParams" }, "requestBody": { "contentType": "application/json", @@ -16840,19 +15545,15 @@ "transport": "http" }, { - "resource": "sdks", - "publicResource": "sdks", - "operation": "delete", - "publicOperation": "delete", + "resource": "authentication", + "publicResource": "authentication", + "operation": "listCurrentUser", + "publicOperation": "listCurrentUser", "deprecated": false, - "method": "DELETE", - "path": "/v1/sdks/{uid}", - "pathParams": [ - "uid" - ], - "publicPathParams": [ - "uid" - ], + "method": "GET", + "path": "/v1/auth/me", + "pathParams": [], + "publicPathParams": [], "queryParams": [], "publicQueryParams": [], "headerParams": [], @@ -16860,22 +15561,12 @@ "bodyParams": [], "publicBodyParams": [], "bodyParamDetails": [], - "pathParamDetails": [ - { - "name": "uid", - "required": true, - "style": "simple", - "explode": false - } - ], + "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], - "paramsModel": { - "publicName": "SdkDeleteParams" - }, "response": { "status": "200", "contentType": "application/json", @@ -16887,6 +15578,10 @@ } ] }, + "responseModel": { + "name": "user", + "publicAliases": [] + }, "result": { "successStatus": "200", "errorStatuses": [ @@ -16996,67 +15691,39 @@ { "resource": "sdks", "publicResource": "sdks", - "operation": "build", - "publicOperation": "build", + "operation": "list", + "publicOperation": "list", "deprecated": false, - "method": "POST", - "path": "/v1/sdks/{uid}/build", - "pathParams": [ - "uid" + "method": "GET", + "path": "/v1/sdks", + "pathParams": [], + "publicPathParams": [], + "queryParams": [ + "limit" ], - "publicPathParams": [ - "uid" + "publicQueryParams": [ + "limit" ], - "queryParams": [], - "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "version", - "languages" - ], - "publicBodyParams": [ - "version", - "languages" - ], - "bodyParamDetails": [ - { - "name": "version", - "required": false - }, - { - "name": "languages", - "required": false - } - ], - "pathParamDetails": [ + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [], + "queryParamDetails": [ { - "name": "uid", - "required": true, - "style": "simple", - "explode": false + "name": "limit", + "required": false, + "style": "form", + "explode": true } ], - "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "SdkBuildParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "SdkListParams" }, "response": { "status": "200", @@ -17176,56 +15843,69 @@ "transport": "http" }, { - "resource": "sdks.versions", - "publicResource": "sdks.versions", + "resource": "sdks", + "publicResource": "sdks", "operation": "create", "publicOperation": "create", "deprecated": false, "method": "POST", - "path": "/v1/sdks/{uid}/versions", - "pathParams": [ - "uid" - ], - "publicPathParams": [ - "uid" - ], + "path": "/v1/sdks", + "pathParams": [], + "publicPathParams": [], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], "bodyParams": [ - "version", - "apiVersion" + "apiUid", + "languages", + "title", + "slug", + "className", + "config" ], "publicBodyParams": [ - "version", - "apiVersion" + "apiUid", + "languages", + "title", + "slug", + "className", + "config" ], "bodyParamDetails": [ { - "name": "version", + "name": "apiUid", "required": true }, { - "name": "apiVersion", + "name": "languages", "required": true - } - ], - "pathParamDetails": [ + }, { - "name": "uid", - "required": true, - "style": "simple", - "explode": false + "name": "title", + "required": false + }, + { + "name": "slug", + "required": false + }, + { + "name": "className", + "required": false + }, + { + "name": "config", + "required": false } ], + "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "VersionCreateParams" + "publicName": "SdkCreateParams" }, "requestBody": { "contentType": "application/json", @@ -17251,6 +15931,10 @@ } ] }, + "responseModel": { + "name": "uid", + "publicAliases": [] + }, "result": { "successStatus": "200", "errorStatuses": [ @@ -17358,20 +16042,18 @@ "transport": "http" }, { - "resource": "sdks.versions", - "publicResource": "sdks.versions", - "operation": "delete", - "publicOperation": "delete", + "resource": "sdks", + "publicResource": "sdks", + "operation": "retrieve", + "publicOperation": "retrieve", "deprecated": false, - "method": "DELETE", - "path": "/v1/sdks/{uid}/versions/{version}", + "method": "GET", + "path": "/v1/sdks/{uid}", "pathParams": [ - "uid", - "version" + "uid" ], "publicPathParams": [ - "uid", - "version" + "uid" ], "queryParams": [], "publicQueryParams": [], @@ -17386,12 +16068,6 @@ "required": true, "style": "simple", "explode": false - }, - { - "name": "version", - "required": true, - "style": "simple", - "explode": false } ], "queryParamDetails": [], @@ -17400,7 +16076,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "VersionDeleteParams" + "publicName": "SdkRetrieveParams" }, "response": { "status": "200", @@ -17413,6 +16089,10 @@ } ] }, + "responseModel": { + "name": "sdk", + "publicAliases": [] + }, "result": { "successStatus": "200", "errorStatuses": [ @@ -17520,13 +16200,13 @@ "transport": "http" }, { - "resource": "sdks.repositories", - "publicResource": "sdks.repositories", - "operation": "link", - "publicOperation": "link", + "resource": "sdks", + "publicResource": "sdks", + "operation": "update", + "publicOperation": "update", "deprecated": false, - "method": "POST", - "path": "/v1/sdks/{uid}/repositories", + "method": "PATCH", + "path": "/v1/sdks/{uid}", "pathParams": [ "uid" ], @@ -17538,32 +16218,44 @@ "headerParams": [], "publicHeaderParams": [], "bodyParams": [ - "language", - "repositoryId", - "baseBranch", - "prereleaseType" + "title", + "slug", + "isPrivate", + "config", + "apiUid", + "apiVersion" ], "publicBodyParams": [ - "language", - "repositoryId", - "baseBranch", - "prereleaseType" + "title", + "slug", + "isPrivate", + "config", + "apiUid", + "apiVersion" ], "bodyParamDetails": [ { - "name": "language", - "required": true + "name": "title", + "required": false }, { - "name": "repositoryId", - "required": true + "name": "slug", + "required": false }, { - "name": "baseBranch", - "required": true + "name": "isPrivate", + "required": false }, { - "name": "prereleaseType", + "name": "config", + "required": false + }, + { + "name": "apiUid", + "required": false + }, + { + "name": "apiVersion", "required": false } ], @@ -17581,7 +16273,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RepositoryLinkParams" + "publicName": "SdkUpdateParams" }, "requestBody": { "contentType": "application/json", @@ -17714,20 +16406,18 @@ "transport": "http" }, { - "resource": "sdks.repositories", - "publicResource": "sdks.repositories", - "operation": "unlink", - "publicOperation": "unlink", + "resource": "sdks", + "publicResource": "sdks", + "operation": "delete", + "publicOperation": "delete", "deprecated": false, "method": "DELETE", - "path": "/v1/sdks/{uid}/repositories/{language}", + "path": "/v1/sdks/{uid}", "pathParams": [ - "uid", - "language" + "uid" ], "publicPathParams": [ - "uid", - "language" + "uid" ], "queryParams": [], "publicQueryParams": [], @@ -17742,12 +16432,6 @@ "required": true, "style": "simple", "explode": false - }, - { - "name": "language", - "required": true, - "style": "simple", - "explode": false } ], "queryParamDetails": [], @@ -17756,7 +16440,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RepositoryUnlinkParams" + "publicName": "SdkDeleteParams" }, "response": { "status": "200", @@ -17876,52 +16560,38 @@ "transport": "http" }, { - "resource": "sdks.repositories", - "publicResource": "sdks.repositories", - "operation": "updatePublishing", - "publicOperation": "updatePublishing", + "resource": "sdks", + "publicResource": "sdks", + "operation": "build", + "publicOperation": "build", "deprecated": false, "method": "POST", - "path": "/v1/sdks/{uid}/repositories/{language}/publishing", + "path": "/v1/sdks/{uid}/build", "pathParams": [ - "uid", - "language" + "uid" ], "publicPathParams": [ - "uid", - "language" + "uid" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], "bodyParams": [ - "publishOnMerge", - "authMethod", - "access", - "tag" + "version", + "languages" ], "publicBodyParams": [ - "publishOnMerge", - "authMethod", - "access", - "tag" + "version", + "languages" ], "bodyParamDetails": [ { - "name": "publishOnMerge", - "required": true - }, - { - "name": "authMethod", - "required": false - }, - { - "name": "access", + "name": "version", "required": false }, { - "name": "tag", + "name": "languages", "required": false } ], @@ -17931,12 +16601,6 @@ "required": true, "style": "simple", "explode": false - }, - { - "name": "language", - "required": true, - "style": "simple", - "explode": false } ], "queryParamDetails": [], @@ -17945,7 +16609,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RepositoryUpdatePublishingParams" + "publicName": "SdkBuildParams" }, "requestBody": { "contentType": "application/json", @@ -18078,28 +16742,70 @@ "transport": "http" }, { - "resource": "mcp.servers", - "publicResource": "mcp.servers", - "operation": "list", - "publicOperation": "list", + "resource": "sdks.versions", + "publicResource": "sdks.versions", + "operation": "create", + "publicOperation": "create", "deprecated": false, - "method": "GET", - "path": "/v1/mcp/servers", - "pathParams": [], - "publicPathParams": [], + "method": "POST", + "path": "/v1/sdks/{uid}/versions", + "pathParams": [ + "uid" + ], + "publicPathParams": [ + "uid" + ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], - "pathParamDetails": [], + "bodyParams": [ + "version", + "apiVersion" + ], + "publicBodyParams": [ + "version", + "apiVersion" + ], + "bodyParamDetails": [ + { + "name": "version", + "required": true + }, + { + "name": "apiVersion", + "required": true + } + ], + "pathParamDetails": [ + { + "name": "uid", + "required": true, + "style": "simple", + "explode": false + } + ], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], + "paramsModel": { + "publicName": "VersionCreateParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, "response": { "status": "200", "contentType": "application/json", @@ -18218,70 +16924,49 @@ "transport": "http" }, { - "resource": "mcp.servers", - "publicResource": "mcp.servers", - "operation": "create", - "publicOperation": "create", + "resource": "sdks.versions", + "publicResource": "sdks.versions", + "operation": "delete", + "publicOperation": "delete", "deprecated": false, - "method": "POST", - "path": "/v1/mcp/servers", - "pathParams": [], - "publicPathParams": [], - "queryParams": [], - "publicQueryParams": [], - "headerParams": [], - "publicHeaderParams": [], - "bodyParams": [ - "name", - "slug", - "versionUids", - "projectUids" + "method": "DELETE", + "path": "/v1/sdks/{uid}/versions/{version}", + "pathParams": [ + "uid", + "version" ], - "publicBodyParams": [ - "name", - "slug", - "versionUids", - "projectUids" + "publicPathParams": [ + "uid", + "version" ], - "bodyParamDetails": [ - { - "name": "name", - "required": true - }, - { - "name": "slug", - "required": false - }, + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [ { - "name": "versionUids", - "required": false + "name": "uid", + "required": true, + "style": "simple", + "explode": false }, { - "name": "projectUids", - "required": false + "name": "version", + "required": true, + "style": "simple", + "explode": false } ], - "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "ServerCreateParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "VersionDeleteParams" }, "response": { "status": "200", @@ -18401,29 +17086,56 @@ "transport": "http" }, { - "resource": "mcp.servers", - "publicResource": "mcp.servers", - "operation": "retrieve", - "publicOperation": "retrieve", + "resource": "sdks.repositories", + "publicResource": "sdks.repositories", + "operation": "link", + "publicOperation": "link", "deprecated": false, - "method": "GET", - "path": "/v1/mcp/servers/{id}", + "method": "POST", + "path": "/v1/sdks/{uid}/repositories", "pathParams": [ - "id" + "uid" ], "publicPathParams": [ - "id" + "uid" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], + "bodyParams": [ + "language", + "repositoryId", + "baseBranch", + "prereleaseType" + ], + "publicBodyParams": [ + "language", + "repositoryId", + "baseBranch", + "prereleaseType" + ], + "bodyParamDetails": [ + { + "name": "language", + "required": true + }, + { + "name": "repositoryId", + "required": true + }, + { + "name": "baseBranch", + "required": true + }, + { + "name": "prereleaseType", + "required": false + } + ], "pathParamDetails": [ { - "name": "id", + "name": "uid", "required": true, "style": "simple", "explode": false @@ -18435,7 +17147,20 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "ServerRetrieveParams" + "publicName": "RepositoryLinkParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" }, "response": { "status": "200", @@ -18448,10 +17173,6 @@ } ] }, - "responseModel": { - "name": "mcp_server", - "publicAliases": [] - }, "result": { "successStatus": "200", "errorStatuses": [ @@ -18559,62 +17280,37 @@ "transport": "http" }, { - "resource": "mcp.servers", - "publicResource": "mcp.servers", - "operation": "update", - "publicOperation": "update", + "resource": "sdks.repositories", + "publicResource": "sdks.repositories", + "operation": "unlink", + "publicOperation": "unlink", "deprecated": false, - "method": "PATCH", - "path": "/v1/mcp/servers/{id}", + "method": "DELETE", + "path": "/v1/sdks/{uid}/repositories/{language}", "pathParams": [ - "id" + "uid", + "language" ], "publicPathParams": [ - "id" + "uid", + "language" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "name", - "slug", - "autoAddOperations", - "operations", - "docsPages" - ], - "publicBodyParams": [ - "name", - "slug", - "autoAddOperations", - "operations", - "docsPages" - ], - "bodyParamDetails": [ - { - "name": "name", - "required": false - }, - { - "name": "slug", - "required": false - }, - { - "name": "autoAddOperations", - "required": false - }, + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [ { - "name": "operations", - "required": false + "name": "uid", + "required": true, + "style": "simple", + "explode": false }, { - "name": "docsPages", - "required": false - } - ], - "pathParamDetails": [ - { - "name": "id", + "name": "language", "required": true, "style": "simple", "explode": false @@ -18626,20 +17322,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "ServerUpdateParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "RepositoryUnlinkParams" }, "response": { "status": "200", @@ -18652,10 +17335,6 @@ } ] }, - "responseModel": { - "name": "mcp_server", - "publicAliases": [] - }, "result": { "successStatus": "200", "errorStatuses": [ @@ -18763,29 +17442,64 @@ "transport": "http" }, { - "resource": "mcp.servers", - "publicResource": "mcp.servers", - "operation": "delete", - "publicOperation": "delete", + "resource": "sdks.repositories", + "publicResource": "sdks.repositories", + "operation": "updatePublishing", + "publicOperation": "updatePublishing", "deprecated": false, - "method": "DELETE", - "path": "/v1/mcp/servers/{id}", + "method": "POST", + "path": "/v1/sdks/{uid}/repositories/{language}/publishing", "pathParams": [ - "id" + "uid", + "language" ], "publicPathParams": [ - "id" + "uid", + "language" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], + "bodyParams": [ + "publishOnMerge", + "authMethod", + "access", + "tag" + ], + "publicBodyParams": [ + "publishOnMerge", + "authMethod", + "access", + "tag" + ], + "bodyParamDetails": [ + { + "name": "publishOnMerge", + "required": true + }, + { + "name": "authMethod", + "required": false + }, + { + "name": "access", + "required": false + }, + { + "name": "tag", + "required": false + } + ], "pathParamDetails": [ { - "name": "id", + "name": "uid", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "language", "required": true, "style": "simple", "explode": false @@ -18797,7 +17511,20 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "ServerDeleteParams" + "publicName": "RepositoryUpdatePublishingParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" }, "response": { "status": "200", @@ -18917,19 +17644,15 @@ "transport": "http" }, { - "resource": "mcp.servers.installations", - "publicResource": "mcp.servers.installations", + "resource": "mcp.servers", + "publicResource": "mcp.servers", "operation": "list", "publicOperation": "list", "deprecated": false, "method": "GET", - "path": "/v1/mcp/servers/{id}/installations", - "pathParams": [ - "id" - ], - "publicPathParams": [ - "id" - ], + "path": "/v1/mcp/servers", + "pathParams": [], + "publicPathParams": [], "queryParams": [], "publicQueryParams": [], "headerParams": [], @@ -18937,22 +17660,12 @@ "bodyParams": [], "publicBodyParams": [], "bodyParamDetails": [], - "pathParamDetails": [ - { - "name": "id", - "required": true, - "style": "simple", - "explode": false - } - ], + "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], - "paramsModel": { - "publicName": "InstallationListParams" - }, "response": { "status": "200", "contentType": "application/json", @@ -19071,19 +17784,15 @@ "transport": "http" }, { - "resource": "mcp.servers.installations", - "publicResource": "mcp.servers.installations", + "resource": "mcp.servers", + "publicResource": "mcp.servers", "operation": "create", "publicOperation": "create", "deprecated": false, "method": "POST", - "path": "/v1/mcp/servers/{id}/installations", - "pathParams": [ - "id" - ], - "publicPathParams": [ - "id" - ], + "path": "/v1/mcp/servers", + "pathParams": [], + "publicPathParams": [], "queryParams": [], "publicQueryParams": [], "headerParams": [], @@ -19091,12 +17800,14 @@ "bodyParams": [ "name", "slug", - "documentAuth" + "versionUids", + "projectUids" ], "publicBodyParams": [ "name", "slug", - "documentAuth" + "versionUids", + "projectUids" ], "bodyParamDetails": [ { @@ -19108,25 +17819,22 @@ "required": false }, { - "name": "documentAuth", - "required": true - } - ], - "pathParamDetails": [ + "name": "versionUids", + "required": false + }, { - "name": "id", - "required": true, - "style": "simple", - "explode": false + "name": "projectUids", + "required": false } ], + "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "InstallationCreateParams" + "publicName": "ServerCreateParams" }, "requestBody": { "contentType": "application/json", @@ -19152,10 +17860,6 @@ } ] }, - "responseModel": { - "name": "mcp_installation", - "publicAliases": [] - }, "result": { "successStatus": "200", "errorStatuses": [ @@ -19263,20 +17967,18 @@ "transport": "http" }, { - "resource": "mcp.servers.installations", - "publicResource": "mcp.servers.installations", + "resource": "mcp.servers", + "publicResource": "mcp.servers", "operation": "retrieve", "publicOperation": "retrieve", "deprecated": false, "method": "GET", - "path": "/v1/mcp/servers/{id}/installations/{installationId}", + "path": "/v1/mcp/servers/{id}", "pathParams": [ - "id", - "installationId" + "id" ], "publicPathParams": [ - "id", - "installationId" + "id" ], "queryParams": [], "publicQueryParams": [], @@ -19291,12 +17993,6 @@ "required": true, "style": "simple", "explode": false - }, - { - "name": "installationId", - "required": true, - "style": "simple", - "explode": false } ], "queryParamDetails": [], @@ -19305,7 +18001,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "InstallationRetrieveParams" + "publicName": "ServerRetrieveParams" }, "response": { "status": "200", @@ -19319,7 +18015,7 @@ ] }, "responseModel": { - "name": "mcp_installation", + "name": "mcp_server", "publicAliases": [] }, "result": { @@ -19429,20 +18125,18 @@ "transport": "http" }, { - "resource": "mcp.servers.installations", - "publicResource": "mcp.servers.installations", + "resource": "mcp.servers", + "publicResource": "mcp.servers", "operation": "update", "publicOperation": "update", "deprecated": false, "method": "PATCH", - "path": "/v1/mcp/servers/{id}/installations/{installationId}", + "path": "/v1/mcp/servers/{id}", "pathParams": [ - "id", - "installationId" + "id" ], "publicPathParams": [ - "id", - "installationId" + "id" ], "queryParams": [], "publicQueryParams": [], @@ -19451,18 +18145,16 @@ "bodyParams": [ "name", "slug", - "isPrivate", - "loginPortalUid", - "documentAuth", - "mcpVersion" + "autoAddOperations", + "operations", + "docsPages" ], "publicBodyParams": [ "name", "slug", - "isPrivate", - "loginPortalUid", - "documentAuth", - "mcpVersion" + "autoAddOperations", + "operations", + "docsPages" ], "bodyParamDetails": [ { @@ -19474,34 +18166,195 @@ "required": false }, { - "name": "isPrivate", + "name": "autoAddOperations", "required": false }, { - "name": "loginPortalUid", + "name": "operations", "required": false }, { - "name": "documentAuth", + "name": "docsPages", "required": false + } + ], + "pathParamDetails": [ + { + "name": "id", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "ServerUpdateParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "responseModel": { + "name": "mcp_server", + "publicAliases": [] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } }, { - "name": "mcpVersion", - "required": false + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } } ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "mcp.servers", + "publicResource": "mcp.servers", + "operation": "delete", + "publicOperation": "delete", + "deprecated": false, + "method": "DELETE", + "path": "/v1/mcp/servers/{id}", + "pathParams": [ + "id" + ], + "publicPathParams": [ + "id" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], "pathParamDetails": [ { "name": "id", "required": true, "style": "simple", "explode": false - }, - { - "name": "installationId", - "required": true, - "style": "simple", - "explode": false } ], "queryParamDetails": [], @@ -19510,20 +18363,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "InstallationUpdateParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "ServerDeleteParams" }, "response": { "status": "200", @@ -19536,10 +18376,6 @@ } ] }, - "responseModel": { - "name": "mcp_installation", - "publicAliases": [] - }, "result": { "successStatus": "200", "errorStatuses": [ @@ -19649,18 +18485,16 @@ { "resource": "mcp.servers.installations", "publicResource": "mcp.servers.installations", - "operation": "delete", - "publicOperation": "delete", + "operation": "list", + "publicOperation": "list", "deprecated": false, - "method": "DELETE", - "path": "/v1/mcp/servers/{id}/installations/{installationId}", + "method": "GET", + "path": "/v1/mcp/servers/{id}/installations", "pathParams": [ - "id", - "installationId" + "id" ], "publicPathParams": [ - "id", - "installationId" + "id" ], "queryParams": [], "publicQueryParams": [], @@ -19675,12 +18509,6 @@ "required": true, "style": "simple", "explode": false - }, - { - "name": "installationId", - "required": true, - "style": "simple", - "explode": false } ], "queryParamDetails": [], @@ -19689,7 +18517,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "InstallationDeleteParams" + "publicName": "InstallationListParams" }, "response": { "status": "200", @@ -19811,32 +18639,42 @@ { "resource": "mcp.servers.installations", "publicResource": "mcp.servers.installations", - "operation": "createAccessGroup", - "publicOperation": "createAccessGroup", + "operation": "create", + "publicOperation": "create", "deprecated": false, "method": "POST", - "path": "/v1/mcp/servers/{id}/installations/{installationId}/access-group", + "path": "/v1/mcp/servers/{id}/installations", "pathParams": [ - "id", - "installationId" + "id" ], "publicPathParams": [ - "id", - "installationId" + "id" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], "bodyParams": [ - "accessGroupUid" + "name", + "slug", + "documentAuth" ], "publicBodyParams": [ - "accessGroupUid" + "name", + "slug", + "documentAuth" ], "bodyParamDetails": [ { - "name": "accessGroupUid", + "name": "name", + "required": true + }, + { + "name": "slug", + "required": false + }, + { + "name": "documentAuth", "required": true } ], @@ -19846,12 +18684,6 @@ "required": true, "style": "simple", "explode": false - }, - { - "name": "installationId", - "required": true, - "style": "simple", - "explode": false } ], "queryParamDetails": [], @@ -19860,7 +18692,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "InstallationCreateAccessGroupParams" + "publicName": "InstallationCreateParams" }, "requestBody": { "contentType": "application/json", @@ -19886,6 +18718,10 @@ } ] }, + "responseModel": { + "name": "mcp_installation", + "publicAliases": [] + }, "result": { "successStatus": "200", "errorStatuses": [ @@ -19995,11 +18831,11 @@ { "resource": "mcp.servers.installations", "publicResource": "mcp.servers.installations", - "operation": "deleteAccessGroup", - "publicOperation": "deleteAccessGroup", + "operation": "retrieve", + "publicOperation": "retrieve", "deprecated": false, - "method": "DELETE", - "path": "/v1/mcp/servers/{id}/installations/{installationId}/access-group", + "method": "GET", + "path": "/v1/mcp/servers/{id}/installations/{installationId}", "pathParams": [ "id", "installationId" @@ -20012,18 +18848,9 @@ "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "accessGroupUid" - ], - "publicBodyParams": [ - "accessGroupUid" - ], - "bodyParamDetails": [ - { - "name": "accessGroupUid", - "required": true - } - ], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], "pathParamDetails": [ { "name": "id", @@ -20044,20 +18871,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "InstallationDeleteAccessGroupParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "InstallationRetrieveParams" }, "response": { "status": "200", @@ -20070,6 +18884,10 @@ } ] }, + "responseModel": { + "name": "mcp_installation", + "publicAliases": [] + }, "result": { "successStatus": "200", "errorStatuses": [ @@ -20143,62 +18961,136 @@ } }, { - "status": "422", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "422", - "publicAliases": [] - } + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "mcp.servers.installations", + "publicResource": "mcp.servers.installations", + "operation": "update", + "publicOperation": "update", + "deprecated": false, + "method": "PATCH", + "path": "/v1/mcp/servers/{id}/installations/{installationId}", + "pathParams": [ + "id", + "installationId" + ], + "publicPathParams": [ + "id", + "installationId" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "name", + "slug", + "isPrivate", + "loginPortalUid", + "documentAuth", + "mcpVersion" + ], + "publicBodyParams": [ + "name", + "slug", + "isPrivate", + "loginPortalUid", + "documentAuth", + "mcpVersion" + ], + "bodyParamDetails": [ + { + "name": "name", + "required": false + }, + { + "name": "slug", + "required": false + }, + { + "name": "isPrivate", + "required": false + }, + { + "name": "loginPortalUid", + "required": false }, { - "status": "500", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "model": { - "name": "500", - "publicAliases": [] - } + "name": "documentAuth", + "required": false + }, + { + "name": "mcpVersion", + "required": false + } + ], + "pathParamDetails": [ + { + "name": "id", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "installationId", + "required": true, + "style": "simple", + "explode": false } ], - "responseLinks": [], - "transport": "http" - }, - { - "resource": "oAuth", - "publicResource": "oAuth", - "operation": "oauthAuthorize", - "publicOperation": "oauthAuthorize", - "deprecated": false, - "method": "GET", - "path": "/v1/oauth/authorize", - "pathParams": [], - "publicPathParams": [], - "queryParams": [], - "publicQueryParams": [], - "headerParams": [], - "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], - "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], + "paramsModel": { + "publicName": "InstallationUpdateParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, "response": { "status": "200", "contentType": "application/json", @@ -20210,6 +19102,10 @@ } ] }, + "responseModel": { + "name": "mcp_installation", + "publicAliases": [] + }, "result": { "successStatus": "200", "errorStatuses": [ @@ -20317,94 +19213,49 @@ "transport": "http" }, { - "resource": "oAuth", - "publicResource": "oAuth", - "operation": "oauthToken", - "publicOperation": "oauthToken", + "resource": "mcp.servers.installations", + "publicResource": "mcp.servers.installations", + "operation": "delete", + "publicOperation": "delete", "deprecated": false, - "method": "POST", - "path": "/v1/oauth/token", - "pathParams": [], - "publicPathParams": [], + "method": "DELETE", + "path": "/v1/mcp/servers/{id}/installations/{installationId}", + "pathParams": [ + "id", + "installationId" + ], + "publicPathParams": [ + "id", + "installationId" + ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "grant_type", - "client_id", - "client_secret", - "code", - "redirect_uri", - "code_verifier", - "refresh_token", - "scope" - ], - "publicBodyParams": [ - "grant_type", - "client_id", - "client_secret", - "code", - "redirect_uri", - "code_verifier", - "refresh_token", - "scope" - ], - "bodyParamDetails": [ - { - "name": "grant_type", - "required": true - }, - { - "name": "client_id", - "required": false - }, - { - "name": "client_secret", - "required": false - }, - { - "name": "code", - "required": false - }, - { - "name": "redirect_uri", - "required": false - }, - { - "name": "code_verifier", - "required": false - }, + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [ { - "name": "refresh_token", - "required": false + "name": "id", + "required": true, + "style": "simple", + "explode": false }, { - "name": "scope", - "required": false + "name": "installationId", + "required": true, + "style": "simple", + "explode": false } ], - "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "OAuthOauthTokenParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "InstallationDeleteParams" }, "response": { "status": "200", @@ -20524,57 +19375,58 @@ "transport": "http" }, { - "resource": "oAuth", - "publicResource": "oAuth", - "operation": "oauthRevoke", - "publicOperation": "oauthRevoke", + "resource": "mcp.servers.installations", + "publicResource": "mcp.servers.installations", + "operation": "createAccessGroup", + "publicOperation": "createAccessGroup", "deprecated": false, "method": "POST", - "path": "/v1/oauth/revoke", - "pathParams": [], - "publicPathParams": [], + "path": "/v1/mcp/servers/{id}/installations/{installationId}/access-group", + "pathParams": [ + "id", + "installationId" + ], + "publicPathParams": [ + "id", + "installationId" + ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], "bodyParams": [ - "token", - "token_type_hint", - "client_id", - "client_secret" + "accessGroupUid" ], "publicBodyParams": [ - "token", - "token_type_hint", - "client_id", - "client_secret" + "accessGroupUid" ], "bodyParamDetails": [ { - "name": "token", + "name": "accessGroupUid", "required": true - }, - { - "name": "token_type_hint", - "required": false - }, + } + ], + "pathParamDetails": [ { - "name": "client_id", - "required": false + "name": "id", + "required": true, + "style": "simple", + "explode": false }, { - "name": "client_secret", - "required": false + "name": "installationId", + "required": true, + "style": "simple", + "explode": false } ], - "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "OAuthOauthRevokeParams" + "publicName": "InstallationCreateAccessGroupParams" }, "requestBody": { "contentType": "application/json", @@ -20707,28 +19559,72 @@ "transport": "http" }, { - "resource": "oAuth", - "publicResource": "oAuth", - "operation": "oauthAuthorizationServerMetadata", - "publicOperation": "oauthAuthorizationServerMetadata", + "resource": "mcp.servers.installations", + "publicResource": "mcp.servers.installations", + "operation": "deleteAccessGroup", + "publicOperation": "deleteAccessGroup", "deprecated": false, - "method": "GET", - "path": "/.well-known/oauth-authorization-server", - "pathParams": [], - "publicPathParams": [], + "method": "DELETE", + "path": "/v1/mcp/servers/{id}/installations/{installationId}/access-group", + "pathParams": [ + "id", + "installationId" + ], + "publicPathParams": [ + "id", + "installationId" + ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], - "pathParamDetails": [], + "bodyParams": [ + "accessGroupUid" + ], + "publicBodyParams": [ + "accessGroupUid" + ], + "bodyParamDetails": [ + { + "name": "accessGroupUid", + "required": true + } + ], + "pathParamDetails": [ + { + "name": "id", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "installationId", + "required": true, + "style": "simple", + "explode": false + } + ], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], + "paramsModel": { + "publicName": "InstallationDeleteAccessGroupParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, "response": { "status": "200", "contentType": "application/json", @@ -20740,10 +19636,6 @@ } ] }, - "responseModel": { - "name": "oauth_authorization_server_metadata", - "publicAliases": [] - }, "result": { "successStatus": "200", "errorStatuses": [ diff --git a/tests/smoke-test.java b/tests/smoke-test.java index a897051..cf113c3 100644 --- a/tests/smoke-test.java +++ b/tests/smoke-test.java @@ -28,8 +28,6 @@ import com.scalar.models.mcp.servers.installations.InstallationListParams; import com.scalar.models.mcp.servers.installations.InstallationRetrieveParams; import com.scalar.models.mcp.servers.installations.InstallationUpdateParams; -import com.scalar.models.oAuth.OAuthOauthRevokeParams; -import com.scalar.models.oAuth.OAuthOauthTokenParams; import com.scalar.models.registry.AccessGroup; import com.scalar.models.registry.RegistryCreateApiDocumentAccessGroupParams; import com.scalar.models.registry.RegistryCreateApiDocumentParams; @@ -1161,50 +1159,6 @@ private static void _smokeCase120() throws Exception { var installation = client.mcp().servers().installations().deleteAccessGroup(params); } - private static void _smokeCase121() throws Exception { - var oAuth = client.oAuth().oauthAuthorize(); - } - - private static void _smokeCase122() throws Exception { - OAuthOauthTokenParams params = OAuthOauthTokenParams.builder().grantType("").build(); - var oAuth = client.oAuth().oauthToken(params); - } - - private static void _smokeCase123() throws Exception { - OAuthOauthTokenParams params = - OAuthOauthTokenParams.builder() - .grantType("") - .clientId("") - .clientSecret("") - .code("") - .redirectUri("") - .codeVerifier("") - .refreshToken("") - .scope("") - .build(); - var oAuth = client.oAuth().oauthToken(params); - } - - private static void _smokeCase124() throws Exception { - OAuthOauthRevokeParams params = OAuthOauthRevokeParams.builder().token("").build(); - var oAuth = client.oAuth().oauthRevoke(params); - } - - private static void _smokeCase125() throws Exception { - OAuthOauthRevokeParams params = - OAuthOauthRevokeParams.builder() - .token("") - .tokenTypeHint("") - .clientId("") - .clientSecret("") - .build(); - var oAuth = client.oAuth().oauthRevoke(params); - } - - private static void _smokeCase126() throws Exception { - var oAuth = client.oAuth().oauthAuthorizationServerMetadata(); - } - private static final List cases = List.of( new SmokeCase("listAllApiDocuments", "GET", "/v1/apis", "", SmokeTest::_smokeCase0), @@ -1626,27 +1580,7 @@ private static void _smokeCase126() throws Exception { "DELETE", "/v1/mcp/servers/{id}/installations/{installationId}/access-group", "", - SmokeTest::_smokeCase120), - new SmokeCase( - "oauthAuthorize", "GET", "/v1/oauth/authorize", "", SmokeTest::_smokeCase121), - new SmokeCase( - "oauthToken", "POST", "/v1/oauth/token", "required params", SmokeTest::_smokeCase122), - new SmokeCase( - "oauthToken", "POST", "/v1/oauth/token", "all params", SmokeTest::_smokeCase123), - new SmokeCase( - "oauthRevoke", - "POST", - "/v1/oauth/revoke", - "required params", - SmokeTest::_smokeCase124), - new SmokeCase( - "oauthRevoke", "POST", "/v1/oauth/revoke", "all params", SmokeTest::_smokeCase125), - new SmokeCase( - "oauthAuthorizationServerMetadata", - "GET", - "/.well-known/oauth-authorization-server", - "", - SmokeTest::_smokeCase126)); + SmokeTest::_smokeCase120)); private static List selectedCases() { String filter = System.getenv("SCALAR_SMOKE_FILTER"); From 56f9c2f81a98c0815a20ff4a800f2c3787fa8e0d Mon Sep 17 00:00:00 2001 From: "scalar-docs[bot]" <148485328+scalar-docs[bot]@users.noreply.github.com> Date: Fri, 2 Oct 2026 20:37:34 +0000 Subject: [PATCH 6/6] release: 0.2.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 47 +++++++++++++++++++++++++++++++++++ build.gradle.kts | 2 +- 3 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 CHANGELOG.md diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 466df71..2be9c43 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0" + ".": "0.2.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..f9f43ca --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,47 @@ +# Changelog + +## [0.2.0](https://github.com/scalar/scalar-java/compare/v0.1.0...v0.2.0) (2026-10-02) + + +### ⚠ BREAKING CHANGES + +* **api:** 10 breaking changes to the SDK surface. + - Removed operation `oAuth.oauthAuthorize` (`GET /v1/oauth/authorize`). + - Removed operation `oAuth.oauthToken` (`POST /v1/oauth/token`). + - Removed operation `oAuth.oauthRevoke` (`POST /v1/oauth/revoke`). + - Removed operation `oAuth.oauthAuthorizationServerMetadata` (`GET /.well-known/oauth-authorization-server`). + - Removed schema `oauth_token`. + - Removed schema `oauth_scope`. + - Removed schema `oauth_error`. + - Removed schema `oauth_token_request`. + - Removed schema `oauth_revoke_request`. + - Removed schema `oauth_authorization_server_metadata`. +* **api:** 4 breaking changes to the SDK surface. + - Property `api_document.tags` type changed from `unknown` to `string`. + - Property `managed_doc_version.tools` type changed from `Array` to `Array`. + - Property `github_project.accessGroups` type changed from `unknown` to `string`. + - Property `docs_project.accessGroups` type changed from `unknown` to `string`. +* **api:** 10 breaking changes to the SDK surface. + - Removed body field `lastKnownVersionSha` from `registry.updateApiDocumentVersion`. + - Removed body field `lastKnownVersionSha` from `registry.createApiDocumentVersion`. + - Response of `schemas.version.create` changed from `uid` to `none`. + - Schema `slug` shape changed. + - Schema `namespace` shape changed. + - Added required property `managed_doc_version.endpointCount`. + - Removed optional property `managed_doc_version.versionSha`. + - Schema `method` shape changed. + - Added required property `github_project.userInfoHookUrl`. + - Added required property `github_project.analyticsEnabled`. + +### Features + +* **api:** add operation accessGroups.create (+66 more changes) ([443f8c3](https://github.com/scalar/scalar-java/commit/443f8c3daf74a9380e383d3db6632ab0fb339797)) +* **api:** initial SDK generation ([d527660](https://github.com/scalar/scalar-java/commit/d5276604fa7864c6a70601236e41a71801ef67ec)) +* **api:** remove operation oAuth.oauthAuthorize (+9 more changes) ([8f31264](https://github.com/scalar/scalar-java/commit/8f312641dd13dba604c46eb7e9400410a6fff274)) +* **api:** update property api_document.tags (+3 more changes) ([0d0a8f1](https://github.com/scalar/scalar-java/commit/0d0a8f14a335b0ee8fc4b933bfef086d36035621)) +* **api:** update SDK surface (15 changes) ([582f867](https://github.com/scalar/scalar-java/commit/582f867e84e41d0046e9b23a6fa8fa38d6d32e62)) + + +### Chores + +* **api:** update generated SDK content ([6700dbb](https://github.com/scalar/scalar-java/commit/6700dbb2fa21cb80112573765b623c2a03035960)) diff --git a/build.gradle.kts b/build.gradle.kts index cf2fe43..b3ccaf2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,4 @@ allprojects { group = "com.scalar" - version = "0.1.0" // x-release-please-version + version = "0.2.0" // x-release-please-version }