Skip to content

Commit 2690cf4

Browse files
feat: Removed requiring x-language and x-sdk-version from openapi spec
1 parent b67a0d6 commit 2690cf4

19 files changed

Lines changed: 16 additions & 1378 deletions

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 7
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-39cd9547d16412cf0568f6ce2ad8d43805dffe65bde830beeff630b903ae3b38.yml
3-
openapi_spec_hash: 9cd7c9fefa686f9711392782d948470f
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-1705ff86e7ec80d6be2ddbb0e3cbee821f3e95d68fa6a48c790f586e3470e678.yml
3+
openapi_spec_hash: cf0d4dad078a7f7c1256b437e349b911
44
config_hash: 3c21550e2c94cad4339d3093d794beb0

stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionActParams.kt

Lines changed: 2 additions & 177 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ import kotlin.jvm.optionals.getOrNull
3939
class SessionActParams
4040
private constructor(
4141
private val id: String?,
42-
private val xLanguage: XLanguage?,
43-
private val xSdkVersion: String?,
4442
private val xSentAt: OffsetDateTime?,
4543
private val xStreamResponse: XStreamResponse?,
4644
private val body: Body,
@@ -51,12 +49,6 @@ private constructor(
5149
/** Unique session identifier */
5250
fun id(): Optional<String> = Optional.ofNullable(id)
5351

54-
/** Client SDK language */
55-
fun xLanguage(): Optional<XLanguage> = Optional.ofNullable(xLanguage)
56-
57-
/** Version of the Stagehand SDK */
58-
fun xSdkVersion(): Optional<String> = Optional.ofNullable(xSdkVersion)
59-
6052
/** ISO timestamp when request was sent */
6153
fun xSentAt(): Optional<OffsetDateTime> = Optional.ofNullable(xSentAt)
6254

@@ -133,8 +125,6 @@ private constructor(
133125
class Builder internal constructor() {
134126

135127
private var id: String? = null
136-
private var xLanguage: XLanguage? = null
137-
private var xSdkVersion: String? = null
138128
private var xSentAt: OffsetDateTime? = null
139129
private var xStreamResponse: XStreamResponse? = null
140130
private var body: Body.Builder = Body.builder()
@@ -144,8 +134,6 @@ private constructor(
144134
@JvmSynthetic
145135
internal fun from(sessionActParams: SessionActParams) = apply {
146136
id = sessionActParams.id
147-
xLanguage = sessionActParams.xLanguage
148-
xSdkVersion = sessionActParams.xSdkVersion
149137
xSentAt = sessionActParams.xSentAt
150138
xStreamResponse = sessionActParams.xStreamResponse
151139
body = sessionActParams.body.toBuilder()
@@ -159,18 +147,6 @@ private constructor(
159147
/** Alias for calling [Builder.id] with `id.orElse(null)`. */
160148
fun id(id: Optional<String>) = id(id.getOrNull())
161149

162-
/** Client SDK language */
163-
fun xLanguage(xLanguage: XLanguage?) = apply { this.xLanguage = xLanguage }
164-
165-
/** Alias for calling [Builder.xLanguage] with `xLanguage.orElse(null)`. */
166-
fun xLanguage(xLanguage: Optional<XLanguage>) = xLanguage(xLanguage.getOrNull())
167-
168-
/** Version of the Stagehand SDK */
169-
fun xSdkVersion(xSdkVersion: String?) = apply { this.xSdkVersion = xSdkVersion }
170-
171-
/** Alias for calling [Builder.xSdkVersion] with `xSdkVersion.orElse(null)`. */
172-
fun xSdkVersion(xSdkVersion: Optional<String>) = xSdkVersion(xSdkVersion.getOrNull())
173-
174150
/** ISO timestamp when request was sent */
175151
fun xSentAt(xSentAt: OffsetDateTime?) = apply { this.xSentAt = xSentAt }
176152

@@ -367,8 +343,6 @@ private constructor(
367343
fun build(): SessionActParams =
368344
SessionActParams(
369345
id,
370-
xLanguage,
371-
xSdkVersion,
372346
xSentAt,
373347
xStreamResponse,
374348
body.build(),
@@ -388,8 +362,6 @@ private constructor(
388362
override fun _headers(): Headers =
389363
Headers.builder()
390364
.apply {
391-
xLanguage?.let { put("x-language", it.toString()) }
392-
xSdkVersion?.let { put("x-sdk-version", it) }
393365
xSentAt?.let { put("x-sent-at", DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) }
394366
xStreamResponse?.let { put("x-stream-response", it.toString()) }
395367
putAll(additionalHeaders)
@@ -1142,142 +1114,6 @@ private constructor(
11421114
"Options{model=$model, timeout=$timeout, variables=$variables, additionalProperties=$additionalProperties}"
11431115
}
11441116

1145-
/** Client SDK language */
1146-
class XLanguage @JsonCreator private constructor(private val value: JsonField<String>) : Enum {
1147-
1148-
/**
1149-
* Returns this class instance's raw value.
1150-
*
1151-
* This is usually only useful if this instance was deserialized from data that doesn't
1152-
* match any known member, and you want to know that value. For example, if the SDK is on an
1153-
* older version than the API, then the API may respond with new members that the SDK is
1154-
* unaware of.
1155-
*/
1156-
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value
1157-
1158-
companion object {
1159-
1160-
@JvmField val TYPESCRIPT = of("typescript")
1161-
1162-
@JvmField val PYTHON = of("python")
1163-
1164-
@JvmField val PLAYGROUND = of("playground")
1165-
1166-
@JvmStatic fun of(value: String) = XLanguage(JsonField.of(value))
1167-
}
1168-
1169-
/** An enum containing [XLanguage]'s known values. */
1170-
enum class Known {
1171-
TYPESCRIPT,
1172-
PYTHON,
1173-
PLAYGROUND,
1174-
}
1175-
1176-
/**
1177-
* An enum containing [XLanguage]'s known values, as well as an [_UNKNOWN] member.
1178-
*
1179-
* An instance of [XLanguage] can contain an unknown value in a couple of cases:
1180-
* - It was deserialized from data that doesn't match any known member. For example, if the
1181-
* SDK is on an older version than the API, then the API may respond with new members that
1182-
* the SDK is unaware of.
1183-
* - It was constructed with an arbitrary value using the [of] method.
1184-
*/
1185-
enum class Value {
1186-
TYPESCRIPT,
1187-
PYTHON,
1188-
PLAYGROUND,
1189-
/**
1190-
* An enum member indicating that [XLanguage] was instantiated with an unknown value.
1191-
*/
1192-
_UNKNOWN,
1193-
}
1194-
1195-
/**
1196-
* Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
1197-
* if the class was instantiated with an unknown value.
1198-
*
1199-
* Use the [known] method instead if you're certain the value is always known or if you want
1200-
* to throw for the unknown case.
1201-
*/
1202-
fun value(): Value =
1203-
when (this) {
1204-
TYPESCRIPT -> Value.TYPESCRIPT
1205-
PYTHON -> Value.PYTHON
1206-
PLAYGROUND -> Value.PLAYGROUND
1207-
else -> Value._UNKNOWN
1208-
}
1209-
1210-
/**
1211-
* Returns an enum member corresponding to this class instance's value.
1212-
*
1213-
* Use the [value] method instead if you're uncertain the value is always known and don't
1214-
* want to throw for the unknown case.
1215-
*
1216-
* @throws StagehandInvalidDataException if this class instance's value is a not a known
1217-
* member.
1218-
*/
1219-
fun known(): Known =
1220-
when (this) {
1221-
TYPESCRIPT -> Known.TYPESCRIPT
1222-
PYTHON -> Known.PYTHON
1223-
PLAYGROUND -> Known.PLAYGROUND
1224-
else -> throw StagehandInvalidDataException("Unknown XLanguage: $value")
1225-
}
1226-
1227-
/**
1228-
* Returns this class instance's primitive wire representation.
1229-
*
1230-
* This differs from the [toString] method because that method is primarily for debugging
1231-
* and generally doesn't throw.
1232-
*
1233-
* @throws StagehandInvalidDataException if this class instance's value does not have the
1234-
* expected primitive type.
1235-
*/
1236-
fun asString(): String =
1237-
_value().asString().orElseThrow {
1238-
StagehandInvalidDataException("Value is not a String")
1239-
}
1240-
1241-
private var validated: Boolean = false
1242-
1243-
fun validate(): XLanguage = apply {
1244-
if (validated) {
1245-
return@apply
1246-
}
1247-
1248-
known()
1249-
validated = true
1250-
}
1251-
1252-
fun isValid(): Boolean =
1253-
try {
1254-
validate()
1255-
true
1256-
} catch (e: StagehandInvalidDataException) {
1257-
false
1258-
}
1259-
1260-
/**
1261-
* Returns a score indicating how many valid values are contained in this object
1262-
* recursively.
1263-
*
1264-
* Used for best match union deserialization.
1265-
*/
1266-
@JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
1267-
1268-
override fun equals(other: Any?): Boolean {
1269-
if (this === other) {
1270-
return true
1271-
}
1272-
1273-
return other is XLanguage && value == other.value
1274-
}
1275-
1276-
override fun hashCode() = value.hashCode()
1277-
1278-
override fun toString() = value.toString()
1279-
}
1280-
12811117
/** Whether to stream the response via SSE */
12821118
class XStreamResponse @JsonCreator private constructor(private val value: JsonField<String>) :
12831119
Enum {
@@ -1417,8 +1253,6 @@ private constructor(
14171253

14181254
return other is SessionActParams &&
14191255
id == other.id &&
1420-
xLanguage == other.xLanguage &&
1421-
xSdkVersion == other.xSdkVersion &&
14221256
xSentAt == other.xSentAt &&
14231257
xStreamResponse == other.xStreamResponse &&
14241258
body == other.body &&
@@ -1427,17 +1261,8 @@ private constructor(
14271261
}
14281262

14291263
override fun hashCode(): Int =
1430-
Objects.hash(
1431-
id,
1432-
xLanguage,
1433-
xSdkVersion,
1434-
xSentAt,
1435-
xStreamResponse,
1436-
body,
1437-
additionalHeaders,
1438-
additionalQueryParams,
1439-
)
1264+
Objects.hash(id, xSentAt, xStreamResponse, body, additionalHeaders, additionalQueryParams)
14401265

14411266
override fun toString() =
1442-
"SessionActParams{id=$id, xLanguage=$xLanguage, xSdkVersion=$xSdkVersion, xSentAt=$xSentAt, xStreamResponse=$xStreamResponse, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
1267+
"SessionActParams{id=$id, xSentAt=$xSentAt, xStreamResponse=$xStreamResponse, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
14431268
}

0 commit comments

Comments
 (0)