diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 2ed3b71..3d2ac0b 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.0.4"
+ ".": "0.1.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 92721c7..06e7614 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 5
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cas-parser%2Fcas-parser-b7fdba3d3f97c7debc22c7ca30b828bce81bcd64648df8c94029b27a3321ebb9.yml
-openapi_spec_hash: 03f1315f1d32ada42445ca920f047dff
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cas-parser%2Fcas-parser-9eaed98ce5934f11e901cef376a28257d2c196bd3dba7c690babc6741a730ded.yml
+openapi_spec_hash: b76e4e830c4d03ba4cf9429bb9fb9c8a
config_hash: cb5d75abef6264b5d86448caf7295afa
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f21b326..825d9ee 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,26 @@
# Changelog
+## 0.1.0 (2025-09-26)
+
+Full Changelog: [v0.0.4...v0.1.0](https://github.com/CASParser/cas-parser-java/compare/v0.0.4...v0.1.0)
+
+### Features
+
+* **api:** api update ([557721f](https://github.com/CASParser/cas-parser-java/commit/557721f0775228db057005e912d8f820f512fcca))
+* **client:** expose sleeper option ([482319f](https://github.com/CASParser/cas-parser-java/commit/482319f0e19023df4e3ba5414e38914f6ad037fa))
+
+
+### Bug Fixes
+
+* **client:** deserialization of empty objects ([ce29632](https://github.com/CASParser/cas-parser-java/commit/ce29632f7f03c172ad042bbaa68e431ab2fd7fa7))
+* **client:** ensure single timer is created per client ([482319f](https://github.com/CASParser/cas-parser-java/commit/482319f0e19023df4e3ba5414e38914f6ad037fa))
+* **client:** incorrect `getPackageVersion` impl ([6772c5e](https://github.com/CASParser/cas-parser-java/commit/6772c5eeb5557a1e494852713cc55ec722b75145))
+
+
+### Chores
+
+* improve formatter performance ([692db64](https://github.com/CASParser/cas-parser-java/commit/692db64a36ef927e9c0ea23bd57192af99aaaf02))
+
## 0.0.4 (2025-09-13)
Full Changelog: [v0.0.3...v0.0.4](https://github.com/CASParser/cas-parser-java/compare/v0.0.3...v0.0.4)
diff --git a/README.md b/README.md
index eb1c0bb..8512460 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/com.cas_parser.api/cas-parser-java/0.0.4)
-[](https://javadoc.io/doc/com.cas_parser.api/cas-parser-java/0.0.4)
+[](https://central.sonatype.com/artifact/com.cas_parser.api/cas-parser-java/0.1.0)
+[](https://javadoc.io/doc/com.cas_parser.api/cas-parser-java/0.1.0)
@@ -13,7 +13,7 @@ It is generated with [Stainless](https://www.stainless.com/).
-The REST API documentation can be found on [docs.casparser.in](https://docs.casparser.in/reference). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.cas_parser.api/cas-parser-java/0.0.4).
+The REST API documentation can be found on [docs.casparser.in](https://docs.casparser.in/reference). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.cas_parser.api/cas-parser-java/0.1.0).
@@ -24,7 +24,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.0.4")
+implementation("com.cas_parser.api:cas-parser-java:0.1.0")
```
### Maven
@@ -33,7 +33,7 @@ implementation("com.cas_parser.api:cas-parser-java:0.0.4")
com.cas_parser.api
cas-parser-java
- 0.0.4
+ 0.1.0
```
diff --git a/build.gradle.kts b/build.gradle.kts
index d58d78e..30b3cae 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -9,7 +9,7 @@ repositories {
allprojects {
group = "com.cas_parser.api"
- version = "0.0.4" // x-release-please-version
+ version = "0.1.0" // x-release-please-version
}
subprojects {
diff --git a/cas-parser-java-client-okhttp/src/main/kotlin/com/cas_parser/api/client/okhttp/CasParserOkHttpClient.kt b/cas-parser-java-client-okhttp/src/main/kotlin/com/cas_parser/api/client/okhttp/CasParserOkHttpClient.kt
index 687527a..f75536a 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
@@ -5,6 +5,7 @@ package com.cas_parser.api.client.okhttp
import com.cas_parser.api.client.CasParserClient
import com.cas_parser.api.client.CasParserClientImpl
import com.cas_parser.api.core.ClientOptions
+import com.cas_parser.api.core.Sleeper
import com.cas_parser.api.core.Timeout
import com.cas_parser.api.core.http.Headers
import com.cas_parser.api.core.http.HttpClient
@@ -120,6 +121,17 @@ class CasParserOkHttpClient private constructor() {
*/
fun jsonMapper(jsonMapper: JsonMapper) = apply { clientOptions.jsonMapper(jsonMapper) }
+ /**
+ * The interface to use for delaying execution, like during retries.
+ *
+ * This is primarily useful for using fake delays in tests.
+ *
+ * Defaults to real execution delays.
+ *
+ * This class takes ownership of the sleeper and closes it when closed.
+ */
+ fun sleeper(sleeper: Sleeper) = apply { clientOptions.sleeper(sleeper) }
+
/**
* The clock to use for operations that require timing, like retries.
*
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 186bbe4..4142acc 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
@@ -5,6 +5,7 @@ package com.cas_parser.api.client.okhttp
import com.cas_parser.api.client.CasParserClientAsync
import com.cas_parser.api.client.CasParserClientAsyncImpl
import com.cas_parser.api.core.ClientOptions
+import com.cas_parser.api.core.Sleeper
import com.cas_parser.api.core.Timeout
import com.cas_parser.api.core.http.Headers
import com.cas_parser.api.core.http.HttpClient
@@ -120,6 +121,17 @@ class CasParserOkHttpClientAsync private constructor() {
*/
fun jsonMapper(jsonMapper: JsonMapper) = apply { clientOptions.jsonMapper(jsonMapper) }
+ /**
+ * The interface to use for delaying execution, like during retries.
+ *
+ * This is primarily useful for using fake delays in tests.
+ *
+ * Defaults to real execution delays.
+ *
+ * This class takes ownership of the sleeper and closes it when closed.
+ */
+ fun sleeper(sleeper: Sleeper) = apply { clientOptions.sleeper(sleeper) }
+
/**
* The clock to use for operations that require timing, like retries.
*
diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/ClientOptions.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/ClientOptions.kt
index d330bc7..f5195cd 100644
--- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/ClientOptions.kt
+++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/ClientOptions.kt
@@ -40,6 +40,16 @@ private constructor(
* rarely needs to be overridden.
*/
@get:JvmName("jsonMapper") val jsonMapper: JsonMapper,
+ /**
+ * The interface to use for delaying execution, like during retries.
+ *
+ * This is primarily useful for using fake delays in tests.
+ *
+ * Defaults to real execution delays.
+ *
+ * This class takes ownership of the sleeper and closes it when closed.
+ */
+ @get:JvmName("sleeper") val sleeper: Sleeper,
/**
* The clock to use for operations that require timing, like retries.
*
@@ -131,6 +141,7 @@ private constructor(
private var httpClient: HttpClient? = null
private var checkJacksonVersionCompatibility: Boolean = true
private var jsonMapper: JsonMapper = jsonMapper()
+ private var sleeper: Sleeper? = null
private var clock: Clock = Clock.systemUTC()
private var baseUrl: String? = null
private var headers: Headers.Builder = Headers.builder()
@@ -145,6 +156,7 @@ private constructor(
httpClient = clientOptions.originalHttpClient
checkJacksonVersionCompatibility = clientOptions.checkJacksonVersionCompatibility
jsonMapper = clientOptions.jsonMapper
+ sleeper = clientOptions.sleeper
clock = clientOptions.clock
baseUrl = clientOptions.baseUrl
headers = clientOptions.headers.toBuilder()
@@ -185,6 +197,17 @@ private constructor(
*/
fun jsonMapper(jsonMapper: JsonMapper) = apply { this.jsonMapper = jsonMapper }
+ /**
+ * The interface to use for delaying execution, like during retries.
+ *
+ * This is primarily useful for using fake delays in tests.
+ *
+ * Defaults to real execution delays.
+ *
+ * This class takes ownership of the sleeper and closes it when closed.
+ */
+ fun sleeper(sleeper: Sleeper) = apply { this.sleeper = PhantomReachableSleeper(sleeper) }
+
/**
* The clock to use for operations that require timing, like retries.
*
@@ -369,6 +392,7 @@ private constructor(
*/
fun build(): ClientOptions {
val httpClient = checkRequired("httpClient", httpClient)
+ val sleeper = sleeper ?: PhantomReachableSleeper(DefaultSleeper())
val apiKey = checkRequired("apiKey", apiKey)
val headers = Headers.builder()
@@ -392,11 +416,13 @@ private constructor(
httpClient,
RetryingHttpClient.builder()
.httpClient(httpClient)
+ .sleeper(sleeper)
.clock(clock)
.maxRetries(maxRetries)
.build(),
checkJacksonVersionCompatibility,
jsonMapper,
+ sleeper,
clock,
baseUrl,
headers.build(),
@@ -421,5 +447,6 @@ private constructor(
*/
fun close() {
httpClient.close()
+ sleeper.close()
}
}
diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/DefaultSleeper.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/DefaultSleeper.kt
new file mode 100644
index 0000000..5e092e2
--- /dev/null
+++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/DefaultSleeper.kt
@@ -0,0 +1,28 @@
+package com.cas_parser.api.core
+
+import java.time.Duration
+import java.util.Timer
+import java.util.TimerTask
+import java.util.concurrent.CompletableFuture
+
+class DefaultSleeper : Sleeper {
+
+ private val timer = Timer("DefaultSleeper", true)
+
+ override fun sleep(duration: Duration) = Thread.sleep(duration.toMillis())
+
+ override fun sleepAsync(duration: Duration): CompletableFuture {
+ val future = CompletableFuture()
+ timer.schedule(
+ object : TimerTask() {
+ override fun run() {
+ future.complete(null)
+ }
+ },
+ duration.toMillis(),
+ )
+ return future
+ }
+
+ override fun close() = timer.cancel()
+}
diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/PhantomReachableSleeper.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/PhantomReachableSleeper.kt
new file mode 100644
index 0000000..2b3afd5
--- /dev/null
+++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/PhantomReachableSleeper.kt
@@ -0,0 +1,23 @@
+package com.cas_parser.api.core
+
+import java.time.Duration
+import java.util.concurrent.CompletableFuture
+
+/**
+ * A delegating wrapper around a [Sleeper] that closes it once it's only phantom reachable.
+ *
+ * This class ensures the [Sleeper] is closed even if the user forgets to do it.
+ */
+internal class PhantomReachableSleeper(private val sleeper: Sleeper) : Sleeper {
+
+ init {
+ closeWhenPhantomReachable(this, sleeper)
+ }
+
+ override fun sleep(duration: Duration) = sleeper.sleep(duration)
+
+ override fun sleepAsync(duration: Duration): CompletableFuture =
+ sleeper.sleepAsync(duration)
+
+ override fun close() = sleeper.close()
+}
diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/Properties.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/Properties.kt
index c715f1a..dc9a375 100644
--- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/Properties.kt
+++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/Properties.kt
@@ -2,7 +2,7 @@
package com.cas_parser.api.core
-import java.util.Properties
+import com.cas_parser.api.client.CasParserClient
fun getOsArch(): String {
val osArch = System.getProperty("os.arch")
@@ -16,7 +16,7 @@ fun getOsArch(): String {
"x86_64" -> "x64"
"arm" -> "arm"
"aarch64" -> "arm64"
- else -> "other:${osArch}"
+ else -> "other:$osArch"
}
}
@@ -30,13 +30,13 @@ fun getOsName(): String {
osName.startsWith("Linux") -> "Linux"
osName.startsWith("Mac OS") -> "MacOS"
osName.startsWith("Windows") -> "Windows"
- else -> "Other:${osName}"
+ else -> "Other:$osName"
}
}
fun getOsVersion(): String = System.getProperty("os.version", "unknown")
fun getPackageVersion(): String =
- Properties::class.java.`package`.implementationVersion ?: "unknown"
+ CasParserClient::class.java.`package`.implementationVersion ?: "unknown"
fun getJavaVersion(): String = System.getProperty("java.version", "unknown")
diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/Sleeper.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/Sleeper.kt
new file mode 100644
index 0000000..5a93d9a
--- /dev/null
+++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/Sleeper.kt
@@ -0,0 +1,21 @@
+package com.cas_parser.api.core
+
+import java.time.Duration
+import java.util.concurrent.CompletableFuture
+
+/**
+ * An interface for delaying execution for a specified amount of time.
+ *
+ * Useful for testing and cleaning up resources.
+ */
+interface Sleeper : AutoCloseable {
+
+ /** Synchronously pauses execution for the given [duration]. */
+ fun sleep(duration: Duration)
+
+ /** Asynchronously pauses execution for the given [duration]. */
+ fun sleepAsync(duration: Duration): CompletableFuture
+
+ /** Overridden from [AutoCloseable] to not have a checked exception in its signature. */
+ override fun close()
+}
diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/http/RetryingHttpClient.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/http/RetryingHttpClient.kt
index 569b1aa..2bf9815 100644
--- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/http/RetryingHttpClient.kt
+++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/http/RetryingHttpClient.kt
@@ -1,6 +1,8 @@
package com.cas_parser.api.core.http
+import com.cas_parser.api.core.DefaultSleeper
import com.cas_parser.api.core.RequestOptions
+import com.cas_parser.api.core.Sleeper
import com.cas_parser.api.core.checkRequired
import com.cas_parser.api.errors.CasParserIoException
import com.cas_parser.api.errors.CasParserRetryableException
@@ -11,8 +13,6 @@ import java.time.OffsetDateTime
import java.time.format.DateTimeFormatter
import java.time.format.DateTimeParseException
import java.time.temporal.ChronoUnit
-import java.util.Timer
-import java.util.TimerTask
import java.util.UUID
import java.util.concurrent.CompletableFuture
import java.util.concurrent.ThreadLocalRandom
@@ -130,7 +130,10 @@ private constructor(
return executeWithRetries(modifiedRequest, requestOptions)
}
- override fun close() = httpClient.close()
+ override fun close() {
+ httpClient.close()
+ sleeper.close()
+ }
private fun isRetryable(request: HttpRequest): Boolean =
// Some requests, such as when a request body is being streamed, cannot be retried because
@@ -235,33 +238,14 @@ private constructor(
class Builder internal constructor() {
private var httpClient: HttpClient? = null
- private var sleeper: Sleeper =
- object : Sleeper {
-
- private val timer = Timer("RetryingHttpClient", true)
-
- override fun sleep(duration: Duration) = Thread.sleep(duration.toMillis())
-
- override fun sleepAsync(duration: Duration): CompletableFuture {
- val future = CompletableFuture()
- timer.schedule(
- object : TimerTask() {
- override fun run() {
- future.complete(null)
- }
- },
- duration.toMillis(),
- )
- return future
- }
- }
+ private var sleeper: Sleeper? = null
private var clock: Clock = Clock.systemUTC()
private var maxRetries: Int = 2
private var idempotencyHeader: String? = null
fun httpClient(httpClient: HttpClient) = apply { this.httpClient = httpClient }
- @JvmSynthetic internal fun sleeper(sleeper: Sleeper) = apply { this.sleeper = sleeper }
+ fun sleeper(sleeper: Sleeper) = apply { this.sleeper = sleeper }
fun clock(clock: Clock) = apply { this.clock = clock }
@@ -272,17 +256,10 @@ private constructor(
fun build(): HttpClient =
RetryingHttpClient(
checkRequired("httpClient", httpClient),
- sleeper,
+ sleeper ?: DefaultSleeper(),
clock,
maxRetries,
idempotencyHeader,
)
}
-
- internal interface Sleeper {
-
- fun sleep(duration: Duration)
-
- fun sleepAsync(duration: Duration): CompletableFuture
- }
}
diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/casgenerator/CasGeneratorGenerateCasParams.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/casgenerator/CasGeneratorGenerateCasParams.kt
index eb7213c..598c6a2 100644
--- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/casgenerator/CasGeneratorGenerateCasParams.kt
+++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/casgenerator/CasGeneratorGenerateCasParams.kt
@@ -394,6 +394,7 @@ private constructor(
override fun _queryParams(): QueryParams = additionalQueryParams
class Body
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val email: JsonField,
private val fromDate: JsonField,
diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/casgenerator/CasGeneratorGenerateCasResponse.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/casgenerator/CasGeneratorGenerateCasResponse.kt
index 09df4cd..ad4901d 100644
--- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/casgenerator/CasGeneratorGenerateCasResponse.kt
+++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/casgenerator/CasGeneratorGenerateCasResponse.kt
@@ -16,6 +16,7 @@ import java.util.Objects
import java.util.Optional
class CasGeneratorGenerateCasResponse
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val msg: JsonField,
private val status: JsonField,
diff --git a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/casparser/UnifiedResponse.kt b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/casparser/UnifiedResponse.kt
index 2c18576..98a9131 100644
--- a/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/casparser/UnifiedResponse.kt
+++ b/cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/casparser/UnifiedResponse.kt
@@ -22,12 +22,14 @@ import java.util.Optional
import kotlin.jvm.optionals.getOrNull
class UnifiedResponse
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val dematAccounts: JsonField>,
private val insurance: JsonField,
private val investor: JsonField,
private val meta: JsonField,
private val mutualFunds: JsonField>,
+ private val nps: JsonField>,
private val summary: JsonField,
private val additionalProperties: MutableMap,
) {
@@ -45,8 +47,9 @@ private constructor(
@JsonProperty("mutual_funds")
@ExcludeMissing
mutualFunds: JsonField> = JsonMissing.of(),
+ @JsonProperty("nps") @ExcludeMissing nps: JsonField> = JsonMissing.of(),
@JsonProperty("summary") @ExcludeMissing summary: JsonField = JsonMissing.of(),
- ) : this(dematAccounts, insurance, investor, meta, mutualFunds, summary, mutableMapOf())
+ ) : this(dematAccounts, insurance, investor, meta, mutualFunds, nps, summary, mutableMapOf())
/**
* @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -78,6 +81,14 @@ private constructor(
*/
fun mutualFunds(): Optional> = mutualFunds.getOptional("mutual_funds")
+ /**
+ * List of NPS accounts
+ *
+ * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun nps(): Optional> = nps.getOptional("nps")
+
/**
* @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
@@ -123,6 +134,13 @@ private constructor(
@ExcludeMissing
fun _mutualFunds(): JsonField> = mutualFunds
+ /**
+ * Returns the raw JSON value of [nps].
+ *
+ * Unlike [nps], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("nps") @ExcludeMissing fun _nps(): JsonField> = nps
+
/**
* Returns the raw JSON value of [summary].
*
@@ -156,6 +174,7 @@ private constructor(
private var investor: JsonField = JsonMissing.of()
private var meta: JsonField = JsonMissing.of()
private var mutualFunds: JsonField>? = null
+ private var nps: JsonField>? = null
private var summary: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@@ -166,6 +185,7 @@ private constructor(
investor = unifiedResponse.investor
meta = unifiedResponse.meta
mutualFunds = unifiedResponse.mutualFunds.map { it.toMutableList() }
+ nps = unifiedResponse.nps.map { it.toMutableList() }
summary = unifiedResponse.summary
additionalProperties = unifiedResponse.additionalProperties.toMutableMap()
}
@@ -253,6 +273,26 @@ private constructor(
}
}
+ /** List of NPS accounts */
+ fun nps(nps: List) = nps(JsonField.of(nps))
+
+ /**
+ * Sets [Builder.nps] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.nps] with a well-typed `List` value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun nps(nps: JsonField>) = apply { this.nps = nps.map { it.toMutableList() } }
+
+ /**
+ * Adds a single [Np] to [nps].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addNp(np: Np) = apply {
+ nps = (nps ?: JsonField.of(mutableListOf())).also { checkKnown("nps", it).add(np) }
+ }
+
fun summary(summary: Summary) = summary(JsonField.of(summary))
/**
@@ -294,6 +334,7 @@ private constructor(
investor,
meta,
(mutualFunds ?: JsonMissing.of()).map { it.toImmutable() },
+ (nps ?: JsonMissing.of()).map { it.toImmutable() },
summary,
additionalProperties.toMutableMap(),
)
@@ -311,6 +352,7 @@ private constructor(
investor().ifPresent { it.validate() }
meta().ifPresent { it.validate() }
mutualFunds().ifPresent { it.forEach { it.validate() } }
+ nps().ifPresent { it.forEach { it.validate() } }
summary().ifPresent { it.validate() }
validated = true
}
@@ -335,9 +377,11 @@ private constructor(
(investor.asKnown().getOrNull()?.validity() ?: 0) +
(meta.asKnown().getOrNull()?.validity() ?: 0) +
(mutualFunds.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
+ (nps.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
(summary.asKnown().getOrNull()?.validity() ?: 0)
class DematAccount
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val additionalInfo: JsonField,
private val boId: JsonField,
@@ -346,6 +390,7 @@ private constructor(
private val dpId: JsonField,
private val dpName: JsonField,
private val holdings: JsonField,
+ private val linkedHolders: JsonField>,
private val value: JsonField,
private val additionalProperties: MutableMap,
) {
@@ -367,6 +412,9 @@ private constructor(
@JsonProperty("holdings")
@ExcludeMissing
holdings: JsonField = JsonMissing.of(),
+ @JsonProperty("linked_holders")
+ @ExcludeMissing
+ linkedHolders: JsonField> = JsonMissing.of(),
@JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(),
) : this(
additionalInfo,
@@ -376,6 +424,7 @@ private constructor(
dpId,
dpName,
holdings,
+ linkedHolders,
value,
mutableMapOf(),
)
@@ -435,6 +484,15 @@ private constructor(
*/
fun holdings(): Optional = holdings.getOptional("holdings")
+ /**
+ * List of account holders linked to this demat account
+ *
+ * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun linkedHolders(): Optional> =
+ linkedHolders.getOptional("linked_holders")
+
/**
* Total value of the demat account
*
@@ -497,6 +555,16 @@ private constructor(
*/
@JsonProperty("holdings") @ExcludeMissing fun _holdings(): JsonField = holdings
+ /**
+ * Returns the raw JSON value of [linkedHolders].
+ *
+ * Unlike [linkedHolders], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("linked_holders")
+ @ExcludeMissing
+ fun _linkedHolders(): JsonField> = linkedHolders
+
/**
* Returns the raw JSON value of [value].
*
@@ -532,6 +600,7 @@ private constructor(
private var dpId: JsonField = JsonMissing.of()
private var dpName: JsonField = JsonMissing.of()
private var holdings: JsonField = JsonMissing.of()
+ private var linkedHolders: JsonField>? = null
private var value: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@@ -544,6 +613,7 @@ private constructor(
dpId = dematAccount.dpId
dpName = dematAccount.dpName
holdings = dematAccount.holdings
+ linkedHolders = dematAccount.linkedHolders.map { it.toMutableList() }
value = dematAccount.value
additionalProperties = dematAccount.additionalProperties.toMutableMap()
}
@@ -634,6 +704,33 @@ private constructor(
*/
fun holdings(holdings: JsonField) = apply { this.holdings = holdings }
+ /** List of account holders linked to this demat account */
+ fun linkedHolders(linkedHolders: List) =
+ linkedHolders(JsonField.of(linkedHolders))
+
+ /**
+ * Sets [Builder.linkedHolders] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.linkedHolders] with a well-typed
+ * `List` value instead. This method is primarily for setting the field to
+ * an undocumented or not yet supported value.
+ */
+ fun linkedHolders(linkedHolders: JsonField>) = apply {
+ this.linkedHolders = linkedHolders.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [LinkedHolder] to [linkedHolders].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addLinkedHolder(linkedHolder: LinkedHolder) = apply {
+ linkedHolders =
+ (linkedHolders ?: JsonField.of(mutableListOf())).also {
+ checkKnown("linkedHolders", it).add(linkedHolder)
+ }
+ }
+
/** Total value of the demat account */
fun value(value: Float) = value(JsonField.of(value))
@@ -679,6 +776,7 @@ private constructor(
dpId,
dpName,
holdings,
+ (linkedHolders ?: JsonMissing.of()).map { it.toImmutable() },
value,
additionalProperties.toMutableMap(),
)
@@ -698,6 +796,7 @@ private constructor(
dpId()
dpName()
holdings().ifPresent { it.validate() }
+ linkedHolders().ifPresent { it.forEach { it.validate() } }
value()
validated = true
}
@@ -725,10 +824,12 @@ private constructor(
(if (dpId.asKnown().isPresent) 1 else 0) +
(if (dpName.asKnown().isPresent) 1 else 0) +
(holdings.asKnown().getOrNull()?.validity() ?: 0) +
+ (linkedHolders.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
(if (value.asKnown().isPresent) 1 else 0)
/** Additional information specific to the demat account type */
class AdditionalInfo
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val boStatus: JsonField,
private val boSubStatus: JsonField,
@@ -1310,6 +1411,7 @@ private constructor(
}
class Holdings
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val aifs: JsonField>,
private val corporateBonds: JsonField>,
@@ -1668,6 +1770,7 @@ private constructor(
?: 0)
class Aif
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val additionalInfo: JsonValue,
private val isin: JsonField,
@@ -1954,6 +2057,7 @@ private constructor(
}
class CorporateBond
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val additionalInfo: JsonValue,
private val isin: JsonField,
@@ -2242,6 +2346,7 @@ private constructor(
}
class DematMutualFund
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val additionalInfo: JsonValue,
private val isin: JsonField,
@@ -2530,6 +2635,7 @@ private constructor(
}
class Equity
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val additionalInfo: JsonValue,
private val isin: JsonField,
@@ -2816,6 +2922,7 @@ private constructor(
}
class GovernmentSecurity
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val additionalInfo: JsonValue,
private val isin: JsonField,
@@ -3136,6 +3243,186 @@ private constructor(
"Holdings{aifs=$aifs, corporateBonds=$corporateBonds, dematMutualFunds=$dematMutualFunds, equities=$equities, governmentSecurities=$governmentSecurities, additionalProperties=$additionalProperties}"
}
+ class LinkedHolder
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val name: JsonField,
+ private val pan: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(),
+ @JsonProperty("pan") @ExcludeMissing pan: JsonField = JsonMissing.of(),
+ ) : this(name, pan, mutableMapOf())
+
+ /**
+ * Name of the account holder
+ *
+ * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun name(): Optional = name.getOptional("name")
+
+ /**
+ * PAN of the account holder
+ *
+ * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun pan(): Optional = pan.getOptional("pan")
+
+ /**
+ * Returns the raw JSON value of [name].
+ *
+ * Unlike [name], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name
+
+ /**
+ * Returns the raw JSON value of [pan].
+ *
+ * Unlike [pan], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("pan") @ExcludeMissing fun _pan(): JsonField = pan
+
+ @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 [LinkedHolder]. */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [LinkedHolder]. */
+ class Builder internal constructor() {
+
+ private var name: JsonField = JsonMissing.of()
+ private var pan: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(linkedHolder: LinkedHolder) = apply {
+ name = linkedHolder.name
+ pan = linkedHolder.pan
+ additionalProperties = linkedHolder.additionalProperties.toMutableMap()
+ }
+
+ /** Name of the account holder */
+ fun name(name: String) = name(JsonField.of(name))
+
+ /**
+ * Sets [Builder.name] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.name] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun name(name: JsonField) = apply { this.name = name }
+
+ /** PAN of the account holder */
+ fun pan(pan: String) = pan(JsonField.of(pan))
+
+ /**
+ * Sets [Builder.pan] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.pan] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun pan(pan: JsonField) = apply { this.pan = pan }
+
+ 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 [LinkedHolder].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): LinkedHolder =
+ LinkedHolder(name, pan, additionalProperties.toMutableMap())
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): LinkedHolder = apply {
+ if (validated) {
+ return@apply
+ }
+
+ name()
+ pan()
+ 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 (name.asKnown().isPresent) 1 else 0) + (if (pan.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is LinkedHolder &&
+ name == other.name &&
+ pan == other.pan &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(name, pan, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "LinkedHolder{name=$name, pan=$pan, additionalProperties=$additionalProperties}"
+ }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3149,6 +3436,7 @@ private constructor(
dpId == other.dpId &&
dpName == other.dpName &&
holdings == other.holdings &&
+ linkedHolders == other.linkedHolders &&
value == other.value &&
additionalProperties == other.additionalProperties
}
@@ -3162,6 +3450,7 @@ private constructor(
dpId,
dpName,
holdings,
+ linkedHolders,
value,
additionalProperties,
)
@@ -3170,10 +3459,11 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "DematAccount{additionalInfo=$additionalInfo, boId=$boId, clientId=$clientId, dematType=$dematType, dpId=$dpId, dpName=$dpName, holdings=$holdings, value=$value, additionalProperties=$additionalProperties}"
+ "DematAccount{additionalInfo=$additionalInfo, boId=$boId, clientId=$clientId, dematType=$dematType, dpId=$dpId, dpName=$dpName, holdings=$holdings, linkedHolders=$linkedHolders, value=$value, additionalProperties=$additionalProperties}"
}
class Insurance
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val lifeInsurancePolicies: JsonField>,
private val additionalProperties: MutableMap,
@@ -3321,6 +3611,7 @@ private constructor(
(lifeInsurancePolicies.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
class LifeInsurancePolicy
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val additionalInfo: JsonValue,
private val lifeAssured: JsonField,
@@ -3828,6 +4119,7 @@ private constructor(
}
class Investor
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val address: JsonField,
private val casId: JsonField,
@@ -4186,6 +4478,7 @@ private constructor(
}
class Meta
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val casType: JsonField,
private val generatedAt: JsonField,
@@ -4528,6 +4821,7 @@ private constructor(
}
class StatementPeriod
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val from: JsonField,
private val to: JsonField,
@@ -4729,10 +5023,12 @@ private constructor(
}
class MutualFund
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val additionalInfo: JsonField,
private val amc: JsonField,
private val folioNumber: JsonField,
+ private val linkedHolders: JsonField>,
private val registrar: JsonField,
private val schemes: JsonField>,
private val value: JsonField,
@@ -4748,6 +5044,9 @@ private constructor(
@JsonProperty("folio_number")
@ExcludeMissing
folioNumber: JsonField = JsonMissing.of(),
+ @JsonProperty("linked_holders")
+ @ExcludeMissing
+ linkedHolders: JsonField> = JsonMissing.of(),
@JsonProperty("registrar")
@ExcludeMissing
registrar: JsonField = JsonMissing.of(),
@@ -4755,7 +5054,16 @@ private constructor(
@ExcludeMissing
schemes: JsonField> = JsonMissing.of(),
@JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(),
- ) : this(additionalInfo, amc, folioNumber, registrar, schemes, value, mutableMapOf())
+ ) : this(
+ additionalInfo,
+ amc,
+ folioNumber,
+ linkedHolders,
+ registrar,
+ schemes,
+ value,
+ mutableMapOf(),
+ )
/**
* Additional folio information
@@ -4782,6 +5090,15 @@ private constructor(
*/
fun folioNumber(): Optional = folioNumber.getOptional("folio_number")
+ /**
+ * List of account holders linked to this mutual fund folio
+ *
+ * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun linkedHolders(): Optional> =
+ linkedHolders.getOptional("linked_holders")
+
/**
* Registrar and Transfer Agent name
*
@@ -4830,6 +5147,16 @@ private constructor(
@ExcludeMissing
fun _folioNumber(): JsonField = folioNumber
+ /**
+ * Returns the raw JSON value of [linkedHolders].
+ *
+ * Unlike [linkedHolders], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("linked_holders")
+ @ExcludeMissing
+ fun _linkedHolders(): JsonField> = linkedHolders
+
/**
* Returns the raw JSON value of [registrar].
*
@@ -4875,6 +5202,7 @@ private constructor(
private var additionalInfo: JsonField = JsonMissing.of()
private var amc: JsonField = JsonMissing.of()
private var folioNumber: JsonField = JsonMissing.of()
+ private var linkedHolders: JsonField>? = null
private var registrar: JsonField = JsonMissing.of()
private var schemes: JsonField>? = null
private var value: JsonField = JsonMissing.of()
@@ -4885,6 +5213,7 @@ private constructor(
additionalInfo = mutualFund.additionalInfo
amc = mutualFund.amc
folioNumber = mutualFund.folioNumber
+ linkedHolders = mutualFund.linkedHolders.map { it.toMutableList() }
registrar = mutualFund.registrar
schemes = mutualFund.schemes.map { it.toMutableList() }
value = mutualFund.value
@@ -4932,6 +5261,33 @@ private constructor(
this.folioNumber = folioNumber
}
+ /** List of account holders linked to this mutual fund folio */
+ fun linkedHolders(linkedHolders: List) =
+ linkedHolders(JsonField.of(linkedHolders))
+
+ /**
+ * Sets [Builder.linkedHolders] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.linkedHolders] with a well-typed
+ * `List` value instead. This method is primarily for setting the field to
+ * an undocumented or not yet supported value.
+ */
+ fun linkedHolders(linkedHolders: JsonField>) = apply {
+ this.linkedHolders = linkedHolders.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [LinkedHolder] to [linkedHolders].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addLinkedHolder(linkedHolder: LinkedHolder) = apply {
+ linkedHolders =
+ (linkedHolders ?: JsonField.of(mutableListOf())).also {
+ checkKnown("linkedHolders", it).add(linkedHolder)
+ }
+ }
+
/** Registrar and Transfer Agent name */
fun registrar(registrar: String) = registrar(JsonField.of(registrar))
@@ -5010,6 +5366,7 @@ private constructor(
additionalInfo,
amc,
folioNumber,
+ (linkedHolders ?: JsonMissing.of()).map { it.toImmutable() },
registrar,
(schemes ?: JsonMissing.of()).map { it.toImmutable() },
value,
@@ -5027,6 +5384,7 @@ private constructor(
additionalInfo().ifPresent { it.validate() }
amc()
folioNumber()
+ linkedHolders().ifPresent { it.forEach { it.validate() } }
registrar()
schemes().ifPresent { it.forEach { it.validate() } }
value()
@@ -5052,12 +5410,14 @@ private constructor(
(additionalInfo.asKnown().getOrNull()?.validity() ?: 0) +
(if (amc.asKnown().isPresent) 1 else 0) +
(if (folioNumber.asKnown().isPresent) 1 else 0) +
+ (linkedHolders.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
(if (registrar.asKnown().isPresent) 1 else 0) +
(schemes.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
(if (value.asKnown().isPresent) 1 else 0)
/** Additional folio information */
class AdditionalInfo
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val kyc: JsonField,
private val pan: JsonField,
@@ -5273,30 +5633,211 @@ private constructor(
"AdditionalInfo{kyc=$kyc, pan=$pan, pankyc=$pankyc, additionalProperties=$additionalProperties}"
}
- class Scheme
+ class LinkedHolder
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
- private val additionalInfo: JsonField,
- private val cost: JsonField,
- private val gain: JsonField,
- private val isin: JsonField,
private val name: JsonField,
- private val nav: JsonField,
- private val nominees: JsonField>,
- private val transactions: JsonField>,
- private val type: JsonField,
- private val units: JsonField,
- private val value: JsonField,
+ private val pan: JsonField,
private val additionalProperties: MutableMap,
) {
@JsonCreator
private constructor(
- @JsonProperty("additional_info")
- @ExcludeMissing
- additionalInfo: JsonField = JsonMissing.of(),
- @JsonProperty("cost") @ExcludeMissing cost: JsonField = JsonMissing.of(),
- @JsonProperty("gain") @ExcludeMissing gain: JsonField = JsonMissing.of(),
- @JsonProperty("isin") @ExcludeMissing isin: JsonField = JsonMissing.of(),
+ @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(),
+ @JsonProperty("pan") @ExcludeMissing pan: JsonField = JsonMissing.of(),
+ ) : this(name, pan, mutableMapOf())
+
+ /**
+ * Name of the account holder
+ *
+ * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun name(): Optional = name.getOptional("name")
+
+ /**
+ * PAN of the account holder
+ *
+ * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun pan(): Optional = pan.getOptional("pan")
+
+ /**
+ * Returns the raw JSON value of [name].
+ *
+ * Unlike [name], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name
+
+ /**
+ * Returns the raw JSON value of [pan].
+ *
+ * Unlike [pan], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("pan") @ExcludeMissing fun _pan(): JsonField = pan
+
+ @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 [LinkedHolder]. */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [LinkedHolder]. */
+ class Builder internal constructor() {
+
+ private var name: JsonField = JsonMissing.of()
+ private var pan: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(linkedHolder: LinkedHolder) = apply {
+ name = linkedHolder.name
+ pan = linkedHolder.pan
+ additionalProperties = linkedHolder.additionalProperties.toMutableMap()
+ }
+
+ /** Name of the account holder */
+ fun name(name: String) = name(JsonField.of(name))
+
+ /**
+ * Sets [Builder.name] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.name] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun name(name: JsonField) = apply { this.name = name }
+
+ /** PAN of the account holder */
+ fun pan(pan: String) = pan(JsonField.of(pan))
+
+ /**
+ * Sets [Builder.pan] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.pan] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun pan(pan: JsonField) = apply { this.pan = pan }
+
+ 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 [LinkedHolder].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): LinkedHolder =
+ LinkedHolder(name, pan, additionalProperties.toMutableMap())
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): LinkedHolder = apply {
+ if (validated) {
+ return@apply
+ }
+
+ name()
+ pan()
+ 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 (name.asKnown().isPresent) 1 else 0) + (if (pan.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is LinkedHolder &&
+ name == other.name &&
+ pan == other.pan &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(name, pan, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "LinkedHolder{name=$name, pan=$pan, additionalProperties=$additionalProperties}"
+ }
+
+ class Scheme
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val additionalInfo: JsonField,
+ private val cost: JsonField,
+ private val gain: JsonField,
+ private val isin: JsonField,
+ private val name: JsonField,
+ private val nav: JsonField,
+ private val nominees: JsonField>,
+ private val transactions: JsonField>,
+ private val type: JsonField,
+ private val units: JsonField,
+ private val value: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("additional_info")
+ @ExcludeMissing
+ additionalInfo: JsonField = JsonMissing.of(),
+ @JsonProperty("cost") @ExcludeMissing cost: JsonField = JsonMissing.of(),
+ @JsonProperty("gain") @ExcludeMissing gain: JsonField = JsonMissing.of(),
+ @JsonProperty("isin") @ExcludeMissing isin: JsonField = JsonMissing.of(),
@JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(),
@JsonProperty("nav") @ExcludeMissing nav: JsonField = JsonMissing.of(),
@JsonProperty("nominees")
@@ -5802,6 +6343,7 @@ private constructor(
/** Additional information specific to the scheme */
class AdditionalInfo
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val advisor: JsonField,
private val amfi: JsonField,
@@ -6127,6 +6669,7 @@ private constructor(
}
class Gain
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val absolute: JsonField,
private val percentage: JsonField,
@@ -6321,6 +6864,7 @@ private constructor(
}
class Transaction
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val amount: JsonField,
private val balance: JsonField,
@@ -6968,6 +7512,7 @@ private constructor(
additionalInfo == other.additionalInfo &&
amc == other.amc &&
folioNumber == other.folioNumber &&
+ linkedHolders == other.linkedHolders &&
registrar == other.registrar &&
schemes == other.schemes &&
value == other.value &&
@@ -6979,6 +7524,7 @@ private constructor(
additionalInfo,
amc,
folioNumber,
+ linkedHolders,
registrar,
schemes,
value,
@@ -6989,55 +7535,116 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "MutualFund{additionalInfo=$additionalInfo, amc=$amc, folioNumber=$folioNumber, registrar=$registrar, schemes=$schemes, value=$value, additionalProperties=$additionalProperties}"
+ "MutualFund{additionalInfo=$additionalInfo, amc=$amc, folioNumber=$folioNumber, linkedHolders=$linkedHolders, registrar=$registrar, schemes=$schemes, value=$value, additionalProperties=$additionalProperties}"
}
- class Summary
+ class Np
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
- private val accounts: JsonField,
- private val totalValue: JsonField,
+ private val additionalInfo: JsonValue,
+ private val cra: JsonField,
+ private val funds: JsonField>,
+ private val linkedHolders: JsonField>,
+ private val pran: JsonField,
+ private val value: JsonField,
private val additionalProperties: MutableMap,
) {
@JsonCreator
private constructor(
- @JsonProperty("accounts")
+ @JsonProperty("additional_info")
@ExcludeMissing
- accounts: JsonField = JsonMissing.of(),
- @JsonProperty("total_value")
+ additionalInfo: JsonValue = JsonMissing.of(),
+ @JsonProperty("cra") @ExcludeMissing cra: JsonField = JsonMissing.of(),
+ @JsonProperty("funds") @ExcludeMissing funds: JsonField> = JsonMissing.of(),
+ @JsonProperty("linked_holders")
@ExcludeMissing
- totalValue: JsonField = JsonMissing.of(),
- ) : this(accounts, totalValue, mutableMapOf())
+ linkedHolders: JsonField> = JsonMissing.of(),
+ @JsonProperty("pran") @ExcludeMissing pran: JsonField = JsonMissing.of(),
+ @JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(),
+ ) : this(additionalInfo, cra, funds, linkedHolders, pran, value, mutableMapOf())
+
+ /** Additional information specific to the NPS account */
+ @JsonProperty("additional_info")
+ @ExcludeMissing
+ fun _additionalInfo(): JsonValue = additionalInfo
/**
+ * Central Record Keeping Agency name
+ *
* @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
*/
- fun accounts(): Optional = accounts.getOptional("accounts")
+ fun cra(): Optional = cra.getOptional("cra")
/**
- * Total portfolio value across all accounts
+ * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun funds(): Optional> = funds.getOptional("funds")
+
+ /**
+ * List of account holders linked to this NPS account
*
* @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
*/
- fun totalValue(): Optional = totalValue.getOptional("total_value")
+ fun linkedHolders(): Optional> =
+ linkedHolders.getOptional("linked_holders")
/**
- * Returns the raw JSON value of [accounts].
+ * Permanent Retirement Account Number (PRAN)
*
- * Unlike [accounts], this method doesn't throw if the JSON field has an unexpected type.
+ * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
*/
- @JsonProperty("accounts") @ExcludeMissing fun _accounts(): JsonField = accounts
+ fun pran(): Optional = pran.getOptional("pran")
/**
- * Returns the raw JSON value of [totalValue].
+ * Total value of the NPS account
*
- * Unlike [totalValue], this method doesn't throw if the JSON field has an unexpected type.
+ * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
*/
- @JsonProperty("total_value")
+ fun value(): Optional = value.getOptional("value")
+
+ /**
+ * Returns the raw JSON value of [cra].
+ *
+ * Unlike [cra], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("cra") @ExcludeMissing fun _cra(): JsonField = cra
+
+ /**
+ * Returns the raw JSON value of [funds].
+ *
+ * Unlike [funds], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("funds") @ExcludeMissing fun _funds(): JsonField> = funds
+
+ /**
+ * Returns the raw JSON value of [linkedHolders].
+ *
+ * Unlike [linkedHolders], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("linked_holders")
@ExcludeMissing
- fun _totalValue(): JsonField = totalValue
+ fun _linkedHolders(): JsonField> = linkedHolders
+
+ /**
+ * Returns the raw JSON value of [pran].
+ *
+ * Unlike [pran], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("pran") @ExcludeMissing fun _pran(): JsonField = pran
+
+ /**
+ * Returns the raw JSON value of [value].
+ *
+ * Unlike [value], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value
@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
@@ -7053,37 +7660,1163 @@ private constructor(
companion object {
- /** Returns a mutable builder for constructing an instance of [Summary]. */
+ /** Returns a mutable builder for constructing an instance of [Np]. */
@JvmStatic fun builder() = Builder()
}
- /** A builder for [Summary]. */
+ /** A builder for [Np]. */
class Builder internal constructor() {
- private var accounts: JsonField = JsonMissing.of()
- private var totalValue: JsonField = JsonMissing.of()
+ private var additionalInfo: JsonValue = JsonMissing.of()
+ private var cra: JsonField = JsonMissing.of()
+ private var funds: JsonField>? = null
+ private var linkedHolders: JsonField>? = null
+ private var pran: JsonField = JsonMissing.of()
+ private var value: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
- internal fun from(summary: Summary) = apply {
- accounts = summary.accounts
- totalValue = summary.totalValue
- additionalProperties = summary.additionalProperties.toMutableMap()
+ internal fun from(np: Np) = apply {
+ additionalInfo = np.additionalInfo
+ cra = np.cra
+ funds = np.funds.map { it.toMutableList() }
+ linkedHolders = np.linkedHolders.map { it.toMutableList() }
+ pran = np.pran
+ value = np.value
+ additionalProperties = np.additionalProperties.toMutableMap()
}
- fun accounts(accounts: Accounts) = accounts(JsonField.of(accounts))
+ /** Additional information specific to the NPS account */
+ fun additionalInfo(additionalInfo: JsonValue) = apply {
+ this.additionalInfo = additionalInfo
+ }
+
+ /** Central Record Keeping Agency name */
+ fun cra(cra: String) = cra(JsonField.of(cra))
/**
- * Sets [Builder.accounts] to an arbitrary JSON value.
+ * Sets [Builder.cra] to an arbitrary JSON value.
*
- * You should usually call [Builder.accounts] with a well-typed [Accounts] value
- * instead. This method is primarily for setting the field to an undocumented or not yet
- * supported value.
+ * You should usually call [Builder.cra] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported
+ * value.
*/
- fun accounts(accounts: JsonField) = apply { this.accounts = accounts }
+ fun cra(cra: JsonField) = apply { this.cra = cra }
- /** Total portfolio value across all accounts */
- fun totalValue(totalValue: Float) = totalValue(JsonField.of(totalValue))
+ fun funds(funds: List) = funds(JsonField.of(funds))
+
+ /**
+ * Sets [Builder.funds] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.funds] with a well-typed `List` value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun funds(funds: JsonField>) = apply {
+ this.funds = funds.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [Fund] to [funds].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addFund(fund: Fund) = apply {
+ funds =
+ (funds ?: JsonField.of(mutableListOf())).also {
+ checkKnown("funds", it).add(fund)
+ }
+ }
+
+ /** List of account holders linked to this NPS account */
+ fun linkedHolders(linkedHolders: List) =
+ linkedHolders(JsonField.of(linkedHolders))
+
+ /**
+ * Sets [Builder.linkedHolders] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.linkedHolders] with a well-typed
+ * `List` value instead. This method is primarily for setting the field to
+ * an undocumented or not yet supported value.
+ */
+ fun linkedHolders(linkedHolders: JsonField>) = apply {
+ this.linkedHolders = linkedHolders.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [LinkedHolder] to [linkedHolders].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addLinkedHolder(linkedHolder: LinkedHolder) = apply {
+ linkedHolders =
+ (linkedHolders ?: JsonField.of(mutableListOf())).also {
+ checkKnown("linkedHolders", it).add(linkedHolder)
+ }
+ }
+
+ /** Permanent Retirement Account Number (PRAN) */
+ fun pran(pran: String) = pran(JsonField.of(pran))
+
+ /**
+ * Sets [Builder.pran] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.pran] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun pran(pran: JsonField) = apply { this.pran = pran }
+
+ /** Total value of the NPS account */
+ fun value(value: Float) = value(JsonField.of(value))
+
+ /**
+ * Sets [Builder.value] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.value] with a well-typed [Float] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun value(value: JsonField) = apply { this.value = value }
+
+ 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 [Np].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): Np =
+ Np(
+ additionalInfo,
+ cra,
+ (funds ?: JsonMissing.of()).map { it.toImmutable() },
+ (linkedHolders ?: JsonMissing.of()).map { it.toImmutable() },
+ pran,
+ value,
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Np = apply {
+ if (validated) {
+ return@apply
+ }
+
+ cra()
+ funds().ifPresent { it.forEach { it.validate() } }
+ linkedHolders().ifPresent { it.forEach { it.validate() } }
+ pran()
+ value()
+ 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 (cra.asKnown().isPresent) 1 else 0) +
+ (funds.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
+ (linkedHolders.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
+ (if (pran.asKnown().isPresent) 1 else 0) +
+ (if (value.asKnown().isPresent) 1 else 0)
+
+ class Fund
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val additionalInfo: JsonField,
+ private val cost: JsonField,
+ private val name: JsonField,
+ private val nav: JsonField,
+ private val units: JsonField,
+ private val value: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("additional_info")
+ @ExcludeMissing
+ additionalInfo: JsonField = JsonMissing.of(),
+ @JsonProperty("cost") @ExcludeMissing cost: JsonField = JsonMissing.of(),
+ @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(),
+ @JsonProperty("nav") @ExcludeMissing nav: JsonField = JsonMissing.of(),
+ @JsonProperty("units") @ExcludeMissing units: JsonField = JsonMissing.of(),
+ @JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(),
+ ) : this(additionalInfo, cost, name, nav, units, value, mutableMapOf())
+
+ /**
+ * Additional information specific to the NPS fund
+ *
+ * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun additionalInfo(): Optional =
+ additionalInfo.getOptional("additional_info")
+
+ /**
+ * Cost of investment
+ *
+ * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun cost(): Optional = cost.getOptional("cost")
+
+ /**
+ * Name of the NPS fund
+ *
+ * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun name(): Optional = name.getOptional("name")
+
+ /**
+ * Net Asset Value per unit
+ *
+ * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun nav(): Optional = nav.getOptional("nav")
+
+ /**
+ * Number of units held
+ *
+ * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun units(): Optional = units.getOptional("units")
+
+ /**
+ * Current market value of the holding
+ *
+ * @throws CasParserInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun value(): Optional = value.getOptional("value")
+
+ /**
+ * Returns the raw JSON value of [additionalInfo].
+ *
+ * Unlike [additionalInfo], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("additional_info")
+ @ExcludeMissing
+ fun _additionalInfo(): JsonField = additionalInfo
+
+ /**
+ * Returns the raw JSON value of [cost].
+ *
+ * Unlike [cost], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("cost") @ExcludeMissing fun _cost(): JsonField = cost
+
+ /**
+ * Returns the raw JSON value of [name].
+ *
+ * Unlike [name], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name
+
+ /**
+ * Returns the raw JSON value of [nav].
+ *
+ * Unlike [nav], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("nav") @ExcludeMissing fun _nav(): JsonField = nav
+
+ /**
+ * Returns the raw JSON value of [units].
+ *
+ * Unlike [units], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("units") @ExcludeMissing fun _units(): JsonField = units
+
+ /**
+ * Returns the raw JSON value of [value].
+ *
+ * Unlike [value], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value
+
+ @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 [Fund]. */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Fund]. */
+ class Builder internal constructor() {
+
+ private var additionalInfo: JsonField