Skip to content

Commit 5fb8812

Browse files
feat(api): api update
1 parent 1c7a4f1 commit 5fb8812

File tree

10 files changed

+130
-29
lines changed

10 files changed

+130
-29
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
- name: Get GitHub OIDC Token
6868
if: github.repository == 'stainless-sdks/cas-parser-java'
6969
id: github-oidc
70-
uses: actions/github-script@v6
70+
uses: actions/github-script@v8
7171
with:
7272
script: core.setOutput('github_token', await core.getIDToken());
7373

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 4
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cas-parser%2Fcas-parser-ce2296c4b14d27c141bb2745607d2456c923fdca3ae0a0a0800c26e564333850.yml
3-
openapi_spec_hash: 8eb586ccf16b534c0c15ff6a22274c7d
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cas-parser%2Fcas-parser-2e3df9c77e887f49ca3dffd5d68f30a8a0ea0b557f31282dd191ce85713e3e34.yml
3+
openapi_spec_hash: 1cb90023118602a40a106cd51ed6a926
44
config_hash: cb5d75abef6264b5d86448caf7295afa

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ It is generated with [Stainless](https://www.stainless.com/).
1515

1616
Use the Cas Parser MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.
1717

18-
[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=cas-parser-node-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsImNhcy1wYXJzZXItbm9kZS1tY3AiXX0)
19-
[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22cas-parser-node-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22cas-parser-node-mcp%22%5D%7D)
18+
[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=cas-parser-node-mcp&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jdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22cas-parser-node-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22cas-parser-node-mcp%22%5D%2C%22env%22%3A%7B%22CAS_PARSER_API_KEY%22%3A%22My%20API%20Key%22%7D%7D)
2020

2121
> Note: You may need to set environment variables in your MCP client.
2222

buildSrc/src/main/kotlin/cas-parser.kotlin.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ kotlin {
3333
tasks.withType<Test>().configureEach {
3434
systemProperty("junit.jupiter.execution.parallel.enabled", true)
3535
systemProperty("junit.jupiter.execution.parallel.mode.default", "concurrent")
36+
37+
// `SKIP_MOCK_TESTS` affects which tests run so it must be added as input for proper cache invalidation.
38+
inputs.property("skipMockTests", System.getenv("SKIP_MOCK_TESTS")).optional(true)
3639
}
3740

3841
val ktfmt by configurations.creating

cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/ClientOptions.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ private constructor(
404404
headers.put("X-Stainless-Package-Version", getPackageVersion())
405405
headers.put("X-Stainless-Runtime", "JRE")
406406
headers.put("X-Stainless-Runtime-Version", getJavaVersion())
407+
headers.put("X-Stainless-Kotlin-Version", KotlinVersion.CURRENT.toString())
407408
apiKey.let {
408409
if (!it.isEmpty()) {
409410
headers.put("x-api-key", it)

cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/ObjectMappers.kt

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import java.time.DateTimeException
2525
import java.time.LocalDate
2626
import java.time.LocalDateTime
2727
import java.time.OffsetDateTime
28-
import java.time.ZonedDateTime
28+
import java.time.ZoneId
2929
import java.time.format.DateTimeFormatter
3030
import java.time.temporal.ChronoField
3131

@@ -157,14 +157,15 @@ private class LenientOffsetDateTimeDeserializer :
157157
val temporal = formatter.parse(p.text)
158158

159159
return when {
160-
!temporal.isSupported(ChronoField.HOUR_OF_DAY) ->
161-
LocalDate.from(temporal).atStartOfDay()
162-
!temporal.isSupported(ChronoField.OFFSET_SECONDS) ->
163-
LocalDateTime.from(temporal)
164-
else -> ZonedDateTime.from(temporal).toLocalDateTime()
165-
}
166-
.atZone(context.timeZone.toZoneId())
167-
.toOffsetDateTime()
160+
!temporal.isSupported(ChronoField.HOUR_OF_DAY) ->
161+
LocalDate.from(temporal)
162+
.atStartOfDay()
163+
.atZone(ZoneId.of("UTC"))
164+
.toOffsetDateTime()
165+
!temporal.isSupported(ChronoField.OFFSET_SECONDS) ->
166+
LocalDateTime.from(temporal).atZone(ZoneId.of("UTC")).toOffsetDateTime()
167+
else -> OffsetDateTime.from(temporal)
168+
}
168169
} catch (e: DateTimeException) {
169170
exceptions.add(e)
170171
}

cas-parser-java-core/src/main/kotlin/com/cas_parser/api/models/casparser/UnifiedResponse.kt

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11312,7 +11312,15 @@ private constructor(
1131211312
mutableMapOf(),
1131311313
)
1131411314

11315-
/** Additional information specific to the policy */
11315+
/**
11316+
* Additional information specific to the policy
11317+
*
11318+
* This arbitrary value can be deserialized into a custom type using the `convert`
11319+
* method:
11320+
* ```java
11321+
* MyClass myObject = lifeInsurancePolicy.additionalInfo().convert(MyClass.class);
11322+
* ```
11323+
*/
1131611324
@JsonProperty("additional_info")
1131711325
@ExcludeMissing
1131811326
fun _additionalInfo(): JsonValue = additionalInfo
@@ -15959,7 +15967,14 @@ private constructor(
1595915967
@JsonProperty("value") @ExcludeMissing value: JsonField<Float> = JsonMissing.of(),
1596015968
) : this(additionalInfo, cra, funds, linkedHolders, pran, value, mutableMapOf())
1596115969

15962-
/** Additional information specific to the NPS account */
15970+
/**
15971+
* Additional information specific to the NPS account
15972+
*
15973+
* This arbitrary value can be deserialized into a custom type using the `convert` method:
15974+
* ```java
15975+
* MyClass myObject = np.additionalInfo().convert(MyClass.class);
15976+
* ```
15977+
*/
1596315978
@JsonProperty("additional_info")
1596415979
@ExcludeMissing
1596515980
fun _additionalInfo(): JsonValue = additionalInfo

cas-parser-java-core/src/test/kotlin/com/cas_parser/api/core/ObjectMappersTest.kt

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ package com.cas_parser.api.core
33
import com.fasterxml.jackson.annotation.JsonProperty
44
import com.fasterxml.jackson.databind.exc.MismatchedInputException
55
import com.fasterxml.jackson.module.kotlin.readValue
6+
import java.time.LocalDate
7+
import java.time.LocalTime
68
import java.time.OffsetDateTime
9+
import java.time.ZoneOffset
710
import kotlin.reflect.KClass
811
import org.assertj.core.api.Assertions.assertThat
912
import org.assertj.core.api.Assertions.catchThrowable
1013
import org.junit.jupiter.api.Test
11-
import org.junit.jupiter.api.assertDoesNotThrow
1214
import org.junit.jupiter.params.ParameterizedTest
1315
import org.junit.jupiter.params.provider.EnumSource
1416
import org.junitpioneer.jupiter.cartesian.CartesianTest
@@ -72,11 +74,34 @@ internal class ObjectMappersTest {
7274
}
7375
}
7476

75-
enum class LenientOffsetDateTimeTestCase(val string: String) {
76-
DATE("1998-04-21"),
77-
DATE_TIME("1998-04-21T04:00:00"),
78-
ZONED_DATE_TIME_1("1998-04-21T04:00:00+03:00"),
79-
ZONED_DATE_TIME_2("1998-04-21T04:00:00Z"),
77+
enum class LenientOffsetDateTimeTestCase(
78+
val string: String,
79+
val expectedOffsetDateTime: OffsetDateTime,
80+
) {
81+
DATE(
82+
"1998-04-21",
83+
expectedOffsetDateTime =
84+
OffsetDateTime.of(LocalDate.of(1998, 4, 21), LocalTime.of(0, 0), ZoneOffset.UTC),
85+
),
86+
DATE_TIME(
87+
"1998-04-21T04:00:00",
88+
expectedOffsetDateTime =
89+
OffsetDateTime.of(LocalDate.of(1998, 4, 21), LocalTime.of(4, 0), ZoneOffset.UTC),
90+
),
91+
ZONED_DATE_TIME_1(
92+
"1998-04-21T04:00:00+03:00",
93+
expectedOffsetDateTime =
94+
OffsetDateTime.of(
95+
LocalDate.of(1998, 4, 21),
96+
LocalTime.of(4, 0),
97+
ZoneOffset.ofHours(3),
98+
),
99+
),
100+
ZONED_DATE_TIME_2(
101+
"1998-04-21T04:00:00Z",
102+
expectedOffsetDateTime =
103+
OffsetDateTime.of(LocalDate.of(1998, 4, 21), LocalTime.of(4, 0), ZoneOffset.UTC),
104+
),
80105
}
81106

82107
@ParameterizedTest
@@ -85,6 +110,8 @@ internal class ObjectMappersTest {
85110
val jsonMapper = jsonMapper()
86111
val json = jsonMapper.writeValueAsString(testCase.string)
87112

88-
assertDoesNotThrow { jsonMapper().readValue<OffsetDateTime>(json) }
113+
val offsetDateTime = jsonMapper().readValue<OffsetDateTime>(json)
114+
115+
assertThat(offsetDateTime).isEqualTo(testCase.expectedOffsetDateTime)
89116
}
90117
}

scripts/build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ set -e
55
cd "$(dirname "$0")/.."
66

77
echo "==> Building classes"
8-
./gradlew build testClasses -x test
8+
./gradlew build testClasses "$@" -x test

scripts/upload-artifacts

Lines changed: 59 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,23 +96,77 @@ generate_instructions() {
9696
<h1>Stainless SDK Maven Repository</h1>
9797
<p>This is the Maven repository for your Stainless Java SDK build.</p>
9898
99-
<h1>Directions</h1>
100-
<p>To use the uploaded Maven repository, add the following to your project's <code>pom.xml</code>:</p>
99+
<h2>Project configuration</h2>
100+
101+
<p>The details depend on whether you're using Maven or Gradle as your build tool.</p>
102+
103+
<h3>Maven</h3>
104+
105+
<p>Add the following to your project's <code>pom.xml</code>:</p>
106+
<pre>&lt;repositories&gt;
107+
&lt;repository&gt;
108+
&lt;id&gt;stainless-sdk-repo&lt;/id&gt;
109+
&lt;url&gt;https://pkg.stainless.com/s/${PROJECT}/${SHA}/mvn&lt;/url&gt;
110+
&lt;/repository&gt;
111+
&lt;/repositories&gt;</pre>
112+
113+
<h3>Gradle</h3>
114+
<p>Add the following to your <code>build.gradle</code> file:</p>
115+
<pre>repositories {
116+
maven {
117+
url "https://pkg.stainless.com/s/${PROJECT}/${SHA}/mvn"
118+
}
119+
}</pre>
120+
121+
<details>
122+
<summary><h3 style="display:inline-block">Configuring authentication (if required)<h3></summary>
123+
124+
<p>Some accounts may require authentication to access the repository. If so, use the
125+
following instructions, replacing <code>YOUR_STAINLESS_API_TOKEN</code> with your actual token.</p>
126+
127+
<h3>Maven with authentication</h3>
128+
129+
<p>First, ensure you have the following in your Maven <code>settings.xml</code> for repo authentication:</p>
130+
<pre>&lt;servers&gt;
131+
&lt;server&gt;
132+
&lt;id&gt;stainless-sdk-repo&lt;/id&gt;
133+
&lt;configuration&gt;
134+
&lt;httpHeaders&gt;
135+
&lt;property&gt;
136+
&lt;name&gt;Authorization&lt;/name&gt;
137+
&lt;value&gt;Bearer YOUR_STAINLESS_API_TOKEN&lt;/value&gt;
138+
&lt;/property&gt;
139+
&lt;/httpHeaders&gt;
140+
&lt;/configuration&gt;
141+
&lt;/server&gt;
142+
&lt;/servers&gt;</pre>
143+
144+
<p>Then, add the following to your project's <code>pom.xml</code>:</p>
101145
<pre>&lt;repositories&gt;
102146
&lt;repository&gt;
103147
&lt;id&gt;stainless-sdk-repo&lt;/id&gt;
104148
&lt;url&gt;https://pkg.stainless.com/s/${PROJECT}/${SHA}/mvn&lt;/url&gt;
105149
&lt;/repository&gt;
106150
&lt;/repositories&gt;</pre>
107151
108-
<p>If you're using Gradle, add the following to your <code>build.gradle</code> file:</p>
152+
<h3>Gradle with authentication</h3>
153+
<p>Add the following to your <code>build.gradle</code> file:</p>
109154
<pre>repositories {
110155
maven {
111-
url 'https://pkg.stainless.com/s/${PROJECT}/${SHA}/mvn'
156+
url "https://pkg.stainless.com/s/${PROJECT}/${SHA}/mvn"
157+
credentials(HttpHeaderCredentials) {
158+
name = "Authorization"
159+
value = "Bearer YOUR_STAINLESS_API_TOKEN"
160+
}
161+
authentication {
162+
header(HttpHeaderAuthentication)
163+
}
112164
}
113165
}</pre>
166+
</details>
114167
115-
<p>Once you've added the repository, you can include dependencies from it as usual. See your
168+
<h2>Using the repository</h2>
169+
<p>Once you've configured the repository, you can include dependencies from it as usual. See your
116170
<a href="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/blob/${GITHUB_SHA}/README.md">project README</a>
117171
for more details.</p>
118172
</body>

0 commit comments

Comments
 (0)