Skip to content

Commit 1c7a4f1

Browse files
feat(api): api update
1 parent 2e6c34f commit 1c7a4f1

File tree

17 files changed

+429
-58
lines changed

17 files changed

+429
-58
lines changed

.github/workflows/ci.yml

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ jobs:
2020
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
2121

2222
steps:
23-
- uses: actions/checkout@v4
23+
- uses: actions/checkout@v6
2424

2525
- name: Set up Java
26-
uses: actions/setup-java@v4
26+
uses: actions/setup-java@v5
2727
with:
2828
distribution: temurin
2929
java-version: |
@@ -40,14 +40,17 @@ jobs:
4040
build:
4141
timeout-minutes: 15
4242
name: build
43+
permissions:
44+
contents: read
45+
id-token: write
4346
runs-on: ${{ github.repository == 'stainless-sdks/cas-parser-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
4447
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
4548

4649
steps:
47-
- uses: actions/checkout@v4
50+
- uses: actions/checkout@v6
4851

4952
- name: Set up Java
50-
uses: actions/setup-java@v4
53+
uses: actions/setup-java@v5
5154
with:
5255
distribution: temurin
5356
java-version: |
@@ -61,16 +64,31 @@ jobs:
6164
- name: Build SDK
6265
run: ./scripts/build
6366

67+
- name: Get GitHub OIDC Token
68+
if: github.repository == 'stainless-sdks/cas-parser-java'
69+
id: github-oidc
70+
uses: actions/github-script@v6
71+
with:
72+
script: core.setOutput('github_token', await core.getIDToken());
73+
74+
- name: Build and upload Maven artifacts
75+
if: github.repository == 'stainless-sdks/cas-parser-java'
76+
env:
77+
URL: https://pkg.stainless.com/s
78+
AUTH: ${{ steps.github-oidc.outputs.github_token }}
79+
SHA: ${{ github.sha }}
80+
PROJECT: cas-parser-java
81+
run: ./scripts/upload-artifacts
6482
test:
6583
timeout-minutes: 15
6684
name: test
6785
runs-on: ${{ github.repository == 'stainless-sdks/cas-parser-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
6886
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
6987
steps:
70-
- uses: actions/checkout@v4
88+
- uses: actions/checkout@v6
7189

7290
- name: Set up Java
73-
uses: actions/setup-java@v4
91+
uses: actions/setup-java@v5
7492
with:
7593
distribution: temurin
7694
java-version: |

.github/workflows/publish-sonatype.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ jobs:
1414
runs-on: ubuntu-latest
1515

1616
steps:
17-
- uses: actions/checkout@v4
17+
- uses: actions/checkout@v6
1818

1919
- name: Set up Java
20-
uses: actions/setup-java@v4
20+
uses: actions/setup-java@v5
2121
with:
2222
distribution: temurin
2323
java-version: |

.github/workflows/release-doctor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
if: github.repository == 'CASParser/cas-parser-java' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')
1313

1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@v6
1616

1717
- name: Check release environment
1818
run: |

.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-7e6397bddc220d1a59b5e2c7e7c3ff38f1a6eb174f4e383e03bc49cf78c8c44f.yml
3-
openapi_spec_hash: cb852eeb4ce89c80f4246815cbe21f72
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cas-parser%2Fcas-parser-ce2296c4b14d27c141bb2745607d2456c923fdca3ae0a0a0800c26e564333850.yml
3+
openapi_spec_hash: 8eb586ccf16b534c0c15ff6a22274c7d
44
config_hash: cb5d75abef6264b5d86448caf7295afa

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ The Cas Parser Java SDK provides convenient access to the [Cas Parser REST API](
1111

1212
It is generated with [Stainless](https://www.stainless.com/).
1313

14+
## MCP Server
15+
16+
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.
17+
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)
20+
21+
> Note: You may need to set environment variables in your MCP client.
22+
1423
<!-- x-release-please-start-version -->
1524

1625
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).
@@ -274,6 +283,8 @@ If the SDK threw an exception, but you're _certain_ the version is compatible, t
274283
> [!CAUTION]
275284
> We make no guarantee that the SDK works correctly when the Jackson version check is disabled.
276285
286+
Also note that there are bugs in older Jackson versions that can affect the SDK. We don't work around all Jackson bugs ([example](https://github.com/FasterXML/jackson-databind/issues/3240)) and expect users to upgrade Jackson for those instead.
287+
277288
## Network options
278289

279290
### Retries

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ configure<PublishingExtension> {
4040
}
4141
}
4242
}
43+
repositories {
44+
if (project.hasProperty("publishLocal")) {
45+
maven {
46+
name = "LocalFileSystem"
47+
url = uri("${rootProject.layout.buildDirectory.get()}/local-maven-repo")
48+
}
49+
}
50+
}
4351
}
4452

4553
signing {

cas-parser-java-client-okhttp/src/main/kotlin/com/cas_parser/api/client/okhttp/CasParserOkHttpClient.kt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import java.net.Proxy
1616
import java.time.Clock
1717
import java.time.Duration
1818
import java.util.Optional
19+
import java.util.concurrent.ExecutorService
1920
import javax.net.ssl.HostnameVerifier
2021
import javax.net.ssl.SSLSocketFactory
2122
import javax.net.ssl.X509TrustManager
@@ -44,11 +45,31 @@ class CasParserOkHttpClient private constructor() {
4445
class Builder internal constructor() {
4546

4647
private var clientOptions: ClientOptions.Builder = ClientOptions.builder()
48+
private var dispatcherExecutorService: ExecutorService? = null
4749
private var proxy: Proxy? = null
4850
private var sslSocketFactory: SSLSocketFactory? = null
4951
private var trustManager: X509TrustManager? = null
5052
private var hostnameVerifier: HostnameVerifier? = null
5153

54+
/**
55+
* The executor service to use for running HTTP requests.
56+
*
57+
* Defaults to OkHttp's
58+
* [default executor service](https://github.com/square/okhttp/blob/ace792f443b2ffb17974f5c0d1cecdf589309f26/okhttp/src/commonJvmAndroid/kotlin/okhttp3/Dispatcher.kt#L98-L104).
59+
*
60+
* This class takes ownership of the executor service and shuts it down when closed.
61+
*/
62+
fun dispatcherExecutorService(dispatcherExecutorService: ExecutorService?) = apply {
63+
this.dispatcherExecutorService = dispatcherExecutorService
64+
}
65+
66+
/**
67+
* Alias for calling [Builder.dispatcherExecutorService] with
68+
* `dispatcherExecutorService.orElse(null)`.
69+
*/
70+
fun dispatcherExecutorService(dispatcherExecutorService: Optional<ExecutorService>) =
71+
dispatcherExecutorService(dispatcherExecutorService.getOrNull())
72+
5273
fun proxy(proxy: Proxy?) = apply { this.proxy = proxy }
5374

5475
/** Alias for calling [Builder.proxy] with `proxy.orElse(null)`. */
@@ -297,6 +318,7 @@ class CasParserOkHttpClient private constructor() {
297318
OkHttpClient.builder()
298319
.timeout(clientOptions.timeout())
299320
.proxy(proxy)
321+
.dispatcherExecutorService(dispatcherExecutorService)
300322
.sslSocketFactory(sslSocketFactory)
301323
.trustManager(trustManager)
302324
.hostnameVerifier(hostnameVerifier)

cas-parser-java-client-okhttp/src/main/kotlin/com/cas_parser/api/client/okhttp/CasParserOkHttpClientAsync.kt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import java.net.Proxy
1616
import java.time.Clock
1717
import java.time.Duration
1818
import java.util.Optional
19+
import java.util.concurrent.ExecutorService
1920
import javax.net.ssl.HostnameVerifier
2021
import javax.net.ssl.SSLSocketFactory
2122
import javax.net.ssl.X509TrustManager
@@ -44,11 +45,31 @@ class CasParserOkHttpClientAsync private constructor() {
4445
class Builder internal constructor() {
4546

4647
private var clientOptions: ClientOptions.Builder = ClientOptions.builder()
48+
private var dispatcherExecutorService: ExecutorService? = null
4749
private var proxy: Proxy? = null
4850
private var sslSocketFactory: SSLSocketFactory? = null
4951
private var trustManager: X509TrustManager? = null
5052
private var hostnameVerifier: HostnameVerifier? = null
5153

54+
/**
55+
* The executor service to use for running HTTP requests.
56+
*
57+
* Defaults to OkHttp's
58+
* [default executor service](https://github.com/square/okhttp/blob/ace792f443b2ffb17974f5c0d1cecdf589309f26/okhttp/src/commonJvmAndroid/kotlin/okhttp3/Dispatcher.kt#L98-L104).
59+
*
60+
* This class takes ownership of the executor service and shuts it down when closed.
61+
*/
62+
fun dispatcherExecutorService(dispatcherExecutorService: ExecutorService?) = apply {
63+
this.dispatcherExecutorService = dispatcherExecutorService
64+
}
65+
66+
/**
67+
* Alias for calling [Builder.dispatcherExecutorService] with
68+
* `dispatcherExecutorService.orElse(null)`.
69+
*/
70+
fun dispatcherExecutorService(dispatcherExecutorService: Optional<ExecutorService>) =
71+
dispatcherExecutorService(dispatcherExecutorService.getOrNull())
72+
5273
fun proxy(proxy: Proxy?) = apply { this.proxy = proxy }
5374

5475
/** Alias for calling [Builder.proxy] with `proxy.orElse(null)`. */
@@ -297,6 +318,7 @@ class CasParserOkHttpClientAsync private constructor() {
297318
OkHttpClient.builder()
298319
.timeout(clientOptions.timeout())
299320
.proxy(proxy)
321+
.dispatcherExecutorService(dispatcherExecutorService)
300322
.sslSocketFactory(sslSocketFactory)
301323
.trustManager(trustManager)
302324
.hostnameVerifier(hostnameVerifier)

cas-parser-java-client-okhttp/src/main/kotlin/com/cas_parser/api/client/okhttp/OkHttpClient.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ import java.net.Proxy
1515
import java.time.Duration
1616
import java.util.concurrent.CancellationException
1717
import java.util.concurrent.CompletableFuture
18+
import java.util.concurrent.ExecutorService
1819
import javax.net.ssl.HostnameVerifier
1920
import javax.net.ssl.SSLSocketFactory
2021
import javax.net.ssl.X509TrustManager
2122
import okhttp3.Call
2223
import okhttp3.Callback
24+
import okhttp3.Dispatcher
2325
import okhttp3.HttpUrl.Companion.toHttpUrl
2426
import okhttp3.MediaType
2527
import okhttp3.MediaType.Companion.toMediaType
@@ -198,6 +200,7 @@ private constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClien
198200

199201
private var timeout: Timeout = Timeout.default()
200202
private var proxy: Proxy? = null
203+
private var dispatcherExecutorService: ExecutorService? = null
201204
private var sslSocketFactory: SSLSocketFactory? = null
202205
private var trustManager: X509TrustManager? = null
203206
private var hostnameVerifier: HostnameVerifier? = null
@@ -208,6 +211,10 @@ private constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClien
208211

209212
fun proxy(proxy: Proxy?) = apply { this.proxy = proxy }
210213

214+
fun dispatcherExecutorService(dispatcherExecutorService: ExecutorService?) = apply {
215+
this.dispatcherExecutorService = dispatcherExecutorService
216+
}
217+
211218
fun sslSocketFactory(sslSocketFactory: SSLSocketFactory?) = apply {
212219
this.sslSocketFactory = sslSocketFactory
213220
}
@@ -223,12 +230,16 @@ private constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClien
223230
fun build(): OkHttpClient =
224231
OkHttpClient(
225232
okhttp3.OkHttpClient.Builder()
233+
// `RetryingHttpClient` handles retries if the user enabled them.
234+
.retryOnConnectionFailure(false)
226235
.connectTimeout(timeout.connect())
227236
.readTimeout(timeout.read())
228237
.writeTimeout(timeout.write())
229238
.callTimeout(timeout.request())
230239
.proxy(proxy)
231240
.apply {
241+
dispatcherExecutorService?.let { dispatcher(Dispatcher(it)) }
242+
232243
val sslSocketFactory = sslSocketFactory
233244
val trustManager = trustManager
234245
if (sslSocketFactory != null && trustManager != null) {

cas-parser-java-core/build.gradle.kts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@ plugins {
55

66
configurations.all {
77
resolutionStrategy {
8-
// Compile and test against a lower Jackson version to ensure we're compatible with it.
9-
// We publish with a higher version (see below) to ensure users depend on a secure version by default.
10-
force("com.fasterxml.jackson.core:jackson-core:2.13.4")
11-
force("com.fasterxml.jackson.core:jackson-databind:2.13.4")
12-
force("com.fasterxml.jackson.core:jackson-annotations:2.13.4")
13-
force("com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.13.4")
14-
force("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.13.4")
15-
force("com.fasterxml.jackson.module:jackson-module-kotlin:2.13.4")
8+
// Compile and test against a lower Jackson version to ensure we're compatible with it. Note that
9+
// we generally support 2.13.4, but test against 2.14.0 because 2.13.4 has some annoying (but
10+
// niche) bugs (users should upgrade if they encounter them). We publish with a higher version
11+
// (see below) to ensure users depend on a secure version by default.
12+
force("com.fasterxml.jackson.core:jackson-core:2.14.0")
13+
force("com.fasterxml.jackson.core:jackson-databind:2.14.0")
14+
force("com.fasterxml.jackson.core:jackson-annotations:2.14.0")
15+
force("com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.14.0")
16+
force("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.14.0")
17+
force("com.fasterxml.jackson.module:jackson-module-kotlin:2.14.0")
1618
}
1719
}
1820

0 commit comments

Comments
 (0)