From 5ab48ed451c7a2f12fc6d98aa736fb616701950b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 14 Feb 2026 01:43:46 +0000 Subject: [PATCH 01/10] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 32808d2..56f5a81 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 17 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cas-parser%2Fcas-parser-56b0f699c5437d9e5326626d35dfc972c17d01f12cb416c7f4854c8ea6d0e95e.yml openapi_spec_hash: 158f405c1880706266d83e6ff16b9d2f -config_hash: ab495a165f0919b37cbf9efbd0f0e6ef +config_hash: 41c337f5cda03b13880617490f82bad0 From 1a29c9e8fc54fa3ebb2fde3192dfde1ecb579d52 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 14 Feb 2026 01:43:55 +0000 Subject: [PATCH 02/10] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 56f5a81..32808d2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 17 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cas-parser%2Fcas-parser-56b0f699c5437d9e5326626d35dfc972c17d01f12cb416c7f4854c8ea6d0e95e.yml openapi_spec_hash: 158f405c1880706266d83e6ff16b9d2f -config_hash: 41c337f5cda03b13880617490f82bad0 +config_hash: ab495a165f0919b37cbf9efbd0f0e6ef From 2bc22e2b59ac2cfb61486480a3d652d6a910effc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 14 Feb 2026 01:44:22 +0000 Subject: [PATCH 03/10] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 32808d2..56f5a81 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 17 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cas-parser%2Fcas-parser-56b0f699c5437d9e5326626d35dfc972c17d01f12cb416c7f4854c8ea6d0e95e.yml openapi_spec_hash: 158f405c1880706266d83e6ff16b9d2f -config_hash: ab495a165f0919b37cbf9efbd0f0e6ef +config_hash: 41c337f5cda03b13880617490f82bad0 From ff77ead512a0b13377c61c0e92cc478586e7a67e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 18 Feb 2026 04:40:05 +0000 Subject: [PATCH 04/10] chore(internal): update `TestServerExtension` comment --- .../com/cas_parser/api/TestServerExtension.kt | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/TestServerExtension.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/TestServerExtension.kt index a567645..7b684c2 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/TestServerExtension.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/TestServerExtension.kt @@ -15,25 +15,12 @@ class TestServerExtension : BeforeAllCallback, ExecutionCondition { } catch (e: Exception) { throw RuntimeException( """ - The test suite will not run without a mock Prism server running against your OpenAPI spec. + The test suite will not run without a mock server running against your OpenAPI spec. You can set the environment variable `SKIP_MOCK_TESTS` to `true` to skip running any tests that require the mock server. - To fix: - - 1. Install Prism (requires Node 16+): - - With npm: - $ npm install -g @stoplight/prism-cli - - With yarn: - $ yarn global add @stoplight/prism-cli - - 2. Run the mock server - - To run the server, pass in the path of your OpenAPI spec to the prism command: - $ prism mock path/to/your.openapi.yml + To fix run `./scripts/mock` in a separate terminal. """ .trimIndent(), e, From 1939ec1346feeb7a1ea45db385d6f8b7f8daacf6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 19 Feb 2026 04:32:12 +0000 Subject: [PATCH 05/10] chore(internal): make `OkHttp` constructor internal --- .../kotlin/com/cas_parser/api/client/okhttp/OkHttpClient.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cas-parser-java-client-okhttp/src/main/kotlin/com/cas_parser/api/client/okhttp/OkHttpClient.kt b/cas-parser-java-client-okhttp/src/main/kotlin/com/cas_parser/api/client/okhttp/OkHttpClient.kt index 7079d3c..9cfdd63 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 @@ -33,7 +33,7 @@ import okhttp3.logging.HttpLoggingInterceptor import okio.BufferedSink class OkHttpClient -private constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClient) : HttpClient { +internal constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClient) : HttpClient { override fun execute(request: HttpRequest, requestOptions: RequestOptions): HttpResponse { val call = newCall(request, requestOptions) From 3ad0fbcafa782f6f7dfcead9d4c4646aedd4e681 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 19 Feb 2026 04:35:40 +0000 Subject: [PATCH 06/10] feat(client): add connection pooling option --- README.md | 19 ++++++++ .../client/okhttp/CasParserOkHttpClient.kt | 44 +++++++++++++++++++ .../okhttp/CasParserOkHttpClientAsync.kt | 44 +++++++++++++++++++ .../api/client/okhttp/OkHttpClient.kt | 42 ++++++++++++++++++ 4 files changed, 149 insertions(+) diff --git a/README.md b/README.md index c55a4ea..212151b 100644 --- a/README.md +++ b/README.md @@ -342,6 +342,25 @@ CasParserClient client = CasParserOkHttpClient.builder() .build(); ``` +### Connection pooling + +To customize the underlying OkHttp connection pool, configure the client using the `maxIdleConnections` and `keepAliveDuration` methods: + +```java +import com.cas_parser.api.client.CasParserClient; +import com.cas_parser.api.client.okhttp.CasParserOkHttpClient; +import java.time.Duration; + +CasParserClient client = CasParserOkHttpClient.builder() + .fromEnv() + // If `maxIdleConnections` is set, then `keepAliveDuration` must be set, and vice versa. + .maxIdleConnections(10) + .keepAliveDuration(Duration.ofMinutes(2)) + .build(); +``` + +If both options are unset, OkHttp's default connection pool settings are used. + ### HTTPS > [!NOTE] diff --git a/cas-parser-java-client-okhttp/src/main/kotlin/com/cas_parser/api/client/okhttp/CasParserOkHttpClient.kt b/cas-parser-java-client-okhttp/src/main/kotlin/com/cas_parser/api/client/okhttp/CasParserOkHttpClient.kt index dc713f6..417682f 100644 --- a/cas-parser-java-client-okhttp/src/main/kotlin/com/cas_parser/api/client/okhttp/CasParserOkHttpClient.kt +++ b/cas-parser-java-client-okhttp/src/main/kotlin/com/cas_parser/api/client/okhttp/CasParserOkHttpClient.kt @@ -47,6 +47,8 @@ class CasParserOkHttpClient private constructor() { private var clientOptions: ClientOptions.Builder = ClientOptions.builder() private var dispatcherExecutorService: ExecutorService? = null private var proxy: Proxy? = null + private var maxIdleConnections: Int? = null + private var keepAliveDuration: Duration? = null private var sslSocketFactory: SSLSocketFactory? = null private var trustManager: X509TrustManager? = null private var hostnameVerifier: HostnameVerifier? = null @@ -75,6 +77,46 @@ class CasParserOkHttpClient private constructor() { /** Alias for calling [Builder.proxy] with `proxy.orElse(null)`. */ fun proxy(proxy: Optional) = proxy(proxy.getOrNull()) + /** + * The maximum number of idle connections kept by the underlying OkHttp connection pool. + * + * If this is set, then [keepAliveDuration] must also be set. + * + * If unset, then OkHttp's default is used. + */ + fun maxIdleConnections(maxIdleConnections: Int?) = apply { + this.maxIdleConnections = maxIdleConnections + } + + /** + * Alias for [Builder.maxIdleConnections]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun maxIdleConnections(maxIdleConnections: Int) = + maxIdleConnections(maxIdleConnections as Int?) + + /** + * Alias for calling [Builder.maxIdleConnections] with `maxIdleConnections.orElse(null)`. + */ + fun maxIdleConnections(maxIdleConnections: Optional) = + maxIdleConnections(maxIdleConnections.getOrNull()) + + /** + * The keep-alive duration for idle connections in the underlying OkHttp connection pool. + * + * If this is set, then [maxIdleConnections] must also be set. + * + * If unset, then OkHttp's default is used. + */ + fun keepAliveDuration(keepAliveDuration: Duration?) = apply { + this.keepAliveDuration = keepAliveDuration + } + + /** Alias for calling [Builder.keepAliveDuration] with `keepAliveDuration.orElse(null)`. */ + fun keepAliveDuration(keepAliveDuration: Optional) = + keepAliveDuration(keepAliveDuration.getOrNull()) + /** * The socket factory used to secure HTTPS connections. * @@ -328,6 +370,8 @@ class CasParserOkHttpClient private constructor() { OkHttpClient.builder() .timeout(clientOptions.timeout()) .proxy(proxy) + .maxIdleConnections(maxIdleConnections) + .keepAliveDuration(keepAliveDuration) .dispatcherExecutorService(dispatcherExecutorService) .sslSocketFactory(sslSocketFactory) .trustManager(trustManager) diff --git a/cas-parser-java-client-okhttp/src/main/kotlin/com/cas_parser/api/client/okhttp/CasParserOkHttpClientAsync.kt b/cas-parser-java-client-okhttp/src/main/kotlin/com/cas_parser/api/client/okhttp/CasParserOkHttpClientAsync.kt index 5d4beab..e83fa10 100644 --- a/cas-parser-java-client-okhttp/src/main/kotlin/com/cas_parser/api/client/okhttp/CasParserOkHttpClientAsync.kt +++ b/cas-parser-java-client-okhttp/src/main/kotlin/com/cas_parser/api/client/okhttp/CasParserOkHttpClientAsync.kt @@ -47,6 +47,8 @@ class CasParserOkHttpClientAsync private constructor() { private var clientOptions: ClientOptions.Builder = ClientOptions.builder() private var dispatcherExecutorService: ExecutorService? = null private var proxy: Proxy? = null + private var maxIdleConnections: Int? = null + private var keepAliveDuration: Duration? = null private var sslSocketFactory: SSLSocketFactory? = null private var trustManager: X509TrustManager? = null private var hostnameVerifier: HostnameVerifier? = null @@ -75,6 +77,46 @@ class CasParserOkHttpClientAsync private constructor() { /** Alias for calling [Builder.proxy] with `proxy.orElse(null)`. */ fun proxy(proxy: Optional) = proxy(proxy.getOrNull()) + /** + * The maximum number of idle connections kept by the underlying OkHttp connection pool. + * + * If this is set, then [keepAliveDuration] must also be set. + * + * If unset, then OkHttp's default is used. + */ + fun maxIdleConnections(maxIdleConnections: Int?) = apply { + this.maxIdleConnections = maxIdleConnections + } + + /** + * Alias for [Builder.maxIdleConnections]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun maxIdleConnections(maxIdleConnections: Int) = + maxIdleConnections(maxIdleConnections as Int?) + + /** + * Alias for calling [Builder.maxIdleConnections] with `maxIdleConnections.orElse(null)`. + */ + fun maxIdleConnections(maxIdleConnections: Optional) = + maxIdleConnections(maxIdleConnections.getOrNull()) + + /** + * The keep-alive duration for idle connections in the underlying OkHttp connection pool. + * + * If this is set, then [maxIdleConnections] must also be set. + * + * If unset, then OkHttp's default is used. + */ + fun keepAliveDuration(keepAliveDuration: Duration?) = apply { + this.keepAliveDuration = keepAliveDuration + } + + /** Alias for calling [Builder.keepAliveDuration] with `keepAliveDuration.orElse(null)`. */ + fun keepAliveDuration(keepAliveDuration: Optional) = + keepAliveDuration(keepAliveDuration.getOrNull()) + /** * The socket factory used to secure HTTPS connections. * @@ -328,6 +370,8 @@ class CasParserOkHttpClientAsync private constructor() { OkHttpClient.builder() .timeout(clientOptions.timeout()) .proxy(proxy) + .maxIdleConnections(maxIdleConnections) + .keepAliveDuration(keepAliveDuration) .dispatcherExecutorService(dispatcherExecutorService) .sslSocketFactory(sslSocketFactory) .trustManager(trustManager) diff --git a/cas-parser-java-client-okhttp/src/main/kotlin/com/cas_parser/api/client/okhttp/OkHttpClient.kt b/cas-parser-java-client-okhttp/src/main/kotlin/com/cas_parser/api/client/okhttp/OkHttpClient.kt index 9cfdd63..7bc37ab 100644 --- a/cas-parser-java-client-okhttp/src/main/kotlin/com/cas_parser/api/client/okhttp/OkHttpClient.kt +++ b/cas-parser-java-client-okhttp/src/main/kotlin/com/cas_parser/api/client/okhttp/OkHttpClient.kt @@ -16,11 +16,13 @@ import java.time.Duration import java.util.concurrent.CancellationException import java.util.concurrent.CompletableFuture import java.util.concurrent.ExecutorService +import java.util.concurrent.TimeUnit import javax.net.ssl.HostnameVerifier import javax.net.ssl.SSLSocketFactory import javax.net.ssl.X509TrustManager import okhttp3.Call import okhttp3.Callback +import okhttp3.ConnectionPool import okhttp3.Dispatcher import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.MediaType @@ -200,6 +202,8 @@ internal constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClie private var timeout: Timeout = Timeout.default() private var proxy: Proxy? = null + private var maxIdleConnections: Int? = null + private var keepAliveDuration: Duration? = null private var dispatcherExecutorService: ExecutorService? = null private var sslSocketFactory: SSLSocketFactory? = null private var trustManager: X509TrustManager? = null @@ -211,6 +215,28 @@ internal constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClie fun proxy(proxy: Proxy?) = apply { this.proxy = proxy } + /** + * Sets the maximum number of idle connections kept by the underlying [ConnectionPool]. + * + * If this is set, then [keepAliveDuration] must also be set. + * + * If unset, then OkHttp's default is used. + */ + fun maxIdleConnections(maxIdleConnections: Int?) = apply { + this.maxIdleConnections = maxIdleConnections + } + + /** + * Sets the keep-alive duration for idle connections in the underlying [ConnectionPool]. + * + * If this is set, then [maxIdleConnections] must also be set. + * + * If unset, then OkHttp's default is used. + */ + fun keepAliveDuration(keepAliveDuration: Duration?) = apply { + this.keepAliveDuration = keepAliveDuration + } + fun dispatcherExecutorService(dispatcherExecutorService: ExecutorService?) = apply { this.dispatcherExecutorService = dispatcherExecutorService } @@ -240,6 +266,22 @@ internal constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClie .apply { dispatcherExecutorService?.let { dispatcher(Dispatcher(it)) } + val maxIdleConnections = maxIdleConnections + val keepAliveDuration = keepAliveDuration + if (maxIdleConnections != null && keepAliveDuration != null) { + connectionPool( + ConnectionPool( + maxIdleConnections, + keepAliveDuration.toNanos(), + TimeUnit.NANOSECONDS, + ) + ) + } else { + check((maxIdleConnections != null) == (keepAliveDuration != null)) { + "Both or none of `maxIdleConnections` and `keepAliveDuration` must be set, but only one was set" + } + } + val sslSocketFactory = sslSocketFactory val trustManager = trustManager if (sslSocketFactory != null && trustManager != null) { From 0bdc28fc1a9ae2e735d2c40d9cf86c1dc00461ae Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 20 Feb 2026 05:23:00 +0000 Subject: [PATCH 07/10] chore(internal): remove mock server code --- .../com/cas_parser/api/TestServerExtension.kt | 49 ------------------- .../async/AccessTokenServiceAsyncTest.kt | 9 +--- .../async/CamsKfintechServiceAsyncTest.kt | 9 +--- .../services/async/CdslServiceAsyncTest.kt | 9 +--- .../async/ContractNoteServiceAsyncTest.kt | 9 +--- .../services/async/CreditServiceAsyncTest.kt | 9 +--- .../services/async/InboxServiceAsyncTest.kt | 27 ++-------- .../async/KfintechServiceAsyncTest.kt | 9 +--- .../api/services/async/LogServiceAsyncTest.kt | 15 +----- .../services/async/NsdlServiceAsyncTest.kt | 9 +--- .../services/async/SmartServiceAsyncTest.kt | 9 +--- .../async/VerifyTokenServiceAsyncTest.kt | 9 +--- .../async/cdsl/FetchServiceAsyncTest.kt | 15 +----- .../blocking/AccessTokenServiceTest.kt | 9 +--- .../blocking/CamsKfintechServiceTest.kt | 9 +--- .../api/services/blocking/CdslServiceTest.kt | 9 +--- .../blocking/ContractNoteServiceTest.kt | 9 +--- .../services/blocking/CreditServiceTest.kt | 9 +--- .../api/services/blocking/InboxServiceTest.kt | 27 ++-------- .../services/blocking/KfintechServiceTest.kt | 9 +--- .../api/services/blocking/LogServiceTest.kt | 15 +----- .../api/services/blocking/NsdlServiceTest.kt | 9 +--- .../api/services/blocking/SmartServiceTest.kt | 9 +--- .../blocking/VerifyTokenServiceTest.kt | 9 +--- .../blocking/cdsl/FetchServiceTest.kt | 15 +----- scripts/mock | 41 ---------------- scripts/test | 46 ----------------- 27 files changed, 34 insertions(+), 378 deletions(-) delete mode 100644 cas-parser-java-core/src/test/kotlin/com/cas_parser/api/TestServerExtension.kt delete mode 100755 scripts/mock diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/TestServerExtension.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/TestServerExtension.kt deleted file mode 100644 index 7b684c2..0000000 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/TestServerExtension.kt +++ /dev/null @@ -1,49 +0,0 @@ -package com.cas_parser.api - -import java.lang.RuntimeException -import java.net.URL -import org.junit.jupiter.api.extension.BeforeAllCallback -import org.junit.jupiter.api.extension.ConditionEvaluationResult -import org.junit.jupiter.api.extension.ExecutionCondition -import org.junit.jupiter.api.extension.ExtensionContext - -class TestServerExtension : BeforeAllCallback, ExecutionCondition { - - override fun beforeAll(context: ExtensionContext?) { - try { - URL(BASE_URL).openConnection().connect() - } catch (e: Exception) { - throw RuntimeException( - """ - The test suite will not run without a mock server running against your OpenAPI spec. - - You can set the environment variable `SKIP_MOCK_TESTS` to `true` to skip running any tests - that require the mock server. - - To fix run `./scripts/mock` in a separate terminal. - """ - .trimIndent(), - e, - ) - } - } - - override fun evaluateExecutionCondition(context: ExtensionContext): ConditionEvaluationResult { - return if (System.getenv(SKIP_TESTS_ENV).toBoolean()) { - ConditionEvaluationResult.disabled( - "Environment variable $SKIP_TESTS_ENV is set to true" - ) - } else { - ConditionEvaluationResult.enabled( - "Environment variable $SKIP_TESTS_ENV is not set to true" - ) - } - } - - companion object { - - val BASE_URL = System.getenv("TEST_API_BASE_URL") ?: "http://localhost:4010" - - const val SKIP_TESTS_ENV: String = "SKIP_MOCK_TESTS" - } -} diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/AccessTokenServiceAsyncTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/AccessTokenServiceAsyncTest.kt index d1a2caa..bb9558e 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/AccessTokenServiceAsyncTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/AccessTokenServiceAsyncTest.kt @@ -2,24 +2,17 @@ package com.cas_parser.api.services.async -import com.cas_parser.api.TestServerExtension import com.cas_parser.api.client.okhttp.CasParserOkHttpClientAsync import com.cas_parser.api.models.accesstoken.AccessTokenCreateParams import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) internal class AccessTokenServiceAsyncTest { @Disabled("Prism tests are disabled") @Test fun create() { - val client = - CasParserOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() + val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() val accessTokenServiceAsync = client.accessToken() val accessTokenFuture = diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/CamsKfintechServiceAsyncTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/CamsKfintechServiceAsyncTest.kt index 2f14e4a..5597a2e 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/CamsKfintechServiceAsyncTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/CamsKfintechServiceAsyncTest.kt @@ -2,24 +2,17 @@ package com.cas_parser.api.services.async -import com.cas_parser.api.TestServerExtension import com.cas_parser.api.client.okhttp.CasParserOkHttpClientAsync import com.cas_parser.api.models.camskfintech.CamsKfintechParseParams import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) internal class CamsKfintechServiceAsyncTest { @Disabled("Prism tests are disabled") @Test fun parse() { - val client = - CasParserOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() + val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() val camsKfintechServiceAsync = client.camsKfintech() val unifiedResponseFuture = diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/CdslServiceAsyncTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/CdslServiceAsyncTest.kt index 36a9797..33d3092 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/CdslServiceAsyncTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/CdslServiceAsyncTest.kt @@ -2,24 +2,17 @@ package com.cas_parser.api.services.async -import com.cas_parser.api.TestServerExtension import com.cas_parser.api.client.okhttp.CasParserOkHttpClientAsync import com.cas_parser.api.models.cdsl.CdslParsePdfParams import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) internal class CdslServiceAsyncTest { @Disabled("Prism tests are disabled") @Test fun parsePdf() { - val client = - CasParserOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() + val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() val cdslServiceAsync = client.cdsl() val unifiedResponseFuture = diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/ContractNoteServiceAsyncTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/ContractNoteServiceAsyncTest.kt index 8e7907e..02dc255 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/ContractNoteServiceAsyncTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/ContractNoteServiceAsyncTest.kt @@ -2,24 +2,17 @@ package com.cas_parser.api.services.async -import com.cas_parser.api.TestServerExtension import com.cas_parser.api.client.okhttp.CasParserOkHttpClientAsync import com.cas_parser.api.models.contractnote.ContractNoteParseParams import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) internal class ContractNoteServiceAsyncTest { @Disabled("Prism tests are disabled") @Test fun parse() { - val client = - CasParserOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() + val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() val contractNoteServiceAsync = client.contractNote() val responseFuture = diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/CreditServiceAsyncTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/CreditServiceAsyncTest.kt index bedb74b..c831f4e 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/CreditServiceAsyncTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/CreditServiceAsyncTest.kt @@ -2,23 +2,16 @@ package com.cas_parser.api.services.async -import com.cas_parser.api.TestServerExtension import com.cas_parser.api.client.okhttp.CasParserOkHttpClientAsync import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) internal class CreditServiceAsyncTest { @Disabled("Prism tests are disabled") @Test fun check() { - val client = - CasParserOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() + val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() val creditServiceAsync = client.credits() val responseFuture = creditServiceAsync.check() diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/InboxServiceAsyncTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/InboxServiceAsyncTest.kt index 45759bf..f80c8f1 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/InboxServiceAsyncTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/InboxServiceAsyncTest.kt @@ -2,7 +2,6 @@ package com.cas_parser.api.services.async -import com.cas_parser.api.TestServerExtension import com.cas_parser.api.client.okhttp.CasParserOkHttpClientAsync import com.cas_parser.api.models.inbox.InboxCheckConnectionStatusParams import com.cas_parser.api.models.inbox.InboxConnectEmailParams @@ -11,19 +10,13 @@ import com.cas_parser.api.models.inbox.InboxListCasFilesParams import java.time.LocalDate import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) internal class InboxServiceAsyncTest { @Disabled("Prism tests are disabled") @Test fun checkConnectionStatus() { - val client = - CasParserOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() + val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() val inboxServiceAsync = client.inbox() val responseFuture = @@ -38,11 +31,7 @@ internal class InboxServiceAsyncTest { @Disabled("Prism tests are disabled") @Test fun connectEmail() { - val client = - CasParserOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() + val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() val inboxServiceAsync = client.inbox() val responseFuture = @@ -60,11 +49,7 @@ internal class InboxServiceAsyncTest { @Disabled("Prism tests are disabled") @Test fun disconnectEmail() { - val client = - CasParserOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() + val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() val inboxServiceAsync = client.inbox() val responseFuture = @@ -79,11 +64,7 @@ internal class InboxServiceAsyncTest { @Disabled("Prism tests are disabled") @Test fun listCasFiles() { - val client = - CasParserOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() + val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() val inboxServiceAsync = client.inbox() val responseFuture = diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/KfintechServiceAsyncTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/KfintechServiceAsyncTest.kt index 8409abc..3e8ebf1 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/KfintechServiceAsyncTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/KfintechServiceAsyncTest.kt @@ -2,24 +2,17 @@ package com.cas_parser.api.services.async -import com.cas_parser.api.TestServerExtension import com.cas_parser.api.client.okhttp.CasParserOkHttpClientAsync import com.cas_parser.api.models.kfintech.KfintechGenerateCasParams import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) internal class KfintechServiceAsyncTest { @Disabled("Prism tests are disabled") @Test fun generateCas() { - val client = - CasParserOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() + val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() val kfintechServiceAsync = client.kfintech() val responseFuture = diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/LogServiceAsyncTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/LogServiceAsyncTest.kt index bcb12c3..7779a3c 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/LogServiceAsyncTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/LogServiceAsyncTest.kt @@ -2,26 +2,19 @@ package com.cas_parser.api.services.async -import com.cas_parser.api.TestServerExtension import com.cas_parser.api.client.okhttp.CasParserOkHttpClientAsync import com.cas_parser.api.models.logs.LogCreateParams import com.cas_parser.api.models.logs.LogGetSummaryParams import java.time.OffsetDateTime import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) internal class LogServiceAsyncTest { @Disabled("Prism tests are disabled") @Test fun create() { - val client = - CasParserOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() + val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() val logServiceAsync = client.logs() val logFuture = @@ -40,11 +33,7 @@ internal class LogServiceAsyncTest { @Disabled("Prism tests are disabled") @Test fun getSummary() { - val client = - CasParserOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() + val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() val logServiceAsync = client.logs() val responseFuture = diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/NsdlServiceAsyncTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/NsdlServiceAsyncTest.kt index b8db02d..4b569bc 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/NsdlServiceAsyncTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/NsdlServiceAsyncTest.kt @@ -2,24 +2,17 @@ package com.cas_parser.api.services.async -import com.cas_parser.api.TestServerExtension import com.cas_parser.api.client.okhttp.CasParserOkHttpClientAsync import com.cas_parser.api.models.nsdl.NsdlParseParams import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) internal class NsdlServiceAsyncTest { @Disabled("Prism tests are disabled") @Test fun parse() { - val client = - CasParserOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() + val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() val nsdlServiceAsync = client.nsdl() val unifiedResponseFuture = diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/SmartServiceAsyncTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/SmartServiceAsyncTest.kt index 9cc398a..c574f20 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/SmartServiceAsyncTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/SmartServiceAsyncTest.kt @@ -2,24 +2,17 @@ package com.cas_parser.api.services.async -import com.cas_parser.api.TestServerExtension import com.cas_parser.api.client.okhttp.CasParserOkHttpClientAsync import com.cas_parser.api.models.smart.SmartParseCasPdfParams import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) internal class SmartServiceAsyncTest { @Disabled("Prism tests are disabled") @Test fun parseCasPdf() { - val client = - CasParserOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() + val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() val smartServiceAsync = client.smart() val unifiedResponseFuture = diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/VerifyTokenServiceAsyncTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/VerifyTokenServiceAsyncTest.kt index c521605..028abdd 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/VerifyTokenServiceAsyncTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/VerifyTokenServiceAsyncTest.kt @@ -2,23 +2,16 @@ package com.cas_parser.api.services.async -import com.cas_parser.api.TestServerExtension import com.cas_parser.api.client.okhttp.CasParserOkHttpClientAsync import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) internal class VerifyTokenServiceAsyncTest { @Disabled("Prism tests are disabled") @Test fun verify() { - val client = - CasParserOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() + val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() val verifyTokenServiceAsync = client.verifyToken() val responseFuture = verifyTokenServiceAsync.verify() diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/cdsl/FetchServiceAsyncTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/cdsl/FetchServiceAsyncTest.kt index 7cc38ca..aee0987 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/cdsl/FetchServiceAsyncTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/cdsl/FetchServiceAsyncTest.kt @@ -2,25 +2,18 @@ package com.cas_parser.api.services.async.cdsl -import com.cas_parser.api.TestServerExtension import com.cas_parser.api.client.okhttp.CasParserOkHttpClientAsync import com.cas_parser.api.models.cdsl.fetch.FetchRequestOtpParams import com.cas_parser.api.models.cdsl.fetch.FetchVerifyOtpParams import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) internal class FetchServiceAsyncTest { @Disabled("Prism tests are disabled") @Test fun requestOtp() { - val client = - CasParserOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() + val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() val fetchServiceAsync = client.cdsl().fetch() val responseFuture = @@ -39,11 +32,7 @@ internal class FetchServiceAsyncTest { @Disabled("Prism tests are disabled") @Test fun verifyOtp() { - val client = - CasParserOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() + val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() val fetchServiceAsync = client.cdsl().fetch() val responseFuture = diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/AccessTokenServiceTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/AccessTokenServiceTest.kt index 278e2a8..b236856 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/AccessTokenServiceTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/AccessTokenServiceTest.kt @@ -2,24 +2,17 @@ package com.cas_parser.api.services.blocking -import com.cas_parser.api.TestServerExtension import com.cas_parser.api.client.okhttp.CasParserOkHttpClient import com.cas_parser.api.models.accesstoken.AccessTokenCreateParams import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) internal class AccessTokenServiceTest { @Disabled("Prism tests are disabled") @Test fun create() { - val client = - CasParserOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() + val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() val accessTokenService = client.accessToken() val accessToken = diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/CamsKfintechServiceTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/CamsKfintechServiceTest.kt index 86de188..fc27735 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/CamsKfintechServiceTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/CamsKfintechServiceTest.kt @@ -2,24 +2,17 @@ package com.cas_parser.api.services.blocking -import com.cas_parser.api.TestServerExtension import com.cas_parser.api.client.okhttp.CasParserOkHttpClient import com.cas_parser.api.models.camskfintech.CamsKfintechParseParams import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) internal class CamsKfintechServiceTest { @Disabled("Prism tests are disabled") @Test fun parse() { - val client = - CasParserOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() + val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() val camsKfintechService = client.camsKfintech() val unifiedResponse = diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/CdslServiceTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/CdslServiceTest.kt index 492dd5c..7529333 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/CdslServiceTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/CdslServiceTest.kt @@ -2,24 +2,17 @@ package com.cas_parser.api.services.blocking -import com.cas_parser.api.TestServerExtension import com.cas_parser.api.client.okhttp.CasParserOkHttpClient import com.cas_parser.api.models.cdsl.CdslParsePdfParams import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) internal class CdslServiceTest { @Disabled("Prism tests are disabled") @Test fun parsePdf() { - val client = - CasParserOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() + val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() val cdslService = client.cdsl() val unifiedResponse = diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/ContractNoteServiceTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/ContractNoteServiceTest.kt index 07164ca..93bf156 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/ContractNoteServiceTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/ContractNoteServiceTest.kt @@ -2,24 +2,17 @@ package com.cas_parser.api.services.blocking -import com.cas_parser.api.TestServerExtension import com.cas_parser.api.client.okhttp.CasParserOkHttpClient import com.cas_parser.api.models.contractnote.ContractNoteParseParams import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) internal class ContractNoteServiceTest { @Disabled("Prism tests are disabled") @Test fun parse() { - val client = - CasParserOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() + val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() val contractNoteService = client.contractNote() val response = diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/CreditServiceTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/CreditServiceTest.kt index 750948f..faff248 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/CreditServiceTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/CreditServiceTest.kt @@ -2,23 +2,16 @@ package com.cas_parser.api.services.blocking -import com.cas_parser.api.TestServerExtension import com.cas_parser.api.client.okhttp.CasParserOkHttpClient import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) internal class CreditServiceTest { @Disabled("Prism tests are disabled") @Test fun check() { - val client = - CasParserOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() + val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() val creditService = client.credits() val response = creditService.check() diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/InboxServiceTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/InboxServiceTest.kt index 8b62e2d..177e27d 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/InboxServiceTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/InboxServiceTest.kt @@ -2,7 +2,6 @@ package com.cas_parser.api.services.blocking -import com.cas_parser.api.TestServerExtension import com.cas_parser.api.client.okhttp.CasParserOkHttpClient import com.cas_parser.api.models.inbox.InboxCheckConnectionStatusParams import com.cas_parser.api.models.inbox.InboxConnectEmailParams @@ -11,19 +10,13 @@ import com.cas_parser.api.models.inbox.InboxListCasFilesParams import java.time.LocalDate import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) internal class InboxServiceTest { @Disabled("Prism tests are disabled") @Test fun checkConnectionStatus() { - val client = - CasParserOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() + val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() val inboxService = client.inbox() val response = @@ -37,11 +30,7 @@ internal class InboxServiceTest { @Disabled("Prism tests are disabled") @Test fun connectEmail() { - val client = - CasParserOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() + val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() val inboxService = client.inbox() val response = @@ -58,11 +47,7 @@ internal class InboxServiceTest { @Disabled("Prism tests are disabled") @Test fun disconnectEmail() { - val client = - CasParserOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() + val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() val inboxService = client.inbox() val response = @@ -76,11 +61,7 @@ internal class InboxServiceTest { @Disabled("Prism tests are disabled") @Test fun listCasFiles() { - val client = - CasParserOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() + val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() val inboxService = client.inbox() val response = diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/KfintechServiceTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/KfintechServiceTest.kt index 963c6f6..15b7879 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/KfintechServiceTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/KfintechServiceTest.kt @@ -2,24 +2,17 @@ package com.cas_parser.api.services.blocking -import com.cas_parser.api.TestServerExtension import com.cas_parser.api.client.okhttp.CasParserOkHttpClient import com.cas_parser.api.models.kfintech.KfintechGenerateCasParams import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) internal class KfintechServiceTest { @Disabled("Prism tests are disabled") @Test fun generateCas() { - val client = - CasParserOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() + val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() val kfintechService = client.kfintech() val response = diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/LogServiceTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/LogServiceTest.kt index 20549fa..fe5349c 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/LogServiceTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/LogServiceTest.kt @@ -2,26 +2,19 @@ package com.cas_parser.api.services.blocking -import com.cas_parser.api.TestServerExtension import com.cas_parser.api.client.okhttp.CasParserOkHttpClient import com.cas_parser.api.models.logs.LogCreateParams import com.cas_parser.api.models.logs.LogGetSummaryParams import java.time.OffsetDateTime import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) internal class LogServiceTest { @Disabled("Prism tests are disabled") @Test fun create() { - val client = - CasParserOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() + val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() val logService = client.logs() val log = @@ -39,11 +32,7 @@ internal class LogServiceTest { @Disabled("Prism tests are disabled") @Test fun getSummary() { - val client = - CasParserOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() + val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() val logService = client.logs() val response = diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/NsdlServiceTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/NsdlServiceTest.kt index 44b520c..8ae0dc3 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/NsdlServiceTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/NsdlServiceTest.kt @@ -2,24 +2,17 @@ package com.cas_parser.api.services.blocking -import com.cas_parser.api.TestServerExtension import com.cas_parser.api.client.okhttp.CasParserOkHttpClient import com.cas_parser.api.models.nsdl.NsdlParseParams import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) internal class NsdlServiceTest { @Disabled("Prism tests are disabled") @Test fun parse() { - val client = - CasParserOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() + val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() val nsdlService = client.nsdl() val unifiedResponse = diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/SmartServiceTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/SmartServiceTest.kt index 0f96eb7..d1f2d99 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/SmartServiceTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/SmartServiceTest.kt @@ -2,24 +2,17 @@ package com.cas_parser.api.services.blocking -import com.cas_parser.api.TestServerExtension import com.cas_parser.api.client.okhttp.CasParserOkHttpClient import com.cas_parser.api.models.smart.SmartParseCasPdfParams import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) internal class SmartServiceTest { @Disabled("Prism tests are disabled") @Test fun parseCasPdf() { - val client = - CasParserOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() + val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() val smartService = client.smart() val unifiedResponse = diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/VerifyTokenServiceTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/VerifyTokenServiceTest.kt index 05a1f9f..485ae70 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/VerifyTokenServiceTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/VerifyTokenServiceTest.kt @@ -2,23 +2,16 @@ package com.cas_parser.api.services.blocking -import com.cas_parser.api.TestServerExtension import com.cas_parser.api.client.okhttp.CasParserOkHttpClient import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) internal class VerifyTokenServiceTest { @Disabled("Prism tests are disabled") @Test fun verify() { - val client = - CasParserOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() + val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() val verifyTokenService = client.verifyToken() val response = verifyTokenService.verify() diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/cdsl/FetchServiceTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/cdsl/FetchServiceTest.kt index eedc3dd..1c83f66 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/cdsl/FetchServiceTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/cdsl/FetchServiceTest.kt @@ -2,25 +2,18 @@ package com.cas_parser.api.services.blocking.cdsl -import com.cas_parser.api.TestServerExtension import com.cas_parser.api.client.okhttp.CasParserOkHttpClient import com.cas_parser.api.models.cdsl.fetch.FetchRequestOtpParams import com.cas_parser.api.models.cdsl.fetch.FetchVerifyOtpParams import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) internal class FetchServiceTest { @Disabled("Prism tests are disabled") @Test fun requestOtp() { - val client = - CasParserOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() + val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() val fetchService = client.cdsl().fetch() val response = @@ -38,11 +31,7 @@ internal class FetchServiceTest { @Disabled("Prism tests are disabled") @Test fun verifyOtp() { - val client = - CasParserOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() + val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() val fetchService = client.cdsl().fetch() val response = diff --git a/scripts/mock b/scripts/mock deleted file mode 100755 index 0b28f6e..0000000 --- a/scripts/mock +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env bash - -set -e - -cd "$(dirname "$0")/.." - -if [[ -n "$1" && "$1" != '--'* ]]; then - URL="$1" - shift -else - URL="$(grep 'openapi_spec_url' .stats.yml | cut -d' ' -f2)" -fi - -# Check if the URL is empty -if [ -z "$URL" ]; then - echo "Error: No OpenAPI spec path/url provided or found in .stats.yml" - exit 1 -fi - -echo "==> Starting mock server with URL ${URL}" - -# Run prism mock on the given spec -if [ "$1" == "--daemon" ]; then - npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log & - - # Wait for server to come online - echo -n "Waiting for server" - while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do - echo -n "." - sleep 0.1 - done - - if grep -q "✖ fatal" ".prism.log"; then - cat .prism.log - exit 1 - fi - - echo -else - npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" -fi diff --git a/scripts/test b/scripts/test index 047bc1d..904aea6 100755 --- a/scripts/test +++ b/scripts/test @@ -4,53 +4,7 @@ set -e cd "$(dirname "$0")/.." -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[0;33m' -NC='\033[0m' # No Color -function prism_is_running() { - curl --silent "http://localhost:4010" >/dev/null 2>&1 -} - -kill_server_on_port() { - pids=$(lsof -t -i tcp:"$1" || echo "") - if [ "$pids" != "" ]; then - kill "$pids" - echo "Stopped $pids." - fi -} - -function is_overriding_api_base_url() { - [ -n "$TEST_API_BASE_URL" ] -} - -if ! is_overriding_api_base_url && ! prism_is_running ; then - # When we exit this script, make sure to kill the background mock server process - trap 'kill_server_on_port 4010' EXIT - - # Start the dev server - ./scripts/mock --daemon -fi - -if is_overriding_api_base_url ; then - echo -e "${GREEN}✔ Running tests against ${TEST_API_BASE_URL}${NC}" - echo -elif ! prism_is_running ; then - echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Prism server" - echo -e "running against your OpenAPI spec." - echo - echo -e "To run the server, pass in the path or url of your OpenAPI" - echo -e "spec to the prism command:" - echo - echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}" - echo - - exit 1 -else - echo -e "${GREEN}✔ Mock prism server is running with your OpenAPI spec${NC}" - echo -fi echo "==> Running tests" ./gradlew test "$@" From e7286da78e71c2750514686fb39e2b1a0b5140af Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 20 Feb 2026 05:23:57 +0000 Subject: [PATCH 08/10] chore: update mock server docs --- .../com/cas_parser/api/services/ServiceParamsTest.kt | 2 +- .../api/services/async/AccessTokenServiceAsyncTest.kt | 2 +- .../api/services/async/CamsKfintechServiceAsyncTest.kt | 2 +- .../cas_parser/api/services/async/CdslServiceAsyncTest.kt | 2 +- .../api/services/async/ContractNoteServiceAsyncTest.kt | 2 +- .../api/services/async/CreditServiceAsyncTest.kt | 2 +- .../api/services/async/InboxServiceAsyncTest.kt | 8 ++++---- .../api/services/async/KfintechServiceAsyncTest.kt | 2 +- .../cas_parser/api/services/async/LogServiceAsyncTest.kt | 4 ++-- .../cas_parser/api/services/async/NsdlServiceAsyncTest.kt | 2 +- .../api/services/async/SmartServiceAsyncTest.kt | 2 +- .../api/services/async/VerifyTokenServiceAsyncTest.kt | 2 +- .../api/services/async/cdsl/FetchServiceAsyncTest.kt | 4 ++-- .../api/services/blocking/AccessTokenServiceTest.kt | 2 +- .../api/services/blocking/CamsKfintechServiceTest.kt | 2 +- .../cas_parser/api/services/blocking/CdslServiceTest.kt | 2 +- .../api/services/blocking/ContractNoteServiceTest.kt | 2 +- .../cas_parser/api/services/blocking/CreditServiceTest.kt | 2 +- .../cas_parser/api/services/blocking/InboxServiceTest.kt | 8 ++++---- .../api/services/blocking/KfintechServiceTest.kt | 2 +- .../cas_parser/api/services/blocking/LogServiceTest.kt | 4 ++-- .../cas_parser/api/services/blocking/NsdlServiceTest.kt | 2 +- .../cas_parser/api/services/blocking/SmartServiceTest.kt | 2 +- .../api/services/blocking/VerifyTokenServiceTest.kt | 2 +- .../api/services/blocking/cdsl/FetchServiceTest.kt | 4 ++-- 25 files changed, 35 insertions(+), 35 deletions(-) diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/ServiceParamsTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/ServiceParamsTest.kt index 2d2074d..4cdd376 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/ServiceParamsTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/ServiceParamsTest.kt @@ -36,7 +36,7 @@ internal class ServiceParamsTest { .build() } - @Disabled("Prism tests are disabled") + @Disabled("Mock server tests are disabled") @Test fun check() { val creditService = client.credits() diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/AccessTokenServiceAsyncTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/AccessTokenServiceAsyncTest.kt index bb9558e..c795a5c 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/AccessTokenServiceAsyncTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/AccessTokenServiceAsyncTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test internal class AccessTokenServiceAsyncTest { - @Disabled("Prism tests are disabled") + @Disabled("Mock server tests are disabled") @Test fun create() { val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/CamsKfintechServiceAsyncTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/CamsKfintechServiceAsyncTest.kt index 5597a2e..046850e 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/CamsKfintechServiceAsyncTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/CamsKfintechServiceAsyncTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test internal class CamsKfintechServiceAsyncTest { - @Disabled("Prism tests are disabled") + @Disabled("Mock server tests are disabled") @Test fun parse() { val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/CdslServiceAsyncTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/CdslServiceAsyncTest.kt index 33d3092..35d78b1 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/CdslServiceAsyncTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/CdslServiceAsyncTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test internal class CdslServiceAsyncTest { - @Disabled("Prism tests are disabled") + @Disabled("Mock server tests are disabled") @Test fun parsePdf() { val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/ContractNoteServiceAsyncTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/ContractNoteServiceAsyncTest.kt index 02dc255..1d51efe 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/ContractNoteServiceAsyncTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/ContractNoteServiceAsyncTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test internal class ContractNoteServiceAsyncTest { - @Disabled("Prism tests are disabled") + @Disabled("Mock server tests are disabled") @Test fun parse() { val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/CreditServiceAsyncTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/CreditServiceAsyncTest.kt index c831f4e..6c9e4d8 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/CreditServiceAsyncTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/CreditServiceAsyncTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test internal class CreditServiceAsyncTest { - @Disabled("Prism tests are disabled") + @Disabled("Mock server tests are disabled") @Test fun check() { val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/InboxServiceAsyncTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/InboxServiceAsyncTest.kt index f80c8f1..47362c1 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/InboxServiceAsyncTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/InboxServiceAsyncTest.kt @@ -13,7 +13,7 @@ import org.junit.jupiter.api.Test internal class InboxServiceAsyncTest { - @Disabled("Prism tests are disabled") + @Disabled("Mock server tests are disabled") @Test fun checkConnectionStatus() { val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() @@ -28,7 +28,7 @@ internal class InboxServiceAsyncTest { response.validate() } - @Disabled("Prism tests are disabled") + @Disabled("Mock server tests are disabled") @Test fun connectEmail() { val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() @@ -46,7 +46,7 @@ internal class InboxServiceAsyncTest { response.validate() } - @Disabled("Prism tests are disabled") + @Disabled("Mock server tests are disabled") @Test fun disconnectEmail() { val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() @@ -61,7 +61,7 @@ internal class InboxServiceAsyncTest { response.validate() } - @Disabled("Prism tests are disabled") + @Disabled("Mock server tests are disabled") @Test fun listCasFiles() { val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/KfintechServiceAsyncTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/KfintechServiceAsyncTest.kt index 3e8ebf1..0632267 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/KfintechServiceAsyncTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/KfintechServiceAsyncTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test internal class KfintechServiceAsyncTest { - @Disabled("Prism tests are disabled") + @Disabled("Mock server tests are disabled") @Test fun generateCas() { val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/LogServiceAsyncTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/LogServiceAsyncTest.kt index 7779a3c..532be8d 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/LogServiceAsyncTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/LogServiceAsyncTest.kt @@ -11,7 +11,7 @@ import org.junit.jupiter.api.Test internal class LogServiceAsyncTest { - @Disabled("Prism tests are disabled") + @Disabled("Mock server tests are disabled") @Test fun create() { val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() @@ -30,7 +30,7 @@ internal class LogServiceAsyncTest { log.validate() } - @Disabled("Prism tests are disabled") + @Disabled("Mock server tests are disabled") @Test fun getSummary() { val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/NsdlServiceAsyncTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/NsdlServiceAsyncTest.kt index 4b569bc..de5bda4 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/NsdlServiceAsyncTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/NsdlServiceAsyncTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test internal class NsdlServiceAsyncTest { - @Disabled("Prism tests are disabled") + @Disabled("Mock server tests are disabled") @Test fun parse() { val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/SmartServiceAsyncTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/SmartServiceAsyncTest.kt index c574f20..db32247 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/SmartServiceAsyncTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/SmartServiceAsyncTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test internal class SmartServiceAsyncTest { - @Disabled("Prism tests are disabled") + @Disabled("Mock server tests are disabled") @Test fun parseCasPdf() { val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/VerifyTokenServiceAsyncTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/VerifyTokenServiceAsyncTest.kt index 028abdd..3d7800c 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/VerifyTokenServiceAsyncTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/VerifyTokenServiceAsyncTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test internal class VerifyTokenServiceAsyncTest { - @Disabled("Prism tests are disabled") + @Disabled("Mock server tests are disabled") @Test fun verify() { val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/cdsl/FetchServiceAsyncTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/cdsl/FetchServiceAsyncTest.kt index aee0987..a7ac051 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/cdsl/FetchServiceAsyncTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/cdsl/FetchServiceAsyncTest.kt @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test internal class FetchServiceAsyncTest { - @Disabled("Prism tests are disabled") + @Disabled("Mock server tests are disabled") @Test fun requestOtp() { val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() @@ -29,7 +29,7 @@ internal class FetchServiceAsyncTest { response.validate() } - @Disabled("Prism tests are disabled") + @Disabled("Mock server tests are disabled") @Test fun verifyOtp() { val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/AccessTokenServiceTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/AccessTokenServiceTest.kt index b236856..f7c9696 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/AccessTokenServiceTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/AccessTokenServiceTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test internal class AccessTokenServiceTest { - @Disabled("Prism tests are disabled") + @Disabled("Mock server tests are disabled") @Test fun create() { val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/CamsKfintechServiceTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/CamsKfintechServiceTest.kt index fc27735..f23fd75 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/CamsKfintechServiceTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/CamsKfintechServiceTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test internal class CamsKfintechServiceTest { - @Disabled("Prism tests are disabled") + @Disabled("Mock server tests are disabled") @Test fun parse() { val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/CdslServiceTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/CdslServiceTest.kt index 7529333..87dffc2 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/CdslServiceTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/CdslServiceTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test internal class CdslServiceTest { - @Disabled("Prism tests are disabled") + @Disabled("Mock server tests are disabled") @Test fun parsePdf() { val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/ContractNoteServiceTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/ContractNoteServiceTest.kt index 93bf156..effc5f4 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/ContractNoteServiceTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/ContractNoteServiceTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test internal class ContractNoteServiceTest { - @Disabled("Prism tests are disabled") + @Disabled("Mock server tests are disabled") @Test fun parse() { val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/CreditServiceTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/CreditServiceTest.kt index faff248..94239a3 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/CreditServiceTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/CreditServiceTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test internal class CreditServiceTest { - @Disabled("Prism tests are disabled") + @Disabled("Mock server tests are disabled") @Test fun check() { val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/InboxServiceTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/InboxServiceTest.kt index 177e27d..dc041fb 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/InboxServiceTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/InboxServiceTest.kt @@ -13,7 +13,7 @@ import org.junit.jupiter.api.Test internal class InboxServiceTest { - @Disabled("Prism tests are disabled") + @Disabled("Mock server tests are disabled") @Test fun checkConnectionStatus() { val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() @@ -27,7 +27,7 @@ internal class InboxServiceTest { response.validate() } - @Disabled("Prism tests are disabled") + @Disabled("Mock server tests are disabled") @Test fun connectEmail() { val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() @@ -44,7 +44,7 @@ internal class InboxServiceTest { response.validate() } - @Disabled("Prism tests are disabled") + @Disabled("Mock server tests are disabled") @Test fun disconnectEmail() { val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() @@ -58,7 +58,7 @@ internal class InboxServiceTest { response.validate() } - @Disabled("Prism tests are disabled") + @Disabled("Mock server tests are disabled") @Test fun listCasFiles() { val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/KfintechServiceTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/KfintechServiceTest.kt index 15b7879..ddc39f7 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/KfintechServiceTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/KfintechServiceTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test internal class KfintechServiceTest { - @Disabled("Prism tests are disabled") + @Disabled("Mock server tests are disabled") @Test fun generateCas() { val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/LogServiceTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/LogServiceTest.kt index fe5349c..2ef5c48 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/LogServiceTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/LogServiceTest.kt @@ -11,7 +11,7 @@ import org.junit.jupiter.api.Test internal class LogServiceTest { - @Disabled("Prism tests are disabled") + @Disabled("Mock server tests are disabled") @Test fun create() { val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() @@ -29,7 +29,7 @@ internal class LogServiceTest { log.validate() } - @Disabled("Prism tests are disabled") + @Disabled("Mock server tests are disabled") @Test fun getSummary() { val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/NsdlServiceTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/NsdlServiceTest.kt index 8ae0dc3..9121446 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/NsdlServiceTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/NsdlServiceTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test internal class NsdlServiceTest { - @Disabled("Prism tests are disabled") + @Disabled("Mock server tests are disabled") @Test fun parse() { val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/SmartServiceTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/SmartServiceTest.kt index d1f2d99..d28949d 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/SmartServiceTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/SmartServiceTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test internal class SmartServiceTest { - @Disabled("Prism tests are disabled") + @Disabled("Mock server tests are disabled") @Test fun parseCasPdf() { val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/VerifyTokenServiceTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/VerifyTokenServiceTest.kt index 485ae70..19af27d 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/VerifyTokenServiceTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/VerifyTokenServiceTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test internal class VerifyTokenServiceTest { - @Disabled("Prism tests are disabled") + @Disabled("Mock server tests are disabled") @Test fun verify() { val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/cdsl/FetchServiceTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/cdsl/FetchServiceTest.kt index 1c83f66..8c93c2a 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/cdsl/FetchServiceTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/cdsl/FetchServiceTest.kt @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test internal class FetchServiceTest { - @Disabled("Prism tests are disabled") + @Disabled("Mock server tests are disabled") @Test fun requestOtp() { val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() @@ -28,7 +28,7 @@ internal class FetchServiceTest { response.validate() } - @Disabled("Prism tests are disabled") + @Disabled("Mock server tests are disabled") @Test fun verifyOtp() { val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() From 8d2cb43b11b1923624fdc32f7433115f5b20cf37 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 21 Feb 2026 21:17:40 +0000 Subject: [PATCH 09/10] feat(api): api update --- .stats.yml | 6 +- README.md | 70 +- .../accesstoken/AccessTokenCreateParams.kt | 410 ----------- .../accesstoken/AccessTokenCreateResponse.kt | 239 ------- .../api/models/credits/CreditCheckParams.kt | 219 ------ .../api/models/credits/CreditCheckResponse.kt | 387 ---------- .../api/models/logs/LogCreateParams.kt | 528 -------------- .../api/models/logs/LogCreateResponse.kt | 578 --------------- .../api/models/logs/LogGetSummaryParams.kt | 468 ------------- .../api/models/logs/LogGetSummaryResponse.kt | 663 ------------------ .../verifytoken/VerifyTokenVerifyParams.kt | 211 ------ .../verifytoken/VerifyTokenVerifyResponse.kt | 240 ------- .../services/async/AccessTokenServiceAsync.kt | 60 -- .../async/AccessTokenServiceAsyncImpl.kt | 56 -- .../api/services/async/CreditServiceAsync.kt | 57 -- .../services/async/CreditServiceAsyncImpl.kt | 56 -- .../api/services/async/LogServiceAsync.kt | 103 --- .../api/services/async/LogServiceAsyncImpl.kt | 96 --- .../services/async/VerifyTokenServiceAsync.kt | 49 -- .../async/VerifyTokenServiceAsyncImpl.kt | 56 -- .../services/blocking/AccessTokenService.kt | 60 -- .../blocking/AccessTokenServiceImpl.kt | 52 -- .../api/services/blocking/CreditService.kt | 56 -- .../services/blocking/CreditServiceImpl.kt | 52 -- .../api/services/blocking/LogService.kt | 102 --- .../api/services/blocking/LogServiceImpl.kt | 89 --- .../services/blocking/VerifyTokenService.kt | 49 -- .../blocking/VerifyTokenServiceImpl.kt | 52 -- .../AccessTokenCreateParamsTest.kt | 30 - .../AccessTokenCreateResponseTest.kt | 45 -- .../models/credits/CreditCheckParamsTest.kt | 13 - .../models/credits/CreditCheckResponseTest.kt | 61 -- .../api/models/logs/LogCreateParamsTest.kt | 42 -- .../api/models/logs/LogCreateResponseTest.kt | 74 -- .../models/logs/LogGetSummaryParamsTest.kt | 39 -- .../models/logs/LogGetSummaryResponseTest.kt | 78 --- .../VerifyTokenVerifyParamsTest.kt | 13 - .../VerifyTokenVerifyResponseTest.kt | 44 -- .../api/services/ErrorHandlingTest.kt | 256 +++++-- .../api/services/ServiceParamsTest.kt | 13 +- .../async/AccessTokenServiceAsyncTest.kt | 26 - .../services/async/CreditServiceAsyncTest.kt | 22 - .../api/services/async/LogServiceAsyncTest.kt | 50 -- .../async/VerifyTokenServiceAsyncTest.kt | 22 - .../blocking/AccessTokenServiceTest.kt | 23 - .../services/blocking/CreditServiceTest.kt | 21 - .../api/services/blocking/LogServiceTest.kt | 48 -- .../blocking/VerifyTokenServiceTest.kt | 21 - .../api/proguard/ProGuardCompatibilityTest.kt | 25 +- 49 files changed, 258 insertions(+), 5772 deletions(-) delete mode 100644 cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/accesstoken/AccessTokenCreateParams.kt delete mode 100644 cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/accesstoken/AccessTokenCreateResponse.kt delete mode 100644 cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/credits/CreditCheckParams.kt delete mode 100644 cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/credits/CreditCheckResponse.kt delete mode 100644 cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/logs/LogCreateParams.kt delete mode 100644 cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/logs/LogCreateResponse.kt delete mode 100644 cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/logs/LogGetSummaryParams.kt delete mode 100644 cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/logs/LogGetSummaryResponse.kt delete mode 100644 cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/verifytoken/VerifyTokenVerifyParams.kt delete mode 100644 cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/verifytoken/VerifyTokenVerifyResponse.kt delete mode 100644 cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/accesstoken/AccessTokenCreateParamsTest.kt delete mode 100644 cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/accesstoken/AccessTokenCreateResponseTest.kt delete mode 100644 cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/credits/CreditCheckParamsTest.kt delete mode 100644 cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/credits/CreditCheckResponseTest.kt delete mode 100644 cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/logs/LogCreateParamsTest.kt delete mode 100644 cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/logs/LogCreateResponseTest.kt delete mode 100644 cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/logs/LogGetSummaryParamsTest.kt delete mode 100644 cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/logs/LogGetSummaryResponseTest.kt delete mode 100644 cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/verifytoken/VerifyTokenVerifyParamsTest.kt delete mode 100644 cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/verifytoken/VerifyTokenVerifyResponseTest.kt delete mode 100644 cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/AccessTokenServiceAsyncTest.kt delete mode 100644 cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/CreditServiceAsyncTest.kt delete mode 100644 cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/LogServiceAsyncTest.kt delete mode 100644 cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/VerifyTokenServiceAsyncTest.kt delete mode 100644 cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/AccessTokenServiceTest.kt delete mode 100644 cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/CreditServiceTest.kt delete mode 100644 cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/LogServiceTest.kt delete mode 100644 cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/VerifyTokenServiceTest.kt diff --git a/.stats.yml b/.stats.yml index 56f5a81..80a6900 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 17 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cas-parser%2Fcas-parser-56b0f699c5437d9e5326626d35dfc972c17d01f12cb416c7f4854c8ea6d0e95e.yml -openapi_spec_hash: 158f405c1880706266d83e6ff16b9d2f +configured_endpoints: 12 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cas-parser%2Fcas-parser-6a9d3b677dcfb856dc571865c34b3fe401e4d7f0d799edfc743acb9a55800bd0.yml +openapi_spec_hash: 037703a6c741e4310fda3f57c22fa51e config_hash: 41c337f5cda03b13880617490f82bad0 diff --git a/README.md b/README.md index 212151b..50e5c0c 100644 --- a/README.md +++ b/README.md @@ -57,14 +57,14 @@ This library requires Java 8 or later. ```java import com.cas_parser.api.client.CasParserClient; import com.cas_parser.api.client.okhttp.CasParserOkHttpClient; -import com.cas_parser.api.models.credits.CreditCheckParams; -import com.cas_parser.api.models.credits.CreditCheckResponse; +import com.cas_parser.api.models.camskfintech.CamsKfintechParseParams; +import com.cas_parser.api.models.camskfintech.UnifiedResponse; // Configures using the `casparser.apiKey` and `casparser.baseUrl` system properties // Or configures using the `CAS_PARSER_API_KEY` and `CAS_PARSER_BASE_URL` environment variables CasParserClient client = CasParserOkHttpClient.fromEnv(); -CreditCheckResponse response = client.credits().check(); +UnifiedResponse unifiedResponse = client.camsKfintech().parse(); ``` ## Client configuration @@ -137,7 +137,7 @@ The `withOptions()` method does not affect the original client or service. To send a request to the Cas Parser API, build an instance of some `Params` class and pass it to the corresponding client method. When the response is received, it will be deserialized into an instance of a Java class. -For example, `client.credits().check(...)` should be called with an instance of `CreditCheckParams`, and it will return an instance of `CreditCheckResponse`. +For example, `client.camsKfintech().parse(...)` should be called with an instance of `CamsKfintechParseParams`, and it will return an instance of `UnifiedResponse`. ## Immutability @@ -154,15 +154,15 @@ The default client is synchronous. To switch to asynchronous execution, call the ```java import com.cas_parser.api.client.CasParserClient; import com.cas_parser.api.client.okhttp.CasParserOkHttpClient; -import com.cas_parser.api.models.credits.CreditCheckParams; -import com.cas_parser.api.models.credits.CreditCheckResponse; +import com.cas_parser.api.models.camskfintech.CamsKfintechParseParams; +import com.cas_parser.api.models.camskfintech.UnifiedResponse; import java.util.concurrent.CompletableFuture; // Configures using the `casparser.apiKey` and `casparser.baseUrl` system properties // Or configures using the `CAS_PARSER_API_KEY` and `CAS_PARSER_BASE_URL` environment variables CasParserClient client = CasParserOkHttpClient.fromEnv(); -CompletableFuture response = client.async().credits().check(); +CompletableFuture unifiedResponse = client.async().camsKfintech().parse(); ``` Or create an asynchronous client from the beginning: @@ -170,15 +170,15 @@ Or create an asynchronous client from the beginning: ```java import com.cas_parser.api.client.CasParserClientAsync; import com.cas_parser.api.client.okhttp.CasParserOkHttpClientAsync; -import com.cas_parser.api.models.credits.CreditCheckParams; -import com.cas_parser.api.models.credits.CreditCheckResponse; +import com.cas_parser.api.models.camskfintech.CamsKfintechParseParams; +import com.cas_parser.api.models.camskfintech.UnifiedResponse; import java.util.concurrent.CompletableFuture; // Configures using the `casparser.apiKey` and `casparser.baseUrl` system properties // Or configures using the `CAS_PARSER_API_KEY` and `CAS_PARSER_BASE_URL` environment variables CasParserClientAsync client = CasParserOkHttpClientAsync.fromEnv(); -CompletableFuture response = client.credits().check(); +CompletableFuture unifiedResponse = client.camsKfintech().parse(); ``` The asynchronous client supports the same options as the synchronous one, except most methods return `CompletableFuture`s. @@ -192,21 +192,21 @@ To access this data, prefix any HTTP method call on a client or service with `wi ```java import com.cas_parser.api.core.http.Headers; import com.cas_parser.api.core.http.HttpResponseFor; -import com.cas_parser.api.models.credits.CreditCheckParams; -import com.cas_parser.api.models.credits.CreditCheckResponse; +import com.cas_parser.api.models.camskfintech.CamsKfintechParseParams; +import com.cas_parser.api.models.camskfintech.UnifiedResponse; -HttpResponseFor response = client.credits().withRawResponse().check(); +HttpResponseFor unifiedResponse = client.camsKfintech().withRawResponse().parse(); -int statusCode = response.statusCode(); -Headers headers = response.headers(); +int statusCode = unifiedResponse.statusCode(); +Headers headers = unifiedResponse.headers(); ``` You can still deserialize the response into an instance of a Java class if needed: ```java -import com.cas_parser.api.models.credits.CreditCheckResponse; +import com.cas_parser.api.models.camskfintech.UnifiedResponse; -CreditCheckResponse parsedResponse = response.parse(); +UnifiedResponse parsedUnifiedResponse = unifiedResponse.parse(); ``` ## Error handling @@ -304,9 +304,9 @@ Requests time out after 1 minute by default. To set a custom timeout, configure the method call using the `timeout` method: ```java -import com.cas_parser.api.models.credits.CreditCheckResponse; +import com.cas_parser.api.models.camskfintech.UnifiedResponse; -CreditCheckResponse response = client.credits().check(RequestOptions.builder().timeout(Duration.ofSeconds(30)).build()); +UnifiedResponse unifiedResponse = client.camsKfintech().parse(RequestOptions.builder().timeout(Duration.ofSeconds(30)).build()); ``` Or configure the default for all method calls at the client level: @@ -443,9 +443,9 @@ To set undocumented parameters, call the `putAdditionalHeader`, `putAdditionalQu ```java import com.cas_parser.api.core.JsonValue; -import com.cas_parser.api.models.credits.CreditCheckParams; +import com.cas_parser.api.models.camskfintech.CamsKfintechParseParams; -CreditCheckParams params = CreditCheckParams.builder() +CamsKfintechParseParams params = CamsKfintechParseParams.builder() .putAdditionalHeader("Secret-Header", "42") .putAdditionalQueryParam("secret_query_param", "42") .putAdditionalBodyProperty("secretProperty", JsonValue.from("42")) @@ -457,9 +457,9 @@ These can be accessed on the built object later using the `_additionalHeaders()` To set a documented parameter or property to an undocumented or not yet supported _value_, pass a [`JsonValue`](cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/Values.kt) object to its setter: ```java -import com.cas_parser.api.models.credits.CreditCheckParams; +import com.cas_parser.api.models.camskfintech.CamsKfintechParseParams; -CreditCheckParams params = CreditCheckParams.builder().build(); +CamsKfintechParseParams params = CamsKfintechParseParams.builder().build(); ``` The most straightforward way to create a [`JsonValue`](cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/Values.kt) is using its `from(...)` method: @@ -507,10 +507,10 @@ To forcibly omit a required parameter or property, pass [`JsonMissing`](cas-pars ```java import com.cas_parser.api.core.JsonMissing; +import com.cas_parser.api.models.camskfintech.CamsKfintechParseParams; import com.cas_parser.api.models.cdsl.fetch.FetchRequestOtpParams; -import com.cas_parser.api.models.credits.CreditCheckParams; -CreditCheckParams params = FetchRequestOtpParams.builder() +CamsKfintechParseParams params = FetchRequestOtpParams.builder() .dob("1990-01-15") .pan("ABCDE1234F") .boId(JsonMissing.of()) @@ -525,7 +525,7 @@ To access undocumented response properties, call the `_additionalProperties()` m import com.cas_parser.api.core.JsonValue; import java.util.Map; -Map additionalProperties = client.credits().check(params)._additionalProperties(); +Map additionalProperties = client.camsKfintech().parse(params)._additionalProperties(); JsonValue secretPropertyValue = additionalProperties.get("secretProperty"); String result = secretPropertyValue.accept(new JsonValue.Visitor<>() { @@ -555,19 +555,19 @@ To access a property's raw JSON value, which may be undocumented, call its `_` p import com.cas_parser.api.core.JsonField; import java.util.Optional; -JsonField field = client.credits().check(params)._field(); +JsonField password = client.camsKfintech().parse(params)._password(); -if (field.isMissing()) { +if (password.isMissing()) { // The property is absent from the JSON response -} else if (field.isNull()) { +} else if (password.isNull()) { // The property was set to literal null } else { // Check if value was provided as a string // Other methods include `asNumber()`, `asBoolean()`, etc. - Optional jsonString = field.asString(); + Optional jsonString = password.asString(); // Try to deserialize into a custom type - MyClass myObject = field.asUnknown().orElseThrow().convert(MyClass.class); + MyClass myObject = password.asUnknown().orElseThrow().convert(MyClass.class); } ``` @@ -580,17 +580,17 @@ By default, the SDK will not throw an exception in this case. It will throw [`Ca If you would prefer to check that the response is completely well-typed upfront, then either call `validate()`: ```java -import com.cas_parser.api.models.credits.CreditCheckResponse; +import com.cas_parser.api.models.camskfintech.UnifiedResponse; -CreditCheckResponse response = client.credits().check(params).validate(); +UnifiedResponse unifiedResponse = client.camsKfintech().parse(params).validate(); ``` Or configure the method call to validate the response using the `responseValidation` method: ```java -import com.cas_parser.api.models.credits.CreditCheckResponse; +import com.cas_parser.api.models.camskfintech.UnifiedResponse; -CreditCheckResponse response = client.credits().check(RequestOptions.builder().responseValidation(true).build()); +UnifiedResponse unifiedResponse = client.camsKfintech().parse(RequestOptions.builder().responseValidation(true).build()); ``` Or configure the default for all method calls at the client level: diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/accesstoken/AccessTokenCreateParams.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/accesstoken/AccessTokenCreateParams.kt deleted file mode 100644 index 676dc4d..0000000 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/accesstoken/AccessTokenCreateParams.kt +++ /dev/null @@ -1,410 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.cas_parser.api.models.accesstoken - -import com.cas_parser.api.core.ExcludeMissing -import com.cas_parser.api.core.JsonField -import com.cas_parser.api.core.JsonMissing -import com.cas_parser.api.core.JsonValue -import com.cas_parser.api.core.Params -import com.cas_parser.api.core.http.Headers -import com.cas_parser.api.core.http.QueryParams -import com.cas_parser.api.errors.CasParserInvalidDataException -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import java.util.Collections -import java.util.Objects -import java.util.Optional - -/** - * Generate a short-lived access token from your API key. - * - * **Use this endpoint from your backend** to create tokens that can be safely passed to - * frontend/SDK. - * - * Access tokens: - * - Are prefixed with `at_` for easy identification - * - Valid for up to 60 minutes - * - Can be used in place of API keys on all v4 endpoints - * - Cannot be used to generate other access tokens - */ -class AccessTokenCreateParams -private constructor( - private val body: Body, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - /** - * Token validity in minutes (max 60) - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun expiryMinutes(): Optional = body.expiryMinutes() - - /** - * Returns the raw JSON value of [expiryMinutes]. - * - * Unlike [expiryMinutes], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _expiryMinutes(): JsonField = body._expiryMinutes() - - fun _additionalBodyProperties(): Map = body._additionalProperties() - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun none(): AccessTokenCreateParams = builder().build() - - /** Returns a mutable builder for constructing an instance of [AccessTokenCreateParams]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [AccessTokenCreateParams]. */ - class Builder internal constructor() { - - private var body: Body.Builder = Body.builder() - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(accessTokenCreateParams: AccessTokenCreateParams) = apply { - body = accessTokenCreateParams.body.toBuilder() - additionalHeaders = accessTokenCreateParams.additionalHeaders.toBuilder() - additionalQueryParams = accessTokenCreateParams.additionalQueryParams.toBuilder() - } - - /** - * Sets the entire request body. - * - * This is generally only useful if you are already constructing the body separately. - * Otherwise, it's more convenient to use the top-level setters instead: - * - [expiryMinutes] - */ - fun body(body: Body) = apply { this.body = body.toBuilder() } - - /** Token validity in minutes (max 60) */ - fun expiryMinutes(expiryMinutes: Long) = apply { body.expiryMinutes(expiryMinutes) } - - /** - * Sets [Builder.expiryMinutes] to an arbitrary JSON value. - * - * You should usually call [Builder.expiryMinutes] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun expiryMinutes(expiryMinutes: JsonField) = apply { - body.expiryMinutes(expiryMinutes) - } - - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - body.additionalProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - body.putAdditionalProperty(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - body.putAllAdditionalProperties(additionalBodyProperties) - } - - fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } - - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - body.removeAllAdditionalProperties(keys) - } - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [AccessTokenCreateParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): AccessTokenCreateParams = - AccessTokenCreateParams( - body.build(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - fun _body(): Body = body - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - class Body - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val expiryMinutes: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("expiry_minutes") - @ExcludeMissing - expiryMinutes: JsonField = JsonMissing.of() - ) : this(expiryMinutes, mutableMapOf()) - - /** - * Token validity in minutes (max 60) - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun expiryMinutes(): Optional = expiryMinutes.getOptional("expiry_minutes") - - /** - * Returns the raw JSON value of [expiryMinutes]. - * - * Unlike [expiryMinutes], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("expiry_minutes") - @ExcludeMissing - fun _expiryMinutes(): JsonField = expiryMinutes - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [Body]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Body]. */ - class Builder internal constructor() { - - private var expiryMinutes: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(body: Body) = apply { - expiryMinutes = body.expiryMinutes - additionalProperties = body.additionalProperties.toMutableMap() - } - - /** Token validity in minutes (max 60) */ - fun expiryMinutes(expiryMinutes: Long) = expiryMinutes(JsonField.of(expiryMinutes)) - - /** - * Sets [Builder.expiryMinutes] to an arbitrary JSON value. - * - * You should usually call [Builder.expiryMinutes] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun expiryMinutes(expiryMinutes: JsonField) = apply { - this.expiryMinutes = expiryMinutes - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Body]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): Body = Body(expiryMinutes, additionalProperties.toMutableMap()) - } - - private var validated: Boolean = false - - fun validate(): Body = apply { - if (validated) { - return@apply - } - - expiryMinutes() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: CasParserInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = (if (expiryMinutes.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Body && - expiryMinutes == other.expiryMinutes && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(expiryMinutes, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Body{expiryMinutes=$expiryMinutes, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is AccessTokenCreateParams && - body == other.body && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = Objects.hash(body, additionalHeaders, additionalQueryParams) - - override fun toString() = - "AccessTokenCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/accesstoken/AccessTokenCreateResponse.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/accesstoken/AccessTokenCreateResponse.kt deleted file mode 100644 index a23d37b..0000000 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/accesstoken/AccessTokenCreateResponse.kt +++ /dev/null @@ -1,239 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.cas_parser.api.models.accesstoken - -import com.cas_parser.api.core.ExcludeMissing -import com.cas_parser.api.core.JsonField -import com.cas_parser.api.core.JsonMissing -import com.cas_parser.api.core.JsonValue -import com.cas_parser.api.errors.CasParserInvalidDataException -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import java.util.Collections -import java.util.Objects -import java.util.Optional - -class AccessTokenCreateResponse -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val accessToken: JsonField, - private val expiresIn: JsonField, - private val tokenType: JsonField, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("access_token") - @ExcludeMissing - accessToken: JsonField = JsonMissing.of(), - @JsonProperty("expires_in") @ExcludeMissing expiresIn: JsonField = JsonMissing.of(), - @JsonProperty("token_type") @ExcludeMissing tokenType: JsonField = JsonMissing.of(), - ) : this(accessToken, expiresIn, tokenType, mutableMapOf()) - - /** - * The at_ prefixed access token - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun accessToken(): Optional = accessToken.getOptional("access_token") - - /** - * Token validity in seconds - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun expiresIn(): Optional = expiresIn.getOptional("expires_in") - - /** - * Always "api_key" - token is a drop-in replacement for x-api-key header - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun tokenType(): Optional = tokenType.getOptional("token_type") - - /** - * Returns the raw JSON value of [accessToken]. - * - * Unlike [accessToken], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("access_token") - @ExcludeMissing - fun _accessToken(): JsonField = accessToken - - /** - * Returns the raw JSON value of [expiresIn]. - * - * Unlike [expiresIn], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("expires_in") @ExcludeMissing fun _expiresIn(): JsonField = expiresIn - - /** - * Returns the raw JSON value of [tokenType]. - * - * Unlike [tokenType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("token_type") @ExcludeMissing fun _tokenType(): JsonField = tokenType - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [AccessTokenCreateResponse]. - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [AccessTokenCreateResponse]. */ - class Builder internal constructor() { - - private var accessToken: JsonField = JsonMissing.of() - private var expiresIn: JsonField = JsonMissing.of() - private var tokenType: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(accessTokenCreateResponse: AccessTokenCreateResponse) = apply { - accessToken = accessTokenCreateResponse.accessToken - expiresIn = accessTokenCreateResponse.expiresIn - tokenType = accessTokenCreateResponse.tokenType - additionalProperties = accessTokenCreateResponse.additionalProperties.toMutableMap() - } - - /** The at_ prefixed access token */ - fun accessToken(accessToken: String) = accessToken(JsonField.of(accessToken)) - - /** - * Sets [Builder.accessToken] to an arbitrary JSON value. - * - * You should usually call [Builder.accessToken] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun accessToken(accessToken: JsonField) = apply { this.accessToken = accessToken } - - /** Token validity in seconds */ - fun expiresIn(expiresIn: Long) = expiresIn(JsonField.of(expiresIn)) - - /** - * Sets [Builder.expiresIn] to an arbitrary JSON value. - * - * You should usually call [Builder.expiresIn] with a well-typed [Long] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun expiresIn(expiresIn: JsonField) = apply { this.expiresIn = expiresIn } - - /** Always "api_key" - token is a drop-in replacement for x-api-key header */ - fun tokenType(tokenType: String) = tokenType(JsonField.of(tokenType)) - - /** - * Sets [Builder.tokenType] to an arbitrary JSON value. - * - * You should usually call [Builder.tokenType] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun tokenType(tokenType: JsonField) = apply { this.tokenType = tokenType } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [AccessTokenCreateResponse]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): AccessTokenCreateResponse = - AccessTokenCreateResponse( - accessToken, - expiresIn, - tokenType, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): AccessTokenCreateResponse = apply { - if (validated) { - return@apply - } - - accessToken() - expiresIn() - tokenType() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: CasParserInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (accessToken.asKnown().isPresent) 1 else 0) + - (if (expiresIn.asKnown().isPresent) 1 else 0) + - (if (tokenType.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is AccessTokenCreateResponse && - accessToken == other.accessToken && - expiresIn == other.expiresIn && - tokenType == other.tokenType && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(accessToken, expiresIn, tokenType, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "AccessTokenCreateResponse{accessToken=$accessToken, expiresIn=$expiresIn, tokenType=$tokenType, additionalProperties=$additionalProperties}" -} diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/credits/CreditCheckParams.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/credits/CreditCheckParams.kt deleted file mode 100644 index aa45ce8..0000000 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/credits/CreditCheckParams.kt +++ /dev/null @@ -1,219 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.cas_parser.api.models.credits - -import com.cas_parser.api.core.JsonValue -import com.cas_parser.api.core.Params -import com.cas_parser.api.core.http.Headers -import com.cas_parser.api.core.http.QueryParams -import com.cas_parser.api.core.toImmutable -import java.util.Objects -import java.util.Optional - -/** - * Check your remaining API credits and usage for the current billing period. - * - * Returns: - * - Number of API calls used and remaining credits - * - Credit limit and reset date - * - List of enabled features for your plan - * - * Credits reset at the start of each billing period. - */ -class CreditCheckParams -private constructor( - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, -) : Params { - - /** Additional body properties to send with the request. */ - fun _additionalBodyProperties(): Map = additionalBodyProperties - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun none(): CreditCheckParams = builder().build() - - /** Returns a mutable builder for constructing an instance of [CreditCheckParams]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [CreditCheckParams]. */ - class Builder internal constructor() { - - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(creditCheckParams: CreditCheckParams) = apply { - additionalHeaders = creditCheckParams.additionalHeaders.toBuilder() - additionalQueryParams = creditCheckParams.additionalQueryParams.toBuilder() - additionalBodyProperties = creditCheckParams.additionalBodyProperties.toMutableMap() - } - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } - - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) - } - - /** - * Returns an immutable instance of [CreditCheckParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): CreditCheckParams = - CreditCheckParams( - additionalHeaders.build(), - additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), - ) - } - - fun _body(): Optional> = - Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is CreditCheckParams && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams && - additionalBodyProperties == other.additionalBodyProperties - } - - override fun hashCode(): Int = - Objects.hash(additionalHeaders, additionalQueryParams, additionalBodyProperties) - - override fun toString() = - "CreditCheckParams{additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" -} diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/credits/CreditCheckResponse.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/credits/CreditCheckResponse.kt deleted file mode 100644 index 6a3f1a3..0000000 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/credits/CreditCheckResponse.kt +++ /dev/null @@ -1,387 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.cas_parser.api.models.credits - -import com.cas_parser.api.core.ExcludeMissing -import com.cas_parser.api.core.JsonField -import com.cas_parser.api.core.JsonMissing -import com.cas_parser.api.core.JsonValue -import com.cas_parser.api.core.checkKnown -import com.cas_parser.api.core.toImmutable -import com.cas_parser.api.errors.CasParserInvalidDataException -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import java.time.OffsetDateTime -import java.util.Collections -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -class CreditCheckResponse -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val enabledFeatures: JsonField>, - private val isUnlimited: JsonField, - private val limit: JsonField, - private val remaining: JsonField, - private val resetsAt: JsonField, - private val used: JsonField, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("enabled_features") - @ExcludeMissing - enabledFeatures: JsonField> = JsonMissing.of(), - @JsonProperty("is_unlimited") - @ExcludeMissing - isUnlimited: JsonField = JsonMissing.of(), - @JsonProperty("limit") @ExcludeMissing limit: JsonField = JsonMissing.of(), - @JsonProperty("remaining") @ExcludeMissing remaining: JsonField = JsonMissing.of(), - @JsonProperty("resets_at") - @ExcludeMissing - resetsAt: JsonField = JsonMissing.of(), - @JsonProperty("used") @ExcludeMissing used: JsonField = JsonMissing.of(), - ) : this(enabledFeatures, isUnlimited, limit, remaining, resetsAt, used, mutableMapOf()) - - /** - * List of API features enabled for your plan - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun enabledFeatures(): Optional> = enabledFeatures.getOptional("enabled_features") - - /** - * Whether the account has unlimited credits - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun isUnlimited(): Optional = isUnlimited.getOptional("is_unlimited") - - /** - * Total credit limit for billing period - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun limit(): Optional = limit.getOptional("limit") - - /** - * Remaining credits (null if unlimited) - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun remaining(): Optional = remaining.getOptional("remaining") - - /** - * When credits reset (ISO 8601) - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun resetsAt(): Optional = resetsAt.getOptional("resets_at") - - /** - * Number of credits used this billing period - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun used(): Optional = used.getOptional("used") - - /** - * Returns the raw JSON value of [enabledFeatures]. - * - * Unlike [enabledFeatures], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("enabled_features") - @ExcludeMissing - fun _enabledFeatures(): JsonField> = enabledFeatures - - /** - * Returns the raw JSON value of [isUnlimited]. - * - * Unlike [isUnlimited], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("is_unlimited") - @ExcludeMissing - fun _isUnlimited(): JsonField = isUnlimited - - /** - * Returns the raw JSON value of [limit]. - * - * Unlike [limit], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("limit") @ExcludeMissing fun _limit(): JsonField = limit - - /** - * Returns the raw JSON value of [remaining]. - * - * Unlike [remaining], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("remaining") @ExcludeMissing fun _remaining(): JsonField = remaining - - /** - * Returns the raw JSON value of [resetsAt]. - * - * Unlike [resetsAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("resets_at") @ExcludeMissing fun _resetsAt(): JsonField = resetsAt - - /** - * Returns the raw JSON value of [used]. - * - * Unlike [used], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("used") @ExcludeMissing fun _used(): JsonField = used - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [CreditCheckResponse]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [CreditCheckResponse]. */ - class Builder internal constructor() { - - private var enabledFeatures: JsonField>? = null - private var isUnlimited: JsonField = JsonMissing.of() - private var limit: JsonField = JsonMissing.of() - private var remaining: JsonField = JsonMissing.of() - private var resetsAt: JsonField = JsonMissing.of() - private var used: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(creditCheckResponse: CreditCheckResponse) = apply { - enabledFeatures = creditCheckResponse.enabledFeatures.map { it.toMutableList() } - isUnlimited = creditCheckResponse.isUnlimited - limit = creditCheckResponse.limit - remaining = creditCheckResponse.remaining - resetsAt = creditCheckResponse.resetsAt - used = creditCheckResponse.used - additionalProperties = creditCheckResponse.additionalProperties.toMutableMap() - } - - /** List of API features enabled for your plan */ - fun enabledFeatures(enabledFeatures: List) = - enabledFeatures(JsonField.of(enabledFeatures)) - - /** - * Sets [Builder.enabledFeatures] to an arbitrary JSON value. - * - * You should usually call [Builder.enabledFeatures] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun enabledFeatures(enabledFeatures: JsonField>) = apply { - this.enabledFeatures = enabledFeatures.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [enabledFeatures]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addEnabledFeature(enabledFeature: String) = apply { - enabledFeatures = - (enabledFeatures ?: JsonField.of(mutableListOf())).also { - checkKnown("enabledFeatures", it).add(enabledFeature) - } - } - - /** Whether the account has unlimited credits */ - fun isUnlimited(isUnlimited: Boolean) = isUnlimited(JsonField.of(isUnlimited)) - - /** - * Sets [Builder.isUnlimited] to an arbitrary JSON value. - * - * You should usually call [Builder.isUnlimited] with a well-typed [Boolean] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun isUnlimited(isUnlimited: JsonField) = apply { this.isUnlimited = isUnlimited } - - /** Total credit limit for billing period */ - fun limit(limit: Long) = limit(JsonField.of(limit)) - - /** - * Sets [Builder.limit] to an arbitrary JSON value. - * - * You should usually call [Builder.limit] with a well-typed [Long] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun limit(limit: JsonField) = apply { this.limit = limit } - - /** Remaining credits (null if unlimited) */ - fun remaining(remaining: Double?) = remaining(JsonField.ofNullable(remaining)) - - /** - * Alias for [Builder.remaining]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun remaining(remaining: Double) = remaining(remaining as Double?) - - /** Alias for calling [Builder.remaining] with `remaining.orElse(null)`. */ - fun remaining(remaining: Optional) = remaining(remaining.getOrNull()) - - /** - * Sets [Builder.remaining] to an arbitrary JSON value. - * - * You should usually call [Builder.remaining] with a well-typed [Double] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun remaining(remaining: JsonField) = apply { this.remaining = remaining } - - /** When credits reset (ISO 8601) */ - fun resetsAt(resetsAt: OffsetDateTime?) = resetsAt(JsonField.ofNullable(resetsAt)) - - /** Alias for calling [Builder.resetsAt] with `resetsAt.orElse(null)`. */ - fun resetsAt(resetsAt: Optional) = resetsAt(resetsAt.getOrNull()) - - /** - * Sets [Builder.resetsAt] to an arbitrary JSON value. - * - * You should usually call [Builder.resetsAt] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun resetsAt(resetsAt: JsonField) = apply { this.resetsAt = resetsAt } - - /** Number of credits used this billing period */ - fun used(used: Double) = used(JsonField.of(used)) - - /** - * Sets [Builder.used] to an arbitrary JSON value. - * - * You should usually call [Builder.used] with a well-typed [Double] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun used(used: JsonField) = apply { this.used = used } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [CreditCheckResponse]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): CreditCheckResponse = - CreditCheckResponse( - (enabledFeatures ?: JsonMissing.of()).map { it.toImmutable() }, - isUnlimited, - limit, - remaining, - resetsAt, - used, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): CreditCheckResponse = apply { - if (validated) { - return@apply - } - - enabledFeatures() - isUnlimited() - limit() - remaining() - resetsAt() - used() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: CasParserInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (enabledFeatures.asKnown().getOrNull()?.size ?: 0) + - (if (isUnlimited.asKnown().isPresent) 1 else 0) + - (if (limit.asKnown().isPresent) 1 else 0) + - (if (remaining.asKnown().isPresent) 1 else 0) + - (if (resetsAt.asKnown().isPresent) 1 else 0) + - (if (used.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is CreditCheckResponse && - enabledFeatures == other.enabledFeatures && - isUnlimited == other.isUnlimited && - limit == other.limit && - remaining == other.remaining && - resetsAt == other.resetsAt && - used == other.used && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - enabledFeatures, - isUnlimited, - limit, - remaining, - resetsAt, - used, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "CreditCheckResponse{enabledFeatures=$enabledFeatures, isUnlimited=$isUnlimited, limit=$limit, remaining=$remaining, resetsAt=$resetsAt, used=$used, additionalProperties=$additionalProperties}" -} diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/logs/LogCreateParams.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/logs/LogCreateParams.kt deleted file mode 100644 index c46a795..0000000 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/logs/LogCreateParams.kt +++ /dev/null @@ -1,528 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.cas_parser.api.models.logs - -import com.cas_parser.api.core.ExcludeMissing -import com.cas_parser.api.core.JsonField -import com.cas_parser.api.core.JsonMissing -import com.cas_parser.api.core.JsonValue -import com.cas_parser.api.core.Params -import com.cas_parser.api.core.http.Headers -import com.cas_parser.api.core.http.QueryParams -import com.cas_parser.api.errors.CasParserInvalidDataException -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import java.time.OffsetDateTime -import java.util.Collections -import java.util.Objects -import java.util.Optional - -/** - * Retrieve detailed API usage logs for your account. - * - * Returns a list of API calls with timestamps, features used, status codes, and credits consumed. - * Useful for monitoring usage patterns and debugging. - */ -class LogCreateParams -private constructor( - private val body: Body, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - /** - * End time filter (ISO 8601). Defaults to now. - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun endTime(): Optional = body.endTime() - - /** - * Maximum number of logs to return - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun limit(): Optional = body.limit() - - /** - * Start time filter (ISO 8601). Defaults to 30 days ago. - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun startTime(): Optional = body.startTime() - - /** - * Returns the raw JSON value of [endTime]. - * - * Unlike [endTime], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _endTime(): JsonField = body._endTime() - - /** - * Returns the raw JSON value of [limit]. - * - * Unlike [limit], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _limit(): JsonField = body._limit() - - /** - * Returns the raw JSON value of [startTime]. - * - * Unlike [startTime], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _startTime(): JsonField = body._startTime() - - fun _additionalBodyProperties(): Map = body._additionalProperties() - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun none(): LogCreateParams = builder().build() - - /** Returns a mutable builder for constructing an instance of [LogCreateParams]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [LogCreateParams]. */ - class Builder internal constructor() { - - private var body: Body.Builder = Body.builder() - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(logCreateParams: LogCreateParams) = apply { - body = logCreateParams.body.toBuilder() - additionalHeaders = logCreateParams.additionalHeaders.toBuilder() - additionalQueryParams = logCreateParams.additionalQueryParams.toBuilder() - } - - /** - * Sets the entire request body. - * - * This is generally only useful if you are already constructing the body separately. - * Otherwise, it's more convenient to use the top-level setters instead: - * - [endTime] - * - [limit] - * - [startTime] - */ - fun body(body: Body) = apply { this.body = body.toBuilder() } - - /** End time filter (ISO 8601). Defaults to now. */ - fun endTime(endTime: OffsetDateTime) = apply { body.endTime(endTime) } - - /** - * Sets [Builder.endTime] to an arbitrary JSON value. - * - * You should usually call [Builder.endTime] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun endTime(endTime: JsonField) = apply { body.endTime(endTime) } - - /** Maximum number of logs to return */ - fun limit(limit: Long) = apply { body.limit(limit) } - - /** - * Sets [Builder.limit] to an arbitrary JSON value. - * - * You should usually call [Builder.limit] with a well-typed [Long] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun limit(limit: JsonField) = apply { body.limit(limit) } - - /** Start time filter (ISO 8601). Defaults to 30 days ago. */ - fun startTime(startTime: OffsetDateTime) = apply { body.startTime(startTime) } - - /** - * Sets [Builder.startTime] to an arbitrary JSON value. - * - * You should usually call [Builder.startTime] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun startTime(startTime: JsonField) = apply { body.startTime(startTime) } - - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - body.additionalProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - body.putAdditionalProperty(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - body.putAllAdditionalProperties(additionalBodyProperties) - } - - fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } - - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - body.removeAllAdditionalProperties(keys) - } - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [LogCreateParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): LogCreateParams = - LogCreateParams(body.build(), additionalHeaders.build(), additionalQueryParams.build()) - } - - fun _body(): Body = body - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - class Body - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val endTime: JsonField, - private val limit: JsonField, - private val startTime: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("end_time") - @ExcludeMissing - endTime: JsonField = JsonMissing.of(), - @JsonProperty("limit") @ExcludeMissing limit: JsonField = JsonMissing.of(), - @JsonProperty("start_time") - @ExcludeMissing - startTime: JsonField = JsonMissing.of(), - ) : this(endTime, limit, startTime, mutableMapOf()) - - /** - * End time filter (ISO 8601). Defaults to now. - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun endTime(): Optional = endTime.getOptional("end_time") - - /** - * Maximum number of logs to return - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun limit(): Optional = limit.getOptional("limit") - - /** - * Start time filter (ISO 8601). Defaults to 30 days ago. - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun startTime(): Optional = startTime.getOptional("start_time") - - /** - * Returns the raw JSON value of [endTime]. - * - * Unlike [endTime], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("end_time") - @ExcludeMissing - fun _endTime(): JsonField = endTime - - /** - * Returns the raw JSON value of [limit]. - * - * Unlike [limit], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("limit") @ExcludeMissing fun _limit(): JsonField = limit - - /** - * Returns the raw JSON value of [startTime]. - * - * Unlike [startTime], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("start_time") - @ExcludeMissing - fun _startTime(): JsonField = startTime - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [Body]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Body]. */ - class Builder internal constructor() { - - private var endTime: JsonField = JsonMissing.of() - private var limit: JsonField = JsonMissing.of() - private var startTime: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(body: Body) = apply { - endTime = body.endTime - limit = body.limit - startTime = body.startTime - additionalProperties = body.additionalProperties.toMutableMap() - } - - /** End time filter (ISO 8601). Defaults to now. */ - fun endTime(endTime: OffsetDateTime) = endTime(JsonField.of(endTime)) - - /** - * Sets [Builder.endTime] to an arbitrary JSON value. - * - * You should usually call [Builder.endTime] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun endTime(endTime: JsonField) = apply { this.endTime = endTime } - - /** Maximum number of logs to return */ - fun limit(limit: Long) = limit(JsonField.of(limit)) - - /** - * Sets [Builder.limit] to an arbitrary JSON value. - * - * You should usually call [Builder.limit] with a well-typed [Long] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun limit(limit: JsonField) = apply { this.limit = limit } - - /** Start time filter (ISO 8601). Defaults to 30 days ago. */ - fun startTime(startTime: OffsetDateTime) = startTime(JsonField.of(startTime)) - - /** - * Sets [Builder.startTime] to an arbitrary JSON value. - * - * You should usually call [Builder.startTime] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun startTime(startTime: JsonField) = apply { - this.startTime = startTime - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Body]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): Body = Body(endTime, limit, startTime, additionalProperties.toMutableMap()) - } - - private var validated: Boolean = false - - fun validate(): Body = apply { - if (validated) { - return@apply - } - - endTime() - limit() - startTime() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: CasParserInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (endTime.asKnown().isPresent) 1 else 0) + - (if (limit.asKnown().isPresent) 1 else 0) + - (if (startTime.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Body && - endTime == other.endTime && - limit == other.limit && - startTime == other.startTime && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(endTime, limit, startTime, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Body{endTime=$endTime, limit=$limit, startTime=$startTime, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is LogCreateParams && - body == other.body && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = Objects.hash(body, additionalHeaders, additionalQueryParams) - - override fun toString() = - "LogCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/logs/LogCreateResponse.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/logs/LogCreateResponse.kt deleted file mode 100644 index b77a776..0000000 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/logs/LogCreateResponse.kt +++ /dev/null @@ -1,578 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.cas_parser.api.models.logs - -import com.cas_parser.api.core.ExcludeMissing -import com.cas_parser.api.core.JsonField -import com.cas_parser.api.core.JsonMissing -import com.cas_parser.api.core.JsonValue -import com.cas_parser.api.core.checkKnown -import com.cas_parser.api.core.toImmutable -import com.cas_parser.api.errors.CasParserInvalidDataException -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import java.time.OffsetDateTime -import java.util.Collections -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -class LogCreateResponse -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val count: JsonField, - private val logs: JsonField>, - private val status: JsonField, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("count") @ExcludeMissing count: JsonField = JsonMissing.of(), - @JsonProperty("logs") @ExcludeMissing logs: JsonField> = JsonMissing.of(), - @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), - ) : this(count, logs, status, mutableMapOf()) - - /** - * Number of logs returned - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun count(): Optional = count.getOptional("count") - - /** - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun logs(): Optional> = logs.getOptional("logs") - - /** - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun status(): Optional = status.getOptional("status") - - /** - * Returns the raw JSON value of [count]. - * - * Unlike [count], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("count") @ExcludeMissing fun _count(): JsonField = count - - /** - * Returns the raw JSON value of [logs]. - * - * Unlike [logs], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("logs") @ExcludeMissing fun _logs(): JsonField> = logs - - /** - * Returns the raw JSON value of [status]. - * - * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [LogCreateResponse]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [LogCreateResponse]. */ - class Builder internal constructor() { - - private var count: JsonField = JsonMissing.of() - private var logs: JsonField>? = null - private var status: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(logCreateResponse: LogCreateResponse) = apply { - count = logCreateResponse.count - logs = logCreateResponse.logs.map { it.toMutableList() } - status = logCreateResponse.status - additionalProperties = logCreateResponse.additionalProperties.toMutableMap() - } - - /** Number of logs returned */ - fun count(count: Long) = count(JsonField.of(count)) - - /** - * Sets [Builder.count] to an arbitrary JSON value. - * - * You should usually call [Builder.count] with a well-typed [Long] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun count(count: JsonField) = apply { this.count = count } - - fun logs(logs: List) = logs(JsonField.of(logs)) - - /** - * Sets [Builder.logs] to an arbitrary JSON value. - * - * You should usually call [Builder.logs] with a well-typed `List` value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun logs(logs: JsonField>) = apply { this.logs = logs.map { it.toMutableList() } } - - /** - * Adds a single [Log] to [logs]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addLog(log: Log) = apply { - logs = (logs ?: JsonField.of(mutableListOf())).also { checkKnown("logs", it).add(log) } - } - - fun status(status: String) = status(JsonField.of(status)) - - /** - * Sets [Builder.status] to an arbitrary JSON value. - * - * You should usually call [Builder.status] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun status(status: JsonField) = apply { this.status = status } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [LogCreateResponse]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): LogCreateResponse = - LogCreateResponse( - count, - (logs ?: JsonMissing.of()).map { it.toImmutable() }, - status, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): LogCreateResponse = apply { - if (validated) { - return@apply - } - - count() - logs().ifPresent { it.forEach { it.validate() } } - status() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: CasParserInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (count.asKnown().isPresent) 1 else 0) + - (logs.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (if (status.asKnown().isPresent) 1 else 0) - - class Log - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val credits: JsonField, - private val feature: JsonField, - private val path: JsonField, - private val requestId: JsonField, - private val statusCode: JsonField, - private val timestamp: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("credits") @ExcludeMissing credits: JsonField = JsonMissing.of(), - @JsonProperty("feature") @ExcludeMissing feature: JsonField = JsonMissing.of(), - @JsonProperty("path") @ExcludeMissing path: JsonField = JsonMissing.of(), - @JsonProperty("request_id") - @ExcludeMissing - requestId: JsonField = JsonMissing.of(), - @JsonProperty("status_code") - @ExcludeMissing - statusCode: JsonField = JsonMissing.of(), - @JsonProperty("timestamp") - @ExcludeMissing - timestamp: JsonField = JsonMissing.of(), - ) : this(credits, feature, path, requestId, statusCode, timestamp, mutableMapOf()) - - /** - * Credits consumed for this request - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun credits(): Optional = credits.getOptional("credits") - - /** - * API feature used - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun feature(): Optional = feature.getOptional("feature") - - /** - * API endpoint path - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun path(): Optional = path.getOptional("path") - - /** - * Unique request identifier - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun requestId(): Optional = requestId.getOptional("request_id") - - /** - * HTTP response status code - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun statusCode(): Optional = statusCode.getOptional("status_code") - - /** - * When the request was made - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun timestamp(): Optional = timestamp.getOptional("timestamp") - - /** - * Returns the raw JSON value of [credits]. - * - * Unlike [credits], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("credits") @ExcludeMissing fun _credits(): JsonField = credits - - /** - * Returns the raw JSON value of [feature]. - * - * Unlike [feature], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("feature") @ExcludeMissing fun _feature(): JsonField = feature - - /** - * Returns the raw JSON value of [path]. - * - * Unlike [path], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("path") @ExcludeMissing fun _path(): JsonField = path - - /** - * Returns the raw JSON value of [requestId]. - * - * Unlike [requestId], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("request_id") @ExcludeMissing fun _requestId(): JsonField = requestId - - /** - * Returns the raw JSON value of [statusCode]. - * - * Unlike [statusCode], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("status_code") @ExcludeMissing fun _statusCode(): JsonField = statusCode - - /** - * Returns the raw JSON value of [timestamp]. - * - * Unlike [timestamp], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("timestamp") - @ExcludeMissing - fun _timestamp(): JsonField = timestamp - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [Log]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Log]. */ - class Builder internal constructor() { - - private var credits: JsonField = JsonMissing.of() - private var feature: JsonField = JsonMissing.of() - private var path: JsonField = JsonMissing.of() - private var requestId: JsonField = JsonMissing.of() - private var statusCode: JsonField = JsonMissing.of() - private var timestamp: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(log: Log) = apply { - credits = log.credits - feature = log.feature - path = log.path - requestId = log.requestId - statusCode = log.statusCode - timestamp = log.timestamp - additionalProperties = log.additionalProperties.toMutableMap() - } - - /** Credits consumed for this request */ - fun credits(credits: Double) = credits(JsonField.of(credits)) - - /** - * Sets [Builder.credits] to an arbitrary JSON value. - * - * You should usually call [Builder.credits] with a well-typed [Double] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun credits(credits: JsonField) = apply { this.credits = credits } - - /** API feature used */ - fun feature(feature: String) = feature(JsonField.of(feature)) - - /** - * Sets [Builder.feature] to an arbitrary JSON value. - * - * You should usually call [Builder.feature] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun feature(feature: JsonField) = apply { this.feature = feature } - - /** API endpoint path */ - fun path(path: String) = path(JsonField.of(path)) - - /** - * Sets [Builder.path] to an arbitrary JSON value. - * - * You should usually call [Builder.path] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun path(path: JsonField) = apply { this.path = path } - - /** Unique request identifier */ - fun requestId(requestId: String) = requestId(JsonField.of(requestId)) - - /** - * Sets [Builder.requestId] to an arbitrary JSON value. - * - * You should usually call [Builder.requestId] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun requestId(requestId: JsonField) = apply { this.requestId = requestId } - - /** HTTP response status code */ - fun statusCode(statusCode: Long) = statusCode(JsonField.of(statusCode)) - - /** - * Sets [Builder.statusCode] to an arbitrary JSON value. - * - * You should usually call [Builder.statusCode] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun statusCode(statusCode: JsonField) = apply { this.statusCode = statusCode } - - /** When the request was made */ - fun timestamp(timestamp: OffsetDateTime) = timestamp(JsonField.of(timestamp)) - - /** - * Sets [Builder.timestamp] to an arbitrary JSON value. - * - * You should usually call [Builder.timestamp] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun timestamp(timestamp: JsonField) = apply { - this.timestamp = timestamp - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Log]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): Log = - Log( - credits, - feature, - path, - requestId, - statusCode, - timestamp, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): Log = apply { - if (validated) { - return@apply - } - - credits() - feature() - path() - requestId() - statusCode() - timestamp() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: CasParserInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (credits.asKnown().isPresent) 1 else 0) + - (if (feature.asKnown().isPresent) 1 else 0) + - (if (path.asKnown().isPresent) 1 else 0) + - (if (requestId.asKnown().isPresent) 1 else 0) + - (if (statusCode.asKnown().isPresent) 1 else 0) + - (if (timestamp.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Log && - credits == other.credits && - feature == other.feature && - path == other.path && - requestId == other.requestId && - statusCode == other.statusCode && - timestamp == other.timestamp && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - credits, - feature, - path, - requestId, - statusCode, - timestamp, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Log{credits=$credits, feature=$feature, path=$path, requestId=$requestId, statusCode=$statusCode, timestamp=$timestamp, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is LogCreateResponse && - count == other.count && - logs == other.logs && - status == other.status && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(count, logs, status, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "LogCreateResponse{count=$count, logs=$logs, status=$status, additionalProperties=$additionalProperties}" -} 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 deleted file mode 100644 index f14f253..0000000 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/logs/LogGetSummaryParams.kt +++ /dev/null @@ -1,468 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.cas_parser.api.models.logs - -import com.cas_parser.api.core.ExcludeMissing -import com.cas_parser.api.core.JsonField -import com.cas_parser.api.core.JsonMissing -import com.cas_parser.api.core.JsonValue -import com.cas_parser.api.core.Params -import com.cas_parser.api.core.http.Headers -import com.cas_parser.api.core.http.QueryParams -import com.cas_parser.api.errors.CasParserInvalidDataException -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import java.time.OffsetDateTime -import java.util.Collections -import java.util.Objects -import java.util.Optional - -/** - * Get aggregated usage statistics grouped by feature. - * - * Useful for understanding which API features are being used most and tracking usage trends. - */ -class LogGetSummaryParams -private constructor( - private val body: Body, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - /** - * End time filter (ISO 8601). Defaults to now. - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun endTime(): Optional = body.endTime() - - /** - * Start time filter (ISO 8601). Defaults to start of current month. - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun startTime(): Optional = body.startTime() - - /** - * Returns the raw JSON value of [endTime]. - * - * Unlike [endTime], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _endTime(): JsonField = body._endTime() - - /** - * Returns the raw JSON value of [startTime]. - * - * Unlike [startTime], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _startTime(): JsonField = body._startTime() - - fun _additionalBodyProperties(): Map = body._additionalProperties() - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun none(): LogGetSummaryParams = builder().build() - - /** Returns a mutable builder for constructing an instance of [LogGetSummaryParams]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [LogGetSummaryParams]. */ - class Builder internal constructor() { - - private var body: Body.Builder = Body.builder() - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(logGetSummaryParams: LogGetSummaryParams) = apply { - body = logGetSummaryParams.body.toBuilder() - additionalHeaders = logGetSummaryParams.additionalHeaders.toBuilder() - additionalQueryParams = logGetSummaryParams.additionalQueryParams.toBuilder() - } - - /** - * Sets the entire request body. - * - * This is generally only useful if you are already constructing the body separately. - * Otherwise, it's more convenient to use the top-level setters instead: - * - [endTime] - * - [startTime] - */ - fun body(body: Body) = apply { this.body = body.toBuilder() } - - /** End time filter (ISO 8601). Defaults to now. */ - fun endTime(endTime: OffsetDateTime) = apply { body.endTime(endTime) } - - /** - * Sets [Builder.endTime] to an arbitrary JSON value. - * - * You should usually call [Builder.endTime] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun endTime(endTime: JsonField) = apply { body.endTime(endTime) } - - /** Start time filter (ISO 8601). Defaults to start of current month. */ - fun startTime(startTime: OffsetDateTime) = apply { body.startTime(startTime) } - - /** - * Sets [Builder.startTime] to an arbitrary JSON value. - * - * You should usually call [Builder.startTime] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun startTime(startTime: JsonField) = apply { body.startTime(startTime) } - - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - body.additionalProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - body.putAdditionalProperty(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - body.putAllAdditionalProperties(additionalBodyProperties) - } - - fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } - - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - body.removeAllAdditionalProperties(keys) - } - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [LogGetSummaryParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): LogGetSummaryParams = - LogGetSummaryParams( - body.build(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - fun _body(): Body = body - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - class Body - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val endTime: JsonField, - private val startTime: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("end_time") - @ExcludeMissing - endTime: JsonField = JsonMissing.of(), - @JsonProperty("start_time") - @ExcludeMissing - startTime: JsonField = JsonMissing.of(), - ) : this(endTime, startTime, mutableMapOf()) - - /** - * End time filter (ISO 8601). Defaults to now. - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun endTime(): Optional = endTime.getOptional("end_time") - - /** - * Start time filter (ISO 8601). Defaults to start of current month. - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun startTime(): Optional = startTime.getOptional("start_time") - - /** - * Returns the raw JSON value of [endTime]. - * - * Unlike [endTime], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("end_time") - @ExcludeMissing - fun _endTime(): JsonField = endTime - - /** - * Returns the raw JSON value of [startTime]. - * - * Unlike [startTime], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("start_time") - @ExcludeMissing - fun _startTime(): JsonField = startTime - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [Body]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Body]. */ - class Builder internal constructor() { - - private var endTime: JsonField = JsonMissing.of() - private var startTime: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(body: Body) = apply { - endTime = body.endTime - startTime = body.startTime - additionalProperties = body.additionalProperties.toMutableMap() - } - - /** End time filter (ISO 8601). Defaults to now. */ - fun endTime(endTime: OffsetDateTime) = endTime(JsonField.of(endTime)) - - /** - * Sets [Builder.endTime] to an arbitrary JSON value. - * - * You should usually call [Builder.endTime] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun endTime(endTime: JsonField) = apply { this.endTime = endTime } - - /** Start time filter (ISO 8601). Defaults to start of current month. */ - fun startTime(startTime: OffsetDateTime) = startTime(JsonField.of(startTime)) - - /** - * Sets [Builder.startTime] to an arbitrary JSON value. - * - * You should usually call [Builder.startTime] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun startTime(startTime: JsonField) = apply { - this.startTime = startTime - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Body]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): Body = Body(endTime, startTime, additionalProperties.toMutableMap()) - } - - private var validated: Boolean = false - - fun validate(): Body = apply { - if (validated) { - return@apply - } - - endTime() - startTime() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: CasParserInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (endTime.asKnown().isPresent) 1 else 0) + - (if (startTime.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Body && - endTime == other.endTime && - startTime == other.startTime && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(endTime, startTime, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Body{endTime=$endTime, startTime=$startTime, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is LogGetSummaryParams && - body == other.body && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = Objects.hash(body, additionalHeaders, additionalQueryParams) - - override fun toString() = - "LogGetSummaryParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} 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 deleted file mode 100644 index a78d1ba..0000000 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/logs/LogGetSummaryResponse.kt +++ /dev/null @@ -1,663 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.cas_parser.api.models.logs - -import com.cas_parser.api.core.ExcludeMissing -import com.cas_parser.api.core.JsonField -import com.cas_parser.api.core.JsonMissing -import com.cas_parser.api.core.JsonValue -import com.cas_parser.api.core.checkKnown -import com.cas_parser.api.core.toImmutable -import com.cas_parser.api.errors.CasParserInvalidDataException -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import java.util.Collections -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -class LogGetSummaryResponse -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val status: JsonField, - private val summary: JsonField, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), - @JsonProperty("summary") @ExcludeMissing summary: JsonField = JsonMissing.of(), - ) : this(status, summary, mutableMapOf()) - - /** - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun status(): Optional = status.getOptional("status") - - /** - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun summary(): Optional = summary.getOptional("summary") - - /** - * Returns the raw JSON value of [status]. - * - * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status - - /** - * Returns the raw JSON value of [summary]. - * - * Unlike [summary], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("summary") @ExcludeMissing fun _summary(): JsonField = summary - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [LogGetSummaryResponse]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [LogGetSummaryResponse]. */ - class Builder internal constructor() { - - private var status: JsonField = JsonMissing.of() - private var summary: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(logGetSummaryResponse: LogGetSummaryResponse) = apply { - status = logGetSummaryResponse.status - summary = logGetSummaryResponse.summary - additionalProperties = logGetSummaryResponse.additionalProperties.toMutableMap() - } - - fun status(status: String) = status(JsonField.of(status)) - - /** - * Sets [Builder.status] to an arbitrary JSON value. - * - * You should usually call [Builder.status] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun status(status: JsonField) = apply { this.status = status } - - fun summary(summary: Summary) = summary(JsonField.of(summary)) - - /** - * Sets [Builder.summary] to an arbitrary JSON value. - * - * You should usually call [Builder.summary] with a well-typed [Summary] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun summary(summary: JsonField) = apply { this.summary = summary } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [LogGetSummaryResponse]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): LogGetSummaryResponse = - LogGetSummaryResponse(status, summary, additionalProperties.toMutableMap()) - } - - private var validated: Boolean = false - - fun validate(): LogGetSummaryResponse = apply { - if (validated) { - return@apply - } - - status() - summary().ifPresent { it.validate() } - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: CasParserInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (status.asKnown().isPresent) 1 else 0) + - (summary.asKnown().getOrNull()?.validity() ?: 0) - - class Summary - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val byFeature: JsonField>, - private val totalCredits: JsonField, - private val totalRequests: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("by_feature") - @ExcludeMissing - byFeature: JsonField> = JsonMissing.of(), - @JsonProperty("total_credits") - @ExcludeMissing - totalCredits: JsonField = JsonMissing.of(), - @JsonProperty("total_requests") - @ExcludeMissing - totalRequests: JsonField = JsonMissing.of(), - ) : this(byFeature, totalCredits, totalRequests, mutableMapOf()) - - /** - * Usage breakdown by feature - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun byFeature(): Optional> = byFeature.getOptional("by_feature") - - /** - * Total credits consumed in the period - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun totalCredits(): Optional = totalCredits.getOptional("total_credits") - - /** - * Total API requests made in the period - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun totalRequests(): Optional = totalRequests.getOptional("total_requests") - - /** - * Returns the raw JSON value of [byFeature]. - * - * Unlike [byFeature], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("by_feature") - @ExcludeMissing - fun _byFeature(): JsonField> = byFeature - - /** - * Returns the raw JSON value of [totalCredits]. - * - * Unlike [totalCredits], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("total_credits") - @ExcludeMissing - fun _totalCredits(): JsonField = totalCredits - - /** - * Returns the raw JSON value of [totalRequests]. - * - * Unlike [totalRequests], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("total_requests") - @ExcludeMissing - fun _totalRequests(): JsonField = totalRequests - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [Summary]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Summary]. */ - class Builder internal constructor() { - - private var byFeature: JsonField>? = null - private var totalCredits: JsonField = JsonMissing.of() - private var totalRequests: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(summary: Summary) = apply { - byFeature = summary.byFeature.map { it.toMutableList() } - totalCredits = summary.totalCredits - totalRequests = summary.totalRequests - additionalProperties = summary.additionalProperties.toMutableMap() - } - - /** Usage breakdown by feature */ - fun byFeature(byFeature: List) = byFeature(JsonField.of(byFeature)) - - /** - * Sets [Builder.byFeature] to an arbitrary JSON value. - * - * You should usually call [Builder.byFeature] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun byFeature(byFeature: JsonField>) = apply { - this.byFeature = byFeature.map { it.toMutableList() } - } - - /** - * Adds a single [ByFeature] to [Builder.byFeature]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addByFeature(byFeature: ByFeature) = apply { - this.byFeature = - (this.byFeature ?: JsonField.of(mutableListOf())).also { - checkKnown("byFeature", it).add(byFeature) - } - } - - /** Total credits consumed in the period */ - fun totalCredits(totalCredits: Double) = totalCredits(JsonField.of(totalCredits)) - - /** - * Sets [Builder.totalCredits] to an arbitrary JSON value. - * - * You should usually call [Builder.totalCredits] with a well-typed [Double] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun totalCredits(totalCredits: JsonField) = apply { - this.totalCredits = totalCredits - } - - /** Total API requests made in the period */ - fun totalRequests(totalRequests: Long) = totalRequests(JsonField.of(totalRequests)) - - /** - * Sets [Builder.totalRequests] to an arbitrary JSON value. - * - * You should usually call [Builder.totalRequests] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun totalRequests(totalRequests: JsonField) = apply { - this.totalRequests = totalRequests - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Summary]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): Summary = - Summary( - (byFeature ?: JsonMissing.of()).map { it.toImmutable() }, - totalCredits, - totalRequests, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): Summary = apply { - if (validated) { - return@apply - } - - byFeature().ifPresent { it.forEach { it.validate() } } - totalCredits() - totalRequests() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: CasParserInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (byFeature.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (if (totalCredits.asKnown().isPresent) 1 else 0) + - (if (totalRequests.asKnown().isPresent) 1 else 0) - - class ByFeature - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val credits: JsonField, - private val feature: JsonField, - private val requests: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("credits") - @ExcludeMissing - credits: JsonField = JsonMissing.of(), - @JsonProperty("feature") - @ExcludeMissing - feature: JsonField = JsonMissing.of(), - @JsonProperty("requests") - @ExcludeMissing - requests: JsonField = JsonMissing.of(), - ) : this(credits, feature, requests, mutableMapOf()) - - /** - * Credits consumed by this feature - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun credits(): Optional = credits.getOptional("credits") - - /** - * API feature name - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun feature(): Optional = feature.getOptional("feature") - - /** - * Number of requests for this feature - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun requests(): Optional = requests.getOptional("requests") - - /** - * Returns the raw JSON value of [credits]. - * - * Unlike [credits], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("credits") @ExcludeMissing fun _credits(): JsonField = credits - - /** - * Returns the raw JSON value of [feature]. - * - * Unlike [feature], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("feature") @ExcludeMissing fun _feature(): JsonField = feature - - /** - * Returns the raw JSON value of [requests]. - * - * Unlike [requests], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("requests") @ExcludeMissing fun _requests(): JsonField = requests - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [ByFeature]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [ByFeature]. */ - class Builder internal constructor() { - - private var credits: JsonField = JsonMissing.of() - private var feature: JsonField = JsonMissing.of() - private var requests: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(byFeature: ByFeature) = apply { - credits = byFeature.credits - feature = byFeature.feature - requests = byFeature.requests - additionalProperties = byFeature.additionalProperties.toMutableMap() - } - - /** Credits consumed by this feature */ - fun credits(credits: Double) = credits(JsonField.of(credits)) - - /** - * Sets [Builder.credits] to an arbitrary JSON value. - * - * You should usually call [Builder.credits] with a well-typed [Double] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun credits(credits: JsonField) = apply { this.credits = credits } - - /** API feature name */ - fun feature(feature: String) = feature(JsonField.of(feature)) - - /** - * Sets [Builder.feature] to an arbitrary JSON value. - * - * You should usually call [Builder.feature] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun feature(feature: JsonField) = apply { this.feature = feature } - - /** Number of requests for this feature */ - fun requests(requests: Long) = requests(JsonField.of(requests)) - - /** - * Sets [Builder.requests] to an arbitrary JSON value. - * - * You should usually call [Builder.requests] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun requests(requests: JsonField) = apply { this.requests = requests } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [ByFeature]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): ByFeature = - ByFeature(credits, feature, requests, additionalProperties.toMutableMap()) - } - - private var validated: Boolean = false - - fun validate(): ByFeature = apply { - if (validated) { - return@apply - } - - credits() - feature() - requests() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: CasParserInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (credits.asKnown().isPresent) 1 else 0) + - (if (feature.asKnown().isPresent) 1 else 0) + - (if (requests.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ByFeature && - credits == other.credits && - feature == other.feature && - requests == other.requests && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(credits, feature, requests, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "ByFeature{credits=$credits, feature=$feature, requests=$requests, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Summary && - byFeature == other.byFeature && - totalCredits == other.totalCredits && - totalRequests == other.totalRequests && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(byFeature, totalCredits, totalRequests, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Summary{byFeature=$byFeature, totalCredits=$totalCredits, totalRequests=$totalRequests, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is LogGetSummaryResponse && - status == other.status && - summary == other.summary && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(status, summary, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "LogGetSummaryResponse{status=$status, summary=$summary, additionalProperties=$additionalProperties}" -} diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/verifytoken/VerifyTokenVerifyParams.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/verifytoken/VerifyTokenVerifyParams.kt deleted file mode 100644 index aac1a81..0000000 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/verifytoken/VerifyTokenVerifyParams.kt +++ /dev/null @@ -1,211 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.cas_parser.api.models.verifytoken - -import com.cas_parser.api.core.JsonValue -import com.cas_parser.api.core.Params -import com.cas_parser.api.core.http.Headers -import com.cas_parser.api.core.http.QueryParams -import com.cas_parser.api.core.toImmutable -import java.util.Objects -import java.util.Optional - -/** Verify an access token and check if it's still valid. Useful for debugging token issues. */ -class VerifyTokenVerifyParams -private constructor( - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, -) : Params { - - /** Additional body properties to send with the request. */ - fun _additionalBodyProperties(): Map = additionalBodyProperties - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun none(): VerifyTokenVerifyParams = builder().build() - - /** Returns a mutable builder for constructing an instance of [VerifyTokenVerifyParams]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [VerifyTokenVerifyParams]. */ - class Builder internal constructor() { - - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(verifyTokenVerifyParams: VerifyTokenVerifyParams) = apply { - additionalHeaders = verifyTokenVerifyParams.additionalHeaders.toBuilder() - additionalQueryParams = verifyTokenVerifyParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - verifyTokenVerifyParams.additionalBodyProperties.toMutableMap() - } - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } - - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) - } - - /** - * Returns an immutable instance of [VerifyTokenVerifyParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): VerifyTokenVerifyParams = - VerifyTokenVerifyParams( - additionalHeaders.build(), - additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), - ) - } - - fun _body(): Optional> = - Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is VerifyTokenVerifyParams && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams && - additionalBodyProperties == other.additionalBodyProperties - } - - override fun hashCode(): Int = - Objects.hash(additionalHeaders, additionalQueryParams, additionalBodyProperties) - - override fun toString() = - "VerifyTokenVerifyParams{additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" -} 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 deleted file mode 100644 index b8859a0..0000000 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/verifytoken/VerifyTokenVerifyResponse.kt +++ /dev/null @@ -1,240 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.cas_parser.api.models.verifytoken - -import com.cas_parser.api.core.ExcludeMissing -import com.cas_parser.api.core.JsonField -import com.cas_parser.api.core.JsonMissing -import com.cas_parser.api.core.JsonValue -import com.cas_parser.api.errors.CasParserInvalidDataException -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import java.util.Collections -import java.util.Objects -import java.util.Optional - -class VerifyTokenVerifyResponse -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val error: JsonField, - private val maskedApiKey: JsonField, - private val valid: JsonField, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("error") @ExcludeMissing error: JsonField = JsonMissing.of(), - @JsonProperty("masked_api_key") - @ExcludeMissing - maskedApiKey: JsonField = JsonMissing.of(), - @JsonProperty("valid") @ExcludeMissing valid: JsonField = JsonMissing.of(), - ) : this(error, maskedApiKey, valid, mutableMapOf()) - - /** - * Error message (only shown if invalid) - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun error(): Optional = error.getOptional("error") - - /** - * Masked API key (only shown if valid) - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun maskedApiKey(): Optional = maskedApiKey.getOptional("masked_api_key") - - /** - * Whether the token is valid - * - * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun valid(): Optional = valid.getOptional("valid") - - /** - * Returns the raw JSON value of [error]. - * - * Unlike [error], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("error") @ExcludeMissing fun _error(): JsonField = error - - /** - * Returns the raw JSON value of [maskedApiKey]. - * - * Unlike [maskedApiKey], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("masked_api_key") - @ExcludeMissing - fun _maskedApiKey(): JsonField = maskedApiKey - - /** - * Returns the raw JSON value of [valid]. - * - * Unlike [valid], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("valid") @ExcludeMissing fun _valid(): JsonField = valid - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [VerifyTokenVerifyResponse]. - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [VerifyTokenVerifyResponse]. */ - class Builder internal constructor() { - - private var error: JsonField = JsonMissing.of() - private var maskedApiKey: JsonField = JsonMissing.of() - private var valid: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(verifyTokenVerifyResponse: VerifyTokenVerifyResponse) = apply { - error = verifyTokenVerifyResponse.error - maskedApiKey = verifyTokenVerifyResponse.maskedApiKey - valid = verifyTokenVerifyResponse.valid - additionalProperties = verifyTokenVerifyResponse.additionalProperties.toMutableMap() - } - - /** Error message (only shown if invalid) */ - fun error(error: String) = error(JsonField.of(error)) - - /** - * Sets [Builder.error] to an arbitrary JSON value. - * - * You should usually call [Builder.error] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun error(error: JsonField) = apply { this.error = error } - - /** Masked API key (only shown if valid) */ - fun maskedApiKey(maskedApiKey: String) = maskedApiKey(JsonField.of(maskedApiKey)) - - /** - * Sets [Builder.maskedApiKey] to an arbitrary JSON value. - * - * You should usually call [Builder.maskedApiKey] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun maskedApiKey(maskedApiKey: JsonField) = apply { - this.maskedApiKey = maskedApiKey - } - - /** Whether the token is valid */ - fun valid(valid: Boolean) = valid(JsonField.of(valid)) - - /** - * Sets [Builder.valid] to an arbitrary JSON value. - * - * You should usually call [Builder.valid] with a well-typed [Boolean] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun valid(valid: JsonField) = apply { this.valid = valid } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [VerifyTokenVerifyResponse]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): VerifyTokenVerifyResponse = - VerifyTokenVerifyResponse( - error, - maskedApiKey, - valid, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): VerifyTokenVerifyResponse = apply { - if (validated) { - return@apply - } - - error() - maskedApiKey() - valid() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: CasParserInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (error.asKnown().isPresent) 1 else 0) + - (if (maskedApiKey.asKnown().isPresent) 1 else 0) + - (if (valid.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is VerifyTokenVerifyResponse && - error == other.error && - maskedApiKey == other.maskedApiKey && - valid == other.valid && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(error, maskedApiKey, valid, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "VerifyTokenVerifyResponse{error=$error, maskedApiKey=$maskedApiKey, valid=$valid, additionalProperties=$additionalProperties}" -} diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/async/AccessTokenServiceAsync.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/async/AccessTokenServiceAsync.kt index 0948924..3809ee6 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/async/AccessTokenServiceAsync.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/async/AccessTokenServiceAsync.kt @@ -3,11 +3,6 @@ package com.cas_parser.api.services.async import com.cas_parser.api.core.ClientOptions -import com.cas_parser.api.core.RequestOptions -import com.cas_parser.api.core.http.HttpResponseFor -import com.cas_parser.api.models.accesstoken.AccessTokenCreateParams -import com.cas_parser.api.models.accesstoken.AccessTokenCreateResponse -import java.util.concurrent.CompletableFuture import java.util.function.Consumer interface AccessTokenServiceAsync { @@ -24,36 +19,6 @@ interface AccessTokenServiceAsync { */ fun withOptions(modifier: Consumer): AccessTokenServiceAsync - /** - * Generate a short-lived access token from your API key. - * - * **Use this endpoint from your backend** to create tokens that can be safely passed to - * frontend/SDK. - * - * Access tokens: - * - Are prefixed with `at_` for easy identification - * - Valid for up to 60 minutes - * - Can be used in place of API keys on all v4 endpoints - * - Cannot be used to generate other access tokens - */ - fun create(): CompletableFuture = - create(AccessTokenCreateParams.none()) - - /** @see create */ - fun create( - params: AccessTokenCreateParams = AccessTokenCreateParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see create */ - fun create( - params: AccessTokenCreateParams = AccessTokenCreateParams.none() - ): CompletableFuture = create(params, RequestOptions.none()) - - /** @see create */ - fun create(requestOptions: RequestOptions): CompletableFuture = - create(AccessTokenCreateParams.none(), requestOptions) - /** * A view of [AccessTokenServiceAsync] that provides access to raw HTTP responses for each * method. @@ -68,30 +33,5 @@ interface AccessTokenServiceAsync { fun withOptions( modifier: Consumer ): AccessTokenServiceAsync.WithRawResponse - - /** - * Returns a raw HTTP response for `post /v1/access-token`, but is otherwise the same as - * [AccessTokenServiceAsync.create]. - */ - fun create(): CompletableFuture> = - create(AccessTokenCreateParams.none()) - - /** @see create */ - fun create( - params: AccessTokenCreateParams = AccessTokenCreateParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see create */ - fun create( - params: AccessTokenCreateParams = AccessTokenCreateParams.none() - ): CompletableFuture> = - create(params, RequestOptions.none()) - - /** @see create */ - fun create( - requestOptions: RequestOptions - ): CompletableFuture> = - create(AccessTokenCreateParams.none(), requestOptions) } } diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/async/AccessTokenServiceAsyncImpl.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/async/AccessTokenServiceAsyncImpl.kt index e71b99c..a947c34 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/async/AccessTokenServiceAsyncImpl.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/async/AccessTokenServiceAsyncImpl.kt @@ -3,21 +3,6 @@ package com.cas_parser.api.services.async import com.cas_parser.api.core.ClientOptions -import com.cas_parser.api.core.RequestOptions -import com.cas_parser.api.core.handlers.errorBodyHandler -import com.cas_parser.api.core.handlers.errorHandler -import com.cas_parser.api.core.handlers.jsonHandler -import com.cas_parser.api.core.http.HttpMethod -import com.cas_parser.api.core.http.HttpRequest -import com.cas_parser.api.core.http.HttpResponse -import com.cas_parser.api.core.http.HttpResponse.Handler -import com.cas_parser.api.core.http.HttpResponseFor -import com.cas_parser.api.core.http.json -import com.cas_parser.api.core.http.parseable -import com.cas_parser.api.core.prepareAsync -import com.cas_parser.api.models.accesstoken.AccessTokenCreateParams -import com.cas_parser.api.models.accesstoken.AccessTokenCreateResponse -import java.util.concurrent.CompletableFuture import java.util.function.Consumer class AccessTokenServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : @@ -32,55 +17,14 @@ class AccessTokenServiceAsyncImpl internal constructor(private val clientOptions override fun withOptions(modifier: Consumer): AccessTokenServiceAsync = AccessTokenServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - override fun create( - params: AccessTokenCreateParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // post /v1/access-token - withRawResponse().create(params, requestOptions).thenApply { it.parse() } - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : AccessTokenServiceAsync.WithRawResponse { - private val errorHandler: Handler = - errorHandler(errorBodyHandler(clientOptions.jsonMapper)) - override fun withOptions( modifier: Consumer ): AccessTokenServiceAsync.WithRawResponse = AccessTokenServiceAsyncImpl.WithRawResponseImpl( clientOptions.toBuilder().apply(modifier::accept).build() ) - - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun create( - params: AccessTokenCreateParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("v1", "access-token") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } } } diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/async/CreditServiceAsync.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/async/CreditServiceAsync.kt index 05290f8..70f75cb 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/async/CreditServiceAsync.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/async/CreditServiceAsync.kt @@ -3,11 +3,6 @@ package com.cas_parser.api.services.async import com.cas_parser.api.core.ClientOptions -import com.cas_parser.api.core.RequestOptions -import com.cas_parser.api.core.http.HttpResponseFor -import com.cas_parser.api.models.credits.CreditCheckParams -import com.cas_parser.api.models.credits.CreditCheckResponse -import java.util.concurrent.CompletableFuture import java.util.function.Consumer interface CreditServiceAsync { @@ -24,33 +19,6 @@ interface CreditServiceAsync { */ fun withOptions(modifier: Consumer): CreditServiceAsync - /** - * Check your remaining API credits and usage for the current billing period. - * - * Returns: - * - Number of API calls used and remaining credits - * - Credit limit and reset date - * - List of enabled features for your plan - * - * Credits reset at the start of each billing period. - */ - fun check(): CompletableFuture = check(CreditCheckParams.none()) - - /** @see check */ - fun check( - params: CreditCheckParams = CreditCheckParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see check */ - fun check( - params: CreditCheckParams = CreditCheckParams.none() - ): CompletableFuture = check(params, RequestOptions.none()) - - /** @see check */ - fun check(requestOptions: RequestOptions): CompletableFuture = - check(CreditCheckParams.none(), requestOptions) - /** * A view of [CreditServiceAsync] that provides access to raw HTTP responses for each method. */ @@ -64,30 +32,5 @@ interface CreditServiceAsync { fun withOptions( modifier: Consumer ): CreditServiceAsync.WithRawResponse - - /** - * Returns a raw HTTP response for `post /credits`, but is otherwise the same as - * [CreditServiceAsync.check]. - */ - fun check(): CompletableFuture> = - check(CreditCheckParams.none()) - - /** @see check */ - fun check( - params: CreditCheckParams = CreditCheckParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see check */ - fun check( - params: CreditCheckParams = CreditCheckParams.none() - ): CompletableFuture> = - check(params, RequestOptions.none()) - - /** @see check */ - fun check( - requestOptions: RequestOptions - ): CompletableFuture> = - check(CreditCheckParams.none(), requestOptions) } } diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/async/CreditServiceAsyncImpl.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/async/CreditServiceAsyncImpl.kt index 6f2806c..9995851 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/async/CreditServiceAsyncImpl.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/async/CreditServiceAsyncImpl.kt @@ -3,21 +3,6 @@ package com.cas_parser.api.services.async import com.cas_parser.api.core.ClientOptions -import com.cas_parser.api.core.RequestOptions -import com.cas_parser.api.core.handlers.errorBodyHandler -import com.cas_parser.api.core.handlers.errorHandler -import com.cas_parser.api.core.handlers.jsonHandler -import com.cas_parser.api.core.http.HttpMethod -import com.cas_parser.api.core.http.HttpRequest -import com.cas_parser.api.core.http.HttpResponse -import com.cas_parser.api.core.http.HttpResponse.Handler -import com.cas_parser.api.core.http.HttpResponseFor -import com.cas_parser.api.core.http.json -import com.cas_parser.api.core.http.parseable -import com.cas_parser.api.core.prepareAsync -import com.cas_parser.api.models.credits.CreditCheckParams -import com.cas_parser.api.models.credits.CreditCheckResponse -import java.util.concurrent.CompletableFuture import java.util.function.Consumer class CreditServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : @@ -32,55 +17,14 @@ class CreditServiceAsyncImpl internal constructor(private val clientOptions: Cli override fun withOptions(modifier: Consumer): CreditServiceAsync = CreditServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - override fun check( - params: CreditCheckParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // post /credits - withRawResponse().check(params, requestOptions).thenApply { it.parse() } - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : CreditServiceAsync.WithRawResponse { - private val errorHandler: Handler = - errorHandler(errorBodyHandler(clientOptions.jsonMapper)) - override fun withOptions( modifier: Consumer ): CreditServiceAsync.WithRawResponse = CreditServiceAsyncImpl.WithRawResponseImpl( clientOptions.toBuilder().apply(modifier::accept).build() ) - - private val checkHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun check( - params: CreditCheckParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("credits") - .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response - .use { checkHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } } } diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/async/LogServiceAsync.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/async/LogServiceAsync.kt index 641ee6a..4dc2b00 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/async/LogServiceAsync.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/async/LogServiceAsync.kt @@ -3,13 +3,6 @@ package com.cas_parser.api.services.async import com.cas_parser.api.core.ClientOptions -import com.cas_parser.api.core.RequestOptions -import com.cas_parser.api.core.http.HttpResponseFor -import com.cas_parser.api.models.logs.LogCreateParams -import com.cas_parser.api.models.logs.LogCreateResponse -import com.cas_parser.api.models.logs.LogGetSummaryParams -import com.cas_parser.api.models.logs.LogGetSummaryResponse -import java.util.concurrent.CompletableFuture import java.util.function.Consumer interface LogServiceAsync { @@ -26,52 +19,6 @@ interface LogServiceAsync { */ fun withOptions(modifier: Consumer): LogServiceAsync - /** - * Retrieve detailed API usage logs for your account. - * - * Returns a list of API calls with timestamps, features used, status codes, and credits - * consumed. Useful for monitoring usage patterns and debugging. - */ - fun create(): CompletableFuture = create(LogCreateParams.none()) - - /** @see create */ - fun create( - params: LogCreateParams = LogCreateParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see create */ - fun create( - params: LogCreateParams = LogCreateParams.none() - ): CompletableFuture = create(params, RequestOptions.none()) - - /** @see create */ - fun create(requestOptions: RequestOptions): CompletableFuture = - create(LogCreateParams.none(), requestOptions) - - /** - * Get aggregated usage statistics grouped by feature. - * - * Useful for understanding which API features are being used most and tracking usage trends. - */ - fun getSummary(): CompletableFuture = - getSummary(LogGetSummaryParams.none()) - - /** @see getSummary */ - fun getSummary( - params: LogGetSummaryParams = LogGetSummaryParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see getSummary */ - fun getSummary( - params: LogGetSummaryParams = LogGetSummaryParams.none() - ): CompletableFuture = getSummary(params, RequestOptions.none()) - - /** @see getSummary */ - fun getSummary(requestOptions: RequestOptions): CompletableFuture = - getSummary(LogGetSummaryParams.none(), requestOptions) - /** A view of [LogServiceAsync] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -81,55 +28,5 @@ interface LogServiceAsync { * The original service is not modified. */ fun withOptions(modifier: Consumer): LogServiceAsync.WithRawResponse - - /** - * Returns a raw HTTP response for `post /logs`, but is otherwise the same as - * [LogServiceAsync.create]. - */ - fun create(): CompletableFuture> = - create(LogCreateParams.none()) - - /** @see create */ - fun create( - params: LogCreateParams = LogCreateParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see create */ - fun create( - params: LogCreateParams = LogCreateParams.none() - ): CompletableFuture> = - create(params, RequestOptions.none()) - - /** @see create */ - fun create( - requestOptions: RequestOptions - ): CompletableFuture> = - create(LogCreateParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `post /logs/summary`, but is otherwise the same as - * [LogServiceAsync.getSummary]. - */ - fun getSummary(): CompletableFuture> = - getSummary(LogGetSummaryParams.none()) - - /** @see getSummary */ - fun getSummary( - params: LogGetSummaryParams = LogGetSummaryParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see getSummary */ - fun getSummary( - params: LogGetSummaryParams = LogGetSummaryParams.none() - ): CompletableFuture> = - getSummary(params, RequestOptions.none()) - - /** @see getSummary */ - fun getSummary( - requestOptions: RequestOptions - ): CompletableFuture> = - getSummary(LogGetSummaryParams.none(), requestOptions) } } diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/async/LogServiceAsyncImpl.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/async/LogServiceAsyncImpl.kt index 1dd0192..6797075 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/async/LogServiceAsyncImpl.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/async/LogServiceAsyncImpl.kt @@ -3,23 +3,6 @@ package com.cas_parser.api.services.async import com.cas_parser.api.core.ClientOptions -import com.cas_parser.api.core.RequestOptions -import com.cas_parser.api.core.handlers.errorBodyHandler -import com.cas_parser.api.core.handlers.errorHandler -import com.cas_parser.api.core.handlers.jsonHandler -import com.cas_parser.api.core.http.HttpMethod -import com.cas_parser.api.core.http.HttpRequest -import com.cas_parser.api.core.http.HttpResponse -import com.cas_parser.api.core.http.HttpResponse.Handler -import com.cas_parser.api.core.http.HttpResponseFor -import com.cas_parser.api.core.http.json -import com.cas_parser.api.core.http.parseable -import com.cas_parser.api.core.prepareAsync -import com.cas_parser.api.models.logs.LogCreateParams -import com.cas_parser.api.models.logs.LogCreateResponse -import com.cas_parser.api.models.logs.LogGetSummaryParams -import com.cas_parser.api.models.logs.LogGetSummaryResponse -import java.util.concurrent.CompletableFuture import java.util.function.Consumer class LogServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : @@ -34,93 +17,14 @@ class LogServiceAsyncImpl internal constructor(private val clientOptions: Client override fun withOptions(modifier: Consumer): LogServiceAsync = LogServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - override fun create( - params: LogCreateParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // post /logs - withRawResponse().create(params, requestOptions).thenApply { it.parse() } - - override fun getSummary( - params: LogGetSummaryParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // post /logs/summary - withRawResponse().getSummary(params, requestOptions).thenApply { it.parse() } - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : LogServiceAsync.WithRawResponse { - private val errorHandler: Handler = - errorHandler(errorBodyHandler(clientOptions.jsonMapper)) - override fun withOptions( modifier: Consumer ): LogServiceAsync.WithRawResponse = LogServiceAsyncImpl.WithRawResponseImpl( clientOptions.toBuilder().apply(modifier::accept).build() ) - - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun create( - params: LogCreateParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("logs") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } - - private val getSummaryHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun getSummary( - params: LogGetSummaryParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("logs", "summary") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response - .use { getSummaryHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } } } diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/async/VerifyTokenServiceAsync.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/async/VerifyTokenServiceAsync.kt index 2a7125e..4ff8c23 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/async/VerifyTokenServiceAsync.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/async/VerifyTokenServiceAsync.kt @@ -3,11 +3,6 @@ package com.cas_parser.api.services.async import com.cas_parser.api.core.ClientOptions -import com.cas_parser.api.core.RequestOptions -import com.cas_parser.api.core.http.HttpResponseFor -import com.cas_parser.api.models.verifytoken.VerifyTokenVerifyParams -import com.cas_parser.api.models.verifytoken.VerifyTokenVerifyResponse -import java.util.concurrent.CompletableFuture import java.util.function.Consumer interface VerifyTokenServiceAsync { @@ -24,25 +19,6 @@ interface VerifyTokenServiceAsync { */ fun withOptions(modifier: Consumer): VerifyTokenServiceAsync - /** Verify an access token and check if it's still valid. Useful for debugging token issues. */ - fun verify(): CompletableFuture = - verify(VerifyTokenVerifyParams.none()) - - /** @see verify */ - fun verify( - params: VerifyTokenVerifyParams = VerifyTokenVerifyParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see verify */ - fun verify( - params: VerifyTokenVerifyParams = VerifyTokenVerifyParams.none() - ): CompletableFuture = verify(params, RequestOptions.none()) - - /** @see verify */ - fun verify(requestOptions: RequestOptions): CompletableFuture = - verify(VerifyTokenVerifyParams.none(), requestOptions) - /** * A view of [VerifyTokenServiceAsync] that provides access to raw HTTP responses for each * method. @@ -57,30 +33,5 @@ interface VerifyTokenServiceAsync { fun withOptions( modifier: Consumer ): VerifyTokenServiceAsync.WithRawResponse - - /** - * Returns a raw HTTP response for `post /v1/verify-token`, but is otherwise the same as - * [VerifyTokenServiceAsync.verify]. - */ - fun verify(): CompletableFuture> = - verify(VerifyTokenVerifyParams.none()) - - /** @see verify */ - fun verify( - params: VerifyTokenVerifyParams = VerifyTokenVerifyParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see verify */ - fun verify( - params: VerifyTokenVerifyParams = VerifyTokenVerifyParams.none() - ): CompletableFuture> = - verify(params, RequestOptions.none()) - - /** @see verify */ - fun verify( - requestOptions: RequestOptions - ): CompletableFuture> = - verify(VerifyTokenVerifyParams.none(), requestOptions) } } diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/async/VerifyTokenServiceAsyncImpl.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/async/VerifyTokenServiceAsyncImpl.kt index ba12f1b..c617351 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/async/VerifyTokenServiceAsyncImpl.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/async/VerifyTokenServiceAsyncImpl.kt @@ -3,21 +3,6 @@ package com.cas_parser.api.services.async import com.cas_parser.api.core.ClientOptions -import com.cas_parser.api.core.RequestOptions -import com.cas_parser.api.core.handlers.errorBodyHandler -import com.cas_parser.api.core.handlers.errorHandler -import com.cas_parser.api.core.handlers.jsonHandler -import com.cas_parser.api.core.http.HttpMethod -import com.cas_parser.api.core.http.HttpRequest -import com.cas_parser.api.core.http.HttpResponse -import com.cas_parser.api.core.http.HttpResponse.Handler -import com.cas_parser.api.core.http.HttpResponseFor -import com.cas_parser.api.core.http.json -import com.cas_parser.api.core.http.parseable -import com.cas_parser.api.core.prepareAsync -import com.cas_parser.api.models.verifytoken.VerifyTokenVerifyParams -import com.cas_parser.api.models.verifytoken.VerifyTokenVerifyResponse -import java.util.concurrent.CompletableFuture import java.util.function.Consumer class VerifyTokenServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : @@ -32,55 +17,14 @@ class VerifyTokenServiceAsyncImpl internal constructor(private val clientOptions override fun withOptions(modifier: Consumer): VerifyTokenServiceAsync = VerifyTokenServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - override fun verify( - params: VerifyTokenVerifyParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // post /v1/verify-token - withRawResponse().verify(params, requestOptions).thenApply { it.parse() } - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : VerifyTokenServiceAsync.WithRawResponse { - private val errorHandler: Handler = - errorHandler(errorBodyHandler(clientOptions.jsonMapper)) - override fun withOptions( modifier: Consumer ): VerifyTokenServiceAsync.WithRawResponse = VerifyTokenServiceAsyncImpl.WithRawResponseImpl( clientOptions.toBuilder().apply(modifier::accept).build() ) - - private val verifyHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun verify( - params: VerifyTokenVerifyParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("v1", "verify-token") - .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response - .use { verifyHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } } } diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/blocking/AccessTokenService.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/blocking/AccessTokenService.kt index 3414d2a..2779802 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/blocking/AccessTokenService.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/blocking/AccessTokenService.kt @@ -3,11 +3,6 @@ package com.cas_parser.api.services.blocking import com.cas_parser.api.core.ClientOptions -import com.cas_parser.api.core.RequestOptions -import com.cas_parser.api.core.http.HttpResponseFor -import com.cas_parser.api.models.accesstoken.AccessTokenCreateParams -import com.cas_parser.api.models.accesstoken.AccessTokenCreateResponse -import com.google.errorprone.annotations.MustBeClosed import java.util.function.Consumer interface AccessTokenService { @@ -24,35 +19,6 @@ interface AccessTokenService { */ fun withOptions(modifier: Consumer): AccessTokenService - /** - * Generate a short-lived access token from your API key. - * - * **Use this endpoint from your backend** to create tokens that can be safely passed to - * frontend/SDK. - * - * Access tokens: - * - Are prefixed with `at_` for easy identification - * - Valid for up to 60 minutes - * - Can be used in place of API keys on all v4 endpoints - * - Cannot be used to generate other access tokens - */ - fun create(): AccessTokenCreateResponse = create(AccessTokenCreateParams.none()) - - /** @see create */ - fun create( - params: AccessTokenCreateParams = AccessTokenCreateParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): AccessTokenCreateResponse - - /** @see create */ - fun create( - params: AccessTokenCreateParams = AccessTokenCreateParams.none() - ): AccessTokenCreateResponse = create(params, RequestOptions.none()) - - /** @see create */ - fun create(requestOptions: RequestOptions): AccessTokenCreateResponse = - create(AccessTokenCreateParams.none(), requestOptions) - /** * A view of [AccessTokenService] that provides access to raw HTTP responses for each method. */ @@ -66,31 +32,5 @@ interface AccessTokenService { fun withOptions( modifier: Consumer ): AccessTokenService.WithRawResponse - - /** - * Returns a raw HTTP response for `post /v1/access-token`, but is otherwise the same as - * [AccessTokenService.create]. - */ - @MustBeClosed - fun create(): HttpResponseFor = - create(AccessTokenCreateParams.none()) - - /** @see create */ - @MustBeClosed - fun create( - params: AccessTokenCreateParams = AccessTokenCreateParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** @see create */ - @MustBeClosed - fun create( - params: AccessTokenCreateParams = AccessTokenCreateParams.none() - ): HttpResponseFor = create(params, RequestOptions.none()) - - /** @see create */ - @MustBeClosed - fun create(requestOptions: RequestOptions): HttpResponseFor = - create(AccessTokenCreateParams.none(), requestOptions) } } diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/blocking/AccessTokenServiceImpl.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/blocking/AccessTokenServiceImpl.kt index 9906e2d..a8c27c2 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/blocking/AccessTokenServiceImpl.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/blocking/AccessTokenServiceImpl.kt @@ -3,20 +3,6 @@ package com.cas_parser.api.services.blocking import com.cas_parser.api.core.ClientOptions -import com.cas_parser.api.core.RequestOptions -import com.cas_parser.api.core.handlers.errorBodyHandler -import com.cas_parser.api.core.handlers.errorHandler -import com.cas_parser.api.core.handlers.jsonHandler -import com.cas_parser.api.core.http.HttpMethod -import com.cas_parser.api.core.http.HttpRequest -import com.cas_parser.api.core.http.HttpResponse -import com.cas_parser.api.core.http.HttpResponse.Handler -import com.cas_parser.api.core.http.HttpResponseFor -import com.cas_parser.api.core.http.json -import com.cas_parser.api.core.http.parseable -import com.cas_parser.api.core.prepare -import com.cas_parser.api.models.accesstoken.AccessTokenCreateParams -import com.cas_parser.api.models.accesstoken.AccessTokenCreateResponse import java.util.function.Consumer class AccessTokenServiceImpl internal constructor(private val clientOptions: ClientOptions) : @@ -31,52 +17,14 @@ class AccessTokenServiceImpl internal constructor(private val clientOptions: Cli override fun withOptions(modifier: Consumer): AccessTokenService = AccessTokenServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - override fun create( - params: AccessTokenCreateParams, - requestOptions: RequestOptions, - ): AccessTokenCreateResponse = - // post /v1/access-token - withRawResponse().create(params, requestOptions).parse() - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : AccessTokenService.WithRawResponse { - private val errorHandler: Handler = - errorHandler(errorBodyHandler(clientOptions.jsonMapper)) - override fun withOptions( modifier: Consumer ): AccessTokenService.WithRawResponse = AccessTokenServiceImpl.WithRawResponseImpl( clientOptions.toBuilder().apply(modifier::accept).build() ) - - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun create( - params: AccessTokenCreateParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("v1", "access-token") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } } } diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/blocking/CreditService.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/blocking/CreditService.kt index 5d22d46..60ebf10 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/blocking/CreditService.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/blocking/CreditService.kt @@ -3,11 +3,6 @@ package com.cas_parser.api.services.blocking import com.cas_parser.api.core.ClientOptions -import com.cas_parser.api.core.RequestOptions -import com.cas_parser.api.core.http.HttpResponseFor -import com.cas_parser.api.models.credits.CreditCheckParams -import com.cas_parser.api.models.credits.CreditCheckResponse -import com.google.errorprone.annotations.MustBeClosed import java.util.function.Consumer interface CreditService { @@ -24,32 +19,6 @@ interface CreditService { */ fun withOptions(modifier: Consumer): CreditService - /** - * Check your remaining API credits and usage for the current billing period. - * - * Returns: - * - Number of API calls used and remaining credits - * - Credit limit and reset date - * - List of enabled features for your plan - * - * Credits reset at the start of each billing period. - */ - fun check(): CreditCheckResponse = check(CreditCheckParams.none()) - - /** @see check */ - fun check( - params: CreditCheckParams = CreditCheckParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CreditCheckResponse - - /** @see check */ - fun check(params: CreditCheckParams = CreditCheckParams.none()): CreditCheckResponse = - check(params, RequestOptions.none()) - - /** @see check */ - fun check(requestOptions: RequestOptions): CreditCheckResponse = - check(CreditCheckParams.none(), requestOptions) - /** A view of [CreditService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -59,30 +28,5 @@ interface CreditService { * The original service is not modified. */ fun withOptions(modifier: Consumer): CreditService.WithRawResponse - - /** - * Returns a raw HTTP response for `post /credits`, but is otherwise the same as - * [CreditService.check]. - */ - @MustBeClosed - fun check(): HttpResponseFor = check(CreditCheckParams.none()) - - /** @see check */ - @MustBeClosed - fun check( - params: CreditCheckParams = CreditCheckParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** @see check */ - @MustBeClosed - fun check( - params: CreditCheckParams = CreditCheckParams.none() - ): HttpResponseFor = check(params, RequestOptions.none()) - - /** @see check */ - @MustBeClosed - fun check(requestOptions: RequestOptions): HttpResponseFor = - check(CreditCheckParams.none(), requestOptions) } } diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/blocking/CreditServiceImpl.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/blocking/CreditServiceImpl.kt index 549e113..a33b3c5 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/blocking/CreditServiceImpl.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/blocking/CreditServiceImpl.kt @@ -3,20 +3,6 @@ package com.cas_parser.api.services.blocking import com.cas_parser.api.core.ClientOptions -import com.cas_parser.api.core.RequestOptions -import com.cas_parser.api.core.handlers.errorBodyHandler -import com.cas_parser.api.core.handlers.errorHandler -import com.cas_parser.api.core.handlers.jsonHandler -import com.cas_parser.api.core.http.HttpMethod -import com.cas_parser.api.core.http.HttpRequest -import com.cas_parser.api.core.http.HttpResponse -import com.cas_parser.api.core.http.HttpResponse.Handler -import com.cas_parser.api.core.http.HttpResponseFor -import com.cas_parser.api.core.http.json -import com.cas_parser.api.core.http.parseable -import com.cas_parser.api.core.prepare -import com.cas_parser.api.models.credits.CreditCheckParams -import com.cas_parser.api.models.credits.CreditCheckResponse import java.util.function.Consumer class CreditServiceImpl internal constructor(private val clientOptions: ClientOptions) : @@ -31,52 +17,14 @@ class CreditServiceImpl internal constructor(private val clientOptions: ClientOp override fun withOptions(modifier: Consumer): CreditService = CreditServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - override fun check( - params: CreditCheckParams, - requestOptions: RequestOptions, - ): CreditCheckResponse = - // post /credits - withRawResponse().check(params, requestOptions).parse() - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : CreditService.WithRawResponse { - private val errorHandler: Handler = - errorHandler(errorBodyHandler(clientOptions.jsonMapper)) - override fun withOptions( modifier: Consumer ): CreditService.WithRawResponse = CreditServiceImpl.WithRawResponseImpl( clientOptions.toBuilder().apply(modifier::accept).build() ) - - private val checkHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun check( - params: CreditCheckParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("credits") - .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response - .use { checkHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } } } diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/blocking/LogService.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/blocking/LogService.kt index ce35cba..f95703a 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/blocking/LogService.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/blocking/LogService.kt @@ -3,13 +3,6 @@ package com.cas_parser.api.services.blocking import com.cas_parser.api.core.ClientOptions -import com.cas_parser.api.core.RequestOptions -import com.cas_parser.api.core.http.HttpResponseFor -import com.cas_parser.api.models.logs.LogCreateParams -import com.cas_parser.api.models.logs.LogCreateResponse -import com.cas_parser.api.models.logs.LogGetSummaryParams -import com.cas_parser.api.models.logs.LogGetSummaryResponse -import com.google.errorprone.annotations.MustBeClosed import java.util.function.Consumer interface LogService { @@ -26,50 +19,6 @@ interface LogService { */ fun withOptions(modifier: Consumer): LogService - /** - * Retrieve detailed API usage logs for your account. - * - * Returns a list of API calls with timestamps, features used, status codes, and credits - * consumed. Useful for monitoring usage patterns and debugging. - */ - fun create(): LogCreateResponse = create(LogCreateParams.none()) - - /** @see create */ - fun create( - params: LogCreateParams = LogCreateParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): LogCreateResponse - - /** @see create */ - fun create(params: LogCreateParams = LogCreateParams.none()): LogCreateResponse = - create(params, RequestOptions.none()) - - /** @see create */ - fun create(requestOptions: RequestOptions): LogCreateResponse = - create(LogCreateParams.none(), requestOptions) - - /** - * Get aggregated usage statistics grouped by feature. - * - * Useful for understanding which API features are being used most and tracking usage trends. - */ - fun getSummary(): LogGetSummaryResponse = getSummary(LogGetSummaryParams.none()) - - /** @see getSummary */ - fun getSummary( - params: LogGetSummaryParams = LogGetSummaryParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): LogGetSummaryResponse - - /** @see getSummary */ - fun getSummary( - params: LogGetSummaryParams = LogGetSummaryParams.none() - ): LogGetSummaryResponse = getSummary(params, RequestOptions.none()) - - /** @see getSummary */ - fun getSummary(requestOptions: RequestOptions): LogGetSummaryResponse = - getSummary(LogGetSummaryParams.none(), requestOptions) - /** A view of [LogService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -79,56 +28,5 @@ interface LogService { * The original service is not modified. */ fun withOptions(modifier: Consumer): LogService.WithRawResponse - - /** - * Returns a raw HTTP response for `post /logs`, but is otherwise the same as - * [LogService.create]. - */ - @MustBeClosed - fun create(): HttpResponseFor = create(LogCreateParams.none()) - - /** @see create */ - @MustBeClosed - fun create( - params: LogCreateParams = LogCreateParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** @see create */ - @MustBeClosed - fun create( - params: LogCreateParams = LogCreateParams.none() - ): HttpResponseFor = create(params, RequestOptions.none()) - - /** @see create */ - @MustBeClosed - fun create(requestOptions: RequestOptions): HttpResponseFor = - create(LogCreateParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `post /logs/summary`, but is otherwise the same as - * [LogService.getSummary]. - */ - @MustBeClosed - fun getSummary(): HttpResponseFor = - getSummary(LogGetSummaryParams.none()) - - /** @see getSummary */ - @MustBeClosed - fun getSummary( - params: LogGetSummaryParams = LogGetSummaryParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** @see getSummary */ - @MustBeClosed - fun getSummary( - params: LogGetSummaryParams = LogGetSummaryParams.none() - ): HttpResponseFor = getSummary(params, RequestOptions.none()) - - /** @see getSummary */ - @MustBeClosed - fun getSummary(requestOptions: RequestOptions): HttpResponseFor = - getSummary(LogGetSummaryParams.none(), requestOptions) } } diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/blocking/LogServiceImpl.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/blocking/LogServiceImpl.kt index fb303d1..0a82263 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/blocking/LogServiceImpl.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/blocking/LogServiceImpl.kt @@ -3,22 +3,6 @@ package com.cas_parser.api.services.blocking import com.cas_parser.api.core.ClientOptions -import com.cas_parser.api.core.RequestOptions -import com.cas_parser.api.core.handlers.errorBodyHandler -import com.cas_parser.api.core.handlers.errorHandler -import com.cas_parser.api.core.handlers.jsonHandler -import com.cas_parser.api.core.http.HttpMethod -import com.cas_parser.api.core.http.HttpRequest -import com.cas_parser.api.core.http.HttpResponse -import com.cas_parser.api.core.http.HttpResponse.Handler -import com.cas_parser.api.core.http.HttpResponseFor -import com.cas_parser.api.core.http.json -import com.cas_parser.api.core.http.parseable -import com.cas_parser.api.core.prepare -import com.cas_parser.api.models.logs.LogCreateParams -import com.cas_parser.api.models.logs.LogCreateResponse -import com.cas_parser.api.models.logs.LogGetSummaryParams -import com.cas_parser.api.models.logs.LogGetSummaryResponse import java.util.function.Consumer class LogServiceImpl internal constructor(private val clientOptions: ClientOptions) : LogService { @@ -32,87 +16,14 @@ class LogServiceImpl internal constructor(private val clientOptions: ClientOptio override fun withOptions(modifier: Consumer): LogService = LogServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - override fun create( - params: LogCreateParams, - requestOptions: RequestOptions, - ): LogCreateResponse = - // post /logs - withRawResponse().create(params, requestOptions).parse() - - override fun getSummary( - params: LogGetSummaryParams, - requestOptions: RequestOptions, - ): LogGetSummaryResponse = - // post /logs/summary - withRawResponse().getSummary(params, requestOptions).parse() - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : LogService.WithRawResponse { - private val errorHandler: Handler = - errorHandler(errorBodyHandler(clientOptions.jsonMapper)) - override fun withOptions( modifier: Consumer ): LogService.WithRawResponse = LogServiceImpl.WithRawResponseImpl( clientOptions.toBuilder().apply(modifier::accept).build() ) - - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun create( - params: LogCreateParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("logs") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - - private val getSummaryHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun getSummary( - params: LogGetSummaryParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("logs", "summary") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response - .use { getSummaryHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } } } diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/blocking/VerifyTokenService.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/blocking/VerifyTokenService.kt index 6596370..a44e1df 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/blocking/VerifyTokenService.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/blocking/VerifyTokenService.kt @@ -3,11 +3,6 @@ package com.cas_parser.api.services.blocking import com.cas_parser.api.core.ClientOptions -import com.cas_parser.api.core.RequestOptions -import com.cas_parser.api.core.http.HttpResponseFor -import com.cas_parser.api.models.verifytoken.VerifyTokenVerifyParams -import com.cas_parser.api.models.verifytoken.VerifyTokenVerifyResponse -import com.google.errorprone.annotations.MustBeClosed import java.util.function.Consumer interface VerifyTokenService { @@ -24,24 +19,6 @@ interface VerifyTokenService { */ fun withOptions(modifier: Consumer): VerifyTokenService - /** Verify an access token and check if it's still valid. Useful for debugging token issues. */ - fun verify(): VerifyTokenVerifyResponse = verify(VerifyTokenVerifyParams.none()) - - /** @see verify */ - fun verify( - params: VerifyTokenVerifyParams = VerifyTokenVerifyParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): VerifyTokenVerifyResponse - - /** @see verify */ - fun verify( - params: VerifyTokenVerifyParams = VerifyTokenVerifyParams.none() - ): VerifyTokenVerifyResponse = verify(params, RequestOptions.none()) - - /** @see verify */ - fun verify(requestOptions: RequestOptions): VerifyTokenVerifyResponse = - verify(VerifyTokenVerifyParams.none(), requestOptions) - /** * A view of [VerifyTokenService] that provides access to raw HTTP responses for each method. */ @@ -55,31 +32,5 @@ interface VerifyTokenService { fun withOptions( modifier: Consumer ): VerifyTokenService.WithRawResponse - - /** - * Returns a raw HTTP response for `post /v1/verify-token`, but is otherwise the same as - * [VerifyTokenService.verify]. - */ - @MustBeClosed - fun verify(): HttpResponseFor = - verify(VerifyTokenVerifyParams.none()) - - /** @see verify */ - @MustBeClosed - fun verify( - params: VerifyTokenVerifyParams = VerifyTokenVerifyParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** @see verify */ - @MustBeClosed - fun verify( - params: VerifyTokenVerifyParams = VerifyTokenVerifyParams.none() - ): HttpResponseFor = verify(params, RequestOptions.none()) - - /** @see verify */ - @MustBeClosed - fun verify(requestOptions: RequestOptions): HttpResponseFor = - verify(VerifyTokenVerifyParams.none(), requestOptions) } } diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/blocking/VerifyTokenServiceImpl.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/blocking/VerifyTokenServiceImpl.kt index 6780bb3..e202bbc 100644 --- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/blocking/VerifyTokenServiceImpl.kt +++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/services/blocking/VerifyTokenServiceImpl.kt @@ -3,20 +3,6 @@ package com.cas_parser.api.services.blocking import com.cas_parser.api.core.ClientOptions -import com.cas_parser.api.core.RequestOptions -import com.cas_parser.api.core.handlers.errorBodyHandler -import com.cas_parser.api.core.handlers.errorHandler -import com.cas_parser.api.core.handlers.jsonHandler -import com.cas_parser.api.core.http.HttpMethod -import com.cas_parser.api.core.http.HttpRequest -import com.cas_parser.api.core.http.HttpResponse -import com.cas_parser.api.core.http.HttpResponse.Handler -import com.cas_parser.api.core.http.HttpResponseFor -import com.cas_parser.api.core.http.json -import com.cas_parser.api.core.http.parseable -import com.cas_parser.api.core.prepare -import com.cas_parser.api.models.verifytoken.VerifyTokenVerifyParams -import com.cas_parser.api.models.verifytoken.VerifyTokenVerifyResponse import java.util.function.Consumer class VerifyTokenServiceImpl internal constructor(private val clientOptions: ClientOptions) : @@ -31,52 +17,14 @@ class VerifyTokenServiceImpl internal constructor(private val clientOptions: Cli override fun withOptions(modifier: Consumer): VerifyTokenService = VerifyTokenServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - override fun verify( - params: VerifyTokenVerifyParams, - requestOptions: RequestOptions, - ): VerifyTokenVerifyResponse = - // post /v1/verify-token - withRawResponse().verify(params, requestOptions).parse() - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : VerifyTokenService.WithRawResponse { - private val errorHandler: Handler = - errorHandler(errorBodyHandler(clientOptions.jsonMapper)) - override fun withOptions( modifier: Consumer ): VerifyTokenService.WithRawResponse = VerifyTokenServiceImpl.WithRawResponseImpl( clientOptions.toBuilder().apply(modifier::accept).build() ) - - private val verifyHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun verify( - params: VerifyTokenVerifyParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("v1", "verify-token") - .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response - .use { verifyHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } } } diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/accesstoken/AccessTokenCreateParamsTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/accesstoken/AccessTokenCreateParamsTest.kt deleted file mode 100644 index a6a696b..0000000 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/accesstoken/AccessTokenCreateParamsTest.kt +++ /dev/null @@ -1,30 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.cas_parser.api.models.accesstoken - -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class AccessTokenCreateParamsTest { - - @Test - fun create() { - AccessTokenCreateParams.builder().expiryMinutes(60L).build() - } - - @Test - fun body() { - val params = AccessTokenCreateParams.builder().expiryMinutes(60L).build() - - val body = params._body() - - assertThat(body.expiryMinutes()).contains(60L) - } - - @Test - fun bodyWithoutOptionalFields() { - val params = AccessTokenCreateParams.builder().build() - - val body = params._body() - } -} diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/accesstoken/AccessTokenCreateResponseTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/accesstoken/AccessTokenCreateResponseTest.kt deleted file mode 100644 index 09382b7..0000000 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/accesstoken/AccessTokenCreateResponseTest.kt +++ /dev/null @@ -1,45 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.cas_parser.api.models.accesstoken - -import com.cas_parser.api.core.jsonMapper -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class AccessTokenCreateResponseTest { - - @Test - fun create() { - val accessTokenCreateResponse = - AccessTokenCreateResponse.builder() - .accessToken("at_eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...") - .expiresIn(3600L) - .tokenType("api_key") - .build() - - assertThat(accessTokenCreateResponse.accessToken()) - .contains("at_eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...") - assertThat(accessTokenCreateResponse.expiresIn()).contains(3600L) - assertThat(accessTokenCreateResponse.tokenType()).contains("api_key") - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val accessTokenCreateResponse = - AccessTokenCreateResponse.builder() - .accessToken("at_eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...") - .expiresIn(3600L) - .tokenType("api_key") - .build() - - val roundtrippedAccessTokenCreateResponse = - jsonMapper.readValue( - jsonMapper.writeValueAsString(accessTokenCreateResponse), - jacksonTypeRef(), - ) - - assertThat(roundtrippedAccessTokenCreateResponse).isEqualTo(accessTokenCreateResponse) - } -} diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/credits/CreditCheckParamsTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/credits/CreditCheckParamsTest.kt deleted file mode 100644 index b26664b..0000000 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/credits/CreditCheckParamsTest.kt +++ /dev/null @@ -1,13 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.cas_parser.api.models.credits - -import org.junit.jupiter.api.Test - -internal class CreditCheckParamsTest { - - @Test - fun create() { - CreditCheckParams.builder().build() - } -} diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/credits/CreditCheckResponseTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/credits/CreditCheckResponseTest.kt deleted file mode 100644 index 17d52f9..0000000 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/credits/CreditCheckResponseTest.kt +++ /dev/null @@ -1,61 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.cas_parser.api.models.credits - -import com.cas_parser.api.core.jsonMapper -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import java.time.OffsetDateTime -import kotlin.jvm.optionals.getOrNull -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class CreditCheckResponseTest { - - @Test - fun create() { - val creditCheckResponse = - CreditCheckResponse.builder() - .enabledFeatures( - listOf("cams_kfintech_cas_parser", "cdsl_cas_parser", "nsdl_cas_parser") - ) - .isUnlimited(false) - .limit(50L) - .remaining(35.0) - .resetsAt(OffsetDateTime.parse("2026-02-15T00:00:00Z")) - .used(15.0) - .build() - - assertThat(creditCheckResponse.enabledFeatures().getOrNull()) - .containsExactly("cams_kfintech_cas_parser", "cdsl_cas_parser", "nsdl_cas_parser") - assertThat(creditCheckResponse.isUnlimited()).contains(false) - assertThat(creditCheckResponse.limit()).contains(50L) - assertThat(creditCheckResponse.remaining()).contains(35.0) - assertThat(creditCheckResponse.resetsAt()) - .contains(OffsetDateTime.parse("2026-02-15T00:00:00Z")) - assertThat(creditCheckResponse.used()).contains(15.0) - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val creditCheckResponse = - CreditCheckResponse.builder() - .enabledFeatures( - listOf("cams_kfintech_cas_parser", "cdsl_cas_parser", "nsdl_cas_parser") - ) - .isUnlimited(false) - .limit(50L) - .remaining(35.0) - .resetsAt(OffsetDateTime.parse("2026-02-15T00:00:00Z")) - .used(15.0) - .build() - - val roundtrippedCreditCheckResponse = - jsonMapper.readValue( - jsonMapper.writeValueAsString(creditCheckResponse), - jacksonTypeRef(), - ) - - assertThat(roundtrippedCreditCheckResponse).isEqualTo(creditCheckResponse) - } -} diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/logs/LogCreateParamsTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/logs/LogCreateParamsTest.kt deleted file mode 100644 index e7212ba..0000000 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/logs/LogCreateParamsTest.kt +++ /dev/null @@ -1,42 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.cas_parser.api.models.logs - -import java.time.OffsetDateTime -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class LogCreateParamsTest { - - @Test - fun create() { - LogCreateParams.builder() - .endTime(OffsetDateTime.parse("2026-01-31T23:59:59Z")) - .limit(1L) - .startTime(OffsetDateTime.parse("2026-01-01T00:00:00Z")) - .build() - } - - @Test - fun body() { - val params = - LogCreateParams.builder() - .endTime(OffsetDateTime.parse("2026-01-31T23:59:59Z")) - .limit(1L) - .startTime(OffsetDateTime.parse("2026-01-01T00:00:00Z")) - .build() - - val body = params._body() - - assertThat(body.endTime()).contains(OffsetDateTime.parse("2026-01-31T23:59:59Z")) - assertThat(body.limit()).contains(1L) - assertThat(body.startTime()).contains(OffsetDateTime.parse("2026-01-01T00:00:00Z")) - } - - @Test - fun bodyWithoutOptionalFields() { - val params = LogCreateParams.builder().build() - - val body = params._body() - } -} diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/logs/LogCreateResponseTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/logs/LogCreateResponseTest.kt deleted file mode 100644 index 0f24a21..0000000 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/logs/LogCreateResponseTest.kt +++ /dev/null @@ -1,74 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.cas_parser.api.models.logs - -import com.cas_parser.api.core.jsonMapper -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import java.time.OffsetDateTime -import kotlin.jvm.optionals.getOrNull -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class LogCreateResponseTest { - - @Test - fun create() { - val logCreateResponse = - LogCreateResponse.builder() - .count(25L) - .addLog( - LogCreateResponse.Log.builder() - .credits(1.0) - .feature("cdsl_cas_parser") - .path("/v4/cdsl/parse") - .requestId("req_2xYz7KpL8mN3Ab") - .statusCode(200L) - .timestamp(OffsetDateTime.parse("2026-01-15T14:30:00Z")) - .build() - ) - .status("success") - .build() - - assertThat(logCreateResponse.count()).contains(25L) - assertThat(logCreateResponse.logs().getOrNull()) - .containsExactly( - LogCreateResponse.Log.builder() - .credits(1.0) - .feature("cdsl_cas_parser") - .path("/v4/cdsl/parse") - .requestId("req_2xYz7KpL8mN3Ab") - .statusCode(200L) - .timestamp(OffsetDateTime.parse("2026-01-15T14:30:00Z")) - .build() - ) - assertThat(logCreateResponse.status()).contains("success") - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val logCreateResponse = - LogCreateResponse.builder() - .count(25L) - .addLog( - LogCreateResponse.Log.builder() - .credits(1.0) - .feature("cdsl_cas_parser") - .path("/v4/cdsl/parse") - .requestId("req_2xYz7KpL8mN3Ab") - .statusCode(200L) - .timestamp(OffsetDateTime.parse("2026-01-15T14:30:00Z")) - .build() - ) - .status("success") - .build() - - val roundtrippedLogCreateResponse = - jsonMapper.readValue( - jsonMapper.writeValueAsString(logCreateResponse), - jacksonTypeRef(), - ) - - assertThat(roundtrippedLogCreateResponse).isEqualTo(logCreateResponse) - } -} diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/logs/LogGetSummaryParamsTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/logs/LogGetSummaryParamsTest.kt deleted file mode 100644 index a2cfd4a..0000000 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/logs/LogGetSummaryParamsTest.kt +++ /dev/null @@ -1,39 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.cas_parser.api.models.logs - -import java.time.OffsetDateTime -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class LogGetSummaryParamsTest { - - @Test - fun create() { - LogGetSummaryParams.builder() - .endTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - } - - @Test - fun body() { - val params = - LogGetSummaryParams.builder() - .endTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - - val body = params._body() - - assertThat(body.endTime()).contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(body.startTime()).contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - } - - @Test - fun bodyWithoutOptionalFields() { - val params = LogGetSummaryParams.builder().build() - - val body = params._body() - } -} diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/logs/LogGetSummaryResponseTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/logs/LogGetSummaryResponseTest.kt deleted file mode 100644 index 94e8bc7..0000000 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/logs/LogGetSummaryResponseTest.kt +++ /dev/null @@ -1,78 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.cas_parser.api.models.logs - -import com.cas_parser.api.core.jsonMapper -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class LogGetSummaryResponseTest { - - @Test - fun create() { - val logGetSummaryResponse = - LogGetSummaryResponse.builder() - .status("success") - .summary( - LogGetSummaryResponse.Summary.builder() - .addByFeature( - LogGetSummaryResponse.Summary.ByFeature.builder() - .credits(15.0) - .feature("cdsl_cas_parser") - .requests(15L) - .build() - ) - .totalCredits(45.5) - .totalRequests(42L) - .build() - ) - .build() - - assertThat(logGetSummaryResponse.status()).contains("success") - assertThat(logGetSummaryResponse.summary()) - .contains( - LogGetSummaryResponse.Summary.builder() - .addByFeature( - LogGetSummaryResponse.Summary.ByFeature.builder() - .credits(15.0) - .feature("cdsl_cas_parser") - .requests(15L) - .build() - ) - .totalCredits(45.5) - .totalRequests(42L) - .build() - ) - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val logGetSummaryResponse = - LogGetSummaryResponse.builder() - .status("success") - .summary( - LogGetSummaryResponse.Summary.builder() - .addByFeature( - LogGetSummaryResponse.Summary.ByFeature.builder() - .credits(15.0) - .feature("cdsl_cas_parser") - .requests(15L) - .build() - ) - .totalCredits(45.5) - .totalRequests(42L) - .build() - ) - .build() - - val roundtrippedLogGetSummaryResponse = - jsonMapper.readValue( - jsonMapper.writeValueAsString(logGetSummaryResponse), - jacksonTypeRef(), - ) - - assertThat(roundtrippedLogGetSummaryResponse).isEqualTo(logGetSummaryResponse) - } -} diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/verifytoken/VerifyTokenVerifyParamsTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/verifytoken/VerifyTokenVerifyParamsTest.kt deleted file mode 100644 index 6e75d40..0000000 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/verifytoken/VerifyTokenVerifyParamsTest.kt +++ /dev/null @@ -1,13 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.cas_parser.api.models.verifytoken - -import org.junit.jupiter.api.Test - -internal class VerifyTokenVerifyParamsTest { - - @Test - fun create() { - VerifyTokenVerifyParams.builder().build() - } -} diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/verifytoken/VerifyTokenVerifyResponseTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/verifytoken/VerifyTokenVerifyResponseTest.kt deleted file mode 100644 index 813bc45..0000000 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/verifytoken/VerifyTokenVerifyResponseTest.kt +++ /dev/null @@ -1,44 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.cas_parser.api.models.verifytoken - -import com.cas_parser.api.core.jsonMapper -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class VerifyTokenVerifyResponseTest { - - @Test - fun create() { - val verifyTokenVerifyResponse = - VerifyTokenVerifyResponse.builder() - .error("Token has expired") - .maskedApiKey("abc1****ef23") - .valid(true) - .build() - - assertThat(verifyTokenVerifyResponse.error()).contains("Token has expired") - assertThat(verifyTokenVerifyResponse.maskedApiKey()).contains("abc1****ef23") - assertThat(verifyTokenVerifyResponse.valid()).contains(true) - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val verifyTokenVerifyResponse = - VerifyTokenVerifyResponse.builder() - .error("Token has expired") - .maskedApiKey("abc1****ef23") - .valid(true) - .build() - - val roundtrippedVerifyTokenVerifyResponse = - jsonMapper.readValue( - jsonMapper.writeValueAsString(verifyTokenVerifyResponse), - jacksonTypeRef(), - ) - - assertThat(roundtrippedVerifyTokenVerifyResponse).isEqualTo(verifyTokenVerifyResponse) - } -} diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/ErrorHandlingTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/ErrorHandlingTest.kt index f58190a..0cce742 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/ErrorHandlingTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/ErrorHandlingTest.kt @@ -16,6 +16,7 @@ import com.cas_parser.api.errors.RateLimitException import com.cas_parser.api.errors.UnauthorizedException import com.cas_parser.api.errors.UnexpectedStatusCodeException import com.cas_parser.api.errors.UnprocessableEntityException +import com.cas_parser.api.models.camskfintech.CamsKfintechParseParams import com.github.tomakehurst.wiremock.client.WireMock.anyUrl import com.github.tomakehurst.wiremock.client.WireMock.post import com.github.tomakehurst.wiremock.client.WireMock.status @@ -58,8 +59,8 @@ internal class ErrorHandlingTest { } @Test - fun creditsCheck400() { - val creditService = client.credits() + fun camsKfintechParse400() { + val camsKfintechService = client.camsKfintech() stubFor( post(anyUrl()) .willReturn( @@ -67,7 +68,16 @@ internal class ErrorHandlingTest { ) ) - val e = assertThrows { creditService.check() } + val e = + assertThrows { + camsKfintechService.parse( + CamsKfintechParseParams.builder() + .password("password") + .pdfFile("pdf_file") + .pdfUrl("https://example.com") + .build() + ) + } assertThat(e.statusCode()).isEqualTo(400) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) @@ -75,8 +85,8 @@ internal class ErrorHandlingTest { } @Test - fun creditsCheck400WithRawResponse() { - val creditService = client.credits().withRawResponse() + fun camsKfintechParse400WithRawResponse() { + val camsKfintechService = client.camsKfintech().withRawResponse() stubFor( post(anyUrl()) .willReturn( @@ -84,7 +94,16 @@ internal class ErrorHandlingTest { ) ) - val e = assertThrows { creditService.check() } + val e = + assertThrows { + camsKfintechService.parse( + CamsKfintechParseParams.builder() + .password("password") + .pdfFile("pdf_file") + .pdfUrl("https://example.com") + .build() + ) + } assertThat(e.statusCode()).isEqualTo(400) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) @@ -92,8 +111,8 @@ internal class ErrorHandlingTest { } @Test - fun creditsCheck401() { - val creditService = client.credits() + fun camsKfintechParse401() { + val camsKfintechService = client.camsKfintech() stubFor( post(anyUrl()) .willReturn( @@ -101,7 +120,16 @@ internal class ErrorHandlingTest { ) ) - val e = assertThrows { creditService.check() } + val e = + assertThrows { + camsKfintechService.parse( + CamsKfintechParseParams.builder() + .password("password") + .pdfFile("pdf_file") + .pdfUrl("https://example.com") + .build() + ) + } assertThat(e.statusCode()).isEqualTo(401) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) @@ -109,8 +137,8 @@ internal class ErrorHandlingTest { } @Test - fun creditsCheck401WithRawResponse() { - val creditService = client.credits().withRawResponse() + fun camsKfintechParse401WithRawResponse() { + val camsKfintechService = client.camsKfintech().withRawResponse() stubFor( post(anyUrl()) .willReturn( @@ -118,7 +146,16 @@ internal class ErrorHandlingTest { ) ) - val e = assertThrows { creditService.check() } + val e = + assertThrows { + camsKfintechService.parse( + CamsKfintechParseParams.builder() + .password("password") + .pdfFile("pdf_file") + .pdfUrl("https://example.com") + .build() + ) + } assertThat(e.statusCode()).isEqualTo(401) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) @@ -126,8 +163,8 @@ internal class ErrorHandlingTest { } @Test - fun creditsCheck403() { - val creditService = client.credits() + fun camsKfintechParse403() { + val camsKfintechService = client.camsKfintech() stubFor( post(anyUrl()) .willReturn( @@ -135,7 +172,16 @@ internal class ErrorHandlingTest { ) ) - val e = assertThrows { creditService.check() } + val e = + assertThrows { + camsKfintechService.parse( + CamsKfintechParseParams.builder() + .password("password") + .pdfFile("pdf_file") + .pdfUrl("https://example.com") + .build() + ) + } assertThat(e.statusCode()).isEqualTo(403) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) @@ -143,8 +189,8 @@ internal class ErrorHandlingTest { } @Test - fun creditsCheck403WithRawResponse() { - val creditService = client.credits().withRawResponse() + fun camsKfintechParse403WithRawResponse() { + val camsKfintechService = client.camsKfintech().withRawResponse() stubFor( post(anyUrl()) .willReturn( @@ -152,7 +198,16 @@ internal class ErrorHandlingTest { ) ) - val e = assertThrows { creditService.check() } + val e = + assertThrows { + camsKfintechService.parse( + CamsKfintechParseParams.builder() + .password("password") + .pdfFile("pdf_file") + .pdfUrl("https://example.com") + .build() + ) + } assertThat(e.statusCode()).isEqualTo(403) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) @@ -160,8 +215,8 @@ internal class ErrorHandlingTest { } @Test - fun creditsCheck404() { - val creditService = client.credits() + fun camsKfintechParse404() { + val camsKfintechService = client.camsKfintech() stubFor( post(anyUrl()) .willReturn( @@ -169,7 +224,16 @@ internal class ErrorHandlingTest { ) ) - val e = assertThrows { creditService.check() } + val e = + assertThrows { + camsKfintechService.parse( + CamsKfintechParseParams.builder() + .password("password") + .pdfFile("pdf_file") + .pdfUrl("https://example.com") + .build() + ) + } assertThat(e.statusCode()).isEqualTo(404) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) @@ -177,8 +241,8 @@ internal class ErrorHandlingTest { } @Test - fun creditsCheck404WithRawResponse() { - val creditService = client.credits().withRawResponse() + fun camsKfintechParse404WithRawResponse() { + val camsKfintechService = client.camsKfintech().withRawResponse() stubFor( post(anyUrl()) .willReturn( @@ -186,7 +250,16 @@ internal class ErrorHandlingTest { ) ) - val e = assertThrows { creditService.check() } + val e = + assertThrows { + camsKfintechService.parse( + CamsKfintechParseParams.builder() + .password("password") + .pdfFile("pdf_file") + .pdfUrl("https://example.com") + .build() + ) + } assertThat(e.statusCode()).isEqualTo(404) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) @@ -194,8 +267,8 @@ internal class ErrorHandlingTest { } @Test - fun creditsCheck422() { - val creditService = client.credits() + fun camsKfintechParse422() { + val camsKfintechService = client.camsKfintech() stubFor( post(anyUrl()) .willReturn( @@ -203,7 +276,16 @@ internal class ErrorHandlingTest { ) ) - val e = assertThrows { creditService.check() } + val e = + assertThrows { + camsKfintechService.parse( + CamsKfintechParseParams.builder() + .password("password") + .pdfFile("pdf_file") + .pdfUrl("https://example.com") + .build() + ) + } assertThat(e.statusCode()).isEqualTo(422) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) @@ -211,8 +293,8 @@ internal class ErrorHandlingTest { } @Test - fun creditsCheck422WithRawResponse() { - val creditService = client.credits().withRawResponse() + fun camsKfintechParse422WithRawResponse() { + val camsKfintechService = client.camsKfintech().withRawResponse() stubFor( post(anyUrl()) .willReturn( @@ -220,7 +302,16 @@ internal class ErrorHandlingTest { ) ) - val e = assertThrows { creditService.check() } + val e = + assertThrows { + camsKfintechService.parse( + CamsKfintechParseParams.builder() + .password("password") + .pdfFile("pdf_file") + .pdfUrl("https://example.com") + .build() + ) + } assertThat(e.statusCode()).isEqualTo(422) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) @@ -228,8 +319,8 @@ internal class ErrorHandlingTest { } @Test - fun creditsCheck429() { - val creditService = client.credits() + fun camsKfintechParse429() { + val camsKfintechService = client.camsKfintech() stubFor( post(anyUrl()) .willReturn( @@ -237,7 +328,16 @@ internal class ErrorHandlingTest { ) ) - val e = assertThrows { creditService.check() } + val e = + assertThrows { + camsKfintechService.parse( + CamsKfintechParseParams.builder() + .password("password") + .pdfFile("pdf_file") + .pdfUrl("https://example.com") + .build() + ) + } assertThat(e.statusCode()).isEqualTo(429) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) @@ -245,8 +345,8 @@ internal class ErrorHandlingTest { } @Test - fun creditsCheck429WithRawResponse() { - val creditService = client.credits().withRawResponse() + fun camsKfintechParse429WithRawResponse() { + val camsKfintechService = client.camsKfintech().withRawResponse() stubFor( post(anyUrl()) .willReturn( @@ -254,7 +354,16 @@ internal class ErrorHandlingTest { ) ) - val e = assertThrows { creditService.check() } + val e = + assertThrows { + camsKfintechService.parse( + CamsKfintechParseParams.builder() + .password("password") + .pdfFile("pdf_file") + .pdfUrl("https://example.com") + .build() + ) + } assertThat(e.statusCode()).isEqualTo(429) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) @@ -262,8 +371,8 @@ internal class ErrorHandlingTest { } @Test - fun creditsCheck500() { - val creditService = client.credits() + fun camsKfintechParse500() { + val camsKfintechService = client.camsKfintech() stubFor( post(anyUrl()) .willReturn( @@ -271,7 +380,16 @@ internal class ErrorHandlingTest { ) ) - val e = assertThrows { creditService.check() } + val e = + assertThrows { + camsKfintechService.parse( + CamsKfintechParseParams.builder() + .password("password") + .pdfFile("pdf_file") + .pdfUrl("https://example.com") + .build() + ) + } assertThat(e.statusCode()).isEqualTo(500) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) @@ -279,8 +397,8 @@ internal class ErrorHandlingTest { } @Test - fun creditsCheck500WithRawResponse() { - val creditService = client.credits().withRawResponse() + fun camsKfintechParse500WithRawResponse() { + val camsKfintechService = client.camsKfintech().withRawResponse() stubFor( post(anyUrl()) .willReturn( @@ -288,7 +406,16 @@ internal class ErrorHandlingTest { ) ) - val e = assertThrows { creditService.check() } + val e = + assertThrows { + camsKfintechService.parse( + CamsKfintechParseParams.builder() + .password("password") + .pdfFile("pdf_file") + .pdfUrl("https://example.com") + .build() + ) + } assertThat(e.statusCode()).isEqualTo(500) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) @@ -296,8 +423,8 @@ internal class ErrorHandlingTest { } @Test - fun creditsCheck999() { - val creditService = client.credits() + fun camsKfintechParse999() { + val camsKfintechService = client.camsKfintech() stubFor( post(anyUrl()) .willReturn( @@ -305,7 +432,16 @@ internal class ErrorHandlingTest { ) ) - val e = assertThrows { creditService.check() } + val e = + assertThrows { + camsKfintechService.parse( + CamsKfintechParseParams.builder() + .password("password") + .pdfFile("pdf_file") + .pdfUrl("https://example.com") + .build() + ) + } assertThat(e.statusCode()).isEqualTo(999) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) @@ -313,8 +449,8 @@ internal class ErrorHandlingTest { } @Test - fun creditsCheck999WithRawResponse() { - val creditService = client.credits().withRawResponse() + fun camsKfintechParse999WithRawResponse() { + val camsKfintechService = client.camsKfintech().withRawResponse() stubFor( post(anyUrl()) .willReturn( @@ -322,7 +458,16 @@ internal class ErrorHandlingTest { ) ) - val e = assertThrows { creditService.check() } + val e = + assertThrows { + camsKfintechService.parse( + CamsKfintechParseParams.builder() + .password("password") + .pdfFile("pdf_file") + .pdfUrl("https://example.com") + .build() + ) + } assertThat(e.statusCode()).isEqualTo(999) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) @@ -330,14 +475,23 @@ internal class ErrorHandlingTest { } @Test - fun creditsCheckInvalidJsonBody() { - val creditService = client.credits() + fun camsKfintechParseInvalidJsonBody() { + val camsKfintechService = client.camsKfintech() stubFor( post(anyUrl()) .willReturn(status(200).withHeader(HEADER_NAME, HEADER_VALUE).withBody(NOT_JSON)) ) - val e = assertThrows { creditService.check() } + val e = + assertThrows { + camsKfintechService.parse( + CamsKfintechParseParams.builder() + .password("password") + .pdfFile("pdf_file") + .pdfUrl("https://example.com") + .build() + ) + } assertThat(e).hasMessage("Error reading response") } diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/ServiceParamsTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/ServiceParamsTest.kt index 4cdd376..be4ed15 100644 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/ServiceParamsTest.kt +++ b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/ServiceParamsTest.kt @@ -5,7 +5,7 @@ package com.cas_parser.api.services import com.cas_parser.api.client.CasParserClient import com.cas_parser.api.client.okhttp.CasParserOkHttpClient import com.cas_parser.api.core.JsonValue -import com.cas_parser.api.models.credits.CreditCheckParams +import com.cas_parser.api.models.camskfintech.CamsKfintechParseParams import com.github.tomakehurst.wiremock.client.WireMock.anyUrl import com.github.tomakehurst.wiremock.client.WireMock.equalTo import com.github.tomakehurst.wiremock.client.WireMock.matchingJsonPath @@ -38,12 +38,15 @@ internal class ServiceParamsTest { @Disabled("Mock server tests are disabled") @Test - fun check() { - val creditService = client.credits() + fun parse() { + val camsKfintechService = client.camsKfintech() stubFor(post(anyUrl()).willReturn(ok("{}"))) - creditService.check( - CreditCheckParams.builder() + camsKfintechService.parse( + CamsKfintechParseParams.builder() + .password("password") + .pdfFile("pdf_file") + .pdfUrl("https://example.com") .putAdditionalHeader("Secret-Header", "42") .putAdditionalQueryParam("secret_query_param", "42") .putAdditionalBodyProperty("secretProperty", JsonValue.from("42")) diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/AccessTokenServiceAsyncTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/AccessTokenServiceAsyncTest.kt deleted file mode 100644 index c795a5c..0000000 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/AccessTokenServiceAsyncTest.kt +++ /dev/null @@ -1,26 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.cas_parser.api.services.async - -import com.cas_parser.api.client.okhttp.CasParserOkHttpClientAsync -import com.cas_parser.api.models.accesstoken.AccessTokenCreateParams -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.Test - -internal class AccessTokenServiceAsyncTest { - - @Disabled("Mock server tests are disabled") - @Test - fun create() { - val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() - val accessTokenServiceAsync = client.accessToken() - - val accessTokenFuture = - accessTokenServiceAsync.create( - AccessTokenCreateParams.builder().expiryMinutes(60L).build() - ) - - val accessToken = accessTokenFuture.get() - accessToken.validate() - } -} diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/CreditServiceAsyncTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/CreditServiceAsyncTest.kt deleted file mode 100644 index 6c9e4d8..0000000 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/CreditServiceAsyncTest.kt +++ /dev/null @@ -1,22 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.cas_parser.api.services.async - -import com.cas_parser.api.client.okhttp.CasParserOkHttpClientAsync -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.Test - -internal class CreditServiceAsyncTest { - - @Disabled("Mock server tests are disabled") - @Test - fun check() { - val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() - val creditServiceAsync = client.credits() - - val responseFuture = creditServiceAsync.check() - - val response = responseFuture.get() - response.validate() - } -} diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/LogServiceAsyncTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/LogServiceAsyncTest.kt deleted file mode 100644 index 532be8d..0000000 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/LogServiceAsyncTest.kt +++ /dev/null @@ -1,50 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.cas_parser.api.services.async - -import com.cas_parser.api.client.okhttp.CasParserOkHttpClientAsync -import com.cas_parser.api.models.logs.LogCreateParams -import com.cas_parser.api.models.logs.LogGetSummaryParams -import java.time.OffsetDateTime -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.Test - -internal class LogServiceAsyncTest { - - @Disabled("Mock server tests are disabled") - @Test - fun create() { - val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() - val logServiceAsync = client.logs() - - val logFuture = - logServiceAsync.create( - LogCreateParams.builder() - .endTime(OffsetDateTime.parse("2026-01-31T23:59:59Z")) - .limit(1L) - .startTime(OffsetDateTime.parse("2026-01-01T00:00:00Z")) - .build() - ) - - val log = logFuture.get() - log.validate() - } - - @Disabled("Mock server tests are disabled") - @Test - fun getSummary() { - val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() - val logServiceAsync = client.logs() - - val responseFuture = - logServiceAsync.getSummary( - LogGetSummaryParams.builder() - .endTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) - - val response = responseFuture.get() - response.validate() - } -} diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/VerifyTokenServiceAsyncTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/VerifyTokenServiceAsyncTest.kt deleted file mode 100644 index 3d7800c..0000000 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/async/VerifyTokenServiceAsyncTest.kt +++ /dev/null @@ -1,22 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.cas_parser.api.services.async - -import com.cas_parser.api.client.okhttp.CasParserOkHttpClientAsync -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.Test - -internal class VerifyTokenServiceAsyncTest { - - @Disabled("Mock server tests are disabled") - @Test - fun verify() { - val client = CasParserOkHttpClientAsync.builder().apiKey("My API Key").build() - val verifyTokenServiceAsync = client.verifyToken() - - val responseFuture = verifyTokenServiceAsync.verify() - - val response = responseFuture.get() - response.validate() - } -} diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/AccessTokenServiceTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/AccessTokenServiceTest.kt deleted file mode 100644 index f7c9696..0000000 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/AccessTokenServiceTest.kt +++ /dev/null @@ -1,23 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.cas_parser.api.services.blocking - -import com.cas_parser.api.client.okhttp.CasParserOkHttpClient -import com.cas_parser.api.models.accesstoken.AccessTokenCreateParams -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.Test - -internal class AccessTokenServiceTest { - - @Disabled("Mock server tests are disabled") - @Test - fun create() { - val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() - val accessTokenService = client.accessToken() - - val accessToken = - accessTokenService.create(AccessTokenCreateParams.builder().expiryMinutes(60L).build()) - - accessToken.validate() - } -} diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/CreditServiceTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/CreditServiceTest.kt deleted file mode 100644 index 94239a3..0000000 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/CreditServiceTest.kt +++ /dev/null @@ -1,21 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.cas_parser.api.services.blocking - -import com.cas_parser.api.client.okhttp.CasParserOkHttpClient -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.Test - -internal class CreditServiceTest { - - @Disabled("Mock server tests are disabled") - @Test - fun check() { - val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() - val creditService = client.credits() - - val response = creditService.check() - - response.validate() - } -} diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/LogServiceTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/LogServiceTest.kt deleted file mode 100644 index 2ef5c48..0000000 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/LogServiceTest.kt +++ /dev/null @@ -1,48 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.cas_parser.api.services.blocking - -import com.cas_parser.api.client.okhttp.CasParserOkHttpClient -import com.cas_parser.api.models.logs.LogCreateParams -import com.cas_parser.api.models.logs.LogGetSummaryParams -import java.time.OffsetDateTime -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.Test - -internal class LogServiceTest { - - @Disabled("Mock server tests are disabled") - @Test - fun create() { - val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() - val logService = client.logs() - - val log = - logService.create( - LogCreateParams.builder() - .endTime(OffsetDateTime.parse("2026-01-31T23:59:59Z")) - .limit(1L) - .startTime(OffsetDateTime.parse("2026-01-01T00:00:00Z")) - .build() - ) - - log.validate() - } - - @Disabled("Mock server tests are disabled") - @Test - fun getSummary() { - val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() - val logService = client.logs() - - val response = - logService.getSummary( - LogGetSummaryParams.builder() - .endTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) - - response.validate() - } -} diff --git a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/VerifyTokenServiceTest.kt b/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/VerifyTokenServiceTest.kt deleted file mode 100644 index 19af27d..0000000 --- a/cas-parser-java-core/src/test/kotlin/com/cas_parser/api/services/blocking/VerifyTokenServiceTest.kt +++ /dev/null @@ -1,21 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.cas_parser.api.services.blocking - -import com.cas_parser.api.client.okhttp.CasParserOkHttpClient -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.Test - -internal class VerifyTokenServiceTest { - - @Disabled("Mock server tests are disabled") - @Test - fun verify() { - val client = CasParserOkHttpClient.builder().apiKey("My API Key").build() - val verifyTokenService = client.verifyToken() - - val response = verifyTokenService.verify() - - response.validate() - } -} diff --git a/cas-parser-java-proguard-test/src/test/kotlin/com/cas_parser/api/proguard/ProGuardCompatibilityTest.kt b/cas-parser-java-proguard-test/src/test/kotlin/com/cas_parser/api/proguard/ProGuardCompatibilityTest.kt index bdbc9b7..8592efc 100644 --- a/cas-parser-java-proguard-test/src/test/kotlin/com/cas_parser/api/proguard/ProGuardCompatibilityTest.kt +++ b/cas-parser-java-proguard-test/src/test/kotlin/com/cas_parser/api/proguard/ProGuardCompatibilityTest.kt @@ -4,9 +4,8 @@ package com.cas_parser.api.proguard import com.cas_parser.api.client.okhttp.CasParserOkHttpClient import com.cas_parser.api.core.jsonMapper -import com.cas_parser.api.models.credits.CreditCheckResponse +import com.cas_parser.api.models.camskfintech.LinkedHolder import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import java.time.OffsetDateTime import kotlin.reflect.full.memberFunctions import kotlin.reflect.jvm.javaMethod import org.assertj.core.api.Assertions.assertThat @@ -62,26 +61,16 @@ internal class ProGuardCompatibilityTest { } @Test - fun creditCheckResponseRoundtrip() { + fun linkedHolderRoundtrip() { val jsonMapper = jsonMapper() - val creditCheckResponse = - CreditCheckResponse.builder() - .enabledFeatures( - listOf("cams_kfintech_cas_parser", "cdsl_cas_parser", "nsdl_cas_parser") - ) - .isUnlimited(false) - .limit(50L) - .remaining(35.0) - .resetsAt(OffsetDateTime.parse("2026-02-15T00:00:00Z")) - .used(15.0) - .build() + val linkedHolder = LinkedHolder.builder().name("name").pan("pan").build() - val roundtrippedCreditCheckResponse = + val roundtrippedLinkedHolder = jsonMapper.readValue( - jsonMapper.writeValueAsString(creditCheckResponse), - jacksonTypeRef(), + jsonMapper.writeValueAsString(linkedHolder), + jacksonTypeRef(), ) - assertThat(roundtrippedCreditCheckResponse).isEqualTo(creditCheckResponse) + assertThat(roundtrippedLinkedHolder).isEqualTo(linkedHolder) } } From a7ff46394fcaea4570b2fc7e521efd3dcda456b0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 21 Feb 2026 21:17:57 +0000 Subject: [PATCH 10/10] release: 0.4.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 17 +++++++++++++++++ README.md | 10 +++++----- build.gradle.kts | 2 +- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 6b7b74c..da59f99 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.3.0" + ".": "0.4.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 19f5970..8d438f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## 0.4.0 (2026-02-21) + +Full Changelog: [v0.3.0...v0.4.0](https://github.com/CASParser/cas-parser-java/compare/v0.3.0...v0.4.0) + +### Features + +* **api:** api update ([8d2cb43](https://github.com/CASParser/cas-parser-java/commit/8d2cb43b11b1923624fdc32f7433115f5b20cf37)) +* **client:** add connection pooling option ([3ad0fbc](https://github.com/CASParser/cas-parser-java/commit/3ad0fbcafa782f6f7dfcead9d4c4646aedd4e681)) + + +### Chores + +* **internal:** make `OkHttp` constructor internal ([1939ec1](https://github.com/CASParser/cas-parser-java/commit/1939ec1346feeb7a1ea45db385d6f8b7f8daacf6)) +* **internal:** remove mock server code ([0bdc28f](https://github.com/CASParser/cas-parser-java/commit/0bdc28fc1a9ae2e735d2c40d9cf86c1dc00461ae)) +* **internal:** update `TestServerExtension` comment ([ff77ead](https://github.com/CASParser/cas-parser-java/commit/ff77ead512a0b13377c61c0e92cc478586e7a67e)) +* update mock server docs ([e7286da](https://github.com/CASParser/cas-parser-java/commit/e7286da78e71c2750514686fb39e2b1a0b5140af)) + ## 0.3.0 (2026-02-14) Full Changelog: [v0.2.1...v0.3.0](https://github.com/CASParser/cas-parser-java/compare/v0.2.1...v0.3.0) diff --git a/README.md b/README.md index 50e5c0c..8fe2679 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.3.0) -[![javadoc](https://javadoc.io/badge2/com.cas_parser.api/cas-parser-java/0.3.0/javadoc.svg)](https://javadoc.io/doc/com.cas_parser.api/cas-parser-java/0.3.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.4.0) +[![javadoc](https://javadoc.io/badge2/com.cas_parser.api/cas-parser-java/0.4.0/javadoc.svg)](https://javadoc.io/doc/com.cas_parser.api/cas-parser-java/0.4.0) @@ -22,7 +22,7 @@ Use the Cas Parser MCP Server to enable AI assistants to interact with this API, -The REST API documentation can be found on [docs.casparser.in](https://docs.casparser.in). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.cas_parser.api/cas-parser-java/0.3.0). +The REST API documentation can be found on [docs.casparser.in](https://docs.casparser.in). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.cas_parser.api/cas-parser-java/0.4.0). @@ -33,7 +33,7 @@ The REST API documentation can be found on [docs.casparser.in](https://docs.casp ### Gradle ```kotlin -implementation("com.cas_parser.api:cas-parser-java:0.3.0") +implementation("com.cas_parser.api:cas-parser-java:0.4.0") ``` ### Maven @@ -42,7 +42,7 @@ implementation("com.cas_parser.api:cas-parser-java:0.3.0") com.cas_parser.api cas-parser-java - 0.3.0 + 0.4.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 90d29ec..40e9f7a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,7 +9,7 @@ repositories { allprojects { group = "com.cas_parser.api" - version = "0.3.0" // x-release-please-version + version = "0.4.0" // x-release-please-version } subprojects {