diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4208b5c..1b77f50 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.6.0" + ".": "0.7.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index e26d438..582a92c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 21 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cas-parser%2Fcas-parser-e5c0c65637cdf3a6c4360b8193973b73a3d35ad1056ef607c3319ef03e591a55.yml -openapi_spec_hash: 7515d1e5fe3130b9f5411f7aacbc8a64 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cas-parser/cas-parser-e572d88c2af6e4d7bc4f7e119357fd3f68b1e67d612fd1d3a657d916cde0087c.yml +openapi_spec_hash: a9fc7d947111bffa9184f8ca8be4a579 config_hash: 5509bb7a961ae2e79114b24c381606d4 diff --git a/CHANGELOG.md b/CHANGELOG.md index 62fd0e2..8ee6f45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,32 @@ # Changelog +## 0.7.0 (2026-05-06) + +Full Changelog: [v0.6.0...v0.7.0](https://github.com/CASParser/cas-parser-java/compare/v0.6.0...v0.7.0) + +### Features + +* **api:** api update ([298bc41](https://github.com/CASParser/cas-parser-java/commit/298bc41836f9daa2d97dd46cb1cff7a2f8116117)) +* **api:** api update ([2744bf4](https://github.com/CASParser/cas-parser-java/commit/2744bf455786d58b2ccb12e2a7e8f125586b71b1)) +* **client:** more robust error parsing ([98e6ec7](https://github.com/CASParser/cas-parser-java/commit/98e6ec79767f1c16a0cfff5262ae29dad9600873)) +* **client:** support proxy authentication ([2568fbd](https://github.com/CASParser/cas-parser-java/commit/2568fbd4e09f2788cb1b7f49ce00a83505bf2370)) +* support setting headers via env ([ee0b90d](https://github.com/CASParser/cas-parser-java/commit/ee0b90db7cf144c61c23891ff8d026b0b6c358da)) + + +### Performance Improvements + +* **client:** create one json mapper ([720bb86](https://github.com/CASParser/cas-parser-java/commit/720bb86a8c014e99d8e3a3adbd14b5b9ee4d337a)) + + +### Chores + +* remove duplicated dokka setup ([2265192](https://github.com/CASParser/cas-parser-java/commit/226519252d2ec845c0ca05a13902c3574e0d33e2)) + + +### Documentation + +* clarify forwards compat behavior ([1181b47](https://github.com/CASParser/cas-parser-java/commit/1181b475ff522b2753786939e5b36e783ab78690)) + ## 0.6.0 (2026-04-19) Full Changelog: [v0.5.4...v0.6.0](https://github.com/CASParser/cas-parser-java/compare/v0.5.4...v0.6.0) diff --git a/README.md b/README.md index 7e9b378..eb757bf 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.cas_parser.api/cas-parser-java)](https://central.sonatype.com/artifact/com.cas_parser.api/cas-parser-java/0.6.0) -[![javadoc](https://javadoc.io/badge2/com.cas_parser.api/cas-parser-java/0.6.0/javadoc.svg)](https://javadoc.io/doc/com.cas_parser.api/cas-parser-java/0.6.0) +[![Maven Central](https://img.shields.io/maven-central/v/com.cas_parser.api/cas-parser-java)](https://central.sonatype.com/artifact/com.cas_parser.api/cas-parser-java/0.7.0) +[![javadoc](https://javadoc.io/badge2/com.cas_parser.api/cas-parser-java/0.7.0/javadoc.svg)](https://javadoc.io/doc/com.cas_parser.api/cas-parser-java/0.7.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 [casparser.in](https://casparser.in/docs). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.cas_parser.api/cas-parser-java/0.6.0). +The REST API documentation can be found on [casparser.in](https://casparser.in/docs). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.cas_parser.api/cas-parser-java/0.7.0). @@ -33,7 +33,7 @@ The REST API documentation can be found on [casparser.in](https://casparser.in/d ### Gradle ```kotlin -implementation("com.cas_parser.api:cas-parser-java:0.6.0") +implementation("com.cas_parser.api:cas-parser-java:0.7.0") ``` ### Maven @@ -42,7 +42,7 @@ implementation("com.cas_parser.api:cas-parser-java:0.6.0") com.cas_parser.api cas-parser-java - 0.6.0 + 0.7.0 ``` @@ -342,6 +342,21 @@ CasParserClient client = CasParserOkHttpClient.builder() .build(); ``` +If the proxy responds with `407 Proxy Authentication Required`, supply credentials by also configuring `proxyAuthenticator`: + +```java +import com.cas_parser.api.client.CasParserClient; +import com.cas_parser.api.client.okhttp.CasParserOkHttpClient; +import com.cas_parser.api.core.http.ProxyAuthenticator; + +CasParserClient client = CasParserOkHttpClient.builder() + .fromEnv() + .proxy(...) + // Or a custom implementation of `ProxyAuthenticator`. + .proxyAuthenticator(ProxyAuthenticator.basic("username", "password")) + .build(); +``` + ### Connection pooling To customize the underlying OkHttp connection pool, configure the client using the `maxIdleConnections` and `keepAliveDuration` methods: @@ -562,7 +577,9 @@ In rare cases, the API may return a response that doesn't match the expected typ By default, the SDK will not throw an exception in this case. It will throw [`CasParserInvalidDataException`](cas-parser-java-core/src/main/kotlin/com/cas_parser/api/errors/CasParserInvalidDataException.kt) only if you directly access the property. -If you would prefer to check that the response is completely well-typed upfront, then either call `validate()`: +Validating the response is _not_ forwards compatible with new types from the API for existing fields. + +If you would still prefer to check that the response is completely well-typed upfront, then either call `validate()`: ```java import com.cas_parser.api.models.credits.CreditCheckResponse; diff --git a/build.gradle.kts b/build.gradle.kts index 8f7d82f..d0f1e15 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,7 +9,7 @@ repositories { allprojects { group = "com.cas_parser.api" - version = "0.6.0" // x-release-please-version + version = "0.7.0" // x-release-please-version } subprojects { @@ -22,7 +22,6 @@ subprojects { group = "Verification" description = "Verifies all source files are formatted." } - apply(plugin = "org.jetbrains.dokka") } 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 e6b85dd..4446514 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 @@ -9,6 +9,7 @@ import com.cas_parser.api.core.Sleeper import com.cas_parser.api.core.Timeout import com.cas_parser.api.core.http.Headers import com.cas_parser.api.core.http.HttpClient +import com.cas_parser.api.core.http.ProxyAuthenticator import com.cas_parser.api.core.http.QueryParams import com.cas_parser.api.core.jsonMapper import com.fasterxml.jackson.databind.json.JsonMapper @@ -47,6 +48,7 @@ class CasParserOkHttpClient private constructor() { private var clientOptions: ClientOptions.Builder = ClientOptions.builder() private var dispatcherExecutorService: ExecutorService? = null private var proxy: Proxy? = null + private var proxyAuthenticator: ProxyAuthenticator? = null private var maxIdleConnections: Int? = null private var keepAliveDuration: Duration? = null private var sslSocketFactory: SSLSocketFactory? = null @@ -77,6 +79,20 @@ class CasParserOkHttpClient private constructor() { /** Alias for calling [Builder.proxy] with `proxy.orElse(null)`. */ fun proxy(proxy: Optional) = proxy(proxy.getOrNull()) + /** + * Provides credentials when an HTTP proxy responds with `407 Proxy Authentication + * Required`. + */ + fun proxyAuthenticator(proxyAuthenticator: ProxyAuthenticator?) = apply { + this.proxyAuthenticator = proxyAuthenticator + } + + /** + * Alias for calling [Builder.proxyAuthenticator] with `proxyAuthenticator.orElse(null)`. + */ + fun proxyAuthenticator(proxyAuthenticator: Optional) = + proxyAuthenticator(proxyAuthenticator.getOrNull()) + /** * The maximum number of idle connections kept by the underlying OkHttp connection pool. * @@ -217,6 +233,9 @@ class CasParserOkHttpClient private constructor() { /** * Whether to call `validate` on every response before returning it. * + * Setting this to `true` is _not_ forwards compatible with new types from the API for + * existing fields. + * * Defaults to false, which means the shape of the response will not be validated upfront. * Instead, validation will only occur for the parts of the response that are accessed. */ @@ -360,6 +379,7 @@ class CasParserOkHttpClient private constructor() { OkHttpClient.builder() .timeout(clientOptions.timeout()) .proxy(proxy) + .proxyAuthenticator(proxyAuthenticator) .maxIdleConnections(maxIdleConnections) .keepAliveDuration(keepAliveDuration) .dispatcherExecutorService(dispatcherExecutorService) 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 71b4321..2b7f952 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 @@ -9,6 +9,7 @@ import com.cas_parser.api.core.Sleeper import com.cas_parser.api.core.Timeout import com.cas_parser.api.core.http.Headers import com.cas_parser.api.core.http.HttpClient +import com.cas_parser.api.core.http.ProxyAuthenticator import com.cas_parser.api.core.http.QueryParams import com.cas_parser.api.core.jsonMapper import com.fasterxml.jackson.databind.json.JsonMapper @@ -47,6 +48,7 @@ class CasParserOkHttpClientAsync private constructor() { private var clientOptions: ClientOptions.Builder = ClientOptions.builder() private var dispatcherExecutorService: ExecutorService? = null private var proxy: Proxy? = null + private var proxyAuthenticator: ProxyAuthenticator? = null private var maxIdleConnections: Int? = null private var keepAliveDuration: Duration? = null private var sslSocketFactory: SSLSocketFactory? = null @@ -77,6 +79,20 @@ class CasParserOkHttpClientAsync private constructor() { /** Alias for calling [Builder.proxy] with `proxy.orElse(null)`. */ fun proxy(proxy: Optional) = proxy(proxy.getOrNull()) + /** + * Provides credentials when an HTTP proxy responds with `407 Proxy Authentication + * Required`. + */ + fun proxyAuthenticator(proxyAuthenticator: ProxyAuthenticator?) = apply { + this.proxyAuthenticator = proxyAuthenticator + } + + /** + * Alias for calling [Builder.proxyAuthenticator] with `proxyAuthenticator.orElse(null)`. + */ + fun proxyAuthenticator(proxyAuthenticator: Optional) = + proxyAuthenticator(proxyAuthenticator.getOrNull()) + /** * The maximum number of idle connections kept by the underlying OkHttp connection pool. * @@ -217,6 +233,9 @@ class CasParserOkHttpClientAsync private constructor() { /** * Whether to call `validate` on every response before returning it. * + * Setting this to `true` is _not_ forwards compatible with new types from the API for + * existing fields. + * * Defaults to false, which means the shape of the response will not be validated upfront. * Instead, validation will only occur for the parts of the response that are accessed. */ @@ -360,6 +379,7 @@ class CasParserOkHttpClientAsync private constructor() { OkHttpClient.builder() .timeout(clientOptions.timeout()) .proxy(proxy) + .proxyAuthenticator(proxyAuthenticator) .maxIdleConnections(maxIdleConnections) .keepAliveDuration(keepAliveDuration) .dispatcherExecutorService(dispatcherExecutorService) 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 7bc37ab..0630211 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 @@ -8,9 +8,11 @@ import com.cas_parser.api.core.http.HttpMethod import com.cas_parser.api.core.http.HttpRequest import com.cas_parser.api.core.http.HttpRequestBody import com.cas_parser.api.core.http.HttpResponse +import com.cas_parser.api.core.http.ProxyAuthenticator import com.cas_parser.api.errors.CasParserIoException import java.io.IOException import java.io.InputStream +import java.io.OutputStream import java.net.Proxy import java.time.Duration import java.util.concurrent.CancellationException @@ -20,10 +22,12 @@ import java.util.concurrent.TimeUnit import javax.net.ssl.HostnameVerifier import javax.net.ssl.SSLSocketFactory import javax.net.ssl.X509TrustManager +import kotlin.jvm.optionals.getOrNull import okhttp3.Call import okhttp3.Callback import okhttp3.ConnectionPool import okhttp3.Dispatcher +import okhttp3.HttpUrl import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.MediaType import okhttp3.MediaType.Companion.toMediaType @@ -33,6 +37,8 @@ import okhttp3.RequestBody.Companion.toRequestBody import okhttp3.Response import okhttp3.logging.HttpLoggingInterceptor import okio.BufferedSink +import okio.buffer +import okio.sink class OkHttpClient internal constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClient) : HttpClient { @@ -41,7 +47,7 @@ internal constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClie val call = newCall(request, requestOptions) return try { - call.execute().toResponse() + call.execute().toHttpResponse() } catch (e: IOException) { throw CasParserIoException("Request failed", e) } finally { @@ -59,7 +65,7 @@ internal constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClie call.enqueue( object : Callback { override fun onResponse(call: Call, response: Response) { - future.complete(response.toResponse()) + future.complete(response.toHttpResponse()) } override fun onFailure(call: Call, e: IOException) { @@ -111,89 +117,6 @@ internal constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClie return client.newCall(request.toRequest(client)) } - private fun HttpRequest.toRequest(client: okhttp3.OkHttpClient): Request { - var body: RequestBody? = body?.toRequestBody() - if (body == null && requiresBody(method)) { - body = "".toRequestBody() - } - - val builder = Request.Builder().url(toUrl()).method(method.name, body) - headers.names().forEach { name -> - headers.values(name).forEach { builder.addHeader(name, it) } - } - - if ( - !headers.names().contains("X-Stainless-Read-Timeout") && client.readTimeoutMillis != 0 - ) { - builder.addHeader( - "X-Stainless-Read-Timeout", - Duration.ofMillis(client.readTimeoutMillis.toLong()).seconds.toString(), - ) - } - if (!headers.names().contains("X-Stainless-Timeout") && client.callTimeoutMillis != 0) { - builder.addHeader( - "X-Stainless-Timeout", - Duration.ofMillis(client.callTimeoutMillis.toLong()).seconds.toString(), - ) - } - - return builder.build() - } - - /** `OkHttpClient` always requires a request body for some methods. */ - private fun requiresBody(method: HttpMethod): Boolean = - when (method) { - HttpMethod.POST, - HttpMethod.PUT, - HttpMethod.PATCH -> true - else -> false - } - - private fun HttpRequest.toUrl(): String { - val builder = baseUrl.toHttpUrl().newBuilder() - pathSegments.forEach(builder::addPathSegment) - queryParams.keys().forEach { key -> - queryParams.values(key).forEach { builder.addQueryParameter(key, it) } - } - - return builder.toString() - } - - private fun HttpRequestBody.toRequestBody(): RequestBody { - val mediaType = contentType()?.toMediaType() - val length = contentLength() - - return object : RequestBody() { - override fun contentType(): MediaType? = mediaType - - override fun contentLength(): Long = length - - override fun isOneShot(): Boolean = !repeatable() - - override fun writeTo(sink: BufferedSink) = writeTo(sink.outputStream()) - } - } - - private fun Response.toResponse(): HttpResponse { - val headers = headers.toHeaders() - - return object : HttpResponse { - override fun statusCode(): Int = code - - override fun headers(): Headers = headers - - override fun body(): InputStream = body!!.byteStream() - - override fun close() = body!!.close() - } - } - - private fun okhttp3.Headers.toHeaders(): Headers { - val headersBuilder = Headers.builder() - forEach { (name, value) -> headersBuilder.put(name, value) } - return headersBuilder.build() - } - companion object { @JvmStatic fun builder() = Builder() } @@ -202,6 +125,7 @@ internal constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClie private var timeout: Timeout = Timeout.default() private var proxy: Proxy? = null + private var proxyAuthenticator: ProxyAuthenticator? = null private var maxIdleConnections: Int? = null private var keepAliveDuration: Duration? = null private var dispatcherExecutorService: ExecutorService? = null @@ -215,6 +139,10 @@ internal constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClie fun proxy(proxy: Proxy?) = apply { this.proxy = proxy } + fun proxyAuthenticator(proxyAuthenticator: ProxyAuthenticator?) = apply { + this.proxyAuthenticator = proxyAuthenticator + } + /** * Sets the maximum number of idle connections kept by the underlying [ConnectionPool]. * @@ -264,6 +192,19 @@ internal constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClie .callTimeout(timeout.request()) .proxy(proxy) .apply { + proxyAuthenticator?.let { auth -> + proxyAuthenticator { route, response -> + auth + .authenticate( + route?.proxy ?: Proxy.NO_PROXY, + response.request.toHttpRequest(), + response.toHttpResponse(), + ) + .getOrNull() + ?.toRequest(client = null) + } + } + dispatcherExecutorService?.let { dispatcher(Dispatcher(it)) } val maxIdleConnections = maxIdleConnections @@ -303,3 +244,126 @@ internal constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClie ) } } + +private fun HttpRequest.toRequest(client: okhttp3.OkHttpClient?): Request { + var body: RequestBody? = body?.toRequestBody() + if (body == null && requiresBody(method)) { + body = "".toRequestBody() + } + + val builder = Request.Builder().url(toUrl()).method(method.name, body) + headers.names().forEach { name -> headers.values(name).forEach { builder.addHeader(name, it) } } + + if (client != null) { + if ( + !headers.names().contains("X-Stainless-Read-Timeout") && client.readTimeoutMillis != 0 + ) { + builder.addHeader( + "X-Stainless-Read-Timeout", + Duration.ofMillis(client.readTimeoutMillis.toLong()).seconds.toString(), + ) + } + if (!headers.names().contains("X-Stainless-Timeout") && client.callTimeoutMillis != 0) { + builder.addHeader( + "X-Stainless-Timeout", + Duration.ofMillis(client.callTimeoutMillis.toLong()).seconds.toString(), + ) + } + } + + return builder.build() +} + +/** `OkHttpClient` always requires a request body for some methods. */ +private fun requiresBody(method: HttpMethod): Boolean = + when (method) { + HttpMethod.POST, + HttpMethod.PUT, + HttpMethod.PATCH -> true + else -> false + } + +private fun HttpRequest.toUrl(): String { + val builder = baseUrl.toHttpUrl().newBuilder() + pathSegments.forEach(builder::addPathSegment) + queryParams.keys().forEach { key -> + queryParams.values(key).forEach { builder.addQueryParameter(key, it) } + } + + return builder.toString() +} + +private fun HttpRequestBody.toRequestBody(): RequestBody { + val mediaType = contentType()?.toMediaType() + val length = contentLength() + + return object : RequestBody() { + override fun contentType(): MediaType? = mediaType + + override fun contentLength(): Long = length + + override fun isOneShot(): Boolean = !repeatable() + + override fun writeTo(sink: BufferedSink) = writeTo(sink.outputStream()) + } +} + +private fun Request.toHttpRequest(): HttpRequest { + val builder = HttpRequest.builder().method(HttpMethod.valueOf(method)).baseUrl(url.toBaseUrl()) + url.pathSegments.forEach(builder::addPathSegment) + url.queryParameterNames.forEach { name -> + url.queryParameterValues(name).filterNotNull().forEach { builder.putQueryParam(name, it) } + } + headers.forEach { (name, value) -> builder.putHeader(name, value) } + body?.let { builder.body(it.toHttpRequestBody()) } + return builder.build() +} + +private fun HttpUrl.toBaseUrl(): String = buildString { + append(scheme).append("://").append(host) + if (port != HttpUrl.defaultPort(scheme)) { + append(":").append(port) + } +} + +private fun RequestBody.toHttpRequestBody(): HttpRequestBody { + val mediaType = contentType()?.toString() + val length = contentLength() + val isOneShot = isOneShot() + val source = this + return object : HttpRequestBody { + override fun contentType(): String? = mediaType + + override fun contentLength(): Long = length + + override fun repeatable(): Boolean = !isOneShot + + override fun writeTo(outputStream: OutputStream) { + val sink = outputStream.sink().buffer() + source.writeTo(sink) + sink.flush() + } + + override fun close() {} + } +} + +private fun Response.toHttpResponse(): HttpResponse { + val headers = headers.toHeaders() + + return object : HttpResponse { + override fun statusCode(): Int = code + + override fun headers(): Headers = headers + + override fun body(): InputStream = body!!.byteStream() + + override fun close() = body!!.close() + } +} + +private fun okhttp3.Headers.toHeaders(): Headers { + val headersBuilder = Headers.builder() + forEach { (name, value) -> headersBuilder.put(name, value) } + return headersBuilder.build() +} diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/ClientOptions.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/ClientOptions.kt index e5fac28..2129ec2 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/ClientOptions.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/ClientOptions.kt @@ -66,6 +66,9 @@ private constructor( /** * Whether to call `validate` on every response before returning it. * + * Setting this to `true` is _not_ forwards compatible with new types from the API for existing + * fields. + * * Defaults to false, which means the shape of the response will not be validated upfront. * Instead, validation will only occur for the parts of the response that are accessed. */ @@ -230,6 +233,9 @@ private constructor( /** * Whether to call `validate` on every response before returning it. * + * Setting this to `true` is _not_ forwards compatible with new types from the API for + * existing fields. + * * Defaults to false, which means the shape of the response will not be validated upfront. * Instead, validation will only occur for the parts of the response that are accessed. */ @@ -375,6 +381,14 @@ private constructor( (System.getProperty("casparser.apiKey") ?: System.getenv("CAS_PARSER_API_KEY"))?.let { apiKey(it) } + System.getenv("CAS_PARSER_CUSTOM_HEADERS")?.let { customHeadersEnv -> + for (line in customHeadersEnv.split("\n")) { + val colon = line.indexOf(':') + if (colon >= 0) { + putHeader(line.substring(0, colon).trim(), line.substring(colon + 1).trim()) + } + } + } } /** diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/ObjectMappers.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/ObjectMappers.kt index e067f70..0c4aadd 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/ObjectMappers.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/ObjectMappers.kt @@ -29,7 +29,9 @@ import java.time.ZoneId import java.time.format.DateTimeFormatter import java.time.temporal.ChronoField -fun jsonMapper(): JsonMapper = +fun jsonMapper(): JsonMapper = JSON_MAPPER + +private val JSON_MAPPER: JsonMapper = JsonMapper.builder() .addModule(kotlinModule()) .addModule(Jdk8Module()) diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/RequestOptions.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/RequestOptions.kt index 0232e87..b873e13 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/RequestOptions.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/RequestOptions.kt @@ -33,6 +33,15 @@ class RequestOptions private constructor(val responseValidation: Boolean?, val t private var responseValidation: Boolean? = null private var timeout: Timeout? = null + /** + * Whether to call `validate` on the response before returning it. + * + * Setting this to `true` is _not_ forwards compatible with new types from the API for + * existing fields. + * + * Defaults to false, which means the shape of the response will not be validated upfront. + * Instead, validation will only occur for the parts of the response that are accessed. + */ fun responseValidation(responseValidation: Boolean) = apply { this.responseValidation = responseValidation } diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/http/ProxyAuthenticator.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/http/ProxyAuthenticator.kt new file mode 100644 index 0000000..a131d34 --- /dev/null +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/http/ProxyAuthenticator.kt @@ -0,0 +1,59 @@ +package com.cas_parser.api.core.http + +import java.net.Proxy +import java.nio.charset.Charset +import java.nio.charset.StandardCharsets +import java.util.Base64 +import java.util.Optional + +/** + * Provides credentials when an HTTP proxy responds with `407 Proxy Authentication Required`. + * + * Implementations inspect the 407 [response] (typically its `Proxy-Authenticate` header) and return + * the request to retry with a `Proxy-Authorization` header set, or [Optional.empty] to abandon + * authentication and surface the 407 to the caller. + * + * Implementations must be thread-safe; they may be invoked concurrently from multiple HTTP calls. + */ +fun interface ProxyAuthenticator { + + /** + * @param proxy the proxy that produced the challenge, or [Proxy.NO_PROXY] if the route is not + * yet established + * @param request the request that produced [response] + * @param response the 407 challenge response + * @return the retry request to send (typically [request] with a `Proxy-Authorization` header + * added), or [Optional.empty] to abandon authentication + */ + fun authenticate( + proxy: Proxy, + request: HttpRequest, + response: HttpResponse, + ): Optional + + companion object { + + /** + * A [ProxyAuthenticator] that uses RFC 7617 Basic authentication with the ISO-8859-1 + * charset. + */ + @JvmStatic + fun basic(username: String, password: String): ProxyAuthenticator = + basic(username, password, StandardCharsets.ISO_8859_1) + + /** + * A [ProxyAuthenticator] that uses RFC 7617 Basic authentication with the given [charset]. + */ + @JvmStatic + fun basic(username: String, password: String, charset: Charset): ProxyAuthenticator { + val token = + Base64.getEncoder().encodeToString("$username:$password".toByteArray(charset)) + val headerValue = "Basic $token" + return ProxyAuthenticator { _, request, _ -> + Optional.of( + request.toBuilder().putHeader("Proxy-Authorization", headerValue).build() + ) + } + } + } +} diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/errors/BadRequestException.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/errors/BadRequestException.kt index a0737dc..074ca61 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/errors/BadRequestException.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/errors/BadRequestException.kt @@ -5,12 +5,16 @@ package com.cas_parser.api.errors import com.cas_parser.api.core.JsonValue import com.cas_parser.api.core.checkRequired import com.cas_parser.api.core.http.Headers +import com.cas_parser.api.core.jsonMapper import java.util.Optional import kotlin.jvm.optionals.getOrNull class BadRequestException private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) : - CasParserServiceException("400: $body", cause) { + CasParserServiceException( + "400: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}", + cause, + ) { override fun statusCode(): Int = 400 diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/errors/InternalServerException.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/errors/InternalServerException.kt index ec2af8e..75987e6 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/errors/InternalServerException.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/errors/InternalServerException.kt @@ -5,6 +5,7 @@ package com.cas_parser.api.errors import com.cas_parser.api.core.JsonValue import com.cas_parser.api.core.checkRequired import com.cas_parser.api.core.http.Headers +import com.cas_parser.api.core.jsonMapper import java.util.Optional import kotlin.jvm.optionals.getOrNull @@ -14,7 +15,11 @@ private constructor( private val headers: Headers, private val body: JsonValue, cause: Throwable?, -) : CasParserServiceException("$statusCode: $body", cause) { +) : + CasParserServiceException( + "$statusCode: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}", + cause, + ) { override fun statusCode(): Int = statusCode diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/errors/NotFoundException.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/errors/NotFoundException.kt index c01b9dd..6856cd6 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/errors/NotFoundException.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/errors/NotFoundException.kt @@ -5,12 +5,16 @@ package com.cas_parser.api.errors import com.cas_parser.api.core.JsonValue import com.cas_parser.api.core.checkRequired import com.cas_parser.api.core.http.Headers +import com.cas_parser.api.core.jsonMapper import java.util.Optional import kotlin.jvm.optionals.getOrNull class NotFoundException private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) : - CasParserServiceException("404: $body", cause) { + CasParserServiceException( + "404: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}", + cause, + ) { override fun statusCode(): Int = 404 diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/errors/PermissionDeniedException.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/errors/PermissionDeniedException.kt index 520a46f..bb97c2e 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/errors/PermissionDeniedException.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/errors/PermissionDeniedException.kt @@ -5,12 +5,16 @@ package com.cas_parser.api.errors import com.cas_parser.api.core.JsonValue import com.cas_parser.api.core.checkRequired import com.cas_parser.api.core.http.Headers +import com.cas_parser.api.core.jsonMapper import java.util.Optional import kotlin.jvm.optionals.getOrNull class PermissionDeniedException private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) : - CasParserServiceException("403: $body", cause) { + CasParserServiceException( + "403: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}", + cause, + ) { override fun statusCode(): Int = 403 diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/errors/RateLimitException.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/errors/RateLimitException.kt index 10c79f3..c14384b 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/errors/RateLimitException.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/errors/RateLimitException.kt @@ -5,12 +5,16 @@ package com.cas_parser.api.errors import com.cas_parser.api.core.JsonValue import com.cas_parser.api.core.checkRequired import com.cas_parser.api.core.http.Headers +import com.cas_parser.api.core.jsonMapper import java.util.Optional import kotlin.jvm.optionals.getOrNull class RateLimitException private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) : - CasParserServiceException("429: $body", cause) { + CasParserServiceException( + "429: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}", + cause, + ) { override fun statusCode(): Int = 429 diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/errors/UnauthorizedException.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/errors/UnauthorizedException.kt index 290a3e7..3d9e25a 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/errors/UnauthorizedException.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/errors/UnauthorizedException.kt @@ -5,12 +5,16 @@ package com.cas_parser.api.errors import com.cas_parser.api.core.JsonValue import com.cas_parser.api.core.checkRequired import com.cas_parser.api.core.http.Headers +import com.cas_parser.api.core.jsonMapper import java.util.Optional import kotlin.jvm.optionals.getOrNull class UnauthorizedException private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) : - CasParserServiceException("401: $body", cause) { + CasParserServiceException( + "401: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}", + cause, + ) { override fun statusCode(): Int = 401 diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/errors/UnexpectedStatusCodeException.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/errors/UnexpectedStatusCodeException.kt index 55a37fe..2ea9523 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/errors/UnexpectedStatusCodeException.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/errors/UnexpectedStatusCodeException.kt @@ -5,6 +5,7 @@ package com.cas_parser.api.errors import com.cas_parser.api.core.JsonValue import com.cas_parser.api.core.checkRequired import com.cas_parser.api.core.http.Headers +import com.cas_parser.api.core.jsonMapper import java.util.Optional import kotlin.jvm.optionals.getOrNull @@ -14,7 +15,11 @@ private constructor( private val headers: Headers, private val body: JsonValue, cause: Throwable?, -) : CasParserServiceException("$statusCode: $body", cause) { +) : + CasParserServiceException( + "$statusCode: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}", + cause, + ) { override fun statusCode(): Int = statusCode diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/errors/UnprocessableEntityException.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/errors/UnprocessableEntityException.kt index 678980c..a6a9f9a 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/errors/UnprocessableEntityException.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/errors/UnprocessableEntityException.kt @@ -5,12 +5,16 @@ package com.cas_parser.api.errors import com.cas_parser.api.core.JsonValue import com.cas_parser.api.core.checkRequired import com.cas_parser.api.core.http.Headers +import com.cas_parser.api.core.jsonMapper import java.util.Optional import kotlin.jvm.optionals.getOrNull class UnprocessableEntityException private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) : - CasParserServiceException("422: $body", cause) { + CasParserServiceException( + "422: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}", + cause, + ) { override fun statusCode(): Int = 422 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 index 93daf86..d8e5a20 100644 --- 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 @@ -350,6 +350,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply 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 index a23d37b..00a9e51 100644 --- 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 @@ -186,6 +186,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AccessTokenCreateResponse = apply { if (validated) { return@apply diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/camskfintech/CamsKfintechParseParams.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/camskfintech/CamsKfintechParseParams.kt index 2b503a6..20c4db0 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/camskfintech/CamsKfintechParseParams.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/camskfintech/CamsKfintechParseParams.kt @@ -444,6 +444,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/camskfintech/LinkedHolder.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/camskfintech/LinkedHolder.kt index 9aa025d..4ccd215 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/camskfintech/LinkedHolder.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/camskfintech/LinkedHolder.kt @@ -142,6 +142,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): LinkedHolder = apply { if (validated) { return@apply diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/camskfintech/Transaction.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/camskfintech/Transaction.kt index 64c2700..94bec94 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/camskfintech/Transaction.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/camskfintech/Transaction.kt @@ -433,6 +433,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Transaction = apply { if (validated) { return@apply @@ -799,6 +807,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AdditionalInfo = apply { if (validated) { return@apply @@ -1051,6 +1068,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/camskfintech/UnifiedResponse.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/camskfintech/UnifiedResponse.kt index 6a27c6f..cceadd0 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/camskfintech/UnifiedResponse.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/camskfintech/UnifiedResponse.kt @@ -342,6 +342,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UnifiedResponse = apply { if (validated) { return@apply @@ -784,6 +792,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): DematAccount = apply { if (validated) { return@apply @@ -1200,6 +1217,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): AdditionalInfo = apply { if (validated) { return@apply @@ -1372,6 +1399,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): DematType = apply { if (validated) { return@apply @@ -1733,6 +1770,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Holdings = apply { if (validated) { return@apply @@ -2076,6 +2123,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Aif = apply { if (validated) { return@apply @@ -2295,6 +2352,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): AdditionalInfo = apply { if (validated) { return@apply @@ -2687,6 +2754,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): CorporateBond = apply { if (validated) { return@apply @@ -2906,6 +2983,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): AdditionalInfo = apply { if (validated) { return@apply @@ -3298,6 +3385,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): DematMutualFund = apply { if (validated) { return@apply @@ -3517,6 +3614,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): AdditionalInfo = apply { if (validated) { return@apply @@ -3907,6 +4014,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Equity = apply { if (validated) { return@apply @@ -4126,6 +4243,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): AdditionalInfo = apply { if (validated) { return@apply @@ -4520,6 +4647,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): GovernmentSecurity = apply { if (validated) { return@apply @@ -4739,6 +4876,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): AdditionalInfo = apply { if (validated) { return@apply @@ -5013,6 +5160,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Insurance = apply { if (validated) { return@apply @@ -5456,6 +5612,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): LifeInsurancePolicy = apply { if (validated) { return@apply @@ -5850,6 +6016,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Investor = apply { if (validated) { return@apply @@ -6090,6 +6265,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Meta = apply { if (validated) { return@apply @@ -6220,6 +6404,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): CasType = apply { if (validated) { return@apply @@ -6391,6 +6585,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): StatementPeriod = apply { if (validated) { return@apply @@ -6814,6 +7018,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): MutualFund = apply { if (validated) { return@apply @@ -7018,6 +7231,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): AdditionalInfo = apply { if (validated) { return@apply @@ -7552,6 +7775,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Scheme = apply { if (validated) { return@apply @@ -7881,6 +8114,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): AdditionalInfo = apply { if (validated) { return@apply @@ -8092,6 +8335,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Gain = apply { if (validated) { return@apply @@ -8247,6 +8500,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -8649,6 +8912,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Np = apply { if (validated) { return@apply @@ -8958,6 +9230,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Fund = apply { if (validated) { return@apply @@ -9138,6 +9420,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): AdditionalInfo = apply { if (validated) { return@apply @@ -9258,6 +9550,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): Tier = apply { if (validated) { return@apply @@ -9509,6 +9811,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Summary = apply { if (validated) { return@apply @@ -9741,6 +10052,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Accounts = apply { if (validated) { return@apply @@ -9917,6 +10238,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Demat = apply { if (validated) { return@apply @@ -10110,6 +10441,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Insurance = apply { if (validated) { return@apply @@ -10303,6 +10644,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): MutualFunds = apply { if (validated) { return@apply @@ -10495,6 +10846,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Nps = apply { if (validated) { return@apply diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/cdsl/CdslParsePdfParams.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/cdsl/CdslParsePdfParams.kt index e9440f6..81df339 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/cdsl/CdslParsePdfParams.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/cdsl/CdslParsePdfParams.kt @@ -443,6 +443,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/cdsl/fetch/FetchRequestOtpParams.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/cdsl/fetch/FetchRequestOtpParams.kt index 34b641d..e1509fd 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/cdsl/fetch/FetchRequestOtpParams.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/cdsl/fetch/FetchRequestOtpParams.kt @@ -492,6 +492,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/cdsl/fetch/FetchRequestOtpResponse.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/cdsl/fetch/FetchRequestOtpResponse.kt index cf0cf74..12de1bb 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/cdsl/fetch/FetchRequestOtpResponse.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/cdsl/fetch/FetchRequestOtpResponse.kt @@ -168,6 +168,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FetchRequestOtpResponse = apply { if (validated) { return@apply diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/cdsl/fetch/FetchVerifyOtpParams.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/cdsl/fetch/FetchVerifyOtpParams.kt index 854f921..0a81238 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/cdsl/fetch/FetchVerifyOtpParams.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/cdsl/fetch/FetchVerifyOtpParams.kt @@ -438,6 +438,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/cdsl/fetch/FetchVerifyOtpResponse.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/cdsl/fetch/FetchVerifyOtpResponse.kt index 2e72418..49d6bdf 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/cdsl/fetch/FetchVerifyOtpResponse.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/cdsl/fetch/FetchVerifyOtpResponse.kt @@ -185,6 +185,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FetchVerifyOtpResponse = apply { if (validated) { return@apply @@ -343,6 +351,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): File = apply { if (validated) { return@apply diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/contractnote/ContractNoteParseParams.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/contractnote/ContractNoteParseParams.kt index 6c6ee9e..eee36e7 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/contractnote/ContractNoteParseParams.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/contractnote/ContractNoteParseParams.kt @@ -539,6 +539,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -686,6 +695,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): BrokerType = apply { if (validated) { return@apply diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/contractnote/ContractNoteParseResponse.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/contractnote/ContractNoteParseResponse.kt index 370d8b0..9f81c80 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/contractnote/ContractNoteParseResponse.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/contractnote/ContractNoteParseResponse.kt @@ -171,6 +171,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ContractNoteParseResponse = apply { if (validated) { return@apply @@ -592,6 +600,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Data = apply { if (validated) { return@apply @@ -817,6 +834,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): BrokerInfo = apply { if (validated) { return@apply @@ -961,6 +988,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): BrokerType = apply { if (validated) { return@apply @@ -1488,6 +1525,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): ChargesSummary = apply { if (validated) { return@apply @@ -1856,6 +1903,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): ClientInfo = apply { if (validated) { return@apply @@ -2167,6 +2224,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): ContractNoteInfo = apply { if (validated) { return@apply @@ -2586,6 +2653,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): DerivativesTransaction = apply { if (validated) { return@apply @@ -3232,6 +3309,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): DetailedTrade = apply { if (validated) { return@apply @@ -3792,6 +3879,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): EquityTransaction = apply { if (validated) { return@apply 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 index 6a3f1a3..c5f263b 100644 --- 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 @@ -317,6 +317,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CreditCheckResponse = apply { if (validated) { return@apply diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inboundemail/InboundEmailCreateParams.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inboundemail/InboundEmailCreateParams.kt index 54b1e1c..d042ab7 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inboundemail/InboundEmailCreateParams.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inboundemail/InboundEmailCreateParams.kt @@ -694,6 +694,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -865,6 +874,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AllowedSource = apply { if (validated) { return@apply @@ -965,6 +983,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inboundemail/InboundEmailCreateResponse.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inboundemail/InboundEmailCreateResponse.kt index 90aaaf9..9ef158d 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inboundemail/InboundEmailCreateResponse.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inboundemail/InboundEmailCreateResponse.kt @@ -80,8 +80,8 @@ private constructor( allowedSources.getOptional("allowed_sources") /** - * Webhook URL for email notifications. `null` means files are only retrievable via `GET - * /v4/inbound-email/{id}/files` (pull delivery). + * Webhook URL for email notifications. If set, we POST each parsed email here. If omitted, + * files are only retrievable via `GET /v4/inbound-email/{id}/files`. * * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -89,7 +89,7 @@ private constructor( fun callbackUrl(): Optional = callbackUrl.getOptional("callback_url") /** - * When the mailbox was created + * When the inbound email was created * * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -129,7 +129,7 @@ private constructor( fun reference(): Optional = reference.getOptional("reference") /** - * Current mailbox status + * Current inbound email lifecycle status * * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -137,7 +137,7 @@ private constructor( fun status(): Optional = status.getOptional("status") /** - * When the mailbox was last updated + * When the inbound email was last updated * * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -293,13 +293,10 @@ private constructor( } /** - * Webhook URL for email notifications. `null` means files are only retrievable via `GET - * /v4/inbound-email/{id}/files` (pull delivery). + * Webhook URL for email notifications. If set, we POST each parsed email here. If omitted, + * files are only retrievable via `GET /v4/inbound-email/{id}/files`. */ - fun callbackUrl(callbackUrl: String?) = callbackUrl(JsonField.ofNullable(callbackUrl)) - - /** Alias for calling [Builder.callbackUrl] with `callbackUrl.orElse(null)`. */ - fun callbackUrl(callbackUrl: Optional) = callbackUrl(callbackUrl.getOrNull()) + fun callbackUrl(callbackUrl: String) = callbackUrl(JsonField.of(callbackUrl)) /** * Sets [Builder.callbackUrl] to an arbitrary JSON value. @@ -310,7 +307,7 @@ private constructor( */ fun callbackUrl(callbackUrl: JsonField) = apply { this.callbackUrl = callbackUrl } - /** When the mailbox was created */ + /** When the inbound email was created */ fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) /** @@ -374,7 +371,7 @@ private constructor( */ fun reference(reference: JsonField) = apply { this.reference = reference } - /** Current mailbox status */ + /** Current inbound email lifecycle status */ fun status(status: Status) = status(JsonField.of(status)) /** @@ -385,7 +382,7 @@ private constructor( */ fun status(status: JsonField) = apply { this.status = status } - /** When the mailbox was last updated */ + /** When the inbound email was last updated */ fun updatedAt(updatedAt: OffsetDateTime) = updatedAt(JsonField.of(updatedAt)) /** @@ -438,6 +435,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InboundEmailCreateResponse = apply { if (validated) { return@apply @@ -585,6 +590,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AllowedSource = apply { if (validated) { return@apply @@ -682,6 +696,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -723,7 +746,7 @@ private constructor( override fun toString() = "Metadata{additionalProperties=$additionalProperties}" } - /** Current mailbox status */ + /** Current inbound email lifecycle status */ class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -813,6 +836,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inboundemail/InboundEmailDeleteResponse.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inboundemail/InboundEmailDeleteResponse.kt index 332967a..a5ed525 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inboundemail/InboundEmailDeleteResponse.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inboundemail/InboundEmailDeleteResponse.kt @@ -139,6 +139,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InboundEmailDeleteResponse = apply { if (validated) { return@apply diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inboundemail/InboundEmailListParams.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inboundemail/InboundEmailListParams.kt index aea16e2..8b77162 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inboundemail/InboundEmailListParams.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inboundemail/InboundEmailListParams.kt @@ -14,8 +14,8 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** - * List all mailboxes associated with your API key. Returns active and inactive mailboxes (deleted - * mailboxes are excluded). + * List all inbound emails associated with your API key. Returns active and paused inbound emails + * (deleted ones are excluded). */ class InboundEmailListParams private constructor( @@ -322,6 +322,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inboundemail/InboundEmailListResponse.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inboundemail/InboundEmailListResponse.kt index 0412e52..e6f0048 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inboundemail/InboundEmailListResponse.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inboundemail/InboundEmailListResponse.kt @@ -253,6 +253,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InboundEmailListResponse = apply { if (validated) { return@apply @@ -351,8 +359,8 @@ private constructor( allowedSources.getOptional("allowed_sources") /** - * Webhook URL for email notifications. `null` means files are only retrievable via `GET - * /v4/inbound-email/{id}/files` (pull delivery). + * Webhook URL for email notifications. If set, we POST each parsed email here. If omitted, + * files are only retrievable via `GET /v4/inbound-email/{id}/files`. * * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -360,7 +368,7 @@ private constructor( fun callbackUrl(): Optional = callbackUrl.getOptional("callback_url") /** - * When the mailbox was created + * When the inbound email was created * * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -400,7 +408,7 @@ private constructor( fun reference(): Optional = reference.getOptional("reference") /** - * Current mailbox status + * Current inbound email lifecycle status * * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -408,7 +416,7 @@ private constructor( fun status(): Optional = status.getOptional("status") /** - * When the mailbox was last updated + * When the inbound email was last updated * * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -564,13 +572,10 @@ private constructor( } /** - * Webhook URL for email notifications. `null` means files are only retrievable via `GET - * /v4/inbound-email/{id}/files` (pull delivery). + * Webhook URL for email notifications. If set, we POST each parsed email here. If + * omitted, files are only retrievable via `GET /v4/inbound-email/{id}/files`. */ - fun callbackUrl(callbackUrl: String?) = callbackUrl(JsonField.ofNullable(callbackUrl)) - - /** Alias for calling [Builder.callbackUrl] with `callbackUrl.orElse(null)`. */ - fun callbackUrl(callbackUrl: Optional) = callbackUrl(callbackUrl.getOrNull()) + fun callbackUrl(callbackUrl: String) = callbackUrl(JsonField.of(callbackUrl)) /** * Sets [Builder.callbackUrl] to an arbitrary JSON value. @@ -583,7 +588,7 @@ private constructor( this.callbackUrl = callbackUrl } - /** When the mailbox was created */ + /** When the inbound email was created */ fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) /** @@ -651,7 +656,7 @@ private constructor( */ fun reference(reference: JsonField) = apply { this.reference = reference } - /** Current mailbox status */ + /** Current inbound email lifecycle status */ fun status(status: Status) = status(JsonField.of(status)) /** @@ -663,7 +668,7 @@ private constructor( */ fun status(status: JsonField) = apply { this.status = status } - /** When the mailbox was last updated */ + /** When the inbound email was last updated */ fun updatedAt(updatedAt: OffsetDateTime) = updatedAt(JsonField.of(updatedAt)) /** @@ -718,6 +723,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InboundEmail = apply { if (validated) { return@apply @@ -866,6 +880,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): AllowedSource = apply { if (validated) { return@apply @@ -966,6 +990,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -1007,7 +1041,7 @@ private constructor( override fun toString() = "Metadata{additionalProperties=$additionalProperties}" } - /** Current mailbox status */ + /** Current inbound email lifecycle status */ class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -1099,6 +1133,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inboundemail/InboundEmailRetrieveParams.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inboundemail/InboundEmailRetrieveParams.kt index 1c0676b..676faaa 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inboundemail/InboundEmailRetrieveParams.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inboundemail/InboundEmailRetrieveParams.kt @@ -9,7 +9,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Retrieve details of a specific mailbox including statistics. */ +/** Retrieve details of a specific inbound email including statistics. */ class InboundEmailRetrieveParams private constructor( private val inboundEmailId: String?, diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inboundemail/InboundEmailRetrieveResponse.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inboundemail/InboundEmailRetrieveResponse.kt index 39aad18..3bbfbd9 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inboundemail/InboundEmailRetrieveResponse.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inboundemail/InboundEmailRetrieveResponse.kt @@ -80,8 +80,8 @@ private constructor( allowedSources.getOptional("allowed_sources") /** - * Webhook URL for email notifications. `null` means files are only retrievable via `GET - * /v4/inbound-email/{id}/files` (pull delivery). + * Webhook URL for email notifications. If set, we POST each parsed email here. If omitted, + * files are only retrievable via `GET /v4/inbound-email/{id}/files`. * * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -89,7 +89,7 @@ private constructor( fun callbackUrl(): Optional = callbackUrl.getOptional("callback_url") /** - * When the mailbox was created + * When the inbound email was created * * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -129,7 +129,7 @@ private constructor( fun reference(): Optional = reference.getOptional("reference") /** - * Current mailbox status + * Current inbound email lifecycle status * * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -137,7 +137,7 @@ private constructor( fun status(): Optional = status.getOptional("status") /** - * When the mailbox was last updated + * When the inbound email was last updated * * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -293,13 +293,10 @@ private constructor( } /** - * Webhook URL for email notifications. `null` means files are only retrievable via `GET - * /v4/inbound-email/{id}/files` (pull delivery). + * Webhook URL for email notifications. If set, we POST each parsed email here. If omitted, + * files are only retrievable via `GET /v4/inbound-email/{id}/files`. */ - fun callbackUrl(callbackUrl: String?) = callbackUrl(JsonField.ofNullable(callbackUrl)) - - /** Alias for calling [Builder.callbackUrl] with `callbackUrl.orElse(null)`. */ - fun callbackUrl(callbackUrl: Optional) = callbackUrl(callbackUrl.getOrNull()) + fun callbackUrl(callbackUrl: String) = callbackUrl(JsonField.of(callbackUrl)) /** * Sets [Builder.callbackUrl] to an arbitrary JSON value. @@ -310,7 +307,7 @@ private constructor( */ fun callbackUrl(callbackUrl: JsonField) = apply { this.callbackUrl = callbackUrl } - /** When the mailbox was created */ + /** When the inbound email was created */ fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) /** @@ -374,7 +371,7 @@ private constructor( */ fun reference(reference: JsonField) = apply { this.reference = reference } - /** Current mailbox status */ + /** Current inbound email lifecycle status */ fun status(status: Status) = status(JsonField.of(status)) /** @@ -385,7 +382,7 @@ private constructor( */ fun status(status: JsonField) = apply { this.status = status } - /** When the mailbox was last updated */ + /** When the inbound email was last updated */ fun updatedAt(updatedAt: OffsetDateTime) = updatedAt(JsonField.of(updatedAt)) /** @@ -438,6 +435,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InboundEmailRetrieveResponse = apply { if (validated) { return@apply @@ -585,6 +590,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AllowedSource = apply { if (validated) { return@apply @@ -682,6 +696,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -723,7 +746,7 @@ private constructor( override fun toString() = "Metadata{additionalProperties=$additionalProperties}" } - /** Current mailbox status */ + /** Current inbound email lifecycle status */ class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -813,6 +836,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inbox/InboxCheckConnectionStatusResponse.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inbox/InboxCheckConnectionStatusResponse.kt index dad4ab0..585828e 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inbox/InboxCheckConnectionStatusResponse.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inbox/InboxCheckConnectionStatusResponse.kt @@ -209,6 +209,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InboxCheckConnectionStatusResponse = apply { if (validated) { return@apply diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inbox/InboxConnectEmailParams.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inbox/InboxConnectEmailParams.kt index dc2c277..12bb059 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inbox/InboxConnectEmailParams.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inbox/InboxConnectEmailParams.kt @@ -440,6 +440,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inbox/InboxConnectEmailResponse.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inbox/InboxConnectEmailResponse.kt index 4511a59..968248e 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inbox/InboxConnectEmailResponse.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inbox/InboxConnectEmailResponse.kt @@ -177,6 +177,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InboxConnectEmailResponse = apply { if (validated) { return@apply diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inbox/InboxDisconnectEmailResponse.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inbox/InboxDisconnectEmailResponse.kt index 0214edc..48cb354 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inbox/InboxDisconnectEmailResponse.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inbox/InboxDisconnectEmailResponse.kt @@ -139,6 +139,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InboxDisconnectEmailResponse = apply { if (validated) { return@apply diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inbox/InboxListCasFilesParams.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inbox/InboxListCasFilesParams.kt index b3c976d..aa23aae 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inbox/InboxListCasFilesParams.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/inbox/InboxListCasFilesParams.kt @@ -543,6 +543,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -697,6 +706,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CasType = apply { if (validated) { return@apply 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 1373c71..2240910 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 @@ -192,6 +192,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InboxListCasFilesResponse = apply { if (validated) { return@apply @@ -285,7 +293,10 @@ private constructor( fun casType(): Optional = casType.getOptional("cas_type") /** - * URL expiration time in seconds (default 86400 = 24 hours) + * URL expiration time in seconds. Defaults vary by source: + * - Gmail Inbox Import: 86400 (24h) + * - Inbound Email with `callback_url` set: 172800 (48h) + * - Inbound Email without `callback_url`: aligned with the session TTL (~30 min) * * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -477,7 +488,12 @@ private constructor( */ fun casType(casType: JsonField) = apply { this.casType = casType } - /** URL expiration time in seconds (default 86400 = 24 hours) */ + /** + * URL expiration time in seconds. Defaults vary by source: + * - Gmail Inbox Import: 86400 (24h) + * - Inbound Email with `callback_url` set: 172800 (48h) + * - Inbound Email without `callback_url`: aligned with the session TTL (~30 min) + */ fun expiresIn(expiresIn: Long) = expiresIn(JsonField.of(expiresIn)) /** @@ -624,6 +640,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): File = apply { if (validated) { return@apply @@ -772,6 +797,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): CasType = apply { if (validated) { return@apply diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/kfintech/KfintechGenerateCasParams.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/kfintech/KfintechGenerateCasParams.kt index 87b8b15..b8a20e9 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/kfintech/KfintechGenerateCasParams.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/kfintech/KfintechGenerateCasParams.kt @@ -616,6 +616,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/kfintech/KfintechGenerateCasResponse.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/kfintech/KfintechGenerateCasResponse.kt index 40e0359..e1d5883 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/kfintech/KfintechGenerateCasResponse.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/kfintech/KfintechGenerateCasResponse.kt @@ -139,6 +139,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): KfintechGenerateCasResponse = apply { if (validated) { return@apply 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 index b5db085..fbd9946 100644 --- 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 @@ -459,6 +459,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply 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 index b77a776..e545f51 100644 --- 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 @@ -185,6 +185,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): LogCreateResponse = apply { if (validated) { return@apply @@ -487,6 +495,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Log = apply { if (validated) { return@apply diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/logs/LogGetSummaryParams.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/logs/LogGetSummaryParams.kt index 28648da..b645d12 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/logs/LogGetSummaryParams.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/logs/LogGetSummaryParams.kt @@ -404,6 +404,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/logs/LogGetSummaryResponse.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/logs/LogGetSummaryResponse.kt index a78d1ba..892fb73 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/logs/LogGetSummaryResponse.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/logs/LogGetSummaryResponse.kt @@ -140,6 +140,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): LogGetSummaryResponse = apply { if (validated) { return@apply @@ -366,6 +374,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Summary = apply { if (validated) { return@apply @@ -568,6 +585,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): ByFeature = apply { if (validated) { return@apply diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/nsdl/NsdlParseParams.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/nsdl/NsdlParseParams.kt index 240f71c..96eb267 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/nsdl/NsdlParseParams.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/nsdl/NsdlParseParams.kt @@ -439,6 +439,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/smart/SmartParseCasPdfParams.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/smart/SmartParseCasPdfParams.kt index cbfbeb1..730a047 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/smart/SmartParseCasPdfParams.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/smart/SmartParseCasPdfParams.kt @@ -444,6 +444,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/verifytoken/VerifyTokenVerifyResponse.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/verifytoken/VerifyTokenVerifyResponse.kt index b8859a0..f34e4bd 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/verifytoken/VerifyTokenVerifyResponse.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/verifytoken/VerifyTokenVerifyResponse.kt @@ -187,6 +187,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CasParserInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): VerifyTokenVerifyResponse = apply { if (validated) { return@apply diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/async/InboundEmailServiceAsync.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/async/InboundEmailServiceAsync.kt index 70d732d..cfd29f4 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/async/InboundEmailServiceAsync.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/async/InboundEmailServiceAsync.kt @@ -81,7 +81,7 @@ interface InboundEmailServiceAsync { fun create(requestOptions: RequestOptions): CompletableFuture = create(InboundEmailCreateParams.none(), requestOptions) - /** Retrieve details of a specific mailbox including statistics. */ + /** Retrieve details of a specific inbound email including statistics. */ fun retrieve(inboundEmailId: String): CompletableFuture = retrieve(inboundEmailId, InboundEmailRetrieveParams.none()) @@ -119,8 +119,8 @@ interface InboundEmailServiceAsync { retrieve(inboundEmailId, InboundEmailRetrieveParams.none(), requestOptions) /** - * List all mailboxes associated with your API key. Returns active and inactive mailboxes - * (deleted mailboxes are excluded). + * List all inbound emails associated with your API key. Returns active and paused inbound + * emails (deleted ones are excluded). */ fun list(): CompletableFuture = list(InboundEmailListParams.none()) diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/blocking/InboundEmailService.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/blocking/InboundEmailService.kt index 6b52989..ab31236 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/blocking/InboundEmailService.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/blocking/InboundEmailService.kt @@ -80,7 +80,7 @@ interface InboundEmailService { fun create(requestOptions: RequestOptions): InboundEmailCreateResponse = create(InboundEmailCreateParams.none(), requestOptions) - /** Retrieve details of a specific mailbox including statistics. */ + /** Retrieve details of a specific inbound email including statistics. */ fun retrieve(inboundEmailId: String): InboundEmailRetrieveResponse = retrieve(inboundEmailId, InboundEmailRetrieveParams.none()) @@ -116,8 +116,8 @@ interface InboundEmailService { retrieve(inboundEmailId, InboundEmailRetrieveParams.none(), requestOptions) /** - * List all mailboxes associated with your API key. Returns active and inactive mailboxes - * (deleted mailboxes are excluded). + * List all inbound emails associated with your API key. Returns active and paused inbound + * emails (deleted ones are excluded). */ fun list(): InboundEmailListResponse = list(InboundEmailListParams.none()) diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/inboundemail/InboundEmailDeleteResponseTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/inboundemail/InboundEmailDeleteResponseTest.kt index 0c8f6fe..476763e 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/inboundemail/InboundEmailDeleteResponseTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/inboundemail/InboundEmailDeleteResponseTest.kt @@ -13,11 +13,11 @@ internal class InboundEmailDeleteResponseTest { fun create() { val inboundEmailDeleteResponse = InboundEmailDeleteResponse.builder() - .msg("Mailbox deleted successfully") + .msg("Inbound email deleted successfully") .status("success") .build() - assertThat(inboundEmailDeleteResponse.msg()).contains("Mailbox deleted successfully") + assertThat(inboundEmailDeleteResponse.msg()).contains("Inbound email deleted successfully") assertThat(inboundEmailDeleteResponse.status()).contains("success") } @@ -26,7 +26,7 @@ internal class InboundEmailDeleteResponseTest { val jsonMapper = jsonMapper() val inboundEmailDeleteResponse = InboundEmailDeleteResponse.builder() - .msg("Mailbox deleted successfully") + .msg("Inbound email deleted successfully") .status("success") .build()