diff --git a/.claude/skills/scalar-java-sdk/SKILL.md b/.claude/skills/scalar-java-sdk/SKILL.md index 5520294..a56c598 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_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/.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/README.md b/README.md index ebd2489..f22abc0 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_OAUTH_TOKEN. | 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_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 6a74d55..c1aab38 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_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/VERSIONING.md b/VERSIONING.md new file mode 100644 index 0000000..f9cf7dd --- /dev/null +++ b/VERSIONING.md @@ -0,0 +1,100 @@ +# 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. +- **`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), + 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. + +### 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..df9ffdc 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,62 @@ 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) ## Setup @@ -83,7 +138,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 +159,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; @@ -115,7 +170,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); @@ -140,11 +195,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); @@ -168,7 +225,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); @@ -191,7 +248,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); @@ -215,9 +272,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); @@ -243,10 +300,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); @@ -271,9 +330,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); @@ -299,9 +358,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); @@ -327,10 +386,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); @@ -356,9 +417,9 @@ ScalarClient client = RegistryCreateApiDocumentAccessGroupParams params = RegistryCreateApiDocumentAccessGroupParams.builder() - .namespace("namespace") - .slug("slug") - .accessGroup(AccessGroup.builder().accessGroupSlug("xxx").build()) + .namespace("acme") + .slug("acme-api") + .accessGroup(AccessGroup.builder().accessGroupSlug("acme-api").build()) .build(); var registry = client.registry().createApiDocumentAccessGroup(params); @@ -384,9 +445,9 @@ ScalarClient client = RegistryDeleteApiDocumentAccessGroupParams params = RegistryDeleteApiDocumentAccessGroupParams.builder() - .namespace("namespace") - .slug("slug") - .accessGroup(AccessGroup.builder().accessGroupSlug("xxx").build()) + .namespace("acme") + .slug("acme-api") + .accessGroup(AccessGroup.builder().accessGroupSlug("acme-api").build()) .build(); var registry = client.registry().deleteApiDocumentAccessGroup(params); @@ -404,7 +465,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; @@ -414,7 +475,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); @@ -439,11 +500,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); @@ -467,7 +529,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); @@ -490,7 +552,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); @@ -517,11 +579,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); @@ -544,7 +602,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); @@ -557,7 +615,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; @@ -569,10 +627,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); @@ -602,9 +661,9 @@ ScalarClient client = AccessGroupCreateParams params = AccessGroupCreateParams.builder() - .namespace("namespace") - .slug("slug") - .accessGroup(AccessGroup.builder().accessGroupSlug("xxx").build()) + .namespace("acme") + .slug("customer") + .accessGroup(AccessGroup.builder().accessGroupSlug("acme-api").build()) .build(); var accessGroup = client.schemas().accessGroup().create(params); @@ -630,9 +689,9 @@ ScalarClient client = AccessGroupDeleteParams params = AccessGroupDeleteParams.builder() - .namespace("namespace") - .slug("slug") - .accessGroup(AccessGroup.builder().accessGroupSlug("xxx").build()) + .namespace("acme") + .slug("customer") + .accessGroup(AccessGroup.builder().accessGroupSlug("acme-api").build()) .build(); var accessGroup = client.schemas().accessGroup().delete(params); @@ -660,7 +719,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); @@ -682,7 +742,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); @@ -704,7 +764,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); @@ -731,8 +791,8 @@ ScalarClient client = LoginPortalCreateParams params = LoginPortalCreateParams.builder() - .title("") - .slug("") + .title("Acme Private Documentation") + .slug("acme-login") .email( LoginPortalEmail.builder() .logo("") @@ -742,7 +802,7 @@ LoginPortalCreateParams params = .title("Private Docs") .mainColor("#2a2f45") .mainBackground("#f6f6f6") - .cardColor("2a2f45") + .cardColor("#2a2f45") .cardBackground("#fff") .buttonColor("#fff") .buttonBackground("#0f0f0f") @@ -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,148 @@ 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("acme-api").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("acme-api").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("acme-api").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("acme-api").domain("example.com").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("acme-api").domain("example.com").build(); +var domain = client.accessGroups().domains().delete(params); + +System.out.println(domain); +``` + ## `Rules` Rules @@ -802,7 +1004,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; @@ -812,7 +1014,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); @@ -837,10 +1039,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); @@ -864,10 +1066,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); @@ -890,7 +1089,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); @@ -913,7 +1112,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); @@ -938,9 +1137,9 @@ ScalarClient client = RuleCreateRulesetAccessGroupParams params = RuleCreateRulesetAccessGroupParams.builder() - .namespace("namespace") - .slug("slug") - .accessGroup(AccessGroup.builder().accessGroupSlug("xxx").build()) + .namespace("acme") + .slug("acme-rules") + .accessGroup(AccessGroup.builder().accessGroupSlug("acme-api").build()) .build(); var rule = client.rules().createRulesetAccessGroup(params); @@ -966,9 +1165,9 @@ ScalarClient client = RuleDeleteRulesetAccessGroupParams params = RuleDeleteRulesetAccessGroupParams.builder() - .namespace("namespace") - .slug("slug") - .accessGroup(AccessGroup.builder().accessGroupSlug("xxx").build()) + .namespace("acme") + .slug("acme-rules") + .accessGroup(AccessGroup.builder().accessGroupSlug("acme-api").build()) .build(); var rule = client.rules().deleteRulesetAccessGroup(params); @@ -986,7 +1185,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; @@ -1017,7 +1216,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); @@ -1039,7 +1243,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); @@ -1062,7 +1266,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); @@ -1084,7 +1291,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); @@ -1106,7 +1313,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); @@ -1123,7 +1330,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 +1344,149 @@ 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("UakgbKJ5m9gl0JDMbcJqL").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("UakgbKJ5m9gl0JDMbcJqL").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("alex@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("UakgbKJ5m9gl0JDMbcJqL").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("UakgbKJ5m9gl0JDMbcJqL").build(); +var invite = client.teams().invites().cancel(params); + +System.out.println(invite); +``` + ## `ScalarDocs` Scalar Docs @@ -1148,7 +1498,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; @@ -1181,7 +1531,7 @@ ScalarClient client = ScalarDocCreateGuideParams params = ScalarDocCreateGuideParams.builder() - .name("") + .name("Acme Documentation") .isPrivate(false) .allowedUsers(java.util.List.of()) .allowedDomains(java.util.List.of()) @@ -1208,81 +1558,905 @@ 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); ``` -## `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("Acme Documentation") + .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("acme-docs").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("acme-docs").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("acme-docs").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("acme-docs").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("acme-docs").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("acme-docs") + .content("{\"name\":\"Acme Documentation\"}") + .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("acme-docs").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("acme-docs").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("scalar_example_personal_token") + .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("UakgbKJ5m9gl0JDMbcJqL") + .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("UakgbKJ5m9gl0JDMbcJqL").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("UakgbKJ5m9gl0JDMbcJqL").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("UakgbKJ5m9gl0JDMbcJqL").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("UakgbKJ5m9gl0JDMbcJqL").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("UakgbKJ5m9gl0JDMbcJqL") + .version("1.2.0") + .apiVersion("1.2.0") + .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("UakgbKJ5m9gl0JDMbcJqL").version("1.2.0").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("UakgbKJ5m9gl0JDMbcJqL") + .language(RepositoryLinkParams.Language.of("typescript")) + .repositoryId(123456789L) + .baseBranch("main") + .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("UakgbKJ5m9gl0JDMbcJqL") + .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("UakgbKJ5m9gl0JDMbcJqL") + .language(RepositoryUpdatePublishingParams.Language.of("typescript")) + .publishOnMerge(true) + .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("Acme MCP").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("42").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("42").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("42").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("42").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("42") + .name("Acme MCP") + .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("42").installationId("84").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("42").installationId("84").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("42").installationId("84").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("42") + .installationId("84") + .accessGroupUid("UakgbKJ5m9gl0JDMbcJqL") + .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("42") + .installationId("84") + .accessGroupUid("UakgbKJ5m9gl0JDMbcJqL") + .build(); +var installation = client.mcp().servers().installations().deleteAccessGroup(params); + +System.out.println(installation); ``` 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 } 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..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 @@ -294,7 +294,15 @@ 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()) + + 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..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 @@ -294,7 +294,15 @@ 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()) + + 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/client/ScalarClient.kt b/scalar-java-core/src/main/kotlin/com/scalar/client/ScalarClient.kt index c86cce7..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 @@ -3,13 +3,16 @@ 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.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 +62,9 @@ interface ScalarClient { /** Login Portals */ fun loginPortals(): LoginPortalService + /** Access Groups */ + fun accessGroups(): AccessGroupService + /** Rules */ fun rules(): RuleService @@ -77,6 +83,11 @@ interface ScalarClient { /** Authentication */ fun authentication(): AuthenticationService + /** SDKs */ + fun sdks(): SdkService + + fun mcp(): McpService + /** * Closes this client, relinquishing any underlying resources. * @@ -109,6 +120,9 @@ interface ScalarClient { /** Login Portals */ fun loginPortals(): LoginPortalService.WithRawResponse + /** Access Groups */ + fun accessGroups(): AccessGroupService.WithRawResponse + /** Rules */ fun rules(): RuleService.WithRawResponse @@ -126,5 +140,10 @@ interface ScalarClient { /** Authentication */ fun authentication(): AuthenticationService.WithRawResponse + + /** SDKs */ + fun sdks(): SdkService.WithRawResponse + + fun mcp(): McpService.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..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 @@ -3,13 +3,16 @@ 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.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 +62,9 @@ interface ScalarClientAsync { /** Login Portals */ fun loginPortals(): LoginPortalServiceAsync + /** Access Groups */ + fun accessGroups(): AccessGroupServiceAsync + /** Rules */ fun rules(): RuleServiceAsync @@ -77,6 +83,11 @@ interface ScalarClientAsync { /** Authentication */ fun authentication(): AuthenticationServiceAsync + /** SDKs */ + fun sdks(): SdkServiceAsync + + fun mcp(): McpServiceAsync + /** * Closes this client, relinquishing any underlying resources. * @@ -111,6 +122,9 @@ interface ScalarClientAsync { /** Login Portals */ fun loginPortals(): LoginPortalServiceAsync.WithRawResponse + /** Access Groups */ + fun accessGroups(): AccessGroupServiceAsync.WithRawResponse + /** Rules */ fun rules(): RuleServiceAsync.WithRawResponse @@ -128,5 +142,10 @@ interface ScalarClientAsync { /** Authentication */ fun authentication(): AuthenticationServiceAsync.WithRawResponse + + /** SDKs */ + fun sdks(): SdkServiceAsync.WithRawResponse + + fun mcp(): McpServiceAsync.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..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 @@ -4,10 +4,14 @@ 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.RegistryServiceAsync @@ -18,6 +22,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 +59,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 +83,10 @@ 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) } + override fun sync(): ScalarClient = sync override fun withRawResponse(): ScalarClientAsync.WithRawResponse = withRawResponse @@ -89,6 +103,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 +124,11 @@ class ScalarClientAsyncImpl(private val clientOptions: ClientOptions) : ScalarCl /** Authentication */ override fun authentication(): AuthenticationServiceAsync = authentication + /** SDKs */ + override fun sdks(): SdkServiceAsync = sdks + + override fun mcp(): McpServiceAsync = mcp + override fun close() = clientOptions.close() class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : @@ -124,6 +146,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 +174,14 @@ 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) + } + override fun withOptions( modifier: Consumer ): ScalarClientAsync.WithRawResponse = @@ -164,6 +198,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 +218,10 @@ 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 } } 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..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 @@ -4,10 +4,14 @@ 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.RegistryService @@ -18,6 +22,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 +57,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 +79,10 @@ 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) } + override fun async(): ScalarClientAsync = async override fun withRawResponse(): ScalarClient.WithRawResponse = withRawResponse @@ -85,6 +99,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 +120,11 @@ class ScalarClientImpl(private val clientOptions: ClientOptions) : ScalarClient /** Authentication */ override fun authentication(): AuthenticationService = authentication + /** SDKs */ + override fun sdks(): SdkService = sdks + + override fun mcp(): McpService = mcp + override fun close() = clientOptions.close() class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : @@ -120,6 +142,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 +170,14 @@ 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) + } + override fun withOptions( modifier: Consumer ): ScalarClient.WithRawResponse = @@ -160,6 +194,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 +214,10 @@ 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 } } 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..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 @@ -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,10 @@ private constructor( */ fun baseUrl(): String = baseUrl ?: PRODUCTION_URL + fun bearerAuth(): Optional = Optional.ofNullable(bearerAuth) + + fun oAuth2(): Optional = Optional.ofNullable(oAuth2) + fun toBuilder() = Builder().from(this) companion object { @@ -147,7 +152,6 @@ private constructor( * The following fields are required: * ```java * .httpClient() - * .bearerAuth() * ``` */ @JvmStatic fun builder() = Builder() @@ -177,6 +181,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 +199,7 @@ private constructor( maxRetries = clientOptions.maxRetries logLevel = clientOptions.logLevel bearerAuth = clientOptions.bearerAuth + oAuth2 = clientOptions.oAuth2 } /** @@ -326,7 +332,15 @@ 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()) + + 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 +431,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.oauthToken`|`SCALAR_OAUTH_TOKEN`|false |- | * |`baseUrl` |`scalar.baseUrl` |`SCALAR_BASE_URL` |true |`"https://access.scalar.com"`| * * System properties take precedence over environment variables. @@ -430,6 +445,9 @@ private constructor( (System.getProperty("scalar.bearerAuth") ?: System.getenv("BEARER_AUTH"))?.let { bearerAuth(it) } + (System.getProperty("scalar.oauthToken") ?: System.getenv("SCALAR_OAUTH_TOKEN"))?.let { + oAuth2(it) + } System.getenv("SCALAR_CUSTOM_HEADERS")?.let { customHeadersEnv -> for (line in customHeadersEnv.split("\n")) { val colon = line.indexOf(':') @@ -448,7 +466,6 @@ private constructor( * The following fields are required: * ```java * .httpClient() - * .bearerAuth() * ``` * * @throws IllegalStateException if any required field is unset. @@ -474,7 +491,6 @@ private constructor( ) ) val sleeper = sleeper ?: PhantomReachableSleeper(DefaultSleeper()) - val bearerAuth = checkRequired("bearerAuth", bearerAuth) val headers = Headers.builder() val queryParams = QueryParams.builder() @@ -489,7 +505,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 +543,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..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 @@ -27,12 +28,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 +43,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 +53,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 +91,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 +127,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 +155,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 +201,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 +224,7 @@ private constructor( * .createdAt() * .version() * .upgraded() + * .endpointCount() * .embedStatus() * .tags() * ``` @@ -235,12 +239,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 +253,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 +304,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 +408,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 +438,7 @@ private constructor( * .createdAt() * .version() * .upgraded() + * .endpointCount() * .embedStatus() * .tags() * ``` @@ -434,12 +451,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 +480,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 +508,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 { @@ -870,181 +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 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, - 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, - 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 - 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 - 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 { @@ -1218,12 +1060,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 +1075,12 @@ private constructor( createdAt, version, upgraded, + endpointCount, embedStatus, tags, tools, yamlSha, jsonSha, - versionSha, additionalProperties, ) } @@ -1246,5 +1088,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/accessGroups/AccessGroupCreateParams.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupCreateParams.kt new file mode 100644 index 0000000..0fd7a67 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupCreateParams.kt @@ -0,0 +1,520 @@ +// 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 + +/** + * 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: String) = apply { body.allowedDomains(allowedDomains) } + + /** + * Sets [Builder.allowedDomains] to an arbitrary JSON 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 { + 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: String) = + allowedDomains(JsonField.of(allowedDomains)) + + /** + * Sets [Builder.allowedDomains] to an arbitrary JSON 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 { + 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..e02dd07 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupCreateResponse.kt @@ -0,0 +1,328 @@ +// 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 + +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 or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun allowedDomains(): String = allowedDomains.getRequired("allowedDomains") + + /** + * @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(): String = allowedEmails.getRequired("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: String) = allowedDomains(JsonField.of(allowedDomains)) + + /** + * Sets [Builder.allowedDomains] to an arbitrary JSON 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 { + this.allowedDomains = allowedDomains + } + + 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 [String] 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..0d7a98c --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/accessGroups/AccessGroupRetrieveResponse.kt @@ -0,0 +1,328 @@ +// 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 + +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 or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun allowedDomains(): String = allowedDomains.getRequired("allowedDomains") + + /** + * @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(): String = allowedEmails.getRequired("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: String) = allowedDomains(JsonField.of(allowedDomains)) + + /** + * Sets [Builder.allowedDomains] to an arbitrary JSON 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 { + this.allowedDomains = allowedDomains + } + + 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 [String] 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/registry/RegistryListApiDocumentsResponse.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/registry/ApiDocument.kt similarity index 87% 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..b900b48 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 @@ -17,10 +17,9 @@ 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 RegistryListApiDocumentsResponse +class ApiDocument @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val uid: JsonField, @@ -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]. @@ -197,8 +196,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 +214,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [RegistryListApiDocumentsResponse]. */ + /** A builder for [ApiDocument]. */ class Builder internal constructor() { private var uid: JsonField? = null @@ -226,25 +224,23 @@ 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() @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)) @@ -319,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)) @@ -377,7 +370,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 +389,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 +414,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 +461,7 @@ private constructor( return true } - return other is RegistryListApiDocumentsResponse && + return other is ApiDocument && uid == other.uid && version == other.version && title == other.title && @@ -499,5 +492,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/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/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..e7b2da3 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/DocsProject.kt @@ -0,0 +1,602 @@ +// 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 or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun accessGroups(): String = accessGroups.getRequired("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: String) = accessGroups(JsonField.of(accessGroups)) + + /** + * Sets [Builder.accessGroups] to an arbitrary JSON value. + * + * 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 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/GithubProject.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/GithubProject.kt new file mode 100644 index 0000000..292ec10 --- /dev/null +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/GithubProject.kt @@ -0,0 +1,935 @@ +// 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 GithubProject +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val uid: JsonField, + private val createdAt: JsonField, + private val updatedAt: JsonField, + private val name: JsonField, + private val activeDeployment: JsonField, + 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, + private val publishMessage: JsonField, + private val repository: 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("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("activeDeployment") + @ExcludeMissing + activeDeployment: JsonField = JsonMissing.of(), + @JsonProperty("lastPublished") + @ExcludeMissing + lastPublished: JsonField = JsonMissing.of(), + @JsonProperty("lastPublishedUid") + @ExcludeMissing + lastPublishedUid: JsonField = JsonMissing.of(), + @JsonProperty("loginPortalUid") + @ExcludeMissing + loginPortalUid: JsonField = JsonMissing.of(), + @JsonProperty("userInfoHookUrl") + @ExcludeMissing + userInfoHookUrl: JsonField = JsonMissing.of(), + @JsonProperty("activeThemeId") + @ExcludeMissing + activeThemeId: JsonField = JsonMissing.of(), + @JsonProperty("typesenseId") + @ExcludeMissing + typesenseId: JsonField = JsonMissing.of(), + @JsonProperty("isPrivate") @ExcludeMissing isPrivate: JsonField = JsonMissing.of(), + @JsonProperty("agentEnabled") + @ExcludeMissing + agentEnabled: JsonField = JsonMissing.of(), + @JsonProperty("analyticsEnabled") + @ExcludeMissing + analyticsEnabled: JsonField = JsonMissing.of(), + @JsonProperty("accessGroups") + @ExcludeMissing + accessGroups: JsonField = JsonMissing.of(), + @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), + @JsonProperty("publishStatus") + @ExcludeMissing + publishStatus: JsonField = JsonMissing.of(), + @JsonProperty("publishMessage") + @ExcludeMissing + publishMessage: JsonField = JsonMissing.of(), + @JsonProperty("repository") + @ExcludeMissing + repository: JsonField = JsonMissing.of(), + ) : this( + uid, + createdAt, + updatedAt, + name, + activeDeployment, + lastPublished, + lastPublishedUid, + loginPortalUid, + userInfoHookUrl, + activeThemeId, + typesenseId, + isPrivate, + agentEnabled, + analyticsEnabled, + accessGroups, + slug, + publishStatus, + publishMessage, + repository, + 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 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 activeDeployment(): Optional = + activeDeployment.getOptional("activeDeployment") + + /** + * @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 (e.g. if the + * server responded with an unexpected value). + */ + fun lastPublishedUid(): Optional = lastPublishedUid.getOptional("lastPublishedUid") + + /** + * @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 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). + */ + fun activeThemeId(): String = activeThemeId.getRequired("activeThemeId") + + /** + * @throws ScalarInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun typesenseId(): Optional = typesenseId.getOptional("typesenseId") + + /** + * @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 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 or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun accessGroups(): String = accessGroups.getRequired("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 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 publishStatus(): String = publishStatus.getRequired("publishStatus") + + /** + * @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 publishMessage(): String = publishMessage.getRequired("publishMessage") + + /** + * @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") + + /** + * 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 [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 [activeDeployment]. + * + * Unlike [activeDeployment], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("activeDeployment") + @ExcludeMissing + fun _activeDeployment(): JsonField = activeDeployment + + /** + * 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 [lastPublishedUid]. + * + * Unlike [lastPublishedUid], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("lastPublishedUid") + @ExcludeMissing + fun _lastPublishedUid(): JsonField = lastPublishedUid + + /** + * 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 [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]. + * + * 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 [typesenseId]. + * + * Unlike [typesenseId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("typesenseId") @ExcludeMissing fun _typesenseId(): JsonField = typesenseId + + /** + * 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 [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 [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 [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 [publishStatus]. + * + * Unlike [publishStatus], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("publishStatus") + @ExcludeMissing + fun _publishStatus(): JsonField = publishStatus + + /** + * Returns the raw JSON value of [publishMessage]. + * + * Unlike [publishMessage], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("publishMessage") + @ExcludeMissing + fun _publishMessage(): JsonField = publishMessage + + /** + * Returns the raw JSON value of [repository]. + * + * Unlike [repository], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("repository") + @ExcludeMissing + fun _repository(): JsonField = repository + + @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 [GithubProject]. + * + * The following fields are required: + * ```kotlin + * .uid() + * .createdAt() + * .updatedAt() + * .name() + * .activeDeployment() + * .lastPublished() + * .lastPublishedUid() + * .loginPortalUid() + * .userInfoHookUrl() + * .activeThemeId() + * .isPrivate() + * .agentEnabled() + * .analyticsEnabled() + * .accessGroups() + * .slug() + * .publishStatus() + * .publishMessage() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [GithubProject]. */ + class Builder internal constructor() { + + private var uid: JsonField? = null + private var createdAt: JsonField? = null + private var updatedAt: JsonField? = null + private var name: JsonField? = null + private var activeDeployment: JsonField? = null + 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 + private var publishMessage: JsonField? = null + private var repository: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + 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)) + + /** + * 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 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 activeDeployment(activeDeployment: ActiveDeployment?) = + activeDeployment(JsonField.ofNullable(activeDeployment)) + + /** Alias for calling [Builder.activeDeployment] with `activeDeployment.orElse(null)`. */ + fun activeDeployment(activeDeployment: Optional) = + activeDeployment(activeDeployment.getOrNull()) + + /** + * Sets [Builder.activeDeployment] to an arbitrary JSON value. + * + * You should usually call [Builder.activeDeployment] with a well-typed [ActiveDeployment] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun activeDeployment(activeDeployment: JsonField) = apply { + this.activeDeployment = activeDeployment + } + + 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 lastPublishedUid(lastPublishedUid: String?) = + lastPublishedUid(JsonField.ofNullable(lastPublishedUid)) + + /** Alias for calling [Builder.lastPublishedUid] with `lastPublishedUid.orElse(null)`. */ + fun lastPublishedUid(lastPublishedUid: Optional) = + lastPublishedUid(lastPublishedUid.getOrNull()) + + /** + * Sets [Builder.lastPublishedUid] to an arbitrary JSON value. + * + * You should usually call [Builder.lastPublishedUid] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun lastPublishedUid(lastPublishedUid: JsonField) = apply { + this.lastPublishedUid = lastPublishedUid + } + + 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 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)) + + /** + * 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 typesenseId(typesenseId: Double) = typesenseId(JsonField.of(typesenseId)) + + /** + * Sets [Builder.typesenseId] to an arbitrary JSON value. + * + * You should usually call [Builder.typesenseId] with a well-typed [Double] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun typesenseId(typesenseId: JsonField) = apply { this.typesenseId = typesenseId } + + 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 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 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 [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 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 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 publishMessage(publishMessage: String) = publishMessage(JsonField.of(publishMessage)) + + /** + * Sets [Builder.publishMessage] to an arbitrary JSON value. + * + * You should usually call [Builder.publishMessage] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun publishMessage(publishMessage: JsonField) = apply { + this.publishMessage = publishMessage + } + + fun repository(repository: GithubProjectRepository?) = + repository(JsonField.ofNullable(repository)) + + /** Alias for calling [Builder.repository] with `repository.orElse(null)`. */ + 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 [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 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 [GithubProject]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .uid() + * .createdAt() + * .updatedAt() + * .name() + * .activeDeployment() + * .lastPublished() + * .lastPublishedUid() + * .loginPortalUid() + * .userInfoHookUrl() + * .activeThemeId() + * .isPrivate() + * .agentEnabled() + * .analyticsEnabled() + * .accessGroups() + * .slug() + * .publishStatus() + * .publishMessage() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): GithubProject = + GithubProject( + checkRequired("uid", uid), + checkRequired("createdAt", createdAt), + checkRequired("updatedAt", updatedAt), + checkRequired("name", name), + checkRequired("activeDeployment", activeDeployment), + 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), + checkRequired("publishMessage", publishMessage), + repository, + 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(): GithubProject = apply { + if (validated) { + return@apply + } + + uid() + createdAt() + updatedAt() + name() + activeDeployment().ifPresent { it.validate() } + lastPublished() + lastPublishedUid() + loginPortalUid() + userInfoHookUrl() + activeThemeId() + typesenseId() + isPrivate() + agentEnabled() + analyticsEnabled() + accessGroups() + slug() + publishStatus() + publishMessage() + repository().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 (uid.asKnown().isPresent) 1 else 0) + + (if (createdAt.asKnown().isPresent) 1 else 0) + + (if (updatedAt.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (activeDeployment.asKnown().getOrNull()?.validity() ?: 0) + + (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) + + (if (publishMessage.asKnown().isPresent) 1 else 0) + + (repository.asKnown().getOrNull()?.validity() ?: 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is GithubProject && + uid == other.uid && + createdAt == other.createdAt && + updatedAt == other.updatedAt && + name == other.name && + activeDeployment == other.activeDeployment && + 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 && + publishMessage == other.publishMessage && + repository == other.repository && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + uid, + createdAt, + updatedAt, + name, + activeDeployment, + lastPublished, + lastPublishedUid, + loginPortalUid, + userInfoHookUrl, + activeThemeId, + typesenseId, + isPrivate, + agentEnabled, + analyticsEnabled, + accessGroups, + slug, + publishStatus, + publishMessage, + repository, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "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/ScalarDocListGuidesResponse.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListGuidesResponse.kt deleted file mode 100644 index 5980107..0000000 --- a/scalar-java-core/src/main/kotlin/com/scalar/models/scalarDocs/ScalarDocListGuidesResponse.kt +++ /dev/null @@ -1,1573 +0,0 @@ -// 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 ScalarDocListGuidesResponse -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val uid: JsonField, - private val createdAt: JsonField, - private val updatedAt: JsonField, - private val name: JsonField, - private val activeDeployment: JsonField, - private val lastPublished: JsonField, - private val lastPublishedUid: JsonField, - private val loginPortalUid: JsonField, - private val activeThemeId: JsonField, - private val typesenseId: JsonField, - private val isPrivate: JsonField, - private val agentEnabled: JsonField, - private val accessGroups: JsonField, - private val slug: JsonField, - private val publishStatus: JsonField, - private val publishMessage: JsonField, - private val repository: 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("name") @ExcludeMissing name: JsonField = JsonMissing.of(), - @JsonProperty("activeDeployment") - @ExcludeMissing - activeDeployment: JsonField = JsonMissing.of(), - @JsonProperty("lastPublished") - @ExcludeMissing - lastPublished: JsonField = JsonMissing.of(), - @JsonProperty("lastPublishedUid") - @ExcludeMissing - lastPublishedUid: JsonField = JsonMissing.of(), - @JsonProperty("loginPortalUid") - @ExcludeMissing - loginPortalUid: JsonField = JsonMissing.of(), - @JsonProperty("activeThemeId") - @ExcludeMissing - activeThemeId: JsonField = JsonMissing.of(), - @JsonProperty("typesenseId") - @ExcludeMissing - typesenseId: JsonField = JsonMissing.of(), - @JsonProperty("isPrivate") @ExcludeMissing isPrivate: JsonField = JsonMissing.of(), - @JsonProperty("agentEnabled") - @ExcludeMissing - agentEnabled: JsonField = JsonMissing.of(), - @JsonProperty("accessGroups") - @ExcludeMissing - accessGroups: JsonField = JsonMissing.of(), - @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), - @JsonProperty("publishStatus") - @ExcludeMissing - publishStatus: JsonField = JsonMissing.of(), - @JsonProperty("publishMessage") - @ExcludeMissing - publishMessage: JsonField = JsonMissing.of(), - @JsonProperty("repository") - @ExcludeMissing - repository: JsonField = JsonMissing.of(), - ) : this( - uid, - createdAt, - updatedAt, - name, - activeDeployment, - lastPublished, - lastPublishedUid, - loginPortalUid, - activeThemeId, - typesenseId, - isPrivate, - agentEnabled, - accessGroups, - slug, - publishStatus, - publishMessage, - repository, - 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 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 activeDeployment(): Optional = - activeDeployment.getOptional("activeDeployment") - - /** - * @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 (e.g. if the - * server responded with an unexpected value). - */ - fun lastPublishedUid(): Optional = lastPublishedUid.getOptional("lastPublishedUid") - - /** - * @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 (e.g. if the - * server responded with an unexpected value). - */ - fun typesenseId(): Optional = typesenseId.getOptional("typesenseId") - - /** - * @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 agentEnabled(): Boolean = agentEnabled.getRequired("agentEnabled") - - /** - * @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 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 publishStatus(): String = publishStatus.getRequired("publishStatus") - - /** - * @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 publishMessage(): String = publishMessage.getRequired("publishMessage") - - /** - * @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") - - /** - * 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 [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 [activeDeployment]. - * - * Unlike [activeDeployment], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("activeDeployment") - @ExcludeMissing - fun _activeDeployment(): JsonField = activeDeployment - - /** - * 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 [lastPublishedUid]. - * - * Unlike [lastPublishedUid], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("lastPublishedUid") - @ExcludeMissing - fun _lastPublishedUid(): JsonField = lastPublishedUid - - /** - * 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 [typesenseId]. - * - * Unlike [typesenseId], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("typesenseId") @ExcludeMissing fun _typesenseId(): JsonField = typesenseId - - /** - * 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 [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 [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 [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 [publishStatus]. - * - * Unlike [publishStatus], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("publishStatus") - @ExcludeMissing - fun _publishStatus(): JsonField = publishStatus - - /** - * Returns the raw JSON value of [publishMessage]. - * - * Unlike [publishMessage], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("publishMessage") - @ExcludeMissing - fun _publishMessage(): JsonField = publishMessage - - /** - * Returns the raw JSON value of [repository]. - * - * Unlike [repository], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("repository") - @ExcludeMissing - fun _repository(): JsonField = repository - - @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 [ScalarDocListGuidesResponse]. - * - * The following fields are required: - * ```kotlin - * .uid() - * .createdAt() - * .updatedAt() - * .name() - * .activeDeployment() - * .lastPublished() - * .lastPublishedUid() - * .loginPortalUid() - * .activeThemeId() - * .isPrivate() - * .agentEnabled() - * .accessGroups() - * .slug() - * .publishStatus() - * .publishMessage() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [ScalarDocListGuidesResponse]. */ - class Builder internal constructor() { - - private var uid: JsonField? = null - private var createdAt: JsonField? = null - private var updatedAt: JsonField? = null - private var name: JsonField? = null - private var activeDeployment: JsonField? = null - private var lastPublished: JsonField? = null - private var lastPublishedUid: JsonField? = null - private var loginPortalUid: 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 accessGroups: JsonField? = null - private var slug: JsonField? = null - private var publishStatus: JsonField? = null - private var publishMessage: JsonField? = null - 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 - activeThemeId = scalarDocListGuidesResponse.activeThemeId - typesenseId = scalarDocListGuidesResponse.typesenseId - isPrivate = scalarDocListGuidesResponse.isPrivate - agentEnabled = scalarDocListGuidesResponse.agentEnabled - accessGroups = scalarDocListGuidesResponse.accessGroups - slug = scalarDocListGuidesResponse.slug - publishStatus = scalarDocListGuidesResponse.publishStatus - publishMessage = scalarDocListGuidesResponse.publishMessage - repository = scalarDocListGuidesResponse.repository - additionalProperties = scalarDocListGuidesResponse.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 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 activeDeployment(activeDeployment: ActiveDeployment?) = - activeDeployment(JsonField.ofNullable(activeDeployment)) - - /** Alias for calling [Builder.activeDeployment] with `activeDeployment.orElse(null)`. */ - fun activeDeployment(activeDeployment: Optional) = - activeDeployment(activeDeployment.getOrNull()) - - /** - * Sets [Builder.activeDeployment] to an arbitrary JSON value. - * - * You should usually call [Builder.activeDeployment] with a well-typed [ActiveDeployment] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun activeDeployment(activeDeployment: JsonField) = apply { - this.activeDeployment = activeDeployment - } - - 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 lastPublishedUid(lastPublishedUid: String?) = - lastPublishedUid(JsonField.ofNullable(lastPublishedUid)) - - /** Alias for calling [Builder.lastPublishedUid] with `lastPublishedUid.orElse(null)`. */ - fun lastPublishedUid(lastPublishedUid: Optional) = - lastPublishedUid(lastPublishedUid.getOrNull()) - - /** - * Sets [Builder.lastPublishedUid] to an arbitrary JSON value. - * - * You should usually call [Builder.lastPublishedUid] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun lastPublishedUid(lastPublishedUid: JsonField) = apply { - this.lastPublishedUid = lastPublishedUid - } - - 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 typesenseId(typesenseId: Double) = typesenseId(JsonField.of(typesenseId)) - - /** - * Sets [Builder.typesenseId] to an arbitrary JSON value. - * - * You should usually call [Builder.typesenseId] with a well-typed [Double] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun typesenseId(typesenseId: JsonField) = apply { this.typesenseId = typesenseId } - - 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 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 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 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 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 publishMessage(publishMessage: String) = publishMessage(JsonField.of(publishMessage)) - - /** - * Sets [Builder.publishMessage] to an arbitrary JSON value. - * - * You should usually call [Builder.publishMessage] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun publishMessage(publishMessage: JsonField) = apply { - this.publishMessage = publishMessage - } - - fun repository(repository: Repository?) = repository(JsonField.ofNullable(repository)) - - /** Alias for calling [Builder.repository] with `repository.orElse(null)`. */ - 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. - */ - fun repository(repository: JsonField) = apply { this.repository = repository } - - 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 [ScalarDocListGuidesResponse]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```kotlin - * .uid() - * .createdAt() - * .updatedAt() - * .name() - * .activeDeployment() - * .lastPublished() - * .lastPublishedUid() - * .loginPortalUid() - * .activeThemeId() - * .isPrivate() - * .agentEnabled() - * .accessGroups() - * .slug() - * .publishStatus() - * .publishMessage() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): ScalarDocListGuidesResponse = - ScalarDocListGuidesResponse( - checkRequired("uid", uid), - checkRequired("createdAt", createdAt), - checkRequired("updatedAt", updatedAt), - checkRequired("name", name), - checkRequired("activeDeployment", activeDeployment), - checkRequired("lastPublished", lastPublished), - checkRequired("lastPublishedUid", lastPublishedUid), - checkRequired("loginPortalUid", loginPortalUid), - checkRequired("activeThemeId", activeThemeId), - typesenseId, - checkRequired("isPrivate", isPrivate), - checkRequired("agentEnabled", agentEnabled), - checkRequired("accessGroups", accessGroups), - checkRequired("slug", slug), - checkRequired("publishStatus", publishStatus), - checkRequired("publishMessage", publishMessage), - repository, - 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(): ScalarDocListGuidesResponse = apply { - if (validated) { - return@apply - } - - uid() - createdAt() - updatedAt() - name() - activeDeployment().ifPresent { it.validate() } - lastPublished() - lastPublishedUid() - loginPortalUid() - activeThemeId() - typesenseId() - isPrivate() - agentEnabled() - accessGroups() - slug() - publishStatus() - publishMessage() - repository().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 (uid.asKnown().isPresent) 1 else 0) + - (if (createdAt.asKnown().isPresent) 1 else 0) + - (if (updatedAt.asKnown().isPresent) 1 else 0) + - (if (name.asKnown().isPresent) 1 else 0) + - (activeDeployment.asKnown().getOrNull()?.validity() ?: 0) + - (if (lastPublished.asKnown().isPresent) 1 else 0) + - (if (lastPublishedUid.asKnown().isPresent) 1 else 0) + - (if (loginPortalUid.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 (accessGroups.asKnown().isPresent) 1 else 0) + - (if (slug.asKnown().isPresent) 1 else 0) + - (if (publishStatus.asKnown().isPresent) 1 else 0) + - (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 && - uid == other.uid && - createdAt == other.createdAt && - updatedAt == other.updatedAt && - name == other.name && - activeDeployment == other.activeDeployment && - lastPublished == other.lastPublished && - lastPublishedUid == other.lastPublishedUid && - loginPortalUid == other.loginPortalUid && - activeThemeId == other.activeThemeId && - typesenseId == other.typesenseId && - isPrivate == other.isPrivate && - agentEnabled == other.agentEnabled && - accessGroups == other.accessGroups && - slug == other.slug && - publishStatus == other.publishStatus && - publishMessage == other.publishMessage && - repository == other.repository && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - uid, - createdAt, - updatedAt, - name, - activeDeployment, - lastPublished, - lastPublishedUid, - loginPortalUid, - activeThemeId, - typesenseId, - isPrivate, - agentEnabled, - accessGroups, - slug, - publishStatus, - publishMessage, - repository, - additionalProperties, - ) - } - - 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}" -} 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/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/models/schemas/SchemaListResponse.kt b/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/Sdk.kt similarity index 53% rename from scalar-java-core/src/main/kotlin/com/scalar/models/schemas/SchemaListResponse.kt rename to scalar-java-core/src/main/kotlin/com/scalar/models/sdks/Sdk.kt index 3e79965..a72d3ed 100644 --- a/scalar-java-core/src/main/kotlin/com/scalar/models/schemas/SchemaListResponse.kt +++ b/scalar-java-core/src/main/kotlin/com/scalar/models/sdks/Sdk.kt @@ -1,6 +1,6 @@ // File generated by Scalar SDK Generator. DO NOT EDIT. -package com.scalar.models.schemas +package com.scalar.models.sdks import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter @@ -16,18 +16,23 @@ 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 +class Sdk @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 description: JsonField, private val isPrivate: JsonField, - private val versions: 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, ) { @@ -35,16 +40,39 @@ private constructor( 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("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), - @JsonProperty("namespace") @ExcludeMissing namespace: 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, description, slug, namespace, isPrivate, versions, mutableMapOf()) + 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 @@ -62,19 +90,19 @@ 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 description(): String = description.getRequired("description") + 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 slug(): String = slug.getRequired("slug") + 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 namespace(): String = namespace.getRequired("namespace") + fun description(): String = description.getRequired("description") /** * @throws ScalarInvalidDataException if the JSON field has an unexpected type or is @@ -82,11 +110,35 @@ 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 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 versions(): List = versions.getRequired("versions") + 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]. @@ -102,13 +154,6 @@ private constructor( */ @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]. * @@ -123,6 +168,13 @@ private constructor( */ @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]. * @@ -130,12 +182,46 @@ private constructor( */ @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 + @JsonProperty("versions") + @ExcludeMissing + fun _versions(): JsonField> = versions @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -152,44 +238,55 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [SchemaListResponse]. + * Returns a mutable builder for constructing an instance of [Sdk]. * * The following fields are required: * ```kotlin * .uid() * .title() - * .description() * .slug() * .namespace() + * .description() * .isPrivate() + * .apiUid() + * .currentVersion() + * .targets() * .versions() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [SchemaListResponse]. */ + /** A builder for [Sdk]. */ 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 description: JsonField? = null private var isPrivate: JsonField? = null - private var versions: 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(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() + 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)) @@ -212,17 +309,6 @@ private constructor( */ 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)) /** @@ -244,6 +330,17 @@ private constructor( */ 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)) /** @@ -255,25 +352,90 @@ private constructor( */ fun isPrivate(isPrivate: JsonField) = apply { this.isPrivate = isPrivate } - fun versions(versions: List) = versions(JsonField.of(versions)) + 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 + * 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 [Version] to [versions]. + * Adds a single [SdkVersion] to [versions]. * * @throws IllegalStateException if the field was previously set to a non-list. */ - fun addVersion(version: Version) = apply { + fun addVersion(version: SdkVersion) = apply { versions = (versions ?: JsonField.of(mutableListOf())).also { checkKnown("versions", it).add(version) @@ -300,7 +462,7 @@ private constructor( } /** - * Returns an immutable instance of [SchemaListResponse]. + * Returns an immutable instance of [Sdk]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -308,23 +470,30 @@ private constructor( * ```kotlin * .uid() * .title() - * .description() * .slug() * .namespace() + * .description() * .isPrivate() + * .apiUid() + * .currentVersion() + * .targets() * .versions() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): SchemaListResponse = - SchemaListResponse( + fun build(): Sdk = + Sdk( checkRequired("uid", uid), checkRequired("title", title), - checkRequired("description", description), 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(), ) @@ -340,17 +509,21 @@ private constructor( * @throws ScalarInvalidDataException if any value type in this object doesn't match its * expected type. */ - fun validate(): SchemaListResponse = apply { + fun validate(): Sdk = apply { if (validated) { return@apply } uid() title() - description() slug() namespace() + description() isPrivate() + apiUid() + apiVersion() + currentVersion() + targets().forEach { it.validate() } versions().forEach { it.validate() } validated = true } @@ -372,299 +545,32 @@ private constructor( 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 (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) - 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 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(), - ) : this(uid, createdAt, updatedAt, 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 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") - - /** - * 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 - - @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 additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(version: Version) = apply { - uid = version.uid - createdAt = version.createdAt - updatedAt = version.updatedAt - this.version = version.version - 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 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), - 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() - 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) - - 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 && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(uid, createdAt, updatedAt, version, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Version{uid=$uid, createdAt=$createdAt, updatedAt=$updatedAt, version=$version, additionalProperties=$additionalProperties}" - } - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is SchemaListResponse && + return other is Sdk && uid == other.uid && title == other.title && - description == other.description && 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 } @@ -673,10 +579,14 @@ private constructor( Objects.hash( uid, title, - description, slug, namespace, + description, isPrivate, + apiUid, + apiVersion, + currentVersion, + targets, versions, additionalProperties, ) @@ -685,5 +595,5 @@ private constructor( 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}" + "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/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/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/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/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/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-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 2b5cf62..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 @@ -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() } } @@ -45,22 +47,27 @@ 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()) 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()) } @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( @@ -71,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 7a423b0..e34bbeb 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": [], @@ -28,6 +46,15 @@ "source": "400", "publicAliases": [], "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": { + "message": "Invalid request parameters.", + "code": "bad-request" + } + }, "type": { "kind": "object", "properties": [ @@ -60,6 +87,15 @@ "source": "401", "publicAliases": [], "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": { + "message": "Invalid authentication token.", + "code": "unauthorized" + } + }, "type": { "kind": "object", "properties": [ @@ -92,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": [ @@ -124,6 +169,15 @@ "source": "404", "publicAliases": [], "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": { + "message": "Resource not found.", + "code": "not-found" + } + }, "type": { "kind": "object", "properties": [ @@ -156,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": [ @@ -188,6 +251,15 @@ "source": "500", "publicAliases": [], "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": { + "message": "An unexpected error occurred.", + "code": "unknown" + } + }, "type": { "kind": "object", "properties": [ @@ -228,6 +300,12 @@ "publicName": "uid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "ref", "name": "nanoid" @@ -238,6 +316,12 @@ "publicName": "version", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "1.2.0" + }, "type": { "kind": "ref", "name": "version" @@ -248,6 +332,12 @@ "publicName": "title", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Acme API" + }, "type": { "kind": "primitive", "type": "string", @@ -261,6 +351,12 @@ "publicName": "slug", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme-api" + }, "type": { "kind": "ref", "name": "slug" @@ -271,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" @@ -281,6 +383,12 @@ "publicName": "namespace", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme" + }, "type": { "kind": "ref", "name": "namespace" @@ -291,6 +399,12 @@ "publicName": "isPrivate", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": false + }, "type": { "kind": "primitive", "type": "boolean" @@ -301,8 +415,18 @@ "publicName": "tags", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": [ + "products", + "orders" + ] + }, "type": { - "kind": "unknown" + "kind": "primitive", + "type": "string" } }, { @@ -327,6 +451,12 @@ "source": "nanoid", "publicAliases": [], "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "primitive", "type": "string", @@ -340,6 +470,12 @@ "source": "version", "publicAliases": [], "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "1.2.0" + }, "type": { "kind": "primitive", "type": "string", @@ -353,12 +489,18 @@ "source": "slug", "publicAliases": [], "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme-api" + }, "type": { "kind": "primitive", "type": "string", "validation": { "pattern": "^[a-z](?:[a-z0-9-]*[a-z0-9])?$", - "minLength": 3, + "minLength": 1, "maxLength": 60 } } @@ -368,12 +510,18 @@ "source": "namespace", "publicAliases": [], "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme" + }, "type": { "kind": "primitive", "type": "string", "validation": { "pattern": "^[a-zA-Z0-9-_]+$", - "minLength": 3, + "minLength": 2, "maxLength": 50 } } @@ -391,6 +539,12 @@ "publicName": "uid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "ref", "name": "nanoid" @@ -401,6 +555,12 @@ "publicName": "createdAt", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": 1735689600000 + }, "type": { "kind": "primitive", "type": "number" @@ -411,6 +571,12 @@ "publicName": "version", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "1.2.0" + }, "type": { "kind": "ref", "name": "version" @@ -421,16 +587,56 @@ "publicName": "upgraded", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": false + }, "type": { "kind": "primitive", "type": "boolean" } }, + { + "name": "endpointCount", + "publicName": "endpointCount", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": 12 + }, + "type": { + "kind": "union", + "variants": [ + { + "kind": "primitive", + "type": "integer", + "validation": { + "minimum": -9007199254740991, + "maximum": 9007199254740991 + } + }, + { + "kind": "null" + } + ] + } + }, { "name": "embedStatus", "publicName": "embedStatus", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "complete" + }, "type": { "kind": "union", "variants": [ @@ -460,6 +666,15 @@ "publicName": "tags", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": [ + "products", + "orders" + ] + }, "type": { "kind": "array", "items": { @@ -483,6 +698,12 @@ "publicName": "path", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "/products" + }, "type": { "kind": "primitive", "type": "string" @@ -532,6 +753,12 @@ "publicName": "yamlSha", "required": false, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789" + }, "type": { "kind": "primitive", "type": "string" @@ -542,16 +769,12 @@ "publicName": "jsonSha", "required": false, "deprecated": false, - "type": { - "kind": "primitive", - "type": "string" - } - }, - { - "name": "versionSha", - "publicName": "versionSha", - "required": false, - "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" + }, "type": { "kind": "primitive", "type": "string" @@ -576,6 +799,7 @@ "patch", "post", "put", + "query", "trace" ], "names": [ @@ -586,6 +810,7 @@ "Patch", "Post", "Put", + "Query", "Trace" ], "deprecations": [ @@ -596,6 +821,7 @@ false, false, false, + false, false ] } @@ -613,6 +839,12 @@ "publicName": "accessGroupSlug", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme-api" + }, "type": { "kind": "ref", "name": "slug" @@ -635,6 +867,12 @@ "publicName": "uid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "ref", "name": "nanoid" @@ -645,6 +883,12 @@ "publicName": "title", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Acme API" + }, "type": { "kind": "primitive", "type": "string", @@ -658,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" @@ -668,6 +918,12 @@ "publicName": "slug", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme-api" + }, "type": { "kind": "ref", "name": "slug" @@ -678,6 +934,12 @@ "publicName": "namespace", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme" + }, "type": { "kind": "ref", "name": "namespace" @@ -688,6 +950,12 @@ "publicName": "isPrivate", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": false + }, "type": { "kind": "primitive", "type": "boolean" @@ -723,6 +991,12 @@ "publicName": "uid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "ref", "name": "nanoid" @@ -733,6 +1007,12 @@ "publicName": "createdAt", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": 1735689600 + }, "type": { "kind": "ref", "name": "timestamp" @@ -743,6 +1023,12 @@ "publicName": "updatedAt", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": 1735689600 + }, "type": { "kind": "ref", "name": "timestamp" @@ -753,10 +1039,54 @@ "publicName": "version", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "1.2.0" + }, "type": { "kind": "ref", "name": "version" } + }, + { + "name": "yamlSha", + "publicName": "yamlSha", + "required": false, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789" + }, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "pattern": "^[a-f0-9]{64}$" + } + } + }, + { + "name": "jsonSha", + "publicName": "jsonSha", + "required": false, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" + }, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "pattern": "^[a-f0-9]{64}$" + } + } } ], "additionalProperties": false @@ -767,6 +1097,12 @@ "source": "timestamp", "publicAliases": [], "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": 1735689600 + }, "type": { "kind": "primitive", "type": "integer", @@ -789,6 +1125,12 @@ "publicName": "uid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "ref", "name": "nanoid" @@ -811,6 +1153,12 @@ "publicName": "logo", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "\"Acme\"" + }, "type": { "kind": "primitive", "type": "string" @@ -821,6 +1169,12 @@ "publicName": "logoSize", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "100" + }, "type": { "kind": "primitive", "type": "string" @@ -831,6 +1185,12 @@ "publicName": "buttonText", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Access documentation" + }, "type": { "kind": "primitive", "type": "string", @@ -844,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", @@ -857,6 +1223,12 @@ "publicName": "title", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Acme API" + }, "type": { "kind": "primitive", "type": "string", @@ -870,6 +1242,12 @@ "publicName": "mainColor", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "#1f2937" + }, "type": { "kind": "primitive", "type": "string", @@ -883,6 +1261,12 @@ "publicName": "mainBackground", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "#f9fafb" + }, "type": { "kind": "primitive", "type": "string", @@ -896,6 +1280,12 @@ "publicName": "cardColor", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "#1f2937" + }, "type": { "kind": "primitive", "type": "string", @@ -909,6 +1299,12 @@ "publicName": "cardBackground", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "#ffffff" + }, "type": { "kind": "primitive", "type": "string", @@ -922,6 +1318,12 @@ "publicName": "buttonColor", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "#ffffff" + }, "type": { "kind": "primitive", "type": "string", @@ -935,6 +1337,12 @@ "publicName": "buttonBackground", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "#2563eb" + }, "type": { "kind": "primitive", "type": "string", @@ -960,6 +1368,12 @@ "publicName": "title", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Acme API" + }, "type": { "kind": "primitive", "type": "string", @@ -973,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", @@ -986,6 +1406,12 @@ "publicName": "head", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "" + }, "type": { "kind": "primitive", "type": "string" @@ -996,6 +1422,12 @@ "publicName": "script", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "document.documentElement.dataset.company = \"acme\";" + }, "type": { "kind": "primitive", "type": "string" @@ -1006,6 +1438,12 @@ "publicName": "theme", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "TakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "primitive", "type": "string" @@ -1016,6 +1454,12 @@ "publicName": "companyName", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Acme" + }, "type": { "kind": "primitive", "type": "string", @@ -1029,6 +1473,12 @@ "publicName": "logo", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "\"Acme\"" + }, "type": { "kind": "primitive", "type": "string" @@ -1039,6 +1489,12 @@ "publicName": "logoURL", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "https://example.com" + }, "type": { "kind": "primitive", "type": "string" @@ -1049,6 +1505,12 @@ "publicName": "favicon", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "https://example.com/favicon.ico" + }, "type": { "kind": "primitive", "type": "string" @@ -1059,6 +1521,12 @@ "publicName": "termsLink", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "https://example.com/terms" + }, "type": { "kind": "primitive", "type": "string" @@ -1069,6 +1537,12 @@ "publicName": "privacyLink", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "https://example.com/privacy" + }, "type": { "kind": "primitive", "type": "string" @@ -1079,6 +1553,12 @@ "publicName": "formTitle", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Sign in to Acme Documentation" + }, "type": { "kind": "primitive", "type": "string", @@ -1092,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", @@ -1105,6 +1591,12 @@ "publicName": "formImage", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "https://example.com/login-banner.png" + }, "type": { "kind": "primitive", "type": "string" @@ -1127,6 +1619,12 @@ "publicName": "uid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "ref", "name": "nanoid" @@ -1137,6 +1635,12 @@ "publicName": "title", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Acme API" + }, "type": { "kind": "primitive", "type": "string", @@ -1150,6 +1654,12 @@ "publicName": "slug", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme-api" + }, "type": { "kind": "ref", "name": "slug" @@ -1159,6 +1669,45 @@ "additionalProperties": false } }, + { + "name": "access_group_name", + "source": "access_group_name", + "publicAliases": [], + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Engineering" + }, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "maxLength": 40 + } + } + }, + { + "name": "email_domain", + "source": "email_domain", + "publicAliases": [], + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "example.com" + }, + "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", @@ -1172,6 +1721,12 @@ "publicName": "uid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "ref", "name": "nanoid" @@ -1182,6 +1737,12 @@ "publicName": "title", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Acme API" + }, "type": { "kind": "primitive", "type": "string", @@ -1195,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" @@ -1205,6 +1772,12 @@ "publicName": "slug", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme-api" + }, "type": { "kind": "ref", "name": "slug" @@ -1215,6 +1788,12 @@ "publicName": "namespace", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme" + }, "type": { "kind": "ref", "name": "namespace" @@ -1225,6 +1804,12 @@ "publicName": "isPrivate", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": false + }, "type": { "kind": "primitive", "type": "boolean" @@ -1247,6 +1832,12 @@ "publicName": "uid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "ref", "name": "nanoid" @@ -1257,6 +1848,12 @@ "publicName": "name", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Acme Theme" + }, "type": { "kind": "primitive", "type": "string" @@ -1267,6 +1864,12 @@ "publicName": "description", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Custom colors for Acme documentation." + }, "type": { "kind": "primitive", "type": "string" @@ -1277,6 +1880,12 @@ "publicName": "slug", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme-theme" + }, "type": { "kind": "ref", "name": "slug" @@ -1299,6 +1908,12 @@ "publicName": "uid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "ref", "name": "nanoid" @@ -1309,6 +1924,12 @@ "publicName": "name", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Acme API" + }, "type": { "kind": "ref", "name": "team_name" @@ -1319,6 +1940,12 @@ "publicName": "imageUri", "required": false, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "https://example.com/alex.png" + }, "type": { "kind": "ref", "name": "team_image" @@ -1329,6 +1956,12 @@ "publicName": "slug", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme-api" + }, "type": { "kind": "ref", "name": "slug" @@ -1339,6 +1972,12 @@ "publicName": "theme", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "default" + }, "type": { "kind": "primitive", "type": "string" @@ -1353,6 +1992,12 @@ "source": "team_name", "publicAliases": [], "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Acme" + }, "type": { "kind": "primitive", "type": "string" @@ -1363,11 +2008,204 @@ "source": "team_image", "publicAliases": [], "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "https://example.com/logo.svg" + }, "type": { "kind": "primitive", "type": "string" } }, + { + "name": "team_member", + "source": "team_member", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "uid", + "publicName": "uid", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, + "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, + "extensions": { + "source": [ + "examples" + ], + "examples": "Alex Morgan" + }, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "imageUri", + "publicName": "imageUri", + "required": false, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "https://example.com/alex.png" + }, + "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, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, + "type": { + "kind": "ref", + "name": "nanoid" + } + }, + { + "name": "email", + "publicName": "email", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "alex@example.com" + }, + "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, + "extensions": { + "source": [ + "examples" + ], + "examples": 1735776000 + }, + "type": { + "kind": "primitive", + "type": "number" + } + } + ], + "additionalProperties": false + } + }, + { + "name": "email", + "source": "email", + "publicAliases": [], + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "alex@example.com" + }, + "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", @@ -1381,6 +2219,12 @@ "publicName": "uid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "ref", "name": "nanoid" @@ -1391,6 +2235,12 @@ "publicName": "createdAt", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": 1735689600 + }, "type": { "kind": "ref", "name": "timestamp" @@ -1401,6 +2251,12 @@ "publicName": "updatedAt", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": 1735689600 + }, "type": { "kind": "ref", "name": "timestamp" @@ -1411,6 +2267,12 @@ "publicName": "name", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Acme Documentation" + }, "type": { "kind": "primitive", "type": "string" @@ -1439,6 +2301,12 @@ "publicName": "lastPublished", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": 1735689600 + }, "type": { "kind": "union", "variants": [ @@ -1457,6 +2325,12 @@ "publicName": "lastPublishedUid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "PakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "union", "variants": [ @@ -1475,6 +2349,28 @@ "publicName": "loginPortalUid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "LakgbKJ5m9gl0JDMbcJqL" + }, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "userInfoHookUrl", + "publicName": "userInfoHookUrl", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "https://example.com/hooks/user-info" + }, "type": { "kind": "primitive", "type": "string" @@ -1485,6 +2381,12 @@ "publicName": "activeThemeId", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "TakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "primitive", "type": "string" @@ -1495,6 +2397,12 @@ "publicName": "typesenseId", "required": false, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": 42 + }, "type": { "kind": "primitive", "type": "number" @@ -1505,6 +2413,12 @@ "publicName": "isPrivate", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": false + }, "type": { "kind": "primitive", "type": "boolean" @@ -1515,6 +2429,28 @@ "publicName": "agentEnabled", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": true + }, + "type": { + "kind": "primitive", + "type": "boolean" + } + }, + { + "name": "analyticsEnabled", + "publicName": "analyticsEnabled", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": true + }, "type": { "kind": "primitive", "type": "boolean" @@ -1525,8 +2461,17 @@ "publicName": "accessGroups", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": [ + "UakgbKJ5m9gl0JDMbcJqL" + ] + }, "type": { - "kind": "unknown" + "kind": "primitive", + "type": "string" } }, { @@ -1534,6 +2479,12 @@ "publicName": "slug", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme-api" + }, "type": { "kind": "ref", "name": "slug" @@ -1544,6 +2495,12 @@ "publicName": "publishStatus", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "published" + }, "type": { "kind": "primitive", "type": "string" @@ -1554,6 +2511,12 @@ "publicName": "publishMessage", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Documentation published successfully." + }, "type": { "kind": "primitive", "type": "string" @@ -1594,6 +2557,12 @@ "publicName": "uid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "primitive", "type": "string" @@ -1604,6 +2573,12 @@ "publicName": "domain", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "docs.example.com" + }, "type": { "kind": "primitive", "type": "string" @@ -1614,6 +2589,12 @@ "publicName": "publishedAt", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": 1735689600 + }, "type": { "kind": "ref", "name": "timestamp" @@ -1636,6 +2617,12 @@ "publicName": "linkedBy", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "primitive", "type": "string" @@ -1646,6 +2633,12 @@ "publicName": "id", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": 123456789 + }, "type": { "kind": "primitive", "type": "number" @@ -1656,6 +2649,12 @@ "publicName": "name", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Acme Documentation" + }, "type": { "kind": "primitive", "type": "string", @@ -1669,6 +2668,12 @@ "publicName": "configPath", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "scalar.config.json" + }, "type": { "kind": "primitive", "type": "string" @@ -1679,6 +2684,12 @@ "publicName": "branch", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "main" + }, "type": { "kind": "primitive", "type": "string" @@ -1689,6 +2700,12 @@ "publicName": "publishOnMerge", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": true + }, "type": { "kind": "primitive", "type": "boolean" @@ -1699,6 +2716,12 @@ "publicName": "publishPreviews", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": true + }, "type": { "kind": "primitive", "type": "boolean" @@ -1709,6 +2732,12 @@ "publicName": "prComments", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": true + }, "type": { "kind": "primitive", "type": "boolean" @@ -1719,6 +2748,12 @@ "publicName": "expired", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": false + }, "type": { "kind": "primitive", "type": "boolean" @@ -1728,20 +2763,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", @@ -1755,6 +2776,12 @@ "publicName": "uid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "ref", "name": "nanoid" @@ -1765,6 +2792,12 @@ "publicName": "name", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Acme API" + }, "type": { "kind": "ref", "name": "team_name" @@ -1775,6 +2808,12 @@ "publicName": "imageUri", "required": false, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "https://example.com/alex.png" + }, "type": { "kind": "ref", "name": "team_image" @@ -1797,6 +2836,12 @@ "publicName": "uid", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "ref", "name": "nanoid" @@ -1807,6 +2852,12 @@ "publicName": "createdAt", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": 1735689600 + }, "type": { "kind": "ref", "name": "timestamp" @@ -1817,6 +2868,12 @@ "publicName": "updatedAt", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": 1735689600 + }, "type": { "kind": "ref", "name": "timestamp" @@ -1827,6 +2884,12 @@ "publicName": "email", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "alex@example.com" + }, "type": { "kind": "ref", "name": "email" @@ -1837,6 +2900,12 @@ "publicName": "theme", "required": false, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "default" + }, "type": { "kind": "primitive", "type": "string" @@ -1847,6 +2916,12 @@ "publicName": "activeTeamId", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "GakgbKJ5m9gl0JDMbcJqL" + }, "type": { "kind": "union", "variants": [ @@ -1865,6 +2940,12 @@ "publicName": "hasGithub", "required": true, "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": true + }, "type": { "kind": "primitive", "type": "boolean" @@ -1886,43 +2967,8970 @@ ], "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": [ + }, + { + "name": "sdk", + "source": "sdk", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "uid", + "publicName": "uid", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, + "type": { + "kind": "ref", + "name": "nanoid" + } + }, + { + "name": "title", + "publicName": "title", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Acme API" + }, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "maxLength": 100 + } + } + }, + { + "name": "slug", + "publicName": "slug", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme-api" + }, + "type": { + "kind": "ref", + "name": "slug" + } + }, + { + "name": "namespace", + "publicName": "namespace", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme" + }, + "type": { + "kind": "ref", + "name": "namespace" + } + }, + { + "name": "description", + "publicName": "description", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "API for managing Acme products and orders." + }, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "isPrivate", + "publicName": "isPrivate", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": false + }, + "type": { + "kind": "primitive", + "type": "boolean" + } + }, + { + "name": "apiUid", + "publicName": "apiUid", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, + "type": { + "kind": "union", + "variants": [ + { + "kind": "ref", + "name": "nanoid" + }, + { + "kind": "null" + } + ] + } + }, + { + "name": "apiVersion", + "publicName": "apiVersion", + "required": false, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "1.2.0" + }, + "type": { + "kind": "union", + "variants": [ + { + "kind": "ref", + "name": "version" + }, + { + "kind": "null" + } + ] + } + }, + { + "name": "currentVersion", + "publicName": "currentVersion", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "1.2.0" + }, + "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, + "extensions": { + "source": [ + "examples" + ], + "examples": "typescript" + }, + "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, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme-sdk" + }, + "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, + "extensions": { + "source": [ + "examples" + ], + "examples": "1.2.0" + }, + "type": { + "kind": "ref", + "name": "version" + } + }, + { + "name": "apiVersion", + "publicName": "apiVersion", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "1.2.0" + }, + "type": { + "kind": "ref", + "name": "version" + } + }, + { + "name": "status", + "publicName": "status", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "published" + }, + "type": { + "kind": "enum", + "values": [ + "draft", + "published" + ], + "names": [ + "Draft", + "Published" + ], + "deprecations": [ + false, + false + ] + } + }, + { + "name": "languages", + "publicName": "languages", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": [ + "typescript" + ] + }, + "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, + "extensions": { + "source": [ + "examples" + ], + "examples": 1735689600 + }, + "type": { + "kind": "ref", + "name": "timestamp" + } + }, + { + "name": "createdAt", + "publicName": "createdAt", + "required": false, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": 1735689600 + }, + "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, + "extensions": { + "source": [ + "examples" + ], + "examples": "UakgbKJ5m9gl0JDMbcJqL" + }, + "type": { + "kind": "ref", + "name": "nanoid" + } + }, + { + "name": "name", + "publicName": "name", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Acme Documentation" + }, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "slug", + "publicName": "slug", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme-api" + }, + "type": { + "kind": "ref", + "name": "slug" + } + }, + { + "name": "isPrivate", + "publicName": "isPrivate", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": false + }, + "type": { + "kind": "primitive", + "type": "boolean" + } + }, + { + "name": "accessGroups", + "publicName": "accessGroups", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": [ + "UakgbKJ5m9gl0JDMbcJqL" + ] + }, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "loginPortalUid", + "publicName": "loginPortalUid", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "LakgbKJ5m9gl0JDMbcJqL" + }, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "activeThemeId", + "publicName": "activeThemeId", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "TakgbKJ5m9gl0JDMbcJqL" + }, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "agentEnabled", + "publicName": "agentEnabled", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": true + }, + "type": { + "kind": "primitive", + "type": "boolean" + } + }, + { + "name": "analyticsEnabled", + "publicName": "analyticsEnabled", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": true + }, + "type": { + "kind": "primitive", + "type": "boolean" + } + }, + { + "name": "lastPublished", + "publicName": "lastPublished", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": 1735689600 + }, + "type": { + "kind": "union", + "variants": [ + { + "kind": "ref", + "name": "timestamp" + }, + { + "kind": "null" + } + ] + } + }, + { + "name": "publishStatus", + "publicName": "publishStatus", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "published" + }, + "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, + "extensions": { + "source": [ + "examples" + ], + "examples": "42" + }, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "name", + "publicName": "name", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Acme API" + }, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "slug", + "publicName": "slug", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme-api" + }, + "type": { + "kind": "ref", + "name": "slug" + } + }, + { + "name": "autoAddOperations", + "publicName": "autoAddOperations", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": true + }, + "type": { + "kind": "primitive", + "type": "boolean" + } + }, + { + "name": "createdAt", + "publicName": "createdAt", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "2025-01-01T00:00:00.000Z" + }, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "updatedAt", + "publicName": "updatedAt", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "2025-01-01T00:00:00.000Z" + }, + "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, + "extensions": { + "source": [ + "examples" + ], + "examples": "42" + }, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "mcpServerId", + "publicName": "mcpServerId", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "42" + }, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "name", + "publicName": "name", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Acme API" + }, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "slug", + "publicName": "slug", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme-api" + }, + "type": { + "kind": "ref", + "name": "slug" + } + }, + { + "name": "isPrivate", + "publicName": "isPrivate", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": false + }, + "type": { + "kind": "primitive", + "type": "boolean" + } + }, + { + "name": "accessGroups", + "publicName": "accessGroups", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": [ + "UakgbKJ5m9gl0JDMbcJqL" + ] + }, + "type": { + "kind": "array", + "items": { + "kind": "primitive", + "type": "string" + } + } + }, + { + "name": "loginPortalUid", + "publicName": "loginPortalUid", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "LakgbKJ5m9gl0JDMbcJqL" + }, + "type": { + "kind": "union", + "variants": [ + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "null" + } + ] + } + }, + { + "name": "mcpVersion", + "publicName": "mcpVersion", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "1.2.0" + }, + "type": { + "kind": "union", + "variants": [ + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "null" + } + ] + } + }, + { + "name": "piiRedactionEnabled", + "publicName": "piiRedactionEnabled", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": true + }, + "type": { + "kind": "primitive", + "type": "boolean" + } + }, + { + "name": "credentialRedactionEnabled", + "publicName": "credentialRedactionEnabled", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": true + }, + "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, + "extensions": { + "source": [ + "examples" + ], + "examples": "42" + }, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "name", + "publicName": "name", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "Acme API" + }, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "slug", + "publicName": "slug", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "acme-api" + }, + "type": { + "kind": "ref", + "name": "slug" + } + }, + { + "name": "isPrivate", + "publicName": "isPrivate", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": false + }, + "type": { + "kind": "primitive", + "type": "boolean" + } + }, + { + "name": "mcpVersion", + "publicName": "mcpVersion", + "required": true, + "deprecated": false, + "extensions": { + "source": [ + "examples" + ], + "examples": "1.2.0" + }, + "type": { + "kind": "union", + "variants": [ + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "null" + } + ] + } + } + ], + "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" + ], + "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": "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": "registry", - "publicResource": "registry", - "operation": "listAllApiDocuments", - "publicOperation": "listAllApiDocuments", + "resource": "teams", + "publicResource": "teams", + "operation": "list", + "publicOperation": "list", "deprecated": false, "method": "GET", - "path": "/v1/apis", + "path": "/v1/teams", "pathParams": [], "publicPathParams": [], "queryParams": [], @@ -2056,19 +12064,15 @@ "transport": "http" }, { - "resource": "registry", - "publicResource": "registry", - "operation": "listApiDocuments", - "publicOperation": "listApiDocuments", + "resource": "teams.members", + "publicResource": "teams.members", + "operation": "list", + "publicOperation": "list", "deprecated": false, "method": "GET", - "path": "/v1/apis/{namespace}", - "pathParams": [ - "namespace" - ], - "publicPathParams": [ - "namespace" - ], + "path": "/v1/teams/members", + "pathParams": [], + "publicPathParams": [], "queryParams": [], "publicQueryParams": [], "headerParams": [], @@ -2076,22 +12080,12 @@ "bodyParams": [], "publicBodyParams": [], "bodyParamDetails": [], - "pathParamDetails": [ - { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false - } - ], + "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], - "paramsModel": { - "publicName": "RegistryListApiDocumentsParams" - }, "response": { "status": "200", "contentType": "application/json", @@ -2210,74 +12204,38 @@ "transport": "http" }, { - "resource": "registry", - "publicResource": "registry", - "operation": "createApiDocument", - "publicOperation": "createApiDocument", + "resource": "teams.members", + "publicResource": "teams.members", + "operation": "update", + "publicOperation": "update", "deprecated": false, - "method": "POST", - "path": "/v1/apis/{namespace}", + "method": "PATCH", + "path": "/v1/teams/members/{uid}", "pathParams": [ - "namespace" + "uid" ], "publicPathParams": [ - "namespace" + "uid" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], "bodyParams": [ - "title", - "description", - "version", - "slug", - "ruleset", - "isPrivate", - "document" + "role" ], "publicBodyParams": [ - "title", - "description", - "version", - "slug", - "ruleset", - "isPrivate", - "document" + "role" ], "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", + "name": "role", "required": true } ], "pathParamDetails": [ { - "name": "namespace", + "name": "uid", "required": true, "style": "simple", "explode": false @@ -2289,7 +12247,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RegistryCreateApiDocumentParams" + "publicName": "MemberUpdateParams" }, "requestBody": { "contentType": "application/json", @@ -2422,64 +12380,29 @@ "transport": "http" }, { - "resource": "registry", - "publicResource": "registry", - "operation": "updateApiDocument", - "publicOperation": "updateApiDocument", + "resource": "teams.members", + "publicResource": "teams.members", + "operation": "delete", + "publicOperation": "delete", "deprecated": false, - "method": "PATCH", - "path": "/v1/apis/{namespace}/{slug}", + "method": "DELETE", + "path": "/v1/teams/members/{uid}", "pathParams": [ - "namespace", - "slug" + "uid" ], "publicPathParams": [ - "namespace", - "slug" + "uid" ], "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 - } - ], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], "pathParamDetails": [ { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false - }, - { - "name": "slug", + "name": "uid", "required": true, "style": "simple", "explode": false @@ -2491,20 +12414,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RegistryUpdateApiDocumentParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "MemberDeleteParams" }, "response": { "status": "200", @@ -2624,49 +12534,58 @@ "transport": "http" }, { - "resource": "registry", - "publicResource": "registry", - "operation": "deleteApiDocument", - "publicOperation": "deleteApiDocument", + "resource": "teams.invites", + "publicResource": "teams.invites", + "operation": "member", + "publicOperation": "member", "deprecated": false, - "method": "DELETE", - "path": "/v1/apis/{namespace}/{slug}", - "pathParams": [ - "namespace", - "slug" - ], - "publicPathParams": [ - "namespace", - "slug" - ], + "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": "slug", - "required": true, - "style": "simple", - "explode": false + "name": "role", + "required": true } ], + "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RegistryDeleteApiDocumentParams" + "publicName": "InviteMemberParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" }, "response": { "status": "200", @@ -2786,22 +12705,18 @@ "transport": "http" }, { - "resource": "registry", - "publicResource": "registry", - "operation": "retrieveApiDocumentVersion", - "publicOperation": "retrieveApiDocumentVersion", + "resource": "teams.invites", + "publicResource": "teams.invites", + "operation": "resend", + "publicOperation": "resend", "deprecated": false, - "method": "GET", - "path": "/v1/apis/{namespace}/{slug}/version/{semver}", + "method": "PATCH", + "path": "/v1/teams/invites/{uid}", "pathParams": [ - "namespace", - "slug", - "semver" + "uid" ], "publicPathParams": [ - "namespace", - "slug", - "semver" + "uid" ], "queryParams": [], "publicQueryParams": [], @@ -2812,19 +12727,7 @@ "bodyParamDetails": [], "pathParamDetails": [ { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false - }, - { - "name": "slug", - "required": true, - "style": "simple", - "explode": false - }, - { - "name": "semver", + "name": "uid", "required": true, "style": "simple", "explode": false @@ -2836,16 +12739,16 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RegistryRetrieveApiDocumentVersionParams" + "publicName": "InviteResendParams" }, "response": { "status": "200", - "contentType": "text/plain", - "encoding": "text", + "contentType": "application/json", + "encoding": "json", "contents": [ { - "contentType": "text/plain", - "encoding": "text" + "contentType": "application/json", + "encoding": "json" } ] }, @@ -2956,60 +12859,29 @@ "transport": "http" }, { - "resource": "registry", - "publicResource": "registry", - "operation": "updateApiDocumentVersion", - "publicOperation": "updateApiDocumentVersion", + "resource": "teams.invites", + "publicResource": "teams.invites", + "operation": "cancel", + "publicOperation": "cancel", "deprecated": false, - "method": "PATCH", - "path": "/v1/apis/{namespace}/{slug}/version/{semver}", + "method": "DELETE", + "path": "/v1/teams/invites/{uid}", "pathParams": [ - "namespace", - "slug", - "semver" + "uid" ], "publicPathParams": [ - "namespace", - "slug", - "semver" + "uid" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "document", - "lastKnownVersionSha" - ], - "publicBodyParams": [ - "document", - "lastKnownVersionSha" - ], - "bodyParamDetails": [ - { - "name": "document", - "required": true - }, - { - "name": "lastKnownVersionSha", - "required": false - } - ], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], "pathParamDetails": [ { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false - }, - { - "name": "slug", - "required": true, - "style": "simple", - "explode": false - }, - { - "name": "semver", + "name": "uid", "required": true, "style": "simple", "explode": false @@ -3021,20 +12893,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RegistryUpdateApiDocumentVersionParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "InviteCancelParams" }, "response": { "status": "200", @@ -3154,23 +13013,15 @@ "transport": "http" }, { - "resource": "registry", - "publicResource": "registry", - "operation": "deleteApiDocumentVersion", - "publicOperation": "deleteApiDocumentVersion", + "resource": "scalarDocs", + "publicResource": "scalarDocs", + "operation": "listGuides", + "publicOperation": "listGuides", "deprecated": false, - "method": "DELETE", - "path": "/v1/apis/{namespace}/{slug}/version/{semver}", - "pathParams": [ - "namespace", - "slug", - "semver" - ], - "publicPathParams": [ - "namespace", - "slug", - "semver" - ], + "method": "GET", + "path": "/v1/guides", + "pathParams": [], + "publicPathParams": [], "queryParams": [], "publicQueryParams": [], "headerParams": [], @@ -3178,34 +13029,12 @@ "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": "RegistryDeleteApiDocumentVersionParams" - }, "response": { "status": "200", "contentType": "application/json", @@ -3324,57 +13153,76 @@ "transport": "http" }, { - "resource": "registry", - "publicResource": "registry", - "operation": "listApiDocumentVersionMetadata", - "publicOperation": "listApiDocumentVersionMetadata", + "resource": "scalarDocs", + "publicResource": "scalarDocs", + "operation": "createGuide", + "publicOperation": "createGuide", "deprecated": false, - "method": "GET", - "path": "/v1/apis/{namespace}/{slug}/version/{semver}/metadata", - "pathParams": [ - "namespace", - "slug", - "semver" - ], - "publicPathParams": [ - "namespace", - "slug", - "semver" - ], + "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": "semver", - "required": true, - "style": "simple", - "explode": false + "name": "isPrivate", + "required": true + }, + { + "name": "allowedUsers", + "required": true + }, + { + "name": "allowedDomains", + "required": true } ], + "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RegistryListApiDocumentVersionMetadataParams" + "publicName": "ScalarDocCreateGuideParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" }, "response": { "status": "200", @@ -3387,10 +13235,6 @@ } ] }, - "responseModel": { - "name": "managed_doc_version", - "publicAliases": [] - }, "result": { "successStatus": "200", "errorStatuses": [ @@ -3498,89 +13342,41 @@ "transport": "http" }, { - "resource": "registry", - "publicResource": "registry", - "operation": "createApiDocumentVersion", - "publicOperation": "createApiDocumentVersion", + "resource": "scalarDocs", + "publicResource": "scalarDocs", + "operation": "publishGuide", + "publicOperation": "publishGuide", "deprecated": false, "method": "POST", - "path": "/v1/apis/{namespace}/{slug}/version", + "path": "/v1/guides/{slug}/publish", "pathParams": [ - "namespace", "slug" ], "publicPathParams": [ - "namespace", "slug" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "version", - "document", - "force", - "lastKnownVersionSha" - ], - "publicBodyParams": [ - "version", - "document", - "force", - "lastKnownVersionSha" - ], - "bodyParamDetails": [ - { - "name": "version", - "required": true - }, - { - "name": "document", - "required": true - }, - { - "name": "force", - "required": false - }, - { - "name": "lastKnownVersionSha", - "required": false - } - ], + "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": "RegistryCreateApiDocumentVersionParams" - }, - "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": "ScalarDocPublishGuideParams" }, "response": { "status": "200", @@ -3593,10 +13389,6 @@ } ] }, - "responseModel": { - "name": "managed_doc_version", - "publicAliases": [] - }, "result": { "successStatus": "200", "errorStatuses": [ @@ -3704,71 +13496,41 @@ "transport": "http" }, { - "resource": "registry", - "publicResource": "registry", - "operation": "createApiDocumentAccessGroup", - "publicOperation": "createApiDocumentAccessGroup", + "resource": "scalarDocs", + "publicResource": "scalarDocs", + "operation": "listProjects", + "publicOperation": "listProjects", "deprecated": false, - "method": "POST", - "path": "/v1/apis/{namespace}/{slug}/access-group", - "pathParams": [ - "namespace", - "slug" + "method": "GET", + "path": "/v1/docs", + "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": "RegistryCreateApiDocumentAccessGroupParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "ScalarDocListProjectsParams" }, "response": { "status": "200", @@ -3888,58 +13650,75 @@ "transport": "http" }, { - "resource": "registry", - "publicResource": "registry", - "operation": "deleteApiDocumentAccessGroup", - "publicOperation": "deleteApiDocumentAccessGroup", + "resource": "scalarDocs", + "publicResource": "scalarDocs", + "operation": "createProject", + "publicOperation": "createProject", "deprecated": false, - "method": "DELETE", - "path": "/v1/apis/{namespace}/{slug}/access-group", - "pathParams": [ - "namespace", - "slug" - ], - "publicPathParams": [ - "namespace", - "slug" - ], + "method": "POST", + "path": "/v1/docs", + "pathParams": [], + "publicPathParams": [], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], "bodyParams": [ - "accessGroupSlug" + "name", + "slug", + "isPrivate", + "blank", + "provider", + "githubRepository", + "bitbucketRepository" ], "publicBodyParams": [ - "accessGroupSlug" + "name", + "slug", + "isPrivate", + "blank", + "provider", + "githubRepository", + "bitbucketRepository" ], "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": "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": "RegistryDeleteApiDocumentAccessGroupParams" + "publicName": "ScalarDocCreateProjectParams" }, "requestBody": { "contentType": "application/json", @@ -3965,6 +13744,10 @@ } ] }, + "responseModel": { + "name": "docs_project", + "publicAliases": [] + }, "result": { "successStatus": "200", "errorStatuses": [ @@ -4072,18 +13855,18 @@ "transport": "http" }, { - "resource": "schemas", - "publicResource": "schemas", - "operation": "list", - "publicOperation": "list", + "resource": "scalarDocs", + "publicResource": "scalarDocs", + "operation": "retrieveProject", + "publicOperation": "retrieveProject", "deprecated": false, "method": "GET", - "path": "/v1/schemas/{namespace}", + "path": "/v1/docs/{slug}", "pathParams": [ - "namespace" + "slug" ], "publicPathParams": [ - "namespace" + "slug" ], "queryParams": [], "publicQueryParams": [], @@ -4094,7 +13877,7 @@ "bodyParamDetails": [], "pathParamDetails": [ { - "name": "namespace", + "name": "slug", "required": true, "style": "simple", "explode": false @@ -4106,7 +13889,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "SchemaListParams" + "publicName": "ScalarDocRetrieveProjectParams" }, "response": { "status": "200", @@ -4119,6 +13902,10 @@ } ] }, + "responseModel": { + "name": "docs_project", + "publicAliases": [] + }, "result": { "successStatus": "200", "errorStatuses": [ @@ -4226,68 +14013,74 @@ "transport": "http" }, { - "resource": "schemas", - "publicResource": "schemas", - "operation": "create", - "publicOperation": "create", + "resource": "scalarDocs", + "publicResource": "scalarDocs", + "operation": "updateProject", + "publicOperation": "updateProject", "deprecated": false, - "method": "POST", - "path": "/v1/schemas/{namespace}", + "method": "PATCH", + "path": "/v1/docs/{slug}", "pathParams": [ - "namespace" + "slug" ], "publicPathParams": [ - "namespace" + "slug" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], "bodyParams": [ - "title", - "description", - "version", - "slug", + "name", "isPrivate", - "document" + "accessGroups", + "loginPortalUid", + "activeThemeId", + "agentEnabled", + "analyticsEnabled" ], "publicBodyParams": [ - "title", - "description", - "version", - "slug", + "name", "isPrivate", - "document" + "accessGroups", + "loginPortalUid", + "activeThemeId", + "agentEnabled", + "analyticsEnabled" ], "bodyParamDetails": [ { - "name": "title", - "required": true + "name": "name", + "required": false }, { - "name": "description", + "name": "isPrivate", "required": false }, { - "name": "version", - "required": true + "name": "accessGroups", + "required": false }, { - "name": "slug", - "required": true + "name": "loginPortalUid", + "required": false }, { - "name": "isPrivate", + "name": "activeThemeId", "required": false }, { - "name": "document", - "required": true + "name": "agentEnabled", + "required": false + }, + { + "name": "analyticsEnabled", + "required": false } ], "pathParamDetails": [ { - "name": "namespace", + "name": "slug", "required": true, "style": "simple", "explode": false @@ -4299,7 +14092,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "SchemaCreateParams" + "publicName": "ScalarDocUpdateProjectParams" }, "requestBody": { "contentType": "application/json", @@ -4325,10 +14118,6 @@ } ] }, - "responseModel": { - "name": "uid", - "publicAliases": [] - }, "result": { "successStatus": "200", "errorStatuses": [ @@ -4432,60 +14221,31 @@ } } ], - "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 - } - ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "scalarDocs", + "publicResource": "scalarDocs", + "operation": "deleteProject", + "publicOperation": "deleteProject", + "deprecated": false, + "method": "DELETE", + "path": "/v1/docs/{slug}", + "pathParams": [ + "slug" + ], + "publicPathParams": [ + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], "pathParamDetails": [ - { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false - }, { "name": "slug", "required": true, @@ -4499,20 +14259,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": "ScalarDocDeleteProjectParams" }, "response": { "status": "200", @@ -4632,35 +14379,48 @@ "transport": "http" }, { - "resource": "schemas", - "publicResource": "schemas", - "operation": "delete", - "publicOperation": "delete", + "resource": "scalarDocs", + "publicResource": "scalarDocs", + "operation": "publishProject", + "publicOperation": "publishProject", "deprecated": false, - "method": "DELETE", - "path": "/v1/schemas/{namespace}/{slug}", + "method": "POST", + "path": "/v1/docs/{slug}/publish", "pathParams": [ - "namespace", "slug" ], "publicPathParams": [ - "namespace", "slug" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], - "pathParamDetails": [ + "bodyParams": [ + "commitSha", + "preview", + "configPath" + ], + "publicBodyParams": [ + "commitSha", + "preview", + "configPath" + ], + "bodyParamDetails": [ { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false + "name": "commitSha", + "required": false + }, + { + "name": "preview", + "required": false }, + { + "name": "configPath", + "required": false + } + ], + "pathParamDetails": [ { "name": "slug", "required": true, @@ -4674,7 +14434,20 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "SchemaDeleteParams" + "publicName": "ScalarDocPublishProjectParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" }, "response": { "status": "200", @@ -4794,66 +14567,61 @@ "transport": "http" }, { - "resource": "schemas.version", - "publicResource": "schemas.version", - "operation": "retrieve", - "publicOperation": "retrieve", + "resource": "scalarDocs", + "publicResource": "scalarDocs", + "operation": "listProjectConfig", + "publicOperation": "listProjectConfig", "deprecated": false, "method": "GET", - "path": "/v1/schemas/{namespace}/{slug}/version/{semver}", + "path": "/v1/docs/{slug}/config", "pathParams": [ - "namespace", - "slug", - "semver" + "slug" ], "publicPathParams": [ - "namespace", - "slug", - "semver" + "slug" + ], + "queryParams": [ + "ref" + ], + "publicQueryParams": [ + "ref" ], - "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": [ { - "name": "semver", - "required": true, - "style": "simple", - "explode": false + "name": "ref", + "required": false, + "style": "form", + "explode": true } ], - "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "VersionRetrieveParams" + "publicName": "ScalarDocListProjectConfigParams" }, "response": { "status": "200", - "contentType": "text/plain", - "encoding": "text", + "contentType": "application/json", + "encoding": "json", "contents": [ { - "contentType": "text/plain", - "encoding": "text" + "contentType": "application/json", + "encoding": "json" } ] }, @@ -4964,45 +14732,62 @@ "transport": "http" }, { - "resource": "schemas.version", - "publicResource": "schemas.version", - "operation": "delete", - "publicOperation": "delete", + "resource": "scalarDocs", + "publicResource": "scalarDocs", + "operation": "updateProjectConfig", + "publicOperation": "updateProjectConfig", "deprecated": false, - "method": "DELETE", - "path": "/v1/schemas/{namespace}/{slug}/version/{semver}", + "method": "PUT", + "path": "/v1/docs/{slug}/config", "pathParams": [ - "namespace", - "slug", - "semver" + "slug" ], "publicPathParams": [ - "namespace", - "slug", - "semver" + "slug" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], - "pathParamDetails": [ + "bodyParams": [ + "content", + "ref", + "baseToken", + "message", + "path" + ], + "publicBodyParams": [ + "content", + "ref", + "baseToken", + "message", + "path" + ], + "bodyParamDetails": [ { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false + "name": "content", + "required": true }, { - "name": "slug", - "required": true, - "style": "simple", - "explode": false + "name": "ref", + "required": false }, { - "name": "semver", + "name": "baseToken", + "required": false + }, + { + "name": "message", + "required": false + }, + { + "name": "path", + "required": false + } + ], + "pathParamDetails": [ + { + "name": "slug", "required": true, "style": "simple", "explode": false @@ -5014,7 +14799,20 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "VersionDeleteParams" + "publicName": "ScalarDocUpdateProjectConfigParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" }, "response": { "status": "200", @@ -5134,77 +14932,41 @@ "transport": "http" }, { - "resource": "schemas.version", - "publicResource": "schemas.version", - "operation": "create", - "publicOperation": "create", + "resource": "scalarDocs", + "publicResource": "scalarDocs", + "operation": "listProjectDomain", + "publicOperation": "listProjectDomain", "deprecated": false, - "method": "POST", - "path": "/v1/schemas/{namespace}/{slug}/version", + "method": "GET", + "path": "/v1/docs/{slug}/domain", "pathParams": [ - "namespace", "slug" ], "publicPathParams": [ - "namespace", "slug" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "version", - "document" - ], - "publicBodyParams": [ - "version", - "document" - ], - "bodyParamDetails": [ - { - "name": "version", - "required": true - }, - { - "name": "document", - "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": "VersionCreateParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "ScalarDocListProjectDomainParams" }, "response": { "status": "200", @@ -5217,10 +14979,6 @@ } ] }, - "responseModel": { - "name": "uid", - "publicAliases": [] - }, "result": { "successStatus": "200", "errorStatuses": [ @@ -5328,44 +15086,27 @@ "transport": "http" }, { - "resource": "schemas.accessGroup", - "publicResource": "schemas.accessGroup", - "operation": "create", - "publicOperation": "create", + "resource": "scalarDocs", + "publicResource": "scalarDocs", + "operation": "listProjectDomainStatus", + "publicOperation": "listProjectDomainStatus", "deprecated": false, - "method": "POST", - "path": "/v1/schemas/{namespace}/{slug}/access-group", + "method": "GET", + "path": "/v1/docs/{slug}/domain/status", "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, @@ -5379,20 +15120,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "AccessGroupCreateParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "ScalarDocListProjectDomainStatusParams" }, "response": { "status": "200", @@ -5512,72 +15240,28 @@ "transport": "http" }, { - "resource": "schemas.accessGroup", - "publicResource": "schemas.accessGroup", - "operation": "delete", - "publicOperation": "delete", + "resource": "namespaces", + "publicResource": "namespaces", + "operation": "list", + "publicOperation": "list", "deprecated": false, - "method": "DELETE", - "path": "/v1/schemas/{namespace}/{slug}/access-group", - "pathParams": [ - "namespace", - "slug" - ], - "publicPathParams": [ - "namespace", - "slug" - ], + "method": "GET", + "path": "/v1/namespaces", + "pathParams": [], + "publicPathParams": [], "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 - } - ], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [], "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", @@ -5696,41 +15380,52 @@ "transport": "http" }, { - "resource": "loginPortals", - "publicResource": "loginPortals", - "operation": "retrieve", - "publicOperation": "retrieve", + "resource": "authentication", + "publicResource": "authentication", + "operation": "exchangePersonalToken", + "publicOperation": "exchangePersonalToken", "deprecated": false, - "method": "GET", - "path": "/v1/login-portals/{slug}", - "pathParams": [ - "slug" - ], - "publicPathParams": [ - "slug" - ], + "method": "POST", + "path": "/v1/auth/exchange", + "pathParams": [], + "publicPathParams": [], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], - "pathParamDetails": [ + "bodyParams": [ + "personalToken" + ], + "publicBodyParams": [ + "personalToken" + ], + "bodyParamDetails": [ { - "name": "slug", - "required": true, - "style": "simple", - "explode": false + "name": "personalToken", + "required": true } ], + "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "LoginPortalRetrieveParams" + "publicName": "AuthenticationExchangePersonalTokenParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" }, "response": { "status": "200", @@ -5850,64 +15545,28 @@ "transport": "http" }, { - "resource": "loginPortals", - "publicResource": "loginPortals", - "operation": "update", - "publicOperation": "update", + "resource": "authentication", + "publicResource": "authentication", + "operation": "listCurrentUser", + "publicOperation": "listCurrentUser", "deprecated": false, - "method": "PATCH", - "path": "/v1/login-portals/{slug}", - "pathParams": [ - "slug" - ], - "publicPathParams": [ - "slug" - ], + "method": "GET", + "path": "/v1/auth/me", + "pathParams": [], + "publicPathParams": [], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "title" - ], - "publicBodyParams": [ - "title" - ], - "bodyParamDetails": [ - { - "name": "title", - "required": false - } - ], - "pathParamDetails": [ - { - "name": "slug", - "required": true, - "style": "simple", - "explode": false - } - ], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [], "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", @@ -5919,6 +15578,10 @@ } ] }, + "responseModel": { + "name": "user", + "publicAliases": [] + }, "result": { "successStatus": "200", "errorStatuses": [ @@ -6026,41 +15689,41 @@ "transport": "http" }, { - "resource": "loginPortals", - "publicResource": "loginPortals", - "operation": "delete", - "publicOperation": "delete", + "resource": "sdks", + "publicResource": "sdks", + "operation": "list", + "publicOperation": "list", "deprecated": false, - "method": "DELETE", - "path": "/v1/login-portals/{slug}", - "pathParams": [ - "slug" + "method": "GET", + "path": "/v1/sdks", + "pathParams": [], + "publicPathParams": [], + "queryParams": [ + "limit" ], - "publicPathParams": [ - "slug" + "publicQueryParams": [ + "limit" ], - "queryParams": [], - "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], "bodyParams": [], "publicBodyParams": [], "bodyParamDetails": [], - "pathParamDetails": [ + "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": "LoginPortalDeleteParams" + "publicName": "SdkListParams" }, "response": { "status": "200", @@ -6180,13 +15843,13 @@ "transport": "http" }, { - "resource": "loginPortals", - "publicResource": "loginPortals", + "resource": "sdks", + "publicResource": "sdks", "operation": "create", "publicOperation": "create", "deprecated": false, "method": "POST", - "path": "/v1/login-portals", + "path": "/v1/sdks", "pathParams": [], "publicPathParams": [], "queryParams": [], @@ -6194,33 +15857,45 @@ "headerParams": [], "publicHeaderParams": [], "bodyParams": [ + "apiUid", + "languages", "title", "slug", - "email", - "page" + "className", + "config" ], "publicBodyParams": [ + "apiUid", + "languages", "title", "slug", - "email", - "page" + "className", + "config" ], "bodyParamDetails": [ { - "name": "title", + "name": "apiUid", "required": true }, { - "name": "slug", + "name": "languages", "required": true }, { - "name": "email", - "required": true + "name": "title", + "required": false }, { - "name": "page", - "required": true + "name": "slug", + "required": false + }, + { + "name": "className", + "required": false + }, + { + "name": "config", + "required": false } ], "pathParamDetails": [], @@ -6230,7 +15905,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "LoginPortalCreateParams" + "publicName": "SdkCreateParams" }, "requestBody": { "contentType": "application/json", @@ -6367,15 +16042,19 @@ "transport": "http" }, { - "resource": "loginPortals", - "publicResource": "loginPortals", - "operation": "list", - "publicOperation": "list", + "resource": "sdks", + "publicResource": "sdks", + "operation": "retrieve", + "publicOperation": "retrieve", "deprecated": false, "method": "GET", - "path": "/v1/login-portals", - "pathParams": [], - "publicPathParams": [], + "path": "/v1/sdks/{uid}", + "pathParams": [ + "uid" + ], + "publicPathParams": [ + "uid" + ], "queryParams": [], "publicQueryParams": [], "headerParams": [], @@ -6383,12 +16062,22 @@ "bodyParams": [], "publicBodyParams": [], "bodyParamDetails": [], - "pathParamDetails": [], + "pathParamDetails": [ + { + "name": "uid", + "required": true, + "style": "simple", + "explode": false + } + ], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], + "paramsModel": { + "publicName": "SdkRetrieveParams" + }, "response": { "status": "200", "contentType": "application/json", @@ -6400,6 +16089,10 @@ } ] }, + "responseModel": { + "name": "sdk", + "publicAliases": [] + }, "result": { "successStatus": "200", "errorStatuses": [ @@ -6507,29 +16200,68 @@ "transport": "http" }, { - "resource": "rules", - "publicResource": "rules", - "operation": "listRulesets", - "publicOperation": "listRulesets", + "resource": "sdks", + "publicResource": "sdks", + "operation": "update", + "publicOperation": "update", "deprecated": false, - "method": "GET", - "path": "/v1/rulesets/{namespace}", + "method": "PATCH", + "path": "/v1/sdks/{uid}", "pathParams": [ - "namespace" + "uid" ], "publicPathParams": [ - "namespace" + "uid" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], + "bodyParams": [ + "title", + "slug", + "isPrivate", + "config", + "apiUid", + "apiVersion" + ], + "publicBodyParams": [ + "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": "namespace", + "name": "uid", "required": true, "style": "simple", "explode": false @@ -6541,7 +16273,20 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RuleListRulesetsParams" + "publicName": "SdkUpdateParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" }, "response": { "status": "200", @@ -6661,62 +16406,29 @@ "transport": "http" }, { - "resource": "rules", - "publicResource": "rules", - "operation": "createRuleset", - "publicOperation": "createRuleset", + "resource": "sdks", + "publicResource": "sdks", + "operation": "delete", + "publicOperation": "delete", "deprecated": false, - "method": "POST", - "path": "/v1/rulesets/{namespace}", + "method": "DELETE", + "path": "/v1/sdks/{uid}", "pathParams": [ - "namespace" + "uid" ], "publicPathParams": [ - "namespace" + "uid" ], "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 - } - ], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], "pathParamDetails": [ { - "name": "namespace", + "name": "uid", "required": true, "style": "simple", "explode": false @@ -6728,20 +16440,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RuleCreateRulesetParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "SdkDeleteParams" }, "response": { "status": "200", @@ -6754,10 +16453,6 @@ } ] }, - "responseModel": { - "name": "uid", - "publicAliases": [] - }, "result": { "successStatus": "200", "errorStatuses": [ @@ -6865,70 +16560,44 @@ "transport": "http" }, { - "resource": "rules", - "publicResource": "rules", - "operation": "updateRuleset", - "publicOperation": "updateRuleset", + "resource": "sdks", + "publicResource": "sdks", + "operation": "build", + "publicOperation": "build", "deprecated": false, - "method": "PATCH", - "path": "/v1/rulesets/{namespace}/{slug}", + "method": "POST", + "path": "/v1/sdks/{uid}/build", "pathParams": [ - "namespace", - "slug" + "uid" ], "publicPathParams": [ - "namespace", - "slug" + "uid" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], "bodyParams": [ - "namespace", - "slug", - "title", - "description", - "isPrivate" + "version", + "languages" ], "publicBodyParams": [ - "namespace", - "slug", - "title", - "description", - "isPrivate" + "version", + "languages" ], "bodyParamDetails": [ { - "name": "namespace", - "required": false - }, - { - "name": "slug", - "required": false - }, - { - "name": "title", - "required": false - }, - { - "name": "description", + "name": "version", "required": false }, { - "name": "isPrivate", + "name": "languages", "required": false } ], "pathParamDetails": [ { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false - }, - { - "name": "slug", + "name": "uid", "required": true, "style": "simple", "explode": false @@ -6940,7 +16609,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RuleUpdateRulesetParams" + "publicName": "SdkBuildParams" }, "requestBody": { "contentType": "application/json", @@ -7073,37 +16742,44 @@ "transport": "http" }, { - "resource": "rules", - "publicResource": "rules", - "operation": "deleteRuleset", - "publicOperation": "deleteRuleset", + "resource": "sdks.versions", + "publicResource": "sdks.versions", + "operation": "create", + "publicOperation": "create", "deprecated": false, - "method": "DELETE", - "path": "/v1/rulesets/{namespace}/{slug}", + "method": "POST", + "path": "/v1/sdks/{uid}/versions", "pathParams": [ - "namespace", - "slug" + "uid" ], - "publicPathParams": [ - "namespace", - "slug" + "publicPathParams": [ + "uid" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], - "pathParamDetails": [ + "bodyParams": [ + "version", + "apiVersion" + ], + "publicBodyParams": [ + "version", + "apiVersion" + ], + "bodyParamDetails": [ { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false + "name": "version", + "required": true }, { - "name": "slug", + "name": "apiVersion", + "required": true + } + ], + "pathParamDetails": [ + { + "name": "uid", "required": true, "style": "simple", "explode": false @@ -7115,7 +16791,20 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RuleDeleteRulesetParams" + "publicName": "VersionCreateParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" }, "response": { "status": "200", @@ -7235,20 +16924,20 @@ "transport": "http" }, { - "resource": "rules", - "publicResource": "rules", - "operation": "retrieveRulesetDocument", - "publicOperation": "retrieveRulesetDocument", + "resource": "sdks.versions", + "publicResource": "sdks.versions", + "operation": "delete", + "publicOperation": "delete", "deprecated": false, - "method": "GET", - "path": "/v1/rulesets/{namespace}/{slug}", + "method": "DELETE", + "path": "/v1/sdks/{uid}/versions/{version}", "pathParams": [ - "namespace", - "slug" + "uid", + "version" ], "publicPathParams": [ - "namespace", - "slug" + "uid", + "version" ], "queryParams": [], "publicQueryParams": [], @@ -7259,13 +16948,13 @@ "bodyParamDetails": [], "pathParamDetails": [ { - "name": "namespace", + "name": "uid", "required": true, "style": "simple", "explode": false }, { - "name": "slug", + "name": "version", "required": true, "style": "simple", "explode": false @@ -7277,16 +16966,16 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RuleRetrieveRulesetDocumentParams" + "publicName": "VersionDeleteParams" }, "response": { "status": "200", - "contentType": "text/plain", - "encoding": "text", + "contentType": "application/json", + "encoding": "json", "contents": [ { - "contentType": "text/plain", - "encoding": "text" + "contentType": "application/json", + "encoding": "json" } ] }, @@ -7397,46 +17086,56 @@ "transport": "http" }, { - "resource": "rules", - "publicResource": "rules", - "operation": "createRulesetAccessGroup", - "publicOperation": "createRulesetAccessGroup", + "resource": "sdks.repositories", + "publicResource": "sdks.repositories", + "operation": "link", + "publicOperation": "link", "deprecated": false, "method": "POST", - "path": "/v1/rulesets/{namespace}/{slug}/access-group", + "path": "/v1/sdks/{uid}/repositories", "pathParams": [ - "namespace", - "slug" + "uid" ], "publicPathParams": [ - "namespace", - "slug" + "uid" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], "bodyParams": [ - "accessGroupSlug" + "language", + "repositoryId", + "baseBranch", + "prereleaseType" ], "publicBodyParams": [ - "accessGroupSlug" + "language", + "repositoryId", + "baseBranch", + "prereleaseType" ], "bodyParamDetails": [ { - "name": "accessGroupSlug", + "name": "language", + "required": true + }, + { + "name": "repositoryId", "required": true + }, + { + "name": "baseBranch", + "required": true + }, + { + "name": "prereleaseType", + "required": false } ], "pathParamDetails": [ { - "name": "namespace", - "required": true, - "style": "simple", - "explode": false - }, - { - "name": "slug", + "name": "uid", "required": true, "style": "simple", "explode": false @@ -7448,7 +17147,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "RuleCreateRulesetAccessGroupParams" + "publicName": "RepositoryLinkParams" }, "requestBody": { "contentType": "application/json", @@ -7581,46 +17280,37 @@ "transport": "http" }, { - "resource": "rules", - "publicResource": "rules", - "operation": "deleteRulesetAccessGroup", - "publicOperation": "deleteRulesetAccessGroup", + "resource": "sdks.repositories", + "publicResource": "sdks.repositories", + "operation": "unlink", + "publicOperation": "unlink", "deprecated": false, "method": "DELETE", - "path": "/v1/rulesets/{namespace}/{slug}/access-group", + "path": "/v1/sdks/{uid}/repositories/{language}", "pathParams": [ - "namespace", - "slug" + "uid", + "language" ], "publicPathParams": [ - "namespace", - "slug" + "uid", + "language" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "accessGroupSlug" - ], - "publicBodyParams": [ - "accessGroupSlug" - ], - "bodyParamDetails": [ - { - "name": "accessGroupSlug", - "required": true - } - ], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], "pathParamDetails": [ { - "name": "namespace", + "name": "uid", "required": true, "style": "simple", "explode": false }, { - "name": "slug", + "name": "language", "required": true, "style": "simple", "explode": false @@ -7632,20 +17322,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": "RepositoryUnlinkParams" }, "response": { "status": "200", @@ -7765,28 +17442,90 @@ "transport": "http" }, { - "resource": "themes", - "publicResource": "themes", - "operation": "list", - "publicOperation": "list", + "resource": "sdks.repositories", + "publicResource": "sdks.repositories", + "operation": "updatePublishing", + "publicOperation": "updatePublishing", "deprecated": false, - "method": "GET", - "path": "/v1/themes", - "pathParams": [], - "publicPathParams": [], + "method": "POST", + "path": "/v1/sdks/{uid}/repositories/{language}/publishing", + "pathParams": [ + "uid", + "language" + ], + "publicPathParams": [ + "uid", + "language" + ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], - "pathParamDetails": [], + "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": "uid", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "language", + "required": true, + "style": "simple", + "explode": false + } + ], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], + "paramsModel": { + "publicName": "RepositoryUpdatePublishingParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, "response": { "status": "200", "contentType": "application/json", @@ -7905,71 +17644,28 @@ "transport": "http" }, { - "resource": "themes", - "publicResource": "themes", - "operation": "create", - "publicOperation": "create", + "resource": "mcp.servers", + "publicResource": "mcp.servers", + "operation": "list", + "publicOperation": "list", "deprecated": false, - "method": "POST", - "path": "/v1/themes", + "method": "GET", + "path": "/v1/mcp/servers", "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 - } - ], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], "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" - }, + "publicCookieParams": [], + "cookieParamDetails": [], "response": { "status": "200", "contentType": "application/json", @@ -7981,10 +17677,6 @@ } ] }, - "responseModel": { - "name": "uid", - "publicAliases": [] - }, "result": { "successStatus": "200", "errorStatuses": [ @@ -8092,56 +17784,57 @@ "transport": "http" }, { - "resource": "themes", - "publicResource": "themes", - "operation": "update", - "publicOperation": "update", + "resource": "mcp.servers", + "publicResource": "mcp.servers", + "operation": "create", + "publicOperation": "create", "deprecated": false, - "method": "PATCH", - "path": "/v1/themes/{slug}", - "pathParams": [ - "slug" - ], - "publicPathParams": [ - "slug" - ], + "method": "POST", + "path": "/v1/mcp/servers", + "pathParams": [], + "publicPathParams": [], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], "bodyParams": [ "name", - "description" + "slug", + "versionUids", + "projectUids" ], "publicBodyParams": [ "name", - "description" + "slug", + "versionUids", + "projectUids" ], "bodyParamDetails": [ { "name": "name", + "required": true + }, + { + "name": "slug", "required": false }, { - "name": "description", + "name": "versionUids", "required": false - } - ], - "pathParamDetails": [ + }, { - "name": "slug", - "required": true, - "style": "simple", - "explode": false + "name": "projectUids", + "required": false } ], + "pathParamDetails": [], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "ThemeUpdateParams" + "publicName": "ServerCreateParams" }, "requestBody": { "contentType": "application/json", @@ -8274,38 +17967,29 @@ "transport": "http" }, { - "resource": "themes", - "publicResource": "themes", - "operation": "replaceDocument", - "publicOperation": "replaceDocument", + "resource": "mcp.servers", + "publicResource": "mcp.servers", + "operation": "retrieve", + "publicOperation": "retrieve", "deprecated": false, - "method": "PUT", - "path": "/v1/themes/{slug}", + "method": "GET", + "path": "/v1/mcp/servers/{id}", "pathParams": [ - "slug" + "id" ], "publicPathParams": [ - "slug" + "id" ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [ - "document" - ], - "publicBodyParams": [ - "document" - ], - "bodyParamDetails": [ - { - "name": "document", - "required": true - } - ], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], "pathParamDetails": [ { - "name": "slug", + "name": "id", "required": true, "style": "simple", "explode": false @@ -8317,20 +18001,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "ThemeReplaceDocumentParams" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "ServerRetrieveParams" }, "response": { "status": "200", @@ -8343,6 +18014,10 @@ } ] }, + "responseModel": { + "name": "mcp_server", + "publicAliases": [] + }, "result": { "successStatus": "200", "errorStatuses": [ @@ -8450,29 +18125,62 @@ "transport": "http" }, { - "resource": "themes", - "publicResource": "themes", - "operation": "delete", - "publicOperation": "delete", + "resource": "mcp.servers", + "publicResource": "mcp.servers", + "operation": "update", + "publicOperation": "update", "deprecated": false, - "method": "DELETE", - "path": "/v1/themes/{slug}", + "method": "PATCH", + "path": "/v1/mcp/servers/{id}", "pathParams": [ - "slug" + "id" ], "publicPathParams": [ - "slug" + "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 @@ -8484,7 +18192,20 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "ThemeDeleteParams" + "publicName": "ServerUpdateParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" }, "response": { "status": "200", @@ -8497,6 +18218,10 @@ } ] }, + "responseModel": { + "name": "mcp_server", + "publicAliases": [] + }, "result": { "successStatus": "200", "errorStatuses": [ @@ -8604,18 +18329,18 @@ "transport": "http" }, { - "resource": "themes", - "publicResource": "themes", - "operation": "retrieve", - "publicOperation": "retrieve", + "resource": "mcp.servers", + "publicResource": "mcp.servers", + "operation": "delete", + "publicOperation": "delete", "deprecated": false, - "method": "GET", - "path": "/v1/themes/{slug}", + "method": "DELETE", + "path": "/v1/mcp/servers/{id}", "pathParams": [ - "slug" + "id" ], "publicPathParams": [ - "slug" + "id" ], "queryParams": [], "publicQueryParams": [], @@ -8626,7 +18351,7 @@ "bodyParamDetails": [], "pathParamDetails": [ { - "name": "slug", + "name": "id", "required": true, "style": "simple", "explode": false @@ -8638,16 +18363,16 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "ThemeRetrieveParams" + "publicName": "ServerDeleteParams" }, "response": { "status": "200", - "contentType": "text/plain", - "encoding": "text", + "contentType": "application/json", + "encoding": "json", "contents": [ { - "contentType": "text/plain", - "encoding": "text" + "contentType": "application/json", + "encoding": "json" } ] }, @@ -8758,15 +18483,19 @@ "transport": "http" }, { - "resource": "teams", - "publicResource": "teams", + "resource": "mcp.servers.installations", + "publicResource": "mcp.servers.installations", "operation": "list", "publicOperation": "list", "deprecated": false, "method": "GET", - "path": "/v1/teams", - "pathParams": [], - "publicPathParams": [], + "path": "/v1/mcp/servers/{id}/installations", + "pathParams": [ + "id" + ], + "publicPathParams": [ + "id" + ], "queryParams": [], "publicQueryParams": [], "headerParams": [], @@ -8774,12 +18503,22 @@ "bodyParams": [], "publicBodyParams": [], "bodyParamDetails": [], - "pathParamDetails": [], + "pathParamDetails": [ + { + "name": "id", + "required": true, + "style": "simple", + "explode": false + } + ], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], + "paramsModel": { + "publicName": "InstallationListParams" + }, "response": { "status": "200", "contentType": "application/json", @@ -8898,28 +18637,76 @@ "transport": "http" }, { - "resource": "scalarDocs", - "publicResource": "scalarDocs", - "operation": "listGuides", - "publicOperation": "listGuides", + "resource": "mcp.servers.installations", + "publicResource": "mcp.servers.installations", + "operation": "create", + "publicOperation": "create", "deprecated": false, - "method": "GET", - "path": "/v1/guides", - "pathParams": [], - "publicPathParams": [], + "method": "POST", + "path": "/v1/mcp/servers/{id}/installations", + "pathParams": [ + "id" + ], + "publicPathParams": [ + "id" + ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], - "pathParamDetails": [], + "bodyParams": [ + "name", + "slug", + "documentAuth" + ], + "publicBodyParams": [ + "name", + "slug", + "documentAuth" + ], + "bodyParamDetails": [ + { + "name": "name", + "required": true + }, + { + "name": "slug", + "required": false + }, + { + "name": "documentAuth", + "required": true + } + ], + "pathParamDetails": [ + { + "name": "id", + "required": true, + "style": "simple", + "explode": false + } + ], "queryParamDetails": [], "headerParamDetails": [], "cookieParams": [], "publicCookieParams": [], "cookieParamDetails": [], + "paramsModel": { + "publicName": "InstallationCreateParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, "response": { "status": "200", "contentType": "application/json", @@ -8931,6 +18718,10 @@ } ] }, + "responseModel": { + "name": "mcp_installation", + "publicAliases": [] + }, "result": { "successStatus": "200", "errorStatuses": [ @@ -9037,77 +18828,50 @@ "responseLinks": [], "transport": "http" }, - { - "resource": "scalarDocs", - "publicResource": "scalarDocs", - "operation": "createGuide", - "publicOperation": "createGuide", + { + "resource": "mcp.servers.installations", + "publicResource": "mcp.servers.installations", + "operation": "retrieve", + "publicOperation": "retrieve", "deprecated": false, - "method": "POST", - "path": "/v1/guides", - "pathParams": [], - "publicPathParams": [], + "method": "GET", + "path": "/v1/mcp/servers/{id}/installations/{installationId}", + "pathParams": [ + "id", + "installationId" + ], + "publicPathParams": [ + "id", + "installationId" + ], "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 - }, + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "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" - }, - "requestBody": { - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ], - "required": true, - "publicName": "body", - "publicIdentifier": "body" + "publicName": "InstallationRetrieveParams" }, "response": { "status": "200", @@ -9120,6 +18884,10 @@ } ] }, + "responseModel": { + "name": "mcp_installation", + "publicAliases": [] + }, "result": { "successStatus": "200", "errorStatuses": [ @@ -9227,29 +18995,76 @@ "transport": "http" }, { - "resource": "scalarDocs", - "publicResource": "scalarDocs", - "operation": "publishGuide", - "publicOperation": "publishGuide", + "resource": "mcp.servers.installations", + "publicResource": "mcp.servers.installations", + "operation": "update", + "publicOperation": "update", "deprecated": false, - "method": "POST", - "path": "/v1/guides/{slug}/publish", + "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 @@ -9261,7 +19076,20 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "ScalarDocPublishGuideParams" + "publicName": "InstallationUpdateParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" }, "response": { "status": "200", @@ -9274,6 +19102,10 @@ } ] }, + "responseModel": { + "name": "mcp_installation", + "publicAliases": [] + }, "result": { "successStatus": "200", "errorStatuses": [ @@ -9381,15 +19213,21 @@ "transport": "http" }, { - "resource": "namespaces", - "publicResource": "namespaces", - "operation": "list", - "publicOperation": "list", + "resource": "mcp.servers.installations", + "publicResource": "mcp.servers.installations", + "operation": "delete", + "publicOperation": "delete", "deprecated": false, - "method": "GET", - "path": "/v1/namespaces", - "pathParams": [], - "publicPathParams": [], + "method": "DELETE", + "path": "/v1/mcp/servers/{id}/installations/{installationId}", + "pathParams": [ + "id", + "installationId" + ], + "publicPathParams": [ + "id", + "installationId" + ], "queryParams": [], "publicQueryParams": [], "headerParams": [], @@ -9397,12 +19235,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", @@ -9521,39 +19375,58 @@ "transport": "http" }, { - "resource": "authentication", - "publicResource": "authentication", - "operation": "exchangePersonalToken", - "publicOperation": "exchangePersonalToken", + "resource": "mcp.servers.installations", + "publicResource": "mcp.servers.installations", + "operation": "createAccessGroup", + "publicOperation": "createAccessGroup", "deprecated": false, "method": "POST", - "path": "/v1/auth/exchange", - "pathParams": [], - "publicPathParams": [], + "path": "/v1/mcp/servers/{id}/installations/{installationId}/access-group", + "pathParams": [ + "id", + "installationId" + ], + "publicPathParams": [ + "id", + "installationId" + ], "queryParams": [], "publicQueryParams": [], "headerParams": [], "publicHeaderParams": [], "bodyParams": [ - "personalToken" + "accessGroupUid" ], "publicBodyParams": [ - "personalToken" + "accessGroupUid" ], "bodyParamDetails": [ { - "name": "personalToken", + "name": "accessGroupUid", "required": true } ], - "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": "AuthenticationExchangePersonalTokenParams" + "publicName": "InstallationCreateAccessGroupParams" }, "requestBody": { "contentType": "application/json", @@ -9686,28 +19559,72 @@ "transport": "http" }, { - "resource": "authentication", - "publicResource": "authentication", - "operation": "listCurrentUser", - "publicOperation": "listCurrentUser", + "resource": "mcp.servers.installations", + "publicResource": "mcp.servers.installations", + "operation": "deleteAccessGroup", + "publicOperation": "deleteAccessGroup", "deprecated": false, - "method": "GET", - "path": "/v1/auth/me", - "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", @@ -9719,10 +19636,6 @@ } ] }, - "responseModel": { - "name": "user", - "publicAliases": [] - }, "result": { "successStatus": "200", "errorStatuses": [ diff --git a/tests/smoke-test.java b/tests/smoke-test.java index 6000efa..cf113c3 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,17 @@ 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.registry.AccessGroup; import com.scalar.models.registry.RegistryCreateApiDocumentAccessGroupParams; import com.scalar.models.registry.RegistryCreateApiDocumentParams; @@ -33,16 +48,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; @@ -56,7 +92,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, @@ -83,18 +119,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); } @@ -102,49 +140,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); } @@ -152,218 +192,241 @@ 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); } 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") - .slug("slug") - .semver("semver") + .namespace("acme") + .slug("acme-api") + .semver("1.2.0") .build(); var registry = client.registry().deleteApiDocumentVersion(params); } - private static void _smokeCase11() 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); } - private static void _smokeCase12() 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); } - private static void _smokeCase13() 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) - .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()) + .namespace("acme") + .slug("acme-api") + .accessGroup(AccessGroup.builder().accessGroupSlug("acme-api").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()) + .namespace("acme") + .slug("acme-api") + .accessGroup(AccessGroup.builder().accessGroupSlug("acme-api").build()) .build(); var registry = client.registry().deleteApiDocumentAccessGroup(params); } - private static void _smokeCase16() throws Exception { - SchemaListParams params = SchemaListParams.builder().namespace("namespace").build(); + private static void _smokeCase15() throws Exception { + SchemaListParams params = SchemaListParams.builder().namespace("acme").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") - .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); } - private static void _smokeCase18() 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 _smokeCase19() throws Exception { + 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 _smokeCase20() throws Exception { + 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); } - private static void _smokeCase21() 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 _smokeCase22() throws Exception { + 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 _smokeCase23() throws Exception { - VersionDeleteParams params = - VersionDeleteParams.builder().namespace("namespace").slug("slug").semver("semver").build(); + private static void _smokeCase22() throws Exception { + com.scalar.models.schemas.version.VersionDeleteParams params = + com.scalar.models.schemas.version.VersionDeleteParams.builder() + .namespace("acme") + .slug("customer") + .semver("1.2.0") + .build(); var version = client.schemas().version().delete(params); } + private static void _smokeCase23() throws Exception { + com.scalar.models.schemas.version.VersionCreateParams params = + com.scalar.models.schemas.version.VersionCreateParams.builder() + .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); + } + private static void _smokeCase24() throws Exception { - VersionCreateParams params = - VersionCreateParams.builder() - .namespace("namespace") - .slug("slug") - .version("x") - .document("") + com.scalar.models.schemas.version.VersionCreateParams params = + com.scalar.models.schemas.version.VersionCreateParams.builder() + .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); } private static void _smokeCase25() throws Exception { - AccessGroupCreateParams params = - AccessGroupCreateParams.builder() - .namespace("namespace") - .slug("slug") - .accessGroup(AccessGroup.builder().accessGroupSlug("xxx").build()) + com.scalar.models.schemas.accessGroup.AccessGroupCreateParams params = + com.scalar + .models + .schemas + .accessGroup + .AccessGroupCreateParams + .builder() + .namespace("acme") + .slug("customer") + .accessGroup(AccessGroup.builder().accessGroupSlug("acme-api").build()) .build(); var accessGroup = client.schemas().accessGroup().create(params); } private static void _smokeCase26() throws Exception { - AccessGroupDeleteParams params = - AccessGroupDeleteParams.builder() - .namespace("namespace") - .slug("slug") - .accessGroup(AccessGroup.builder().accessGroupSlug("xxx").build()) + com.scalar.models.schemas.accessGroup.AccessGroupDeleteParams params = + com.scalar + .models + .schemas + .accessGroup + .AccessGroupDeleteParams + .builder() + .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("") @@ -373,7 +436,7 @@ private static void _smokeCase31() throws Exception { .title("Private Docs") .mainColor("#2a2f45") .mainBackground("#f6f6f6") - .cardColor("2a2f45") + .cardColor("#2a2f45") .cardBackground("#fff") .buttonColor("#fff") .buttonBackground("#0f0f0f") @@ -404,143 +467,244 @@ private static void _smokeCase32() throws Exception { } private static void _smokeCase33() throws Exception { - RuleListRulesetsParams params = RuleListRulesetsParams.builder().namespace("namespace").build(); - var rule = client.rules().listRulesets(params); + var accessGroup = client.accessGroups().create(); } private static void _smokeCase34() throws Exception { + com.scalar.models.accessGroups.AccessGroupCreateParams params = + com.scalar + .models + .accessGroups + .AccessGroupCreateParams + .builder() + .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("acme-api").build(); + var accessGroup = client.accessGroups().retrieve(params); + } + + private static void _smokeCase36() throws Exception { + 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("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("acme-api").build(); + var accessGroup = client.accessGroups().delete(params); + } + + private static void _smokeCase39() throws Exception { + 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("acme-api").domain("example.com").build(); + var domain = client.accessGroups().domains().delete(params); + } + + private static void _smokeCase41() throws Exception { + 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); } - private static void _smokeCase35() 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 _smokeCase36() throws Exception { + 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 _smokeCase37() throws Exception { + 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); } - private static void _smokeCase38() 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 _smokeCase39() throws Exception { + 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 _smokeCase40() throws Exception { + private static void _smokeCase48() throws Exception { RuleCreateRulesetAccessGroupParams params = RuleCreateRulesetAccessGroupParams.builder() - .namespace("namespace") - .slug("slug") - .accessGroup(AccessGroup.builder().accessGroupSlug("xxx").build()) + .namespace("acme") + .slug("acme-rules") + .accessGroup(AccessGroup.builder().accessGroupSlug("acme-api").build()) .build(); var rule = client.rules().createRulesetAccessGroup(params); } - private static void _smokeCase41() throws Exception { + private static void _smokeCase49() throws Exception { RuleDeleteRulesetAccessGroupParams params = RuleDeleteRulesetAccessGroupParams.builder() - .namespace("namespace") - .slug("slug") - .accessGroup(AccessGroup.builder().accessGroupSlug("xxx").build()) + .namespace("acme") + .slug("acme-rules") + .accessGroup(AccessGroup.builder().accessGroupSlug("acme-api").build()) .build(); 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 { - ThemeCreateParams params = ThemeCreateParams.builder().name("").slug("").document("").build(); + private static void _smokeCase51() throws Exception { + 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 _smokeCase44() throws Exception { + 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 _smokeCase45() throws Exception { - ThemeUpdateParams params = ThemeUpdateParams.builder().slug("slug").build(); + private static void _smokeCase53() throws Exception { + ThemeUpdateParams params = ThemeUpdateParams.builder().slug("acme-theme").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(); + 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 _smokeCase47() throws Exception { + 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 _smokeCase48() throws Exception { - ThemeDeleteParams params = ThemeDeleteParams.builder().slug("slug").build(); + private static void _smokeCase56() throws Exception { + ThemeDeleteParams params = ThemeDeleteParams.builder().slug("acme-theme").build(); var theme = client.themes().delete(params); } - private static void _smokeCase49() throws Exception { - ThemeRetrieveParams params = ThemeRetrieveParams.builder().slug("slug").build(); + private static void _smokeCase57() throws Exception { + ThemeRetrieveParams params = ThemeRetrieveParams.builder().slug("acme-theme").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("UakgbKJ5m9gl0JDMbcJqL").role(Role.OWNER).build(); + var member = client.teams().members().update(params); + } + + private static void _smokeCase61() throws Exception { + 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("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("UakgbKJ5m9gl0JDMbcJqL").build(); + var invite = client.teams().invites().resend(params); + } + + private static void _smokeCase64() throws Exception { + InviteCancelParams params = InviteCancelParams.builder().uid("UakgbKJ5m9gl0JDMbcJqL").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("") + .name("Acme Documentation") .isPrivate(false) .allowedUsers(java.util.List.of()) .allowedDomains(java.util.List.of()) @@ -548,11 +712,11 @@ 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("") - .slug("xxx") + .name("Acme Documentation") + .slug("acme-api") .isPrivate(false) .allowedUsers(java.util.List.of()) .allowedDomains(java.util.List.of()) @@ -560,25 +724,441 @@ private static void _smokeCase53() throws Exception { var scalarDoc = client.scalarDocs().createGuide(params); } - private static void _smokeCase54() throws Exception { - ScalarDocPublishGuideParams params = ScalarDocPublishGuideParams.builder().slug("slug").build(); + private static void _smokeCase68() throws Exception { + ScalarDocPublishGuideParams params = + ScalarDocPublishGuideParams.builder().slug("acme-docs").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(20L).build(); + var scalarDoc = client.scalarDocs().listProjects(params); + } + + private static void _smokeCase71() throws Exception { + ScalarDocCreateProjectParams params = + ScalarDocCreateProjectParams.builder() + .name("Acme Documentation") + .provider(ScalarDocCreateProjectParams.Provider.of("forgejo")) + .build(); + var scalarDoc = client.scalarDocs().createProject(params); + } + + private static void _smokeCase72() throws Exception { + ScalarDocCreateProjectParams params = + ScalarDocCreateProjectParams.builder() + .name("Acme Documentation") + .slug("acme-api") + .isPrivate(false) + .blank(true) + .provider(ScalarDocCreateProjectParams.Provider.of("forgejo")) + .githubRepository( + ScalarDocCreateProjectParams.GithubRepository.builder() + .installationId(84L) + .repoId(123456789L) + .build()) + .bitbucketRepository( + ScalarDocCreateProjectParams.BitbucketRepository.builder() + .workspaceUuid("{12345678-1234-4234-8234-123456789abc}") + .repoUuid("{abcdef01-1234-4234-8234-123456789abc}") + .build()) + .build(); + var scalarDoc = client.scalarDocs().createProject(params); + } + + private static void _smokeCase73() throws Exception { + ScalarDocRetrieveProjectParams params = + ScalarDocRetrieveProjectParams.builder().slug("acme-docs").build(); + var scalarDoc = client.scalarDocs().retrieveProject(params); + } + + private static void _smokeCase74() throws Exception { + ScalarDocUpdateProjectParams params = + ScalarDocUpdateProjectParams.builder().slug("acme-docs").build(); + var scalarDoc = client.scalarDocs().updateProject(params); + } + + private static void _smokeCase75() throws Exception { + ScalarDocUpdateProjectParams params = + ScalarDocUpdateProjectParams.builder() + .slug("acme-docs") + .name("Acme Documentation") + .isPrivate(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("acme-docs").build(); + var scalarDoc = client.scalarDocs().deleteProject(params); + } + + private static void _smokeCase77() throws Exception { + ScalarDocPublishProjectParams params = + ScalarDocPublishProjectParams.builder().slug("acme-docs").build(); + var scalarDoc = client.scalarDocs().publishProject(params); + } + + private static void _smokeCase78() throws Exception { + ScalarDocPublishProjectParams params = + ScalarDocPublishProjectParams.builder() + .slug("acme-docs") + .commitSha("0123456789abcdef0123456789abcdef01234567") + .preview(false) + .configPath("scalar.config.json") + .build(); + var scalarDoc = client.scalarDocs().publishProject(params); + } + + private static void _smokeCase79() throws Exception { + ScalarDocListProjectConfigParams params = + ScalarDocListProjectConfigParams.builder().slug("acme-docs").build(); + var scalarDoc = client.scalarDocs().listProjectConfig(params); + } + + private static void _smokeCase80() throws Exception { + ScalarDocListProjectConfigParams params = + 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("acme-docs") + .content("{\"name\":\"Acme Documentation\"}") + .build(); + var scalarDoc = client.scalarDocs().updateProjectConfig(params); + } + + private static void _smokeCase82() throws Exception { + ScalarDocUpdateProjectConfigParams params = + ScalarDocUpdateProjectConfigParams.builder() + .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("acme-docs").build(); + var scalarDoc = client.scalarDocs().listProjectDomain(params); + } + + private static void _smokeCase84() throws Exception { + ScalarDocListProjectDomainStatusParams params = + ScalarDocListProjectDomainStatusParams.builder().slug("acme-docs").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(); + AuthenticationExchangePersonalTokenParams.builder() + .personalToken("scalar_example_personal_token") + .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(20L).build(); + var sdk = client.sdks().list(params); + } + + private static void _smokeCase90() throws Exception { + SdkCreateParams params = + SdkCreateParams.builder() + .apiUid("UakgbKJ5m9gl0JDMbcJqL") + .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("UakgbKJ5m9gl0JDMbcJqL") + .languages(java.util.List.of(SdkCreateParams.Language.of("typescript"))) + .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("UakgbKJ5m9gl0JDMbcJqL").build(); + var sdk = client.sdks().retrieve(params); + } + + private static void _smokeCase93() throws Exception { + SdkUpdateParams params = SdkUpdateParams.builder().uid("UakgbKJ5m9gl0JDMbcJqL").build(); + var sdk = client.sdks().update(params); + } + + private static void _smokeCase94() throws Exception { + SdkUpdateParams params = + SdkUpdateParams.builder() + .uid("UakgbKJ5m9gl0JDMbcJqL") + .title("Acme SDK") + .slug("acme-api") + .isPrivate(false) + .config("{\"targets\":{\"typescript\":{\"packageName\":\"@acme/sdk\"}}}") + .apiUid("") + .apiVersion("") + .build(); + var sdk = client.sdks().update(params); + } + + private static void _smokeCase95() throws Exception { + SdkDeleteParams params = SdkDeleteParams.builder().uid("UakgbKJ5m9gl0JDMbcJqL").build(); + var sdk = client.sdks().delete(params); + } + + private static void _smokeCase96() throws Exception { + SdkBuildParams params = SdkBuildParams.builder().uid("UakgbKJ5m9gl0JDMbcJqL").build(); + var sdk = client.sdks().build(params); + } + + private static void _smokeCase97() throws Exception { + SdkBuildParams params = + SdkBuildParams.builder() + .uid("UakgbKJ5m9gl0JDMbcJqL") + .version("1.2.0") + .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("UakgbKJ5m9gl0JDMbcJqL") + .version("1.2.0") + .apiVersion("1.2.0") + .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("UakgbKJ5m9gl0JDMbcJqL") + .version("1.2.0") + .build(); + var version = client.sdks().versions().delete(params); + } + + private static void _smokeCase100() throws Exception { + RepositoryLinkParams params = + RepositoryLinkParams.builder() + .uid("UakgbKJ5m9gl0JDMbcJqL") + .language(RepositoryLinkParams.Language.of("typescript")) + .repositoryId(123456789L) + .baseBranch("main") + .build(); + var repository = client.sdks().repositories().link(params); + } + + private static void _smokeCase101() throws Exception { + RepositoryLinkParams params = + RepositoryLinkParams.builder() + .uid("UakgbKJ5m9gl0JDMbcJqL") + .language(RepositoryLinkParams.Language.of("typescript")) + .repositoryId(123456789L) + .baseBranch("main") + .prereleaseType("beta") + .build(); + var repository = client.sdks().repositories().link(params); + } + + private static void _smokeCase102() throws Exception { + RepositoryUnlinkParams params = + RepositoryUnlinkParams.builder() + .uid("UakgbKJ5m9gl0JDMbcJqL") + .language(RepositoryUnlinkParams.Language.of("typescript")) + .build(); + var repository = client.sdks().repositories().unlink(params); + } + + private static void _smokeCase103() throws Exception { + RepositoryUpdatePublishingParams params = + RepositoryUpdatePublishingParams.builder() + .uid("UakgbKJ5m9gl0JDMbcJqL") + .language(RepositoryUpdatePublishingParams.Language.of("typescript")) + .publishOnMerge(true) + .build(); + var repository = client.sdks().repositories().updatePublishing(params); + } + + private static void _smokeCase104() throws Exception { + RepositoryUpdatePublishingParams params = + RepositoryUpdatePublishingParams.builder() + .uid("UakgbKJ5m9gl0JDMbcJqL") + .language(RepositoryUpdatePublishingParams.Language.of("typescript")) + .publishOnMerge(true) + .authMethod(RepositoryUpdatePublishingParams.AuthMethod.of("oidc")) + .access(RepositoryUpdatePublishingParams.Access.of("public")) + .tag("latest") + .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("Acme MCP").build(); + var server = client.mcp().servers().create(params); + } + + private static void _smokeCase107() throws Exception { + ServerCreateParams params = + ServerCreateParams.builder() + .name("Acme MCP") + .slug("acme-api") + .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("42").build(); + var server = client.mcp().servers().retrieve(params); + } + + private static void _smokeCase109() throws Exception { + 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("42") + .name("Acme MCP") + .slug("acme-api") + .autoAddOperations(true) + .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("42").build(); + var server = client.mcp().servers().delete(params); + } + + private static void _smokeCase112() throws Exception { + 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("42") + .name("Acme MCP") + .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("42") + .name("Acme MCP") + .slug("acme-api") + .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("42").installationId("84").build(); + var installation = client.mcp().servers().installations().retrieve(params); + } + + private static void _smokeCase116() throws Exception { + InstallationUpdateParams params = + 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("42") + .installationId("84") + .name("Acme MCP") + .slug("acme-api") + .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("42").installationId("84").build(); + var installation = client.mcp().servers().installations().delete(params); + } + + private static void _smokeCase119() throws Exception { + InstallationCreateAccessGroupParams params = + InstallationCreateAccessGroupParams.builder() + .id("42") + .installationId("84") + .accessGroupUid("UakgbKJ5m9gl0JDMbcJqL") + .build(); + var installation = client.mcp().servers().installations().createAccessGroup(params); + } + + private static void _smokeCase120() throws Exception { + InstallationDeleteAccessGroupParams params = + InstallationDeleteAccessGroupParams.builder() + .id("42") + .installationId("84") + .accessGroupUid("UakgbKJ5m9gl0JDMbcJqL") + .build(); + var installation = client.mcp().servers().installations().deleteAccessGroup(params); + } + private static final List cases = List.of( new SmokeCase("listAllApiDocuments", "GET", "/v1/apis", "", SmokeTest::_smokeCase0), @@ -624,90 +1204,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", @@ -735,76 +1315,272 @@ 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( - "update", "PATCH", "/v1/themes/{slug}", "required params", SmokeTest::_smokeCase45), + "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}", "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), + "publishGuide", "POST", "/v1/guides/{slug}/publish", "", SmokeTest::_smokeCase68), new SmokeCase( - "createGuide", "POST", "/v1/guides", "required params", SmokeTest::_smokeCase52), - new SmokeCase("createGuide", "POST", "/v1/guides", "all params", SmokeTest::_smokeCase53), + "listProjects", "GET", "/v1/docs", "required params", SmokeTest::_smokeCase69), + new SmokeCase("listProjects", "GET", "/v1/docs", "all params", SmokeTest::_smokeCase70), new SmokeCase( - "publishGuide", "POST", "/v1/guides/{slug}/publish", "", SmokeTest::_smokeCase54), - new SmokeCase("list", "GET", "/v1/namespaces", "", SmokeTest::_smokeCase55), + "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( + "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( + "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( - "exchangePersonalToken", "POST", "/v1/auth/exchange", "", SmokeTest::_smokeCase56), - new SmokeCase("listCurrentUser", "GET", "/v1/auth/me", "", SmokeTest::_smokeCase57)); + "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)); private static List selectedCases() { String filter = System.getenv("SCALAR_SMOKE_FILTER");