diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 6b7b74c..da59f99 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.3.0"
+ ".": "0.4.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 32808d2..b880d0c 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 17
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cas-parser%2Fcas-parser-56b0f699c5437d9e5326626d35dfc972c17d01f12cb416c7f4854c8ea6d0e95e.yml
-openapi_spec_hash: 158f405c1880706266d83e6ff16b9d2f
-config_hash: ab495a165f0919b37cbf9efbd0f0e6ef
+configured_endpoints: 12
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cas-parser%2Fcas-parser-d9763d006969b49a1473851069fdfa429eb13133b64103a62963bb70ddb22305.yml
+openapi_spec_hash: 6aee689b7a759b12c85c088c15e29bc0
+config_hash: 41c337f5cda03b13880617490f82bad0
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 19f5970..6504a1a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,24 @@
# Changelog
+## 0.4.0 (2026-02-23)
+
+Full Changelog: [v0.3.0...v0.4.0](https://github.com/CASParser/cas-parser-java/compare/v0.3.0...v0.4.0)
+
+### Features
+
+* **api:** api update ([b23e224](https://github.com/CASParser/cas-parser-java/commit/b23e22466dac01c31d286182542dc8146d5fac7d))
+* **api:** api update ([cfdb276](https://github.com/CASParser/cas-parser-java/commit/cfdb276b8126bf167b489ded6fc13d84ad876dad))
+* **api:** api update ([8d2cb43](https://github.com/CASParser/cas-parser-java/commit/8d2cb43b11b1923624fdc32f7433115f5b20cf37))
+* **client:** add connection pooling option ([3ad0fbc](https://github.com/CASParser/cas-parser-java/commit/3ad0fbcafa782f6f7dfcead9d4c4646aedd4e681))
+
+
+### Chores
+
+* **internal:** make `OkHttp` constructor internal ([1939ec1](https://github.com/CASParser/cas-parser-java/commit/1939ec1346feeb7a1ea45db385d6f8b7f8daacf6))
+* **internal:** remove mock server code ([0bdc28f](https://github.com/CASParser/cas-parser-java/commit/0bdc28fc1a9ae2e735d2c40d9cf86c1dc00461ae))
+* **internal:** update `TestServerExtension` comment ([ff77ead](https://github.com/CASParser/cas-parser-java/commit/ff77ead512a0b13377c61c0e92cc478586e7a67e))
+* update mock server docs ([e7286da](https://github.com/CASParser/cas-parser-java/commit/e7286da78e71c2750514686fb39e2b1a0b5140af))
+
## 0.3.0 (2026-02-14)
Full Changelog: [v0.2.1...v0.3.0](https://github.com/CASParser/cas-parser-java/compare/v0.2.1...v0.3.0)
diff --git a/README.md b/README.md
index c55a4ea..8fe2679 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/com.cas_parser.api/cas-parser-java/0.3.0)
-[](https://javadoc.io/doc/com.cas_parser.api/cas-parser-java/0.3.0)
+[](https://central.sonatype.com/artifact/com.cas_parser.api/cas-parser-java/0.4.0)
+[](https://javadoc.io/doc/com.cas_parser.api/cas-parser-java/0.4.0)
@@ -22,7 +22,7 @@ Use the Cas Parser MCP Server to enable AI assistants to interact with this API,
-The REST API documentation can be found on [docs.casparser.in](https://docs.casparser.in). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.cas_parser.api/cas-parser-java/0.3.0).
+The REST API documentation can be found on [docs.casparser.in](https://docs.casparser.in). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.cas_parser.api/cas-parser-java/0.4.0).
@@ -33,7 +33,7 @@ The REST API documentation can be found on [docs.casparser.in](https://docs.casp
### Gradle
```kotlin
-implementation("com.cas_parser.api:cas-parser-java:0.3.0")
+implementation("com.cas_parser.api:cas-parser-java:0.4.0")
```
### Maven
@@ -42,7 +42,7 @@ implementation("com.cas_parser.api:cas-parser-java:0.3.0")
com.cas_parser.api
cas-parser-java
- 0.3.0
+ 0.4.0
```
@@ -57,14 +57,14 @@ This library requires Java 8 or later.
```java
import com.cas_parser.api.client.CasParserClient;
import com.cas_parser.api.client.okhttp.CasParserOkHttpClient;
-import com.cas_parser.api.models.credits.CreditCheckParams;
-import com.cas_parser.api.models.credits.CreditCheckResponse;
+import com.cas_parser.api.models.camskfintech.CamsKfintechParseParams;
+import com.cas_parser.api.models.camskfintech.UnifiedResponse;
// Configures using the `casparser.apiKey` and `casparser.baseUrl` system properties
// Or configures using the `CAS_PARSER_API_KEY` and `CAS_PARSER_BASE_URL` environment variables
CasParserClient client = CasParserOkHttpClient.fromEnv();
-CreditCheckResponse response = client.credits().check();
+UnifiedResponse unifiedResponse = client.camsKfintech().parse();
```
## Client configuration
@@ -137,7 +137,7 @@ The `withOptions()` method does not affect the original client or service.
To send a request to the Cas Parser 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.
-For example, `client.credits().check(...)` should be called with an instance of `CreditCheckParams`, and it will return an instance of `CreditCheckResponse`.
+For example, `client.camsKfintech().parse(...)` should be called with an instance of `CamsKfintechParseParams`, and it will return an instance of `UnifiedResponse`.
## Immutability
@@ -154,15 +154,15 @@ The default client is synchronous. To switch to asynchronous execution, call the
```java
import com.cas_parser.api.client.CasParserClient;
import com.cas_parser.api.client.okhttp.CasParserOkHttpClient;
-import com.cas_parser.api.models.credits.CreditCheckParams;
-import com.cas_parser.api.models.credits.CreditCheckResponse;
+import com.cas_parser.api.models.camskfintech.CamsKfintechParseParams;
+import com.cas_parser.api.models.camskfintech.UnifiedResponse;
import java.util.concurrent.CompletableFuture;
// Configures using the `casparser.apiKey` and `casparser.baseUrl` system properties
// Or configures using the `CAS_PARSER_API_KEY` and `CAS_PARSER_BASE_URL` environment variables
CasParserClient client = CasParserOkHttpClient.fromEnv();
-CompletableFuture response = client.async().credits().check();
+CompletableFuture unifiedResponse = client.async().camsKfintech().parse();
```
Or create an asynchronous client from the beginning:
@@ -170,15 +170,15 @@ Or create an asynchronous client from the beginning:
```java
import com.cas_parser.api.client.CasParserClientAsync;
import com.cas_parser.api.client.okhttp.CasParserOkHttpClientAsync;
-import com.cas_parser.api.models.credits.CreditCheckParams;
-import com.cas_parser.api.models.credits.CreditCheckResponse;
+import com.cas_parser.api.models.camskfintech.CamsKfintechParseParams;
+import com.cas_parser.api.models.camskfintech.UnifiedResponse;
import java.util.concurrent.CompletableFuture;
// Configures using the `casparser.apiKey` and `casparser.baseUrl` system properties
// Or configures using the `CAS_PARSER_API_KEY` and `CAS_PARSER_BASE_URL` environment variables
CasParserClientAsync client = CasParserOkHttpClientAsync.fromEnv();
-CompletableFuture response = client.credits().check();
+CompletableFuture unifiedResponse = client.camsKfintech().parse();
```
The asynchronous client supports the same options as the synchronous one, except most methods return `CompletableFuture`s.
@@ -192,21 +192,21 @@ To access this data, prefix any HTTP method call on a client or service with `wi
```java
import com.cas_parser.api.core.http.Headers;
import com.cas_parser.api.core.http.HttpResponseFor;
-import com.cas_parser.api.models.credits.CreditCheckParams;
-import com.cas_parser.api.models.credits.CreditCheckResponse;
+import com.cas_parser.api.models.camskfintech.CamsKfintechParseParams;
+import com.cas_parser.api.models.camskfintech.UnifiedResponse;
-HttpResponseFor response = client.credits().withRawResponse().check();
+HttpResponseFor unifiedResponse = client.camsKfintech().withRawResponse().parse();
-int statusCode = response.statusCode();
-Headers headers = response.headers();
+int statusCode = unifiedResponse.statusCode();
+Headers headers = unifiedResponse.headers();
```
You can still deserialize the response into an instance of a Java class if needed:
```java
-import com.cas_parser.api.models.credits.CreditCheckResponse;
+import com.cas_parser.api.models.camskfintech.UnifiedResponse;
-CreditCheckResponse parsedResponse = response.parse();
+UnifiedResponse parsedUnifiedResponse = unifiedResponse.parse();
```
## Error handling
@@ -304,9 +304,9 @@ Requests time out after 1 minute by default.
To set a custom timeout, configure the method call using the `timeout` method:
```java
-import com.cas_parser.api.models.credits.CreditCheckResponse;
+import com.cas_parser.api.models.camskfintech.UnifiedResponse;
-CreditCheckResponse response = client.credits().check(RequestOptions.builder().timeout(Duration.ofSeconds(30)).build());
+UnifiedResponse unifiedResponse = client.camsKfintech().parse(RequestOptions.builder().timeout(Duration.ofSeconds(30)).build());
```
Or configure the default for all method calls at the client level:
@@ -342,6 +342,25 @@ CasParserClient client = CasParserOkHttpClient.builder()
.build();
```
+### Connection pooling
+
+To customize the underlying OkHttp connection pool, configure the client using the `maxIdleConnections` and `keepAliveDuration` methods:
+
+```java
+import com.cas_parser.api.client.CasParserClient;
+import com.cas_parser.api.client.okhttp.CasParserOkHttpClient;
+import java.time.Duration;
+
+CasParserClient client = CasParserOkHttpClient.builder()
+ .fromEnv()
+ // If `maxIdleConnections` is set, then `keepAliveDuration` must be set, and vice versa.
+ .maxIdleConnections(10)
+ .keepAliveDuration(Duration.ofMinutes(2))
+ .build();
+```
+
+If both options are unset, OkHttp's default connection pool settings are used.
+
### HTTPS
> [!NOTE]
@@ -424,9 +443,9 @@ To set undocumented parameters, call the `putAdditionalHeader`, `putAdditionalQu
```java
import com.cas_parser.api.core.JsonValue;
-import com.cas_parser.api.models.credits.CreditCheckParams;
+import com.cas_parser.api.models.camskfintech.CamsKfintechParseParams;
-CreditCheckParams params = CreditCheckParams.builder()
+CamsKfintechParseParams params = CamsKfintechParseParams.builder()
.putAdditionalHeader("Secret-Header", "42")
.putAdditionalQueryParam("secret_query_param", "42")
.putAdditionalBodyProperty("secretProperty", JsonValue.from("42"))
@@ -438,9 +457,9 @@ These can be accessed on the built object later using the `_additionalHeaders()`
To set a documented parameter or property to an undocumented or not yet supported _value_, pass a [`JsonValue`](cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/Values.kt) object to its setter:
```java
-import com.cas_parser.api.models.credits.CreditCheckParams;
+import com.cas_parser.api.models.camskfintech.CamsKfintechParseParams;
-CreditCheckParams params = CreditCheckParams.builder().build();
+CamsKfintechParseParams params = CamsKfintechParseParams.builder().build();
```
The most straightforward way to create a [`JsonValue`](cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/Values.kt) is using its `from(...)` method:
@@ -488,10 +507,10 @@ To forcibly omit a required parameter or property, pass [`JsonMissing`](cas-pars
```java
import com.cas_parser.api.core.JsonMissing;
+import com.cas_parser.api.models.camskfintech.CamsKfintechParseParams;
import com.cas_parser.api.models.cdsl.fetch.FetchRequestOtpParams;
-import com.cas_parser.api.models.credits.CreditCheckParams;
-CreditCheckParams params = FetchRequestOtpParams.builder()
+CamsKfintechParseParams params = FetchRequestOtpParams.builder()
.dob("1990-01-15")
.pan("ABCDE1234F")
.boId(JsonMissing.of())
@@ -506,7 +525,7 @@ To access undocumented response properties, call the `_additionalProperties()` m
import com.cas_parser.api.core.JsonValue;
import java.util.Map;
-Map additionalProperties = client.credits().check(params)._additionalProperties();
+Map additionalProperties = client.camsKfintech().parse(params)._additionalProperties();
JsonValue secretPropertyValue = additionalProperties.get("secretProperty");
String result = secretPropertyValue.accept(new JsonValue.Visitor<>() {
@@ -536,19 +555,19 @@ To access a property's raw JSON value, which may be undocumented, call its `_` p
import com.cas_parser.api.core.JsonField;
import java.util.Optional;
-JsonField field = client.credits().check(params)._field();
+JsonField password = client.camsKfintech().parse(params)._password();
-if (field.isMissing()) {
+if (password.isMissing()) {
// The property is absent from the JSON response
-} else if (field.isNull()) {
+} else if (password.isNull()) {
// The property was set to literal null
} else {
// Check if value was provided as a string
// Other methods include `asNumber()`, `asBoolean()`, etc.
- Optional jsonString = field.asString();
+ Optional jsonString = password.asString();
// Try to deserialize into a custom type
- MyClass myObject = field.asUnknown().orElseThrow().convert(MyClass.class);
+ MyClass myObject = password.asUnknown().orElseThrow().convert(MyClass.class);
}
```
@@ -561,17 +580,17 @@ By default, the SDK will not throw an exception in this case. It will throw [`Ca
If you would prefer to check that the response is completely well-typed upfront, then either call `validate()`:
```java
-import com.cas_parser.api.models.credits.CreditCheckResponse;
+import com.cas_parser.api.models.camskfintech.UnifiedResponse;
-CreditCheckResponse response = client.credits().check(params).validate();
+UnifiedResponse unifiedResponse = client.camsKfintech().parse(params).validate();
```
Or configure the method call to validate the response using the `responseValidation` method:
```java
-import com.cas_parser.api.models.credits.CreditCheckResponse;
+import com.cas_parser.api.models.camskfintech.UnifiedResponse;
-CreditCheckResponse response = client.credits().check(RequestOptions.builder().responseValidation(true).build());
+UnifiedResponse unifiedResponse = client.camsKfintech().parse(RequestOptions.builder().responseValidation(true).build());
```
Or configure the default for all method calls at the client level:
diff --git a/build.gradle.kts b/build.gradle.kts
index 90d29ec..40e9f7a 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -9,7 +9,7 @@ repositories {
allprojects {
group = "com.cas_parser.api"
- version = "0.3.0" // x-release-please-version
+ version = "0.4.0" // x-release-please-version
}
subprojects {
diff --git a/cas-parser-java-client-okhttp/src/main/kotlin/com/cas_parser/api/client/okhttp/CasParserOkHttpClient.kt b/cas-parser-java-client-okhttp/src/main/kotlin/com/cas_parser/api/client/okhttp/CasParserOkHttpClient.kt
index dc713f6..417682f 100644
--- a/cas-parser-java-client-okhttp/src/main/kotlin/com/cas_parser/api/client/okhttp/CasParserOkHttpClient.kt
+++ b/cas-parser-java-client-okhttp/src/main/kotlin/com/cas_parser/api/client/okhttp/CasParserOkHttpClient.kt
@@ -47,6 +47,8 @@ class CasParserOkHttpClient private constructor() {
private var clientOptions: ClientOptions.Builder = ClientOptions.builder()
private var dispatcherExecutorService: ExecutorService? = null
private var proxy: Proxy? = null
+ private var maxIdleConnections: Int? = null
+ private var keepAliveDuration: Duration? = null
private var sslSocketFactory: SSLSocketFactory? = null
private var trustManager: X509TrustManager? = null
private var hostnameVerifier: HostnameVerifier? = null
@@ -75,6 +77,46 @@ class CasParserOkHttpClient private constructor() {
/** Alias for calling [Builder.proxy] with `proxy.orElse(null)`. */
fun proxy(proxy: Optional) = proxy(proxy.getOrNull())
+ /**
+ * The maximum number of idle connections kept by the underlying OkHttp connection pool.
+ *
+ * If this is set, then [keepAliveDuration] must also be set.
+ *
+ * If unset, then OkHttp's default is used.
+ */
+ fun maxIdleConnections(maxIdleConnections: Int?) = apply {
+ this.maxIdleConnections = maxIdleConnections
+ }
+
+ /**
+ * Alias for [Builder.maxIdleConnections].
+ *
+ * This unboxed primitive overload exists for backwards compatibility.
+ */
+ fun maxIdleConnections(maxIdleConnections: Int) =
+ maxIdleConnections(maxIdleConnections as Int?)
+
+ /**
+ * Alias for calling [Builder.maxIdleConnections] with `maxIdleConnections.orElse(null)`.
+ */
+ fun maxIdleConnections(maxIdleConnections: Optional) =
+ maxIdleConnections(maxIdleConnections.getOrNull())
+
+ /**
+ * The keep-alive duration for idle connections in the underlying OkHttp connection pool.
+ *
+ * If this is set, then [maxIdleConnections] must also be set.
+ *
+ * If unset, then OkHttp's default is used.
+ */
+ fun keepAliveDuration(keepAliveDuration: Duration?) = apply {
+ this.keepAliveDuration = keepAliveDuration
+ }
+
+ /** Alias for calling [Builder.keepAliveDuration] with `keepAliveDuration.orElse(null)`. */
+ fun keepAliveDuration(keepAliveDuration: Optional) =
+ keepAliveDuration(keepAliveDuration.getOrNull())
+
/**
* The socket factory used to secure HTTPS connections.
*
@@ -328,6 +370,8 @@ class CasParserOkHttpClient private constructor() {
OkHttpClient.builder()
.timeout(clientOptions.timeout())
.proxy(proxy)
+ .maxIdleConnections(maxIdleConnections)
+ .keepAliveDuration(keepAliveDuration)
.dispatcherExecutorService(dispatcherExecutorService)
.sslSocketFactory(sslSocketFactory)
.trustManager(trustManager)
diff --git a/cas-parser-java-client-okhttp/src/main/kotlin/com/cas_parser/api/client/okhttp/CasParserOkHttpClientAsync.kt b/cas-parser-java-client-okhttp/src/main/kotlin/com/cas_parser/api/client/okhttp/CasParserOkHttpClientAsync.kt
index 5d4beab..e83fa10 100644
--- a/cas-parser-java-client-okhttp/src/main/kotlin/com/cas_parser/api/client/okhttp/CasParserOkHttpClientAsync.kt
+++ b/cas-parser-java-client-okhttp/src/main/kotlin/com/cas_parser/api/client/okhttp/CasParserOkHttpClientAsync.kt
@@ -47,6 +47,8 @@ class CasParserOkHttpClientAsync private constructor() {
private var clientOptions: ClientOptions.Builder = ClientOptions.builder()
private var dispatcherExecutorService: ExecutorService? = null
private var proxy: Proxy? = null
+ private var maxIdleConnections: Int? = null
+ private var keepAliveDuration: Duration? = null
private var sslSocketFactory: SSLSocketFactory? = null
private var trustManager: X509TrustManager? = null
private var hostnameVerifier: HostnameVerifier? = null
@@ -75,6 +77,46 @@ class CasParserOkHttpClientAsync private constructor() {
/** Alias for calling [Builder.proxy] with `proxy.orElse(null)`. */
fun proxy(proxy: Optional) = proxy(proxy.getOrNull())
+ /**
+ * The maximum number of idle connections kept by the underlying OkHttp connection pool.
+ *
+ * If this is set, then [keepAliveDuration] must also be set.
+ *
+ * If unset, then OkHttp's default is used.
+ */
+ fun maxIdleConnections(maxIdleConnections: Int?) = apply {
+ this.maxIdleConnections = maxIdleConnections
+ }
+
+ /**
+ * Alias for [Builder.maxIdleConnections].
+ *
+ * This unboxed primitive overload exists for backwards compatibility.
+ */
+ fun maxIdleConnections(maxIdleConnections: Int) =
+ maxIdleConnections(maxIdleConnections as Int?)
+
+ /**
+ * Alias for calling [Builder.maxIdleConnections] with `maxIdleConnections.orElse(null)`.
+ */
+ fun maxIdleConnections(maxIdleConnections: Optional) =
+ maxIdleConnections(maxIdleConnections.getOrNull())
+
+ /**
+ * The keep-alive duration for idle connections in the underlying OkHttp connection pool.
+ *
+ * If this is set, then [maxIdleConnections] must also be set.
+ *
+ * If unset, then OkHttp's default is used.
+ */
+ fun keepAliveDuration(keepAliveDuration: Duration?) = apply {
+ this.keepAliveDuration = keepAliveDuration
+ }
+
+ /** Alias for calling [Builder.keepAliveDuration] with `keepAliveDuration.orElse(null)`. */
+ fun keepAliveDuration(keepAliveDuration: Optional) =
+ keepAliveDuration(keepAliveDuration.getOrNull())
+
/**
* The socket factory used to secure HTTPS connections.
*
@@ -328,6 +370,8 @@ class CasParserOkHttpClientAsync private constructor() {
OkHttpClient.builder()
.timeout(clientOptions.timeout())
.proxy(proxy)
+ .maxIdleConnections(maxIdleConnections)
+ .keepAliveDuration(keepAliveDuration)
.dispatcherExecutorService(dispatcherExecutorService)
.sslSocketFactory(sslSocketFactory)
.trustManager(trustManager)
diff --git a/cas-parser-java-client-okhttp/src/main/kotlin/com/cas_parser/api/client/okhttp/OkHttpClient.kt b/cas-parser-java-client-okhttp/src/main/kotlin/com/cas_parser/api/client/okhttp/OkHttpClient.kt
index 7079d3c..7bc37ab 100644
--- a/cas-parser-java-client-okhttp/src/main/kotlin/com/cas_parser/api/client/okhttp/OkHttpClient.kt
+++ b/cas-parser-java-client-okhttp/src/main/kotlin/com/cas_parser/api/client/okhttp/OkHttpClient.kt
@@ -16,11 +16,13 @@ import java.time.Duration
import java.util.concurrent.CancellationException
import java.util.concurrent.CompletableFuture
import java.util.concurrent.ExecutorService
+import java.util.concurrent.TimeUnit
import javax.net.ssl.HostnameVerifier
import javax.net.ssl.SSLSocketFactory
import javax.net.ssl.X509TrustManager
import okhttp3.Call
import okhttp3.Callback
+import okhttp3.ConnectionPool
import okhttp3.Dispatcher
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.MediaType
@@ -33,7 +35,7 @@ import okhttp3.logging.HttpLoggingInterceptor
import okio.BufferedSink
class OkHttpClient
-private constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClient) : HttpClient {
+internal constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClient) : HttpClient {
override fun execute(request: HttpRequest, requestOptions: RequestOptions): HttpResponse {
val call = newCall(request, requestOptions)
@@ -200,6 +202,8 @@ private constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClien
private var timeout: Timeout = Timeout.default()
private var proxy: Proxy? = null
+ private var maxIdleConnections: Int? = null
+ private var keepAliveDuration: Duration? = null
private var dispatcherExecutorService: ExecutorService? = null
private var sslSocketFactory: SSLSocketFactory? = null
private var trustManager: X509TrustManager? = null
@@ -211,6 +215,28 @@ private constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClien
fun proxy(proxy: Proxy?) = apply { this.proxy = proxy }
+ /**
+ * Sets the maximum number of idle connections kept by the underlying [ConnectionPool].
+ *
+ * If this is set, then [keepAliveDuration] must also be set.
+ *
+ * If unset, then OkHttp's default is used.
+ */
+ fun maxIdleConnections(maxIdleConnections: Int?) = apply {
+ this.maxIdleConnections = maxIdleConnections
+ }
+
+ /**
+ * Sets the keep-alive duration for idle connections in the underlying [ConnectionPool].
+ *
+ * If this is set, then [maxIdleConnections] must also be set.
+ *
+ * If unset, then OkHttp's default is used.
+ */
+ fun keepAliveDuration(keepAliveDuration: Duration?) = apply {
+ this.keepAliveDuration = keepAliveDuration
+ }
+
fun dispatcherExecutorService(dispatcherExecutorService: ExecutorService?) = apply {
this.dispatcherExecutorService = dispatcherExecutorService
}
@@ -240,6 +266,22 @@ private constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClien
.apply {
dispatcherExecutorService?.let { dispatcher(Dispatcher(it)) }
+ val maxIdleConnections = maxIdleConnections
+ val keepAliveDuration = keepAliveDuration
+ if (maxIdleConnections != null && keepAliveDuration != null) {
+ connectionPool(
+ ConnectionPool(
+ maxIdleConnections,
+ keepAliveDuration.toNanos(),
+ TimeUnit.NANOSECONDS,
+ )
+ )
+ } else {
+ check((maxIdleConnections != null) == (keepAliveDuration != null)) {
+ "Both or none of `maxIdleConnections` and `keepAliveDuration` must be set, but only one was set"
+ }
+ }
+
val sslSocketFactory = sslSocketFactory
val trustManager = trustManager
if (sslSocketFactory != null && trustManager != null) {
diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/accesstoken/AccessTokenCreateParams.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/accesstoken/AccessTokenCreateParams.kt
deleted file mode 100644
index 676dc4d..0000000
--- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/accesstoken/AccessTokenCreateParams.kt
+++ /dev/null
@@ -1,410 +0,0 @@
-// File generated from our OpenAPI spec by Stainless.
-
-package com.cas_parser.api.models.accesstoken
-
-import com.cas_parser.api.core.ExcludeMissing
-import com.cas_parser.api.core.JsonField
-import com.cas_parser.api.core.JsonMissing
-import com.cas_parser.api.core.JsonValue
-import com.cas_parser.api.core.Params
-import com.cas_parser.api.core.http.Headers
-import com.cas_parser.api.core.http.QueryParams
-import com.cas_parser.api.errors.CasParserInvalidDataException
-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 java.util.Collections
-import java.util.Objects
-import java.util.Optional
-
-/**
- * Generate a short-lived access token from your API key.
- *
- * **Use this endpoint from your backend** to create tokens that can be safely passed to
- * frontend/SDK.
- *
- * Access tokens:
- * - Are prefixed with `at_` for easy identification
- * - Valid for up to 60 minutes
- * - Can be used in place of API keys on all v4 endpoints
- * - Cannot be used to generate other access tokens
- */
-class AccessTokenCreateParams
-private constructor(
- private val body: Body,
- private val additionalHeaders: Headers,
- private val additionalQueryParams: QueryParams,
-) : Params {
-
- /**
- * Token validity in minutes (max 60)
- *
- * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun expiryMinutes(): Optional = body.expiryMinutes()
-
- /**
- * Returns the raw JSON value of [expiryMinutes].
- *
- * Unlike [expiryMinutes], this method doesn't throw if the JSON field has an unexpected type.
- */
- fun _expiryMinutes(): JsonField = body._expiryMinutes()
-
- 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(): AccessTokenCreateParams = builder().build()
-
- /** Returns a mutable builder for constructing an instance of [AccessTokenCreateParams]. */
- @JvmStatic fun builder() = Builder()
- }
-
- /** A builder for [AccessTokenCreateParams]. */
- 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(accessTokenCreateParams: AccessTokenCreateParams) = apply {
- body = accessTokenCreateParams.body.toBuilder()
- additionalHeaders = accessTokenCreateParams.additionalHeaders.toBuilder()
- additionalQueryParams = accessTokenCreateParams.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:
- * - [expiryMinutes]
- */
- fun body(body: Body) = apply { this.body = body.toBuilder() }
-
- /** Token validity in minutes (max 60) */
- fun expiryMinutes(expiryMinutes: Long) = apply { body.expiryMinutes(expiryMinutes) }
-
- /**
- * Sets [Builder.expiryMinutes] to an arbitrary JSON value.
- *
- * You should usually call [Builder.expiryMinutes] with a well-typed [Long] value instead.
- * This method is primarily for setting the field to an undocumented or not yet supported
- * value.
- */
- fun expiryMinutes(expiryMinutes: JsonField) = apply {
- body.expiryMinutes(expiryMinutes)
- }
-
- 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 [AccessTokenCreateParams].
- *
- * Further updates to this [Builder] will not mutate the returned instance.
- */
- fun build(): AccessTokenCreateParams =
- AccessTokenCreateParams(
- 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 expiryMinutes: JsonField,
- private val additionalProperties: MutableMap,
- ) {
-
- @JsonCreator
- private constructor(
- @JsonProperty("expiry_minutes")
- @ExcludeMissing
- expiryMinutes: JsonField = JsonMissing.of()
- ) : this(expiryMinutes, mutableMapOf())
-
- /**
- * Token validity in minutes (max 60)
- *
- * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if
- * the server responded with an unexpected value).
- */
- fun expiryMinutes(): Optional = expiryMinutes.getOptional("expiry_minutes")
-
- /**
- * Returns the raw JSON value of [expiryMinutes].
- *
- * Unlike [expiryMinutes], this method doesn't throw if the JSON field has an unexpected
- * type.
- */
- @JsonProperty("expiry_minutes")
- @ExcludeMissing
- fun _expiryMinutes(): JsonField = expiryMinutes
-
- @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 expiryMinutes: JsonField = JsonMissing.of()
- private var additionalProperties: MutableMap = mutableMapOf()
-
- @JvmSynthetic
- internal fun from(body: Body) = apply {
- expiryMinutes = body.expiryMinutes
- additionalProperties = body.additionalProperties.toMutableMap()
- }
-
- /** Token validity in minutes (max 60) */
- fun expiryMinutes(expiryMinutes: Long) = expiryMinutes(JsonField.of(expiryMinutes))
-
- /**
- * Sets [Builder.expiryMinutes] to an arbitrary JSON value.
- *
- * You should usually call [Builder.expiryMinutes] with a well-typed [Long] value
- * instead. This method is primarily for setting the field to an undocumented or not yet
- * supported value.
- */
- fun expiryMinutes(expiryMinutes: JsonField) = apply {
- this.expiryMinutes = expiryMinutes
- }
-
- 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(expiryMinutes, additionalProperties.toMutableMap())
- }
-
- private var validated: Boolean = false
-
- fun validate(): Body = apply {
- if (validated) {
- return@apply
- }
-
- expiryMinutes()
- validated = true
- }
-
- fun isValid(): Boolean =
- try {
- validate()
- true
- } catch (e: CasParserInvalidDataException) {
- 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 (expiryMinutes.asKnown().isPresent) 1 else 0)
-
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
-
- return other is Body &&
- expiryMinutes == other.expiryMinutes &&
- additionalProperties == other.additionalProperties
- }
-
- private val hashCode: Int by lazy { Objects.hash(expiryMinutes, additionalProperties) }
-
- override fun hashCode(): Int = hashCode
-
- override fun toString() =
- "Body{expiryMinutes=$expiryMinutes, additionalProperties=$additionalProperties}"
- }
-
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
-
- return other is AccessTokenCreateParams &&
- body == other.body &&
- additionalHeaders == other.additionalHeaders &&
- additionalQueryParams == other.additionalQueryParams
- }
-
- override fun hashCode(): Int = Objects.hash(body, additionalHeaders, additionalQueryParams)
-
- override fun toString() =
- "AccessTokenCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
-}
diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/accesstoken/AccessTokenCreateResponse.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/accesstoken/AccessTokenCreateResponse.kt
deleted file mode 100644
index a23d37b..0000000
--- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/accesstoken/AccessTokenCreateResponse.kt
+++ /dev/null
@@ -1,239 +0,0 @@
-// File generated from our OpenAPI spec by Stainless.
-
-package com.cas_parser.api.models.accesstoken
-
-import com.cas_parser.api.core.ExcludeMissing
-import com.cas_parser.api.core.JsonField
-import com.cas_parser.api.core.JsonMissing
-import com.cas_parser.api.core.JsonValue
-import com.cas_parser.api.errors.CasParserInvalidDataException
-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 java.util.Collections
-import java.util.Objects
-import java.util.Optional
-
-class AccessTokenCreateResponse
-@JsonCreator(mode = JsonCreator.Mode.DISABLED)
-private constructor(
- private val accessToken: JsonField,
- private val expiresIn: JsonField,
- private val tokenType: JsonField,
- private val additionalProperties: MutableMap,
-) {
-
- @JsonCreator
- private constructor(
- @JsonProperty("access_token")
- @ExcludeMissing
- accessToken: JsonField = JsonMissing.of(),
- @JsonProperty("expires_in") @ExcludeMissing expiresIn: JsonField = JsonMissing.of(),
- @JsonProperty("token_type") @ExcludeMissing tokenType: JsonField = JsonMissing.of(),
- ) : this(accessToken, expiresIn, tokenType, mutableMapOf())
-
- /**
- * The at_ prefixed access token
- *
- * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun accessToken(): Optional = accessToken.getOptional("access_token")
-
- /**
- * Token validity in seconds
- *
- * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun expiresIn(): Optional = expiresIn.getOptional("expires_in")
-
- /**
- * Always "api_key" - token is a drop-in replacement for x-api-key header
- *
- * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun tokenType(): Optional = tokenType.getOptional("token_type")
-
- /**
- * Returns the raw JSON value of [accessToken].
- *
- * Unlike [accessToken], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("access_token")
- @ExcludeMissing
- fun _accessToken(): JsonField = accessToken
-
- /**
- * Returns the raw JSON value of [expiresIn].
- *
- * Unlike [expiresIn], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("expires_in") @ExcludeMissing fun _expiresIn(): JsonField = expiresIn
-
- /**
- * Returns the raw JSON value of [tokenType].
- *
- * Unlike [tokenType], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("token_type") @ExcludeMissing fun _tokenType(): JsonField = tokenType
-
- @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 [AccessTokenCreateResponse].
- */
- @JvmStatic fun builder() = Builder()
- }
-
- /** A builder for [AccessTokenCreateResponse]. */
- class Builder internal constructor() {
-
- private var accessToken: JsonField = JsonMissing.of()
- private var expiresIn: JsonField = JsonMissing.of()
- private var tokenType: JsonField = JsonMissing.of()
- private var additionalProperties: MutableMap = mutableMapOf()
-
- @JvmSynthetic
- internal fun from(accessTokenCreateResponse: AccessTokenCreateResponse) = apply {
- accessToken = accessTokenCreateResponse.accessToken
- expiresIn = accessTokenCreateResponse.expiresIn
- tokenType = accessTokenCreateResponse.tokenType
- additionalProperties = accessTokenCreateResponse.additionalProperties.toMutableMap()
- }
-
- /** The at_ prefixed access token */
- fun accessToken(accessToken: String) = accessToken(JsonField.of(accessToken))
-
- /**
- * Sets [Builder.accessToken] to an arbitrary JSON value.
- *
- * You should usually call [Builder.accessToken] with a well-typed [String] value instead.
- * This method is primarily for setting the field to an undocumented or not yet supported
- * value.
- */
- fun accessToken(accessToken: JsonField) = apply { this.accessToken = accessToken }
-
- /** Token validity in seconds */
- fun expiresIn(expiresIn: Long) = expiresIn(JsonField.of(expiresIn))
-
- /**
- * Sets [Builder.expiresIn] to an arbitrary JSON value.
- *
- * You should usually call [Builder.expiresIn] with a well-typed [Long] value instead. This
- * method is primarily for setting the field to an undocumented or not yet supported value.
- */
- fun expiresIn(expiresIn: JsonField) = apply { this.expiresIn = expiresIn }
-
- /** Always "api_key" - token is a drop-in replacement for x-api-key header */
- fun tokenType(tokenType: String) = tokenType(JsonField.of(tokenType))
-
- /**
- * Sets [Builder.tokenType] to an arbitrary JSON value.
- *
- * You should usually call [Builder.tokenType] with a well-typed [String] value instead.
- * This method is primarily for setting the field to an undocumented or not yet supported
- * value.
- */
- fun tokenType(tokenType: JsonField) = apply { this.tokenType = tokenType }
-
- 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 [AccessTokenCreateResponse].
- *
- * Further updates to this [Builder] will not mutate the returned instance.
- */
- fun build(): AccessTokenCreateResponse =
- AccessTokenCreateResponse(
- accessToken,
- expiresIn,
- tokenType,
- additionalProperties.toMutableMap(),
- )
- }
-
- private var validated: Boolean = false
-
- fun validate(): AccessTokenCreateResponse = apply {
- if (validated) {
- return@apply
- }
-
- accessToken()
- expiresIn()
- tokenType()
- validated = true
- }
-
- fun isValid(): Boolean =
- try {
- validate()
- true
- } catch (e: CasParserInvalidDataException) {
- false
- }
-
- /**
- * Returns a score indicating how many valid values are contained in this object recursively.
- *
- * Used for best match union deserialization.
- */
- @JvmSynthetic
- internal fun validity(): Int =
- (if (accessToken.asKnown().isPresent) 1 else 0) +
- (if (expiresIn.asKnown().isPresent) 1 else 0) +
- (if (tokenType.asKnown().isPresent) 1 else 0)
-
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
-
- return other is AccessTokenCreateResponse &&
- accessToken == other.accessToken &&
- expiresIn == other.expiresIn &&
- tokenType == other.tokenType &&
- additionalProperties == other.additionalProperties
- }
-
- private val hashCode: Int by lazy {
- Objects.hash(accessToken, expiresIn, tokenType, additionalProperties)
- }
-
- override fun hashCode(): Int = hashCode
-
- override fun toString() =
- "AccessTokenCreateResponse{accessToken=$accessToken, expiresIn=$expiresIn, tokenType=$tokenType, additionalProperties=$additionalProperties}"
-}
diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/credits/CreditCheckParams.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/credits/CreditCheckParams.kt
deleted file mode 100644
index aa45ce8..0000000
--- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/credits/CreditCheckParams.kt
+++ /dev/null
@@ -1,219 +0,0 @@
-// File generated from our OpenAPI spec by Stainless.
-
-package com.cas_parser.api.models.credits
-
-import com.cas_parser.api.core.JsonValue
-import com.cas_parser.api.core.Params
-import com.cas_parser.api.core.http.Headers
-import com.cas_parser.api.core.http.QueryParams
-import com.cas_parser.api.core.toImmutable
-import java.util.Objects
-import java.util.Optional
-
-/**
- * Check your remaining API credits and usage for the current billing period.
- *
- * Returns:
- * - Number of API calls used and remaining credits
- * - Credit limit and reset date
- * - List of enabled features for your plan
- *
- * Credits reset at the start of each billing period.
- */
-class CreditCheckParams
-private constructor(
- private val additionalHeaders: Headers,
- private val additionalQueryParams: QueryParams,
- private val additionalBodyProperties: Map,
-) : Params {
-
- /** 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(): CreditCheckParams = builder().build()
-
- /** Returns a mutable builder for constructing an instance of [CreditCheckParams]. */
- @JvmStatic fun builder() = Builder()
- }
-
- /** A builder for [CreditCheckParams]. */
- class Builder internal constructor() {
-
- private var additionalHeaders: Headers.Builder = Headers.builder()
- private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
- private var additionalBodyProperties: MutableMap = mutableMapOf()
-
- @JvmSynthetic
- internal fun from(creditCheckParams: CreditCheckParams) = apply {
- additionalHeaders = creditCheckParams.additionalHeaders.toBuilder()
- additionalQueryParams = creditCheckParams.additionalQueryParams.toBuilder()
- additionalBodyProperties = creditCheckParams.additionalBodyProperties.toMutableMap()
- }
-
- 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 [CreditCheckParams].
- *
- * Further updates to this [Builder] will not mutate the returned instance.
- */
- fun build(): CreditCheckParams =
- CreditCheckParams(
- additionalHeaders.build(),
- additionalQueryParams.build(),
- additionalBodyProperties.toImmutable(),
- )
- }
-
- fun _body(): Optional> =
- Optional.ofNullable(additionalBodyProperties.ifEmpty { null })
-
- override fun _headers(): Headers = additionalHeaders
-
- override fun _queryParams(): QueryParams = additionalQueryParams
-
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
-
- return other is CreditCheckParams &&
- additionalHeaders == other.additionalHeaders &&
- additionalQueryParams == other.additionalQueryParams &&
- additionalBodyProperties == other.additionalBodyProperties
- }
-
- override fun hashCode(): Int =
- Objects.hash(additionalHeaders, additionalQueryParams, additionalBodyProperties)
-
- override fun toString() =
- "CreditCheckParams{additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}"
-}
diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/credits/CreditCheckResponse.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/credits/CreditCheckResponse.kt
deleted file mode 100644
index 6a3f1a3..0000000
--- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/credits/CreditCheckResponse.kt
+++ /dev/null
@@ -1,387 +0,0 @@
-// File generated from our OpenAPI spec by Stainless.
-
-package com.cas_parser.api.models.credits
-
-import com.cas_parser.api.core.ExcludeMissing
-import com.cas_parser.api.core.JsonField
-import com.cas_parser.api.core.JsonMissing
-import com.cas_parser.api.core.JsonValue
-import com.cas_parser.api.core.checkKnown
-import com.cas_parser.api.core.toImmutable
-import com.cas_parser.api.errors.CasParserInvalidDataException
-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 java.time.OffsetDateTime
-import java.util.Collections
-import java.util.Objects
-import java.util.Optional
-import kotlin.jvm.optionals.getOrNull
-
-class CreditCheckResponse
-@JsonCreator(mode = JsonCreator.Mode.DISABLED)
-private constructor(
- private val enabledFeatures: JsonField>,
- private val isUnlimited: JsonField,
- private val limit: JsonField,
- private val remaining: JsonField,
- private val resetsAt: JsonField,
- private val used: JsonField,
- private val additionalProperties: MutableMap,
-) {
-
- @JsonCreator
- private constructor(
- @JsonProperty("enabled_features")
- @ExcludeMissing
- enabledFeatures: JsonField> = JsonMissing.of(),
- @JsonProperty("is_unlimited")
- @ExcludeMissing
- isUnlimited: JsonField = JsonMissing.of(),
- @JsonProperty("limit") @ExcludeMissing limit: JsonField = JsonMissing.of(),
- @JsonProperty("remaining") @ExcludeMissing remaining: JsonField = JsonMissing.of(),
- @JsonProperty("resets_at")
- @ExcludeMissing
- resetsAt: JsonField = JsonMissing.of(),
- @JsonProperty("used") @ExcludeMissing used: JsonField = JsonMissing.of(),
- ) : this(enabledFeatures, isUnlimited, limit, remaining, resetsAt, used, mutableMapOf())
-
- /**
- * List of API features enabled for your plan
- *
- * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun enabledFeatures(): Optional> = enabledFeatures.getOptional("enabled_features")
-
- /**
- * Whether the account has unlimited credits
- *
- * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun isUnlimited(): Optional = isUnlimited.getOptional("is_unlimited")
-
- /**
- * Total credit limit for billing period
- *
- * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun limit(): Optional = limit.getOptional("limit")
-
- /**
- * Remaining credits (null if unlimited)
- *
- * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun remaining(): Optional = remaining.getOptional("remaining")
-
- /**
- * When credits reset (ISO 8601)
- *
- * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun resetsAt(): Optional = resetsAt.getOptional("resets_at")
-
- /**
- * Number of credits used this billing period
- *
- * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun used(): Optional = used.getOptional("used")
-
- /**
- * Returns the raw JSON value of [enabledFeatures].
- *
- * Unlike [enabledFeatures], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("enabled_features")
- @ExcludeMissing
- fun _enabledFeatures(): JsonField> = enabledFeatures
-
- /**
- * Returns the raw JSON value of [isUnlimited].
- *
- * Unlike [isUnlimited], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("is_unlimited")
- @ExcludeMissing
- fun _isUnlimited(): JsonField = isUnlimited
-
- /**
- * Returns the raw JSON value of [limit].
- *
- * Unlike [limit], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("limit") @ExcludeMissing fun _limit(): JsonField = limit
-
- /**
- * Returns the raw JSON value of [remaining].
- *
- * Unlike [remaining], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("remaining") @ExcludeMissing fun _remaining(): JsonField = remaining
-
- /**
- * Returns the raw JSON value of [resetsAt].
- *
- * Unlike [resetsAt], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("resets_at") @ExcludeMissing fun _resetsAt(): JsonField = resetsAt
-
- /**
- * Returns the raw JSON value of [used].
- *
- * Unlike [used], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("used") @ExcludeMissing fun _used(): JsonField = used
-
- @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 [CreditCheckResponse]. */
- @JvmStatic fun builder() = Builder()
- }
-
- /** A builder for [CreditCheckResponse]. */
- class Builder internal constructor() {
-
- private var enabledFeatures: JsonField>? = null
- private var isUnlimited: JsonField = JsonMissing.of()
- private var limit: JsonField = JsonMissing.of()
- private var remaining: JsonField = JsonMissing.of()
- private var resetsAt: JsonField = JsonMissing.of()
- private var used: JsonField = JsonMissing.of()
- private var additionalProperties: MutableMap = mutableMapOf()
-
- @JvmSynthetic
- internal fun from(creditCheckResponse: CreditCheckResponse) = apply {
- enabledFeatures = creditCheckResponse.enabledFeatures.map { it.toMutableList() }
- isUnlimited = creditCheckResponse.isUnlimited
- limit = creditCheckResponse.limit
- remaining = creditCheckResponse.remaining
- resetsAt = creditCheckResponse.resetsAt
- used = creditCheckResponse.used
- additionalProperties = creditCheckResponse.additionalProperties.toMutableMap()
- }
-
- /** List of API features enabled for your plan */
- fun enabledFeatures(enabledFeatures: List) =
- enabledFeatures(JsonField.of(enabledFeatures))
-
- /**
- * Sets [Builder.enabledFeatures] to an arbitrary JSON value.
- *
- * You should usually call [Builder.enabledFeatures] with a well-typed `List` value
- * instead. This method is primarily for setting the field to an undocumented or not yet
- * supported value.
- */
- fun enabledFeatures(enabledFeatures: JsonField>) = apply {
- this.enabledFeatures = enabledFeatures.map { it.toMutableList() }
- }
-
- /**
- * Adds a single [String] to [enabledFeatures].
- *
- * @throws IllegalStateException if the field was previously set to a non-list.
- */
- fun addEnabledFeature(enabledFeature: String) = apply {
- enabledFeatures =
- (enabledFeatures ?: JsonField.of(mutableListOf())).also {
- checkKnown("enabledFeatures", it).add(enabledFeature)
- }
- }
-
- /** Whether the account has unlimited credits */
- fun isUnlimited(isUnlimited: Boolean) = isUnlimited(JsonField.of(isUnlimited))
-
- /**
- * Sets [Builder.isUnlimited] to an arbitrary JSON value.
- *
- * You should usually call [Builder.isUnlimited] with a well-typed [Boolean] value instead.
- * This method is primarily for setting the field to an undocumented or not yet supported
- * value.
- */
- fun isUnlimited(isUnlimited: JsonField) = apply { this.isUnlimited = isUnlimited }
-
- /** Total credit limit for billing period */
- fun limit(limit: Long) = limit(JsonField.of(limit))
-
- /**
- * Sets [Builder.limit] to an arbitrary JSON value.
- *
- * You should usually call [Builder.limit] with a well-typed [Long] value instead. This
- * method is primarily for setting the field to an undocumented or not yet supported value.
- */
- fun limit(limit: JsonField) = apply { this.limit = limit }
-
- /** Remaining credits (null if unlimited) */
- fun remaining(remaining: Double?) = remaining(JsonField.ofNullable(remaining))
-
- /**
- * Alias for [Builder.remaining].
- *
- * This unboxed primitive overload exists for backwards compatibility.
- */
- fun remaining(remaining: Double) = remaining(remaining as Double?)
-
- /** Alias for calling [Builder.remaining] with `remaining.orElse(null)`. */
- fun remaining(remaining: Optional) = remaining(remaining.getOrNull())
-
- /**
- * Sets [Builder.remaining] to an arbitrary JSON value.
- *
- * You should usually call [Builder.remaining] with a well-typed [Double] value instead.
- * This method is primarily for setting the field to an undocumented or not yet supported
- * value.
- */
- fun remaining(remaining: JsonField) = apply { this.remaining = remaining }
-
- /** When credits reset (ISO 8601) */
- fun resetsAt(resetsAt: OffsetDateTime?) = resetsAt(JsonField.ofNullable(resetsAt))
-
- /** Alias for calling [Builder.resetsAt] with `resetsAt.orElse(null)`. */
- fun resetsAt(resetsAt: Optional) = resetsAt(resetsAt.getOrNull())
-
- /**
- * Sets [Builder.resetsAt] to an arbitrary JSON value.
- *
- * You should usually call [Builder.resetsAt] with a well-typed [OffsetDateTime] value
- * instead. This method is primarily for setting the field to an undocumented or not yet
- * supported value.
- */
- fun resetsAt(resetsAt: JsonField) = apply { this.resetsAt = resetsAt }
-
- /** Number of credits used this billing period */
- fun used(used: Double) = used(JsonField.of(used))
-
- /**
- * Sets [Builder.used] to an arbitrary JSON value.
- *
- * You should usually call [Builder.used] with a well-typed [Double] value instead. This
- * method is primarily for setting the field to an undocumented or not yet supported value.
- */
- fun used(used: JsonField) = apply { this.used = used }
-
- 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 [CreditCheckResponse].
- *
- * Further updates to this [Builder] will not mutate the returned instance.
- */
- fun build(): CreditCheckResponse =
- CreditCheckResponse(
- (enabledFeatures ?: JsonMissing.of()).map { it.toImmutable() },
- isUnlimited,
- limit,
- remaining,
- resetsAt,
- used,
- additionalProperties.toMutableMap(),
- )
- }
-
- private var validated: Boolean = false
-
- fun validate(): CreditCheckResponse = apply {
- if (validated) {
- return@apply
- }
-
- enabledFeatures()
- isUnlimited()
- limit()
- remaining()
- resetsAt()
- used()
- validated = true
- }
-
- fun isValid(): Boolean =
- try {
- validate()
- true
- } catch (e: CasParserInvalidDataException) {
- 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 =
- (enabledFeatures.asKnown().getOrNull()?.size ?: 0) +
- (if (isUnlimited.asKnown().isPresent) 1 else 0) +
- (if (limit.asKnown().isPresent) 1 else 0) +
- (if (remaining.asKnown().isPresent) 1 else 0) +
- (if (resetsAt.asKnown().isPresent) 1 else 0) +
- (if (used.asKnown().isPresent) 1 else 0)
-
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
-
- return other is CreditCheckResponse &&
- enabledFeatures == other.enabledFeatures &&
- isUnlimited == other.isUnlimited &&
- limit == other.limit &&
- remaining == other.remaining &&
- resetsAt == other.resetsAt &&
- used == other.used &&
- additionalProperties == other.additionalProperties
- }
-
- private val hashCode: Int by lazy {
- Objects.hash(
- enabledFeatures,
- isUnlimited,
- limit,
- remaining,
- resetsAt,
- used,
- additionalProperties,
- )
- }
-
- override fun hashCode(): Int = hashCode
-
- override fun toString() =
- "CreditCheckResponse{enabledFeatures=$enabledFeatures, isUnlimited=$isUnlimited, limit=$limit, remaining=$remaining, resetsAt=$resetsAt, used=$used, additionalProperties=$additionalProperties}"
-}
diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inbox/InboxListCasFilesResponse.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inbox/InboxListCasFilesResponse.kt
index 84d490e..1373c71 100644
--- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inbox/InboxListCasFilesResponse.kt
+++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inbox/InboxListCasFilesResponse.kt
@@ -232,6 +232,7 @@ private constructor(
private val messageDate: JsonField,
private val messageId: JsonField,
private val originalFilename: JsonField,
+ private val senderEmail: JsonField,
private val size: JsonField,
private val url: JsonField,
private val additionalProperties: MutableMap,
@@ -257,6 +258,9 @@ private constructor(
@JsonProperty("original_filename")
@ExcludeMissing
originalFilename: JsonField = JsonMissing.of(),
+ @JsonProperty("sender_email")
+ @ExcludeMissing
+ senderEmail: JsonField = JsonMissing.of(),
@JsonProperty("size") @ExcludeMissing size: JsonField = JsonMissing.of(),
@JsonProperty("url") @ExcludeMissing url: JsonField = JsonMissing.of(),
) : this(
@@ -266,6 +270,7 @@ private constructor(
messageDate,
messageId,
originalFilename,
+ senderEmail,
size,
url,
mutableMapOf(),
@@ -319,6 +324,15 @@ private constructor(
*/
fun originalFilename(): Optional = originalFilename.getOptional("original_filename")
+ /**
+ * Email address of the CAS authority (CDSL, NSDL, CAMS, or KFintech) who originally sent
+ * this statement
+ *
+ * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun senderEmail(): Optional = senderEmail.getOptional("sender_email")
+
/**
* File size in bytes
*
@@ -382,6 +396,15 @@ private constructor(
@ExcludeMissing
fun _originalFilename(): JsonField = originalFilename
+ /**
+ * Returns the raw JSON value of [senderEmail].
+ *
+ * Unlike [senderEmail], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("sender_email")
+ @ExcludeMissing
+ fun _senderEmail(): JsonField = senderEmail
+
/**
* Returns the raw JSON value of [size].
*
@@ -423,6 +446,7 @@ private constructor(
private var messageDate: JsonField = JsonMissing.of()
private var messageId: JsonField = JsonMissing.of()
private var originalFilename: JsonField = JsonMissing.of()
+ private var senderEmail: JsonField = JsonMissing.of()
private var size: JsonField = JsonMissing.of()
private var url: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@@ -435,6 +459,7 @@ private constructor(
messageDate = file.messageDate
messageId = file.messageId
originalFilename = file.originalFilename
+ senderEmail = file.senderEmail
size = file.size
url = file.url
additionalProperties = file.additionalProperties.toMutableMap()
@@ -517,6 +542,23 @@ private constructor(
this.originalFilename = originalFilename
}
+ /**
+ * Email address of the CAS authority (CDSL, NSDL, CAMS, or KFintech) who originally
+ * sent this statement
+ */
+ fun senderEmail(senderEmail: String) = senderEmail(JsonField.of(senderEmail))
+
+ /**
+ * Sets [Builder.senderEmail] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.senderEmail] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun senderEmail(senderEmail: JsonField) = apply {
+ this.senderEmail = senderEmail
+ }
+
/** File size in bytes */
fun size(size: Long) = size(JsonField.of(size))
@@ -573,6 +615,7 @@ private constructor(
messageDate,
messageId,
originalFilename,
+ senderEmail,
size,
url,
additionalProperties.toMutableMap(),
@@ -592,6 +635,7 @@ private constructor(
messageDate()
messageId()
originalFilename()
+ senderEmail()
size()
url()
validated = true
@@ -619,6 +663,7 @@ private constructor(
(if (messageDate.asKnown().isPresent) 1 else 0) +
(if (messageId.asKnown().isPresent) 1 else 0) +
(if (originalFilename.asKnown().isPresent) 1 else 0) +
+ (if (senderEmail.asKnown().isPresent) 1 else 0) +
(if (size.asKnown().isPresent) 1 else 0) +
(if (url.asKnown().isPresent) 1 else 0)
@@ -777,6 +822,7 @@ private constructor(
messageDate == other.messageDate &&
messageId == other.messageId &&
originalFilename == other.originalFilename &&
+ senderEmail == other.senderEmail &&
size == other.size &&
url == other.url &&
additionalProperties == other.additionalProperties
@@ -790,6 +836,7 @@ private constructor(
messageDate,
messageId,
originalFilename,
+ senderEmail,
size,
url,
additionalProperties,
@@ -799,7 +846,7 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "File{casType=$casType, expiresIn=$expiresIn, filename=$filename, messageDate=$messageDate, messageId=$messageId, originalFilename=$originalFilename, size=$size, url=$url, additionalProperties=$additionalProperties}"
+ "File{casType=$casType, expiresIn=$expiresIn, filename=$filename, messageDate=$messageDate, messageId=$messageId, originalFilename=$originalFilename, senderEmail=$senderEmail, size=$size, url=$url, additionalProperties=$additionalProperties}"
}
override fun equals(other: Any?): Boolean {
diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/logs/LogCreateParams.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/logs/LogCreateParams.kt
deleted file mode 100644
index c46a795..0000000
--- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/logs/LogCreateParams.kt
+++ /dev/null
@@ -1,528 +0,0 @@
-// File generated from our OpenAPI spec by Stainless.
-
-package com.cas_parser.api.models.logs
-
-import com.cas_parser.api.core.ExcludeMissing
-import com.cas_parser.api.core.JsonField
-import com.cas_parser.api.core.JsonMissing
-import com.cas_parser.api.core.JsonValue
-import com.cas_parser.api.core.Params
-import com.cas_parser.api.core.http.Headers
-import com.cas_parser.api.core.http.QueryParams
-import com.cas_parser.api.errors.CasParserInvalidDataException
-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 java.time.OffsetDateTime
-import java.util.Collections
-import java.util.Objects
-import java.util.Optional
-
-/**
- * Retrieve detailed API usage logs for your account.
- *
- * Returns a list of API calls with timestamps, features used, status codes, and credits consumed.
- * Useful for monitoring usage patterns and debugging.
- */
-class LogCreateParams
-private constructor(
- private val body: Body,
- private val additionalHeaders: Headers,
- private val additionalQueryParams: QueryParams,
-) : Params {
-
- /**
- * End time filter (ISO 8601). Defaults to now.
- *
- * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun endTime(): Optional = body.endTime()
-
- /**
- * Maximum number of logs to return
- *
- * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun limit(): Optional = body.limit()
-
- /**
- * Start time filter (ISO 8601). Defaults to 30 days ago.
- *
- * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun startTime(): Optional = body.startTime()
-
- /**
- * Returns the raw JSON value of [endTime].
- *
- * Unlike [endTime], this method doesn't throw if the JSON field has an unexpected type.
- */
- fun _endTime(): JsonField = body._endTime()
-
- /**
- * Returns the raw JSON value of [limit].
- *
- * Unlike [limit], this method doesn't throw if the JSON field has an unexpected type.
- */
- fun _limit(): JsonField = body._limit()
-
- /**
- * Returns the raw JSON value of [startTime].
- *
- * Unlike [startTime], this method doesn't throw if the JSON field has an unexpected type.
- */
- fun _startTime(): JsonField = body._startTime()
-
- 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(): LogCreateParams = builder().build()
-
- /** Returns a mutable builder for constructing an instance of [LogCreateParams]. */
- @JvmStatic fun builder() = Builder()
- }
-
- /** A builder for [LogCreateParams]. */
- 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(logCreateParams: LogCreateParams) = apply {
- body = logCreateParams.body.toBuilder()
- additionalHeaders = logCreateParams.additionalHeaders.toBuilder()
- additionalQueryParams = logCreateParams.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:
- * - [endTime]
- * - [limit]
- * - [startTime]
- */
- fun body(body: Body) = apply { this.body = body.toBuilder() }
-
- /** End time filter (ISO 8601). Defaults to now. */
- fun endTime(endTime: OffsetDateTime) = apply { body.endTime(endTime) }
-
- /**
- * Sets [Builder.endTime] to an arbitrary JSON value.
- *
- * You should usually call [Builder.endTime] with a well-typed [OffsetDateTime] value
- * instead. This method is primarily for setting the field to an undocumented or not yet
- * supported value.
- */
- fun endTime(endTime: JsonField) = apply { body.endTime(endTime) }
-
- /** Maximum number of logs to return */
- fun limit(limit: Long) = apply { body.limit(limit) }
-
- /**
- * Sets [Builder.limit] to an arbitrary JSON value.
- *
- * You should usually call [Builder.limit] with a well-typed [Long] value instead. This
- * method is primarily for setting the field to an undocumented or not yet supported value.
- */
- fun limit(limit: JsonField) = apply { body.limit(limit) }
-
- /** Start time filter (ISO 8601). Defaults to 30 days ago. */
- fun startTime(startTime: OffsetDateTime) = apply { body.startTime(startTime) }
-
- /**
- * Sets [Builder.startTime] to an arbitrary JSON value.
- *
- * You should usually call [Builder.startTime] with a well-typed [OffsetDateTime] value
- * instead. This method is primarily for setting the field to an undocumented or not yet
- * supported value.
- */
- fun startTime(startTime: JsonField) = apply { body.startTime(startTime) }
-
- 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 [LogCreateParams].
- *
- * Further updates to this [Builder] will not mutate the returned instance.
- */
- fun build(): LogCreateParams =
- LogCreateParams(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 endTime: JsonField,
- private val limit: JsonField,
- private val startTime: JsonField,
- private val additionalProperties: MutableMap,
- ) {
-
- @JsonCreator
- private constructor(
- @JsonProperty("end_time")
- @ExcludeMissing
- endTime: JsonField = JsonMissing.of(),
- @JsonProperty("limit") @ExcludeMissing limit: JsonField = JsonMissing.of(),
- @JsonProperty("start_time")
- @ExcludeMissing
- startTime: JsonField = JsonMissing.of(),
- ) : this(endTime, limit, startTime, mutableMapOf())
-
- /**
- * End time filter (ISO 8601). Defaults to now.
- *
- * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if
- * the server responded with an unexpected value).
- */
- fun endTime(): Optional = endTime.getOptional("end_time")
-
- /**
- * Maximum number of logs to return
- *
- * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if
- * the server responded with an unexpected value).
- */
- fun limit(): Optional = limit.getOptional("limit")
-
- /**
- * Start time filter (ISO 8601). Defaults to 30 days ago.
- *
- * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if
- * the server responded with an unexpected value).
- */
- fun startTime(): Optional = startTime.getOptional("start_time")
-
- /**
- * Returns the raw JSON value of [endTime].
- *
- * Unlike [endTime], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("end_time")
- @ExcludeMissing
- fun _endTime(): JsonField = endTime
-
- /**
- * Returns the raw JSON value of [limit].
- *
- * Unlike [limit], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("limit") @ExcludeMissing fun _limit(): JsonField = limit
-
- /**
- * Returns the raw JSON value of [startTime].
- *
- * Unlike [startTime], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("start_time")
- @ExcludeMissing
- fun _startTime(): JsonField = startTime
-
- @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 endTime: JsonField = JsonMissing.of()
- private var limit: JsonField = JsonMissing.of()
- private var startTime: JsonField = JsonMissing.of()
- private var additionalProperties: MutableMap = mutableMapOf()
-
- @JvmSynthetic
- internal fun from(body: Body) = apply {
- endTime = body.endTime
- limit = body.limit
- startTime = body.startTime
- additionalProperties = body.additionalProperties.toMutableMap()
- }
-
- /** End time filter (ISO 8601). Defaults to now. */
- fun endTime(endTime: OffsetDateTime) = endTime(JsonField.of(endTime))
-
- /**
- * Sets [Builder.endTime] to an arbitrary JSON value.
- *
- * You should usually call [Builder.endTime] with a well-typed [OffsetDateTime] value
- * instead. This method is primarily for setting the field to an undocumented or not yet
- * supported value.
- */
- fun endTime(endTime: JsonField) = apply { this.endTime = endTime }
-
- /** Maximum number of logs to return */
- fun limit(limit: Long) = limit(JsonField.of(limit))
-
- /**
- * Sets [Builder.limit] to an arbitrary JSON value.
- *
- * You should usually call [Builder.limit] with a well-typed [Long] value instead. This
- * method is primarily for setting the field to an undocumented or not yet supported
- * value.
- */
- fun limit(limit: JsonField) = apply { this.limit = limit }
-
- /** Start time filter (ISO 8601). Defaults to 30 days ago. */
- fun startTime(startTime: OffsetDateTime) = startTime(JsonField.of(startTime))
-
- /**
- * Sets [Builder.startTime] to an arbitrary JSON value.
- *
- * You should usually call [Builder.startTime] with a well-typed [OffsetDateTime] value
- * instead. This method is primarily for setting the field to an undocumented or not yet
- * supported value.
- */
- fun startTime(startTime: JsonField) = apply {
- this.startTime = startTime
- }
-
- 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(endTime, limit, startTime, additionalProperties.toMutableMap())
- }
-
- private var validated: Boolean = false
-
- fun validate(): Body = apply {
- if (validated) {
- return@apply
- }
-
- endTime()
- limit()
- startTime()
- validated = true
- }
-
- fun isValid(): Boolean =
- try {
- validate()
- true
- } catch (e: CasParserInvalidDataException) {
- 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 (endTime.asKnown().isPresent) 1 else 0) +
- (if (limit.asKnown().isPresent) 1 else 0) +
- (if (startTime.asKnown().isPresent) 1 else 0)
-
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
-
- return other is Body &&
- endTime == other.endTime &&
- limit == other.limit &&
- startTime == other.startTime &&
- additionalProperties == other.additionalProperties
- }
-
- private val hashCode: Int by lazy {
- Objects.hash(endTime, limit, startTime, additionalProperties)
- }
-
- override fun hashCode(): Int = hashCode
-
- override fun toString() =
- "Body{endTime=$endTime, limit=$limit, startTime=$startTime, additionalProperties=$additionalProperties}"
- }
-
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
-
- return other is LogCreateParams &&
- body == other.body &&
- additionalHeaders == other.additionalHeaders &&
- additionalQueryParams == other.additionalQueryParams
- }
-
- override fun hashCode(): Int = Objects.hash(body, additionalHeaders, additionalQueryParams)
-
- override fun toString() =
- "LogCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
-}
diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/logs/LogCreateResponse.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/logs/LogCreateResponse.kt
deleted file mode 100644
index b77a776..0000000
--- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/logs/LogCreateResponse.kt
+++ /dev/null
@@ -1,578 +0,0 @@
-// File generated from our OpenAPI spec by Stainless.
-
-package com.cas_parser.api.models.logs
-
-import com.cas_parser.api.core.ExcludeMissing
-import com.cas_parser.api.core.JsonField
-import com.cas_parser.api.core.JsonMissing
-import com.cas_parser.api.core.JsonValue
-import com.cas_parser.api.core.checkKnown
-import com.cas_parser.api.core.toImmutable
-import com.cas_parser.api.errors.CasParserInvalidDataException
-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 java.time.OffsetDateTime
-import java.util.Collections
-import java.util.Objects
-import java.util.Optional
-import kotlin.jvm.optionals.getOrNull
-
-class LogCreateResponse
-@JsonCreator(mode = JsonCreator.Mode.DISABLED)
-private constructor(
- private val count: JsonField,
- private val logs: JsonField>,
- private val status: JsonField,
- private val additionalProperties: MutableMap,
-) {
-
- @JsonCreator
- private constructor(
- @JsonProperty("count") @ExcludeMissing count: JsonField = JsonMissing.of(),
- @JsonProperty("logs") @ExcludeMissing logs: JsonField> = JsonMissing.of(),
- @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(),
- ) : this(count, logs, status, mutableMapOf())
-
- /**
- * Number of logs returned
- *
- * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun count(): Optional = count.getOptional("count")
-
- /**
- * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun logs(): Optional> = logs.getOptional("logs")
-
- /**
- * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun status(): Optional = status.getOptional("status")
-
- /**
- * Returns the raw JSON value of [count].
- *
- * Unlike [count], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("count") @ExcludeMissing fun _count(): JsonField = count
-
- /**
- * Returns the raw JSON value of [logs].
- *
- * Unlike [logs], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("logs") @ExcludeMissing fun _logs(): JsonField> = logs
-
- /**
- * 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
-
- @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 [LogCreateResponse]. */
- @JvmStatic fun builder() = Builder()
- }
-
- /** A builder for [LogCreateResponse]. */
- class Builder internal constructor() {
-
- private var count: JsonField = JsonMissing.of()
- private var logs: JsonField>? = null
- private var status: JsonField = JsonMissing.of()
- private var additionalProperties: MutableMap = mutableMapOf()
-
- @JvmSynthetic
- internal fun from(logCreateResponse: LogCreateResponse) = apply {
- count = logCreateResponse.count
- logs = logCreateResponse.logs.map { it.toMutableList() }
- status = logCreateResponse.status
- additionalProperties = logCreateResponse.additionalProperties.toMutableMap()
- }
-
- /** Number of logs returned */
- fun count(count: Long) = count(JsonField.of(count))
-
- /**
- * Sets [Builder.count] to an arbitrary JSON value.
- *
- * You should usually call [Builder.count] with a well-typed [Long] value instead. This
- * method is primarily for setting the field to an undocumented or not yet supported value.
- */
- fun count(count: JsonField) = apply { this.count = count }
-
- fun logs(logs: List) = logs(JsonField.of(logs))
-
- /**
- * Sets [Builder.logs] to an arbitrary JSON value.
- *
- * You should usually call [Builder.logs] with a well-typed `List` value instead. This
- * method is primarily for setting the field to an undocumented or not yet supported value.
- */
- fun logs(logs: JsonField>) = apply { this.logs = logs.map { it.toMutableList() } }
-
- /**
- * Adds a single [Log] to [logs].
- *
- * @throws IllegalStateException if the field was previously set to a non-list.
- */
- fun addLog(log: Log) = apply {
- logs = (logs ?: JsonField.of(mutableListOf())).also { checkKnown("logs", it).add(log) }
- }
-
- fun status(status: String) = status(JsonField.of(status))
-
- /**
- * Sets [Builder.status] to an arbitrary JSON value.
- *
- * You should usually call [Builder.status] with a well-typed [String] 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 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 [LogCreateResponse].
- *
- * Further updates to this [Builder] will not mutate the returned instance.
- */
- fun build(): LogCreateResponse =
- LogCreateResponse(
- count,
- (logs ?: JsonMissing.of()).map { it.toImmutable() },
- status,
- additionalProperties.toMutableMap(),
- )
- }
-
- private var validated: Boolean = false
-
- fun validate(): LogCreateResponse = apply {
- if (validated) {
- return@apply
- }
-
- count()
- logs().ifPresent { it.forEach { it.validate() } }
- status()
- validated = true
- }
-
- fun isValid(): Boolean =
- try {
- validate()
- true
- } catch (e: CasParserInvalidDataException) {
- 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 (count.asKnown().isPresent) 1 else 0) +
- (logs.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
- (if (status.asKnown().isPresent) 1 else 0)
-
- class Log
- @JsonCreator(mode = JsonCreator.Mode.DISABLED)
- private constructor(
- private val credits: JsonField,
- private val feature: JsonField,
- private val path: JsonField,
- private val requestId: JsonField,
- private val statusCode: JsonField,
- private val timestamp: JsonField,
- private val additionalProperties: MutableMap,
- ) {
-
- @JsonCreator
- private constructor(
- @JsonProperty("credits") @ExcludeMissing credits: JsonField = JsonMissing.of(),
- @JsonProperty("feature") @ExcludeMissing feature: JsonField = JsonMissing.of(),
- @JsonProperty("path") @ExcludeMissing path: JsonField = JsonMissing.of(),
- @JsonProperty("request_id")
- @ExcludeMissing
- requestId: JsonField = JsonMissing.of(),
- @JsonProperty("status_code")
- @ExcludeMissing
- statusCode: JsonField = JsonMissing.of(),
- @JsonProperty("timestamp")
- @ExcludeMissing
- timestamp: JsonField = JsonMissing.of(),
- ) : this(credits, feature, path, requestId, statusCode, timestamp, mutableMapOf())
-
- /**
- * Credits consumed for this request
- *
- * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if
- * the server responded with an unexpected value).
- */
- fun credits(): Optional = credits.getOptional("credits")
-
- /**
- * API feature used
- *
- * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if
- * the server responded with an unexpected value).
- */
- fun feature(): Optional = feature.getOptional("feature")
-
- /**
- * API endpoint path
- *
- * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if
- * the server responded with an unexpected value).
- */
- fun path(): Optional = path.getOptional("path")
-
- /**
- * Unique request identifier
- *
- * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if
- * the server responded with an unexpected value).
- */
- fun requestId(): Optional = requestId.getOptional("request_id")
-
- /**
- * HTTP response status code
- *
- * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if
- * the server responded with an unexpected value).
- */
- fun statusCode(): Optional = statusCode.getOptional("status_code")
-
- /**
- * When the request was made
- *
- * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if
- * the server responded with an unexpected value).
- */
- fun timestamp(): Optional