Skip to content

Commit 493d5e9

Browse files
feat(api): manual updates
1 parent cd63979 commit 493d5e9

15 files changed

Lines changed: 2005 additions & 2 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 102
1+
configured_endpoints: 103
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/langsmith%2Flangsmith-api-bc1f302915c4d87fd6fc962d3789ae714d63b9f2164e3ef512a7be94cf0a2643.yml
33
openapi_spec_hash: 02460db53e7a9603d3d9b554e3589fa4
4-
config_hash: 8e34bc27e4a132caa784cf9ec62cc4d0
4+
config_hash: c217b34d458f1b65f260715693d447f9
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
// File generated from our OpenAPI spec by Stainless.
2+
3+
package com.langchain.smith.models.sessions.insights
4+
5+
import com.langchain.smith.core.AutoPager
6+
import com.langchain.smith.core.Page
7+
import com.langchain.smith.core.checkRequired
8+
import com.langchain.smith.services.blocking.sessions.InsightService
9+
import java.util.Objects
10+
import kotlin.jvm.optionals.getOrDefault
11+
import kotlin.jvm.optionals.getOrNull
12+
13+
/** @see InsightService.list */
14+
class InsightListPage
15+
private constructor(
16+
private val service: InsightService,
17+
private val params: InsightListParams,
18+
private val response: InsightListPageResponse,
19+
) : Page<InsightListResponse> {
20+
21+
/**
22+
* Delegates to [InsightListPageResponse], but gracefully handles missing data.
23+
*
24+
* @see InsightListPageResponse.clusteringJobs
25+
*/
26+
fun clusteringJobs(): List<InsightListResponse> =
27+
response._clusteringJobs().getOptional("clustering_jobs").getOrNull() ?: emptyList()
28+
29+
override fun items(): List<InsightListResponse> = clusteringJobs()
30+
31+
override fun hasNextPage(): Boolean = items().isNotEmpty()
32+
33+
fun nextPageParams(): InsightListParams {
34+
val offset = params.offset().getOrDefault(0)
35+
return params.toBuilder().offset(offset + items().size).build()
36+
}
37+
38+
override fun nextPage(): InsightListPage = service.list(nextPageParams())
39+
40+
fun autoPager(): AutoPager<InsightListResponse> = AutoPager.from(this)
41+
42+
/** The parameters that were used to request this page. */
43+
fun params(): InsightListParams = params
44+
45+
/** The response that this page was parsed from. */
46+
fun response(): InsightListPageResponse = response
47+
48+
fun toBuilder() = Builder().from(this)
49+
50+
companion object {
51+
52+
/**
53+
* Returns a mutable builder for constructing an instance of [InsightListPage].
54+
*
55+
* The following fields are required:
56+
* ```java
57+
* .service()
58+
* .params()
59+
* .response()
60+
* ```
61+
*/
62+
@JvmStatic fun builder() = Builder()
63+
}
64+
65+
/** A builder for [InsightListPage]. */
66+
class Builder internal constructor() {
67+
68+
private var service: InsightService? = null
69+
private var params: InsightListParams? = null
70+
private var response: InsightListPageResponse? = null
71+
72+
@JvmSynthetic
73+
internal fun from(insightListPage: InsightListPage) = apply {
74+
service = insightListPage.service
75+
params = insightListPage.params
76+
response = insightListPage.response
77+
}
78+
79+
fun service(service: InsightService) = apply { this.service = service }
80+
81+
/** The parameters that were used to request this page. */
82+
fun params(params: InsightListParams) = apply { this.params = params }
83+
84+
/** The response that this page was parsed from. */
85+
fun response(response: InsightListPageResponse) = apply { this.response = response }
86+
87+
/**
88+
* Returns an immutable instance of [InsightListPage].
89+
*
90+
* Further updates to this [Builder] will not mutate the returned instance.
91+
*
92+
* The following fields are required:
93+
* ```java
94+
* .service()
95+
* .params()
96+
* .response()
97+
* ```
98+
*
99+
* @throws IllegalStateException if any required field is unset.
100+
*/
101+
fun build(): InsightListPage =
102+
InsightListPage(
103+
checkRequired("service", service),
104+
checkRequired("params", params),
105+
checkRequired("response", response),
106+
)
107+
}
108+
109+
override fun equals(other: Any?): Boolean {
110+
if (this === other) {
111+
return true
112+
}
113+
114+
return other is InsightListPage &&
115+
service == other.service &&
116+
params == other.params &&
117+
response == other.response
118+
}
119+
120+
override fun hashCode(): Int = Objects.hash(service, params, response)
121+
122+
override fun toString() =
123+
"InsightListPage{service=$service, params=$params, response=$response}"
124+
}
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
// File generated from our OpenAPI spec by Stainless.
2+
3+
package com.langchain.smith.models.sessions.insights
4+
5+
import com.langchain.smith.core.AutoPagerAsync
6+
import com.langchain.smith.core.PageAsync
7+
import com.langchain.smith.core.checkRequired
8+
import com.langchain.smith.services.async.sessions.InsightServiceAsync
9+
import java.util.Objects
10+
import java.util.concurrent.CompletableFuture
11+
import java.util.concurrent.Executor
12+
import kotlin.jvm.optionals.getOrDefault
13+
import kotlin.jvm.optionals.getOrNull
14+
15+
/** @see InsightServiceAsync.list */
16+
class InsightListPageAsync
17+
private constructor(
18+
private val service: InsightServiceAsync,
19+
private val streamHandlerExecutor: Executor,
20+
private val params: InsightListParams,
21+
private val response: InsightListPageResponse,
22+
) : PageAsync<InsightListResponse> {
23+
24+
/**
25+
* Delegates to [InsightListPageResponse], but gracefully handles missing data.
26+
*
27+
* @see InsightListPageResponse.clusteringJobs
28+
*/
29+
fun clusteringJobs(): List<InsightListResponse> =
30+
response._clusteringJobs().getOptional("clustering_jobs").getOrNull() ?: emptyList()
31+
32+
override fun items(): List<InsightListResponse> = clusteringJobs()
33+
34+
override fun hasNextPage(): Boolean = items().isNotEmpty()
35+
36+
fun nextPageParams(): InsightListParams {
37+
val offset = params.offset().getOrDefault(0)
38+
return params.toBuilder().offset(offset + items().size).build()
39+
}
40+
41+
override fun nextPage(): CompletableFuture<InsightListPageAsync> =
42+
service.list(nextPageParams())
43+
44+
fun autoPager(): AutoPagerAsync<InsightListResponse> =
45+
AutoPagerAsync.from(this, streamHandlerExecutor)
46+
47+
/** The parameters that were used to request this page. */
48+
fun params(): InsightListParams = params
49+
50+
/** The response that this page was parsed from. */
51+
fun response(): InsightListPageResponse = response
52+
53+
fun toBuilder() = Builder().from(this)
54+
55+
companion object {
56+
57+
/**
58+
* Returns a mutable builder for constructing an instance of [InsightListPageAsync].
59+
*
60+
* The following fields are required:
61+
* ```java
62+
* .service()
63+
* .streamHandlerExecutor()
64+
* .params()
65+
* .response()
66+
* ```
67+
*/
68+
@JvmStatic fun builder() = Builder()
69+
}
70+
71+
/** A builder for [InsightListPageAsync]. */
72+
class Builder internal constructor() {
73+
74+
private var service: InsightServiceAsync? = null
75+
private var streamHandlerExecutor: Executor? = null
76+
private var params: InsightListParams? = null
77+
private var response: InsightListPageResponse? = null
78+
79+
@JvmSynthetic
80+
internal fun from(insightListPageAsync: InsightListPageAsync) = apply {
81+
service = insightListPageAsync.service
82+
streamHandlerExecutor = insightListPageAsync.streamHandlerExecutor
83+
params = insightListPageAsync.params
84+
response = insightListPageAsync.response
85+
}
86+
87+
fun service(service: InsightServiceAsync) = apply { this.service = service }
88+
89+
fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply {
90+
this.streamHandlerExecutor = streamHandlerExecutor
91+
}
92+
93+
/** The parameters that were used to request this page. */
94+
fun params(params: InsightListParams) = apply { this.params = params }
95+
96+
/** The response that this page was parsed from. */
97+
fun response(response: InsightListPageResponse) = apply { this.response = response }
98+
99+
/**
100+
* Returns an immutable instance of [InsightListPageAsync].
101+
*
102+
* Further updates to this [Builder] will not mutate the returned instance.
103+
*
104+
* The following fields are required:
105+
* ```java
106+
* .service()
107+
* .streamHandlerExecutor()
108+
* .params()
109+
* .response()
110+
* ```
111+
*
112+
* @throws IllegalStateException if any required field is unset.
113+
*/
114+
fun build(): InsightListPageAsync =
115+
InsightListPageAsync(
116+
checkRequired("service", service),
117+
checkRequired("streamHandlerExecutor", streamHandlerExecutor),
118+
checkRequired("params", params),
119+
checkRequired("response", response),
120+
)
121+
}
122+
123+
override fun equals(other: Any?): Boolean {
124+
if (this === other) {
125+
return true
126+
}
127+
128+
return other is InsightListPageAsync &&
129+
service == other.service &&
130+
streamHandlerExecutor == other.streamHandlerExecutor &&
131+
params == other.params &&
132+
response == other.response
133+
}
134+
135+
override fun hashCode(): Int = Objects.hash(service, streamHandlerExecutor, params, response)
136+
137+
override fun toString() =
138+
"InsightListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}"
139+
}

0 commit comments

Comments
 (0)