{"id":30057117,"url":"https://github.com/dimasmith/spotless-java-api-client","last_synced_at":"2025-08-07T23:47:46.016Z","repository":{"id":307977143,"uuid":"1031247764","full_name":"dimasmith/spotless-java-api-client","owner":"dimasmith","description":"Production repostory for Stainless POC","archived":false,"fork":false,"pushed_at":"2025-08-03T10:44:31.000Z","size":167,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-03T12:18:22.169Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dimasmith.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-03T10:40:57.000Z","updated_at":"2025-08-03T10:42:26.000Z","dependencies_parsed_at":"2025-08-03T12:36:16.773Z","dependency_job_id":null,"html_url":"https://github.com/dimasmith/spotless-java-api-client","commit_stats":null,"previous_names":["dimasmith/spotless-java-api-client"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/dimasmith/spotless-java-api-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimasmith%2Fspotless-java-api-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimasmith%2Fspotless-java-api-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimasmith%2Fspotless-java-api-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimasmith%2Fspotless-java-api-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dimasmith","download_url":"https://codeload.github.com/dimasmith/spotless-java-api-client/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimasmith%2Fspotless-java-api-client/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269343176,"owners_count":24401077,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-07T02:00:09.698Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-08-07T23:47:42.805Z","updated_at":"2025-08-07T23:47:45.934Z","avatar_url":"https://github.com/dimasmith.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spotless Java API Library\n\n[![Maven Central](https://img.shields.io/maven-central/v/dev.knopitoshka/spotless-java)](https://central.sonatype.com/artifact/dev.knopitoshka/spotless-java/0.0.1-alpha.0)\n[![javadoc](https://javadoc.io/badge2/dev.knopitoshka/spotless-java/0.0.1-alpha.0/javadoc.svg)](https://javadoc.io/doc/dev.knopitoshka/spotless-java/0.0.1-alpha.0)\n\nThe Spotless Java SDK provides convenient access to the Spotless REST API from applications written in Java.\n\nIt is generated with [Stainless](https://www.stainless.com/).\n\nJavadocs are available on [javadoc.io](https://javadoc.io/doc/dev.knopitoshka/spotless-java/0.0.1-alpha.0).\n\n## Installation\n\n### Gradle\n\n```kotlin\nimplementation(\"dev.knopitoshka:spotless-java:0.0.1-alpha.0\")\n```\n\n### Maven\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003edev.knopitoshka\u003c/groupId\u003e\n  \u003cartifactId\u003espotless-java\u003c/artifactId\u003e\n  \u003cversion\u003e0.0.1-alpha.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Requirements\n\nThis library requires Java 8 or later.\n\n## Usage\n\n```java\nimport dev.knopitoshka.client.SpotlessClient;\nimport dev.knopitoshka.client.okhttp.SpotlessOkHttpClient;\nimport dev.knopitoshka.models.games.GameStartParams;\nimport dev.knopitoshka.models.games.GameStartResponse;\n\n// Configures using the `spotless.apiKey` and `spotless.baseUrl` system properties\n// Or configures using the `SPOTLESS_API_KEY` and `SPOTLESS_BASE_URL` environment variables\nSpotlessClient client = SpotlessOkHttpClient.fromEnv();\n\nGameStartResponse response = client.games().start();\n```\n\n## Client configuration\n\nConfigure the client using system properties or environment variables:\n\n```java\nimport dev.knopitoshka.client.SpotlessClient;\nimport dev.knopitoshka.client.okhttp.SpotlessOkHttpClient;\n\n// Configures using the `spotless.apiKey` and `spotless.baseUrl` system properties\n// Or configures using the `SPOTLESS_API_KEY` and `SPOTLESS_BASE_URL` environment variables\nSpotlessClient client = SpotlessOkHttpClient.fromEnv();\n```\n\nOr manually:\n\n```java\nimport dev.knopitoshka.client.SpotlessClient;\nimport dev.knopitoshka.client.okhttp.SpotlessOkHttpClient;\n\nSpotlessClient client = SpotlessOkHttpClient.builder()\n    .apiKey(\"My API Key\")\n    .build();\n```\n\nOr using a combination of the two approaches:\n\n```java\nimport dev.knopitoshka.client.SpotlessClient;\nimport dev.knopitoshka.client.okhttp.SpotlessOkHttpClient;\n\nSpotlessClient client = SpotlessOkHttpClient.builder()\n    // Configures using the `spotless.apiKey` and `spotless.baseUrl` system properties\n    // Or configures using the `SPOTLESS_API_KEY` and `SPOTLESS_BASE_URL` environment variables\n    .fromEnv()\n    .apiKey(\"My API Key\")\n    .build();\n```\n\nSee this table for the available options:\n\n| Setter    | System property    | Environment variable | Required | Default value               |\n| --------- | ------------------ | -------------------- | -------- | --------------------------- |\n| `apiKey`  | `spotless.apiKey`  | `SPOTLESS_API_KEY`   | false    | -                           |\n| `baseUrl` | `spotless.baseUrl` | `SPOTLESS_BASE_URL`  | true     | `\"https://api.example.com\"` |\n\nSystem properties take precedence over environment variables.\n\n\u003e [!TIP]\n\u003e Don't create more than one client in the same application. Each client has a connection pool and\n\u003e thread pools, which are more efficient to share between requests.\n\n### Modifying configuration\n\nTo temporarily use a modified client configuration, while reusing the same connection and thread pools, call `withOptions()` on any client or service:\n\n```java\nimport dev.knopitoshka.client.SpotlessClient;\n\nSpotlessClient clientWithOptions = client.withOptions(optionsBuilder -\u003e {\n    optionsBuilder.baseUrl(\"https://example.com\");\n    optionsBuilder.maxRetries(42);\n});\n```\n\nThe `withOptions()` method does not affect the original client or service.\n\n## Requests and responses\n\nTo send a request to the Spotless API, build an instance of some `Params` class and pass it to the corresponding client method. When the response is received, it will be deserialized into an instance of a Java class.\n\nFor example, `client.games().start(...)` should be called with an instance of `GameStartParams`, and it will return an instance of `GameStartResponse`.\n\n## Immutability\n\nEach class in the SDK has an associated [builder](https://blogs.oracle.com/javamagazine/post/exploring-joshua-blochs-builder-design-pattern-in-java) or factory method for constructing it.\n\nEach class is [immutable](https://docs.oracle.com/javase/tutorial/essential/concurrency/immutable.html) once constructed. If the class has an associated builder, then it has a `toBuilder()` method, which can be used to convert it back to a builder for making a modified copy.\n\nBecause each class is immutable, builder modification will _never_ affect already built class instances.\n\n## Asynchronous execution\n\nThe default client is synchronous. To switch to asynchronous execution, call the `async()` method:\n\n```java\nimport dev.knopitoshka.client.SpotlessClient;\nimport dev.knopitoshka.client.okhttp.SpotlessOkHttpClient;\nimport dev.knopitoshka.models.games.GameStartParams;\nimport dev.knopitoshka.models.games.GameStartResponse;\nimport java.util.concurrent.CompletableFuture;\n\n// Configures using the `spotless.apiKey` and `spotless.baseUrl` system properties\n// Or configures using the `SPOTLESS_API_KEY` and `SPOTLESS_BASE_URL` environment variables\nSpotlessClient client = SpotlessOkHttpClient.fromEnv();\n\nCompletableFuture\u003cGameStartResponse\u003e response = client.async().games().start();\n```\n\nOr create an asynchronous client from the beginning:\n\n```java\nimport dev.knopitoshka.client.SpotlessClientAsync;\nimport dev.knopitoshka.client.okhttp.SpotlessOkHttpClientAsync;\nimport dev.knopitoshka.models.games.GameStartParams;\nimport dev.knopitoshka.models.games.GameStartResponse;\nimport java.util.concurrent.CompletableFuture;\n\n// Configures using the `spotless.apiKey` and `spotless.baseUrl` system properties\n// Or configures using the `SPOTLESS_API_KEY` and `SPOTLESS_BASE_URL` environment variables\nSpotlessClientAsync client = SpotlessOkHttpClientAsync.fromEnv();\n\nCompletableFuture\u003cGameStartResponse\u003e response = client.games().start();\n```\n\nThe asynchronous client supports the same options as the synchronous one, except most methods return `CompletableFuture`s.\n\n## Raw responses\n\nThe SDK defines methods that deserialize responses into instances of Java classes. However, these methods don't provide access to the response headers, status code, or the raw response body.\n\nTo access this data, prefix any HTTP method call on a client or service with `withRawResponse()`:\n\n```java\nimport dev.knopitoshka.core.http.Headers;\nimport dev.knopitoshka.core.http.HttpResponseFor;\nimport dev.knopitoshka.models.games.GameStartParams;\nimport dev.knopitoshka.models.games.GameStartResponse;\n\nHttpResponseFor\u003cGameStartResponse\u003e response = client.games().withRawResponse().start();\n\nint statusCode = response.statusCode();\nHeaders headers = response.headers();\n```\n\nYou can still deserialize the response into an instance of a Java class if needed:\n\n```java\nimport dev.knopitoshka.models.games.GameStartResponse;\n\nGameStartResponse parsedResponse = response.parse();\n```\n\n## Error handling\n\nThe SDK throws custom unchecked exception types:\n\n- [`SpotlessServiceException`](spotless-java-core/src/main/kotlin/dev/knopitoshka/errors/SpotlessServiceException.kt): Base class for HTTP errors. See this table for which exception subclass is thrown for each HTTP status code:\n\n  | Status | Exception                                                                                                                     |\n  | ------ | ----------------------------------------------------------------------------------------------------------------------------- |\n  | 400    | [`BadRequestException`](spotless-java-core/src/main/kotlin/dev/knopitoshka/errors/BadRequestException.kt)                     |\n  | 401    | [`UnauthorizedException`](spotless-java-core/src/main/kotlin/dev/knopitoshka/errors/UnauthorizedException.kt)                 |\n  | 403    | [`PermissionDeniedException`](spotless-java-core/src/main/kotlin/dev/knopitoshka/errors/PermissionDeniedException.kt)         |\n  | 404    | [`NotFoundException`](spotless-java-core/src/main/kotlin/dev/knopitoshka/errors/NotFoundException.kt)                         |\n  | 422    | [`UnprocessableEntityException`](spotless-java-core/src/main/kotlin/dev/knopitoshka/errors/UnprocessableEntityException.kt)   |\n  | 429    | [`RateLimitException`](spotless-java-core/src/main/kotlin/dev/knopitoshka/errors/RateLimitException.kt)                       |\n  | 5xx    | [`InternalServerException`](spotless-java-core/src/main/kotlin/dev/knopitoshka/errors/InternalServerException.kt)             |\n  | others | [`UnexpectedStatusCodeException`](spotless-java-core/src/main/kotlin/dev/knopitoshka/errors/UnexpectedStatusCodeException.kt) |\n\n- [`SpotlessIoException`](spotless-java-core/src/main/kotlin/dev/knopitoshka/errors/SpotlessIoException.kt): I/O networking errors.\n\n- [`SpotlessRetryableException`](spotless-java-core/src/main/kotlin/dev/knopitoshka/errors/SpotlessRetryableException.kt): Generic error indicating a failure that could be retried by the client.\n\n- [`SpotlessInvalidDataException`](spotless-java-core/src/main/kotlin/dev/knopitoshka/errors/SpotlessInvalidDataException.kt): Failure to interpret successfully parsed data. For example, when accessing a property that's supposed to be required, but the API unexpectedly omitted it from the response.\n\n- [`SpotlessException`](spotless-java-core/src/main/kotlin/dev/knopitoshka/errors/SpotlessException.kt): Base class for all exceptions. Most errors will result in one of the previously mentioned ones, but completely generic errors may be thrown using the base class.\n\n## Logging\n\nThe SDK uses the standard [OkHttp logging interceptor](https://github.com/square/okhttp/tree/master/okhttp-logging-interceptor).\n\nEnable logging by setting the `SPOTLESS_LOG` environment variable to `info`:\n\n```sh\n$ export SPOTLESS_LOG=info\n```\n\nOr to `debug` for more verbose logging:\n\n```sh\n$ export SPOTLESS_LOG=debug\n```\n\n## ProGuard and R8\n\nAlthough the SDK uses reflection, it is still usable with [ProGuard](https://github.com/Guardsquare/proguard) and [R8](https://developer.android.com/topic/performance/app-optimization/enable-app-optimization) because `spotless-java-core` is published with a [configuration file](spotless-java-core/src/main/resources/META-INF/proguard/spotless-java-core.pro) containing [keep rules](https://www.guardsquare.com/manual/configuration/usage).\n\nProGuard and R8 should automatically detect and use the published rules, but you can also manually copy the keep rules if necessary.\n\n## Jackson\n\nThe SDK depends on [Jackson](https://github.com/FasterXML/jackson) for JSON serialization/deserialization. It is compatible with version 2.13.4 or higher, but depends on version 2.18.2 by default.\n\nThe SDK throws an exception if it detects an incompatible Jackson version at runtime (e.g. if the default version was overridden in your Maven or Gradle config).\n\nIf the SDK threw an exception, but you're _certain_ the version is compatible, then disable the version check using the `checkJacksonVersionCompatibility` on [`SpotlessOkHttpClient`](spotless-java-client-okhttp/src/main/kotlin/dev/knopitoshka/client/okhttp/SpotlessOkHttpClient.kt) or [`SpotlessOkHttpClientAsync`](spotless-java-client-okhttp/src/main/kotlin/dev/knopitoshka/client/okhttp/SpotlessOkHttpClientAsync.kt).\n\n\u003e [!CAUTION]\n\u003e We make no guarantee that the SDK works correctly when the Jackson version check is disabled.\n\n## Network options\n\n### Retries\n\nThe SDK automatically retries 2 times by default, with a short exponential backoff between requests.\n\nOnly the following error types are retried:\n\n- Connection errors (for example, due to a network connectivity problem)\n- 408 Request Timeout\n- 409 Conflict\n- 429 Rate Limit\n- 5xx Internal\n\nThe API may also explicitly instruct the SDK to retry or not retry a request.\n\nTo set a custom number of retries, configure the client using the `maxRetries` method:\n\n```java\nimport dev.knopitoshka.client.SpotlessClient;\nimport dev.knopitoshka.client.okhttp.SpotlessOkHttpClient;\n\nSpotlessClient client = SpotlessOkHttpClient.builder()\n    .fromEnv()\n    .maxRetries(4)\n    .build();\n```\n\n### Timeouts\n\nRequests time out after 1 minute by default.\n\nTo set a custom timeout, configure the method call using the `timeout` method:\n\n```java\nimport dev.knopitoshka.models.games.GameStartResponse;\n\nGameStartResponse response = client.games().start(RequestOptions.builder().timeout(Duration.ofSeconds(30)).build());\n```\n\nOr configure the default for all method calls at the client level:\n\n```java\nimport dev.knopitoshka.client.SpotlessClient;\nimport dev.knopitoshka.client.okhttp.SpotlessOkHttpClient;\nimport java.time.Duration;\n\nSpotlessClient client = SpotlessOkHttpClient.builder()\n    .fromEnv()\n    .timeout(Duration.ofSeconds(30))\n    .build();\n```\n\n### Proxies\n\nTo route requests through a proxy, configure the client using the `proxy` method:\n\n```java\nimport dev.knopitoshka.client.SpotlessClient;\nimport dev.knopitoshka.client.okhttp.SpotlessOkHttpClient;\nimport java.net.InetSocketAddress;\nimport java.net.Proxy;\n\nSpotlessClient client = SpotlessOkHttpClient.builder()\n    .fromEnv()\n    .proxy(new Proxy(\n      Proxy.Type.HTTP, new InetSocketAddress(\n        \"https://example.com\", 8080\n      )\n    ))\n    .build();\n```\n\n### HTTPS\n\n\u003e [!NOTE]\n\u003e Most applications should not call these methods, and instead use the system defaults. The defaults include\n\u003e special optimizations that can be lost if the implementations are modified.\n\nTo configure how HTTPS connections are secured, configure the client using the `sslSocketFactory`, `trustManager`, and `hostnameVerifier` methods:\n\n```java\nimport dev.knopitoshka.client.SpotlessClient;\nimport dev.knopitoshka.client.okhttp.SpotlessOkHttpClient;\n\nSpotlessClient client = SpotlessOkHttpClient.builder()\n    .fromEnv()\n    // If `sslSocketFactory` is set, then `trustManager` must be set, and vice versa.\n    .sslSocketFactory(yourSSLSocketFactory)\n    .trustManager(yourTrustManager)\n    .hostnameVerifier(yourHostnameVerifier)\n    .build();\n```\n\n### Custom HTTP client\n\nThe SDK consists of three artifacts:\n\n- `spotless-java-core`\n  - Contains core SDK logic\n  - Does not depend on [OkHttp](https://square.github.io/okhttp)\n  - Exposes [`SpotlessClient`](spotless-java-core/src/main/kotlin/dev/knopitoshka/client/SpotlessClient.kt), [`SpotlessClientAsync`](spotless-java-core/src/main/kotlin/dev/knopitoshka/client/SpotlessClientAsync.kt), [`SpotlessClientImpl`](spotless-java-core/src/main/kotlin/dev/knopitoshka/client/SpotlessClientImpl.kt), and [`SpotlessClientAsyncImpl`](spotless-java-core/src/main/kotlin/dev/knopitoshka/client/SpotlessClientAsyncImpl.kt), all of which can work with any HTTP client\n- `spotless-java-client-okhttp`\n  - Depends on [OkHttp](https://square.github.io/okhttp)\n  - Exposes [`SpotlessOkHttpClient`](spotless-java-client-okhttp/src/main/kotlin/dev/knopitoshka/client/okhttp/SpotlessOkHttpClient.kt) and [`SpotlessOkHttpClientAsync`](spotless-java-client-okhttp/src/main/kotlin/dev/knopitoshka/client/okhttp/SpotlessOkHttpClientAsync.kt), which provide a way to construct [`SpotlessClientImpl`](spotless-java-core/src/main/kotlin/dev/knopitoshka/client/SpotlessClientImpl.kt) and [`SpotlessClientAsyncImpl`](spotless-java-core/src/main/kotlin/dev/knopitoshka/client/SpotlessClientAsyncImpl.kt), respectively, using OkHttp\n- `spotless-java`\n  - Depends on and exposes the APIs of both `spotless-java-core` and `spotless-java-client-okhttp`\n  - Does not have its own logic\n\nThis structure allows replacing the SDK's default HTTP client without pulling in unnecessary dependencies.\n\n#### Customized [`OkHttpClient`](https://square.github.io/okhttp/3.x/okhttp/okhttp3/OkHttpClient.html)\n\n\u003e [!TIP]\n\u003e Try the available [network options](#network-options) before replacing the default client.\n\nTo use a customized `OkHttpClient`:\n\n1. Replace your [`spotless-java` dependency](#installation) with `spotless-java-core`\n2. Copy `spotless-java-client-okhttp`'s [`OkHttpClient`](spotless-java-client-okhttp/src/main/kotlin/dev/knopitoshka/client/okhttp/OkHttpClient.kt) class into your code and customize it\n3. Construct [`SpotlessClientImpl`](spotless-java-core/src/main/kotlin/dev/knopitoshka/client/SpotlessClientImpl.kt) or [`SpotlessClientAsyncImpl`](spotless-java-core/src/main/kotlin/dev/knopitoshka/client/SpotlessClientAsyncImpl.kt), similarly to [`SpotlessOkHttpClient`](spotless-java-client-okhttp/src/main/kotlin/dev/knopitoshka/client/okhttp/SpotlessOkHttpClient.kt) or [`SpotlessOkHttpClientAsync`](spotless-java-client-okhttp/src/main/kotlin/dev/knopitoshka/client/okhttp/SpotlessOkHttpClientAsync.kt), using your customized client\n\n### Completely custom HTTP client\n\nTo use a completely custom HTTP client:\n\n1. Replace your [`spotless-java` dependency](#installation) with `spotless-java-core`\n2. Write a class that implements the [`HttpClient`](spotless-java-core/src/main/kotlin/dev/knopitoshka/core/http/HttpClient.kt) interface\n3. Construct [`SpotlessClientImpl`](spotless-java-core/src/main/kotlin/dev/knopitoshka/client/SpotlessClientImpl.kt) or [`SpotlessClientAsyncImpl`](spotless-java-core/src/main/kotlin/dev/knopitoshka/client/SpotlessClientAsyncImpl.kt), similarly to [`SpotlessOkHttpClient`](spotless-java-client-okhttp/src/main/kotlin/dev/knopitoshka/client/okhttp/SpotlessOkHttpClient.kt) or [`SpotlessOkHttpClientAsync`](spotless-java-client-okhttp/src/main/kotlin/dev/knopitoshka/client/okhttp/SpotlessOkHttpClientAsync.kt), using your new client class\n\n## Undocumented API functionality\n\nThe SDK is typed for convenient usage of the documented API. However, it also supports working with undocumented or not yet supported parts of the API.\n\n### Parameters\n\nTo set undocumented parameters, call the `putAdditionalHeader`, `putAdditionalQueryParam`, or `putAdditionalBodyProperty` methods on any `Params` class:\n\n```java\nimport dev.knopitoshka.core.JsonValue;\nimport dev.knopitoshka.models.games.GameStartParams;\n\nGameStartParams params = GameStartParams.builder()\n    .putAdditionalHeader(\"Secret-Header\", \"42\")\n    .putAdditionalQueryParam(\"secret_query_param\", \"42\")\n    .putAdditionalBodyProperty(\"secretProperty\", JsonValue.from(\"42\"))\n    .build();\n```\n\nThese can be accessed on the built object later using the `_additionalHeaders()`, `_additionalQueryParams()`, and `_additionalBodyProperties()` methods.\n\nTo set a documented parameter or property to an undocumented or not yet supported _value_, pass a [`JsonValue`](spotless-java-core/src/main/kotlin/dev/knopitoshka/core/Values.kt) object to its setter:\n\n```java\nimport dev.knopitoshka.models.games.GameStartParams;\n\nGameStartParams params = GameStartParams.builder().build();\n```\n\nThe most straightforward way to create a [`JsonValue`](spotless-java-core/src/main/kotlin/dev/knopitoshka/core/Values.kt) is using its `from(...)` method:\n\n```java\nimport dev.knopitoshka.core.JsonValue;\nimport java.util.List;\nimport java.util.Map;\n\n// Create primitive JSON values\nJsonValue nullValue = JsonValue.from(null);\nJsonValue booleanValue = JsonValue.from(true);\nJsonValue numberValue = JsonValue.from(42);\nJsonValue stringValue = JsonValue.from(\"Hello World!\");\n\n// Create a JSON array value equivalent to `[\"Hello\", \"World\"]`\nJsonValue arrayValue = JsonValue.from(List.of(\n  \"Hello\", \"World\"\n));\n\n// Create a JSON object value equivalent to `{ \"a\": 1, \"b\": 2 }`\nJsonValue objectValue = JsonValue.from(Map.of(\n  \"a\", 1,\n  \"b\", 2\n));\n\n// Create an arbitrarily nested JSON equivalent to:\n// {\n//   \"a\": [1, 2],\n//   \"b\": [3, 4]\n// }\nJsonValue complexValue = JsonValue.from(Map.of(\n  \"a\", List.of(\n    1, 2\n  ),\n  \"b\", List.of(\n    3, 4\n  )\n));\n```\n\n### Response properties\n\nTo access undocumented response properties, call the `_additionalProperties()` method:\n\n```java\nimport dev.knopitoshka.core.JsonValue;\nimport java.util.Map;\n\nMap\u003cString, JsonValue\u003e additionalProperties = client.games().start(params)._additionalProperties();\nJsonValue secretPropertyValue = additionalProperties.get(\"secretProperty\");\n\nString result = secretPropertyValue.accept(new JsonValue.Visitor\u003c\u003e() {\n    @Override\n    public String visitNull() {\n        return \"It's null!\";\n    }\n\n    @Override\n    public String visitBoolean(boolean value) {\n        return \"It's a boolean!\";\n    }\n\n    @Override\n    public String visitNumber(Number value) {\n        return \"It's a number!\";\n    }\n\n    // Other methods include `visitMissing`, `visitString`, `visitArray`, and `visitObject`\n    // The default implementation of each unimplemented method delegates to `visitDefault`, which throws by default, but can also be overridden\n});\n```\n\nTo access a property's raw JSON value, which may be undocumented, call its `_` prefixed method:\n\n```java\nimport dev.knopitoshka.core.JsonField;\nimport dev.knopitoshka.models.games.GameStartParams;\nimport java.util.Optional;\n\nJsonField\u003cGameStartParams.PlayAs\u003e playAs = client.games().start(params)._playAs();\n\nif (playAs.isMissing()) {\n  // The property is absent from the JSON response\n} else if (playAs.isNull()) {\n  // The property was set to literal null\n} else {\n  // Check if value was provided as a string\n  // Other methods include `asNumber()`, `asBoolean()`, etc.\n  Optional\u003cString\u003e jsonString = playAs.asString();\n\n  // Try to deserialize into a custom type\n  MyClass myObject = playAs.asUnknown().orElseThrow().convert(MyClass.class);\n}\n```\n\n### Response validation\n\nIn rare cases, the API may return a response that doesn't match the expected type. For example, the SDK may expect a property to contain a `String`, but the API could return something else.\n\nBy default, the SDK will not throw an exception in this case. It will throw [`SpotlessInvalidDataException`](spotless-java-core/src/main/kotlin/dev/knopitoshka/errors/SpotlessInvalidDataException.kt) only if you directly access the property.\n\nIf you would prefer to check that the response is completely well-typed upfront, then either call `validate()`:\n\n```java\nimport dev.knopitoshka.models.games.GameStartResponse;\n\nGameStartResponse response = client.games().start(params).validate();\n```\n\nOr configure the method call to validate the response using the `responseValidation` method:\n\n```java\nimport dev.knopitoshka.models.games.GameStartResponse;\n\nGameStartResponse response = client.games().start(RequestOptions.builder().responseValidation(true).build());\n```\n\nOr configure the default for all method calls at the client level:\n\n```java\nimport dev.knopitoshka.client.SpotlessClient;\nimport dev.knopitoshka.client.okhttp.SpotlessOkHttpClient;\n\nSpotlessClient client = SpotlessOkHttpClient.builder()\n    .fromEnv()\n    .responseValidation(true)\n    .build();\n```\n\n## FAQ\n\n### Why don't you use plain `enum` classes?\n\nJava `enum` classes are not trivially [forwards compatible](https://www.stainless.com/blog/making-java-enums-forwards-compatible). Using them in the SDK could cause runtime exceptions if the API is updated to respond with a new enum value.\n\n### Why do you represent fields using `JsonField\u003cT\u003e` instead of just plain `T`?\n\nUsing `JsonField\u003cT\u003e` enables a few features:\n\n- Allowing usage of [undocumented API functionality](#undocumented-api-functionality)\n- Lazily [validating the API response against the expected shape](#response-validation)\n- Representing absent vs explicitly null values\n\n### Why don't you use [`data` classes](https://kotlinlang.org/docs/data-classes.html)?\n\nIt is not [backwards compatible to add new fields to a data class](https://kotlinlang.org/docs/api-guidelines-backward-compatibility.html#avoid-using-data-classes-in-your-api) and we don't want to introduce a breaking change every time we add a field to a class.\n\n### Why don't you use checked exceptions?\n\nChecked exceptions are widely considered a mistake in the Java programming language. In fact, they were omitted from Kotlin for this reason.\n\nChecked exceptions:\n\n- Are verbose to handle\n- Encourage error handling at the wrong level of abstraction, where nothing can be done about the error\n- Are tedious to propagate due to the [function coloring problem](https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function)\n- Don't play well with lambdas (also due to the function coloring problem)\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n2. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/stainless-sdks/spotless-java/issues) with questions, bugs, or suggestions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimasmith%2Fspotless-java-api-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdimasmith%2Fspotless-java-api-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimasmith%2Fspotless-java-api-client/lists"}