Skip to content

Commit 07db616

Browse files
feat(api): manual updates
1 parent 3cf2073 commit 07db616

22 files changed

+229
-1464
lines changed

.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-e6a9dca1a93568e403ac72128d86f30c8c3f1336d4b67017d7e61b1836f10f47.yml
3-
openapi_spec_hash: ef01e0649bb0e283df0aa81c369649df
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-d571232203ef4e00986a3245224267db6f8aaffdad57780f712e0694dc8d9e37.yml
3+
openapi_spec_hash: d5d635dd7b24a2e1255c6f2a895253ff
44
config_hash: 88e87ba7021be93d267ecfc8f5e6b891

buildSrc/src/main/kotlin/stagehand.publish.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ configure<PublishingExtension> {
1010

1111
pom {
1212
name.set("Stagehand API")
13-
description.set("Stagehand SDK for AI browser automation [ALPHA].")
13+
description.set("Stagehand SDK for AI browser automation [ALPHA]. This API allows clients to\nexecute browser automation tasks remotely on the Browserbase cloud.\n\nAll endpoints except /sessions/start require an active session ID. Responses are\nstreamed using Server-Sent Events (SSE) when the `x-stream-response: true`\nheader is provided.\n\nThis SDK is currently ALPHA software and is not production ready! Please try it\nand give us your feedback, stay tuned for upcoming release announcements!")
1414
url.set("https://docs.stagehand.dev")
1515

1616
licenses {

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

Lines changed: 13 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
package com.browserbase.api.models.sessions
44

5-
import com.browserbase.api.core.Enum
65
import com.browserbase.api.core.ExcludeMissing
76
import com.browserbase.api.core.JsonField
87
import com.browserbase.api.core.JsonMissing
@@ -24,14 +23,14 @@ class SessionActResponse
2423
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
2524
private constructor(
2625
private val data: JsonField<Data>,
27-
private val success: JsonField<Success>,
26+
private val success: JsonField<Boolean>,
2827
private val additionalProperties: MutableMap<String, JsonValue>,
2928
) {
3029

3130
@JsonCreator
3231
private constructor(
3332
@JsonProperty("data") @ExcludeMissing data: JsonField<Data> = JsonMissing.of(),
34-
@JsonProperty("success") @ExcludeMissing success: JsonField<Success> = JsonMissing.of(),
33+
@JsonProperty("success") @ExcludeMissing success: JsonField<Boolean> = JsonMissing.of(),
3534
) : this(data, success, mutableMapOf())
3635

3736
/**
@@ -41,10 +40,12 @@ private constructor(
4140
fun data(): Data = data.getRequired("data")
4241

4342
/**
43+
* Indicates whether the request was successful
44+
*
4445
* @throws StagehandInvalidDataException if the JSON field has an unexpected type or is
4546
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
4647
*/
47-
fun success(): Success = success.getRequired("success")
48+
fun success(): Boolean = success.getRequired("success")
4849

4950
/**
5051
* Returns the raw JSON value of [data].
@@ -58,7 +59,7 @@ private constructor(
5859
*
5960
* Unlike [success], this method doesn't throw if the JSON field has an unexpected type.
6061
*/
61-
@JsonProperty("success") @ExcludeMissing fun _success(): JsonField<Success> = success
62+
@JsonProperty("success") @ExcludeMissing fun _success(): JsonField<Boolean> = success
6263

6364
@JsonAnySetter
6465
private fun putAdditionalProperty(key: String, value: JsonValue) {
@@ -90,7 +91,7 @@ private constructor(
9091
class Builder internal constructor() {
9192

9293
private var data: JsonField<Data>? = null
93-
private var success: JsonField<Success>? = null
94+
private var success: JsonField<Boolean>? = null
9495
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
9596

9697
@JvmSynthetic
@@ -110,15 +111,16 @@ private constructor(
110111
*/
111112
fun data(data: JsonField<Data>) = apply { this.data = data }
112113

113-
fun success(success: Success) = success(JsonField.of(success))
114+
/** Indicates whether the request was successful */
115+
fun success(success: Boolean) = success(JsonField.of(success))
114116

115117
/**
116118
* Sets [Builder.success] to an arbitrary JSON value.
117119
*
118-
* You should usually call [Builder.success] with a well-typed [Success] value instead. This
120+
* You should usually call [Builder.success] with a well-typed [Boolean] value instead. This
119121
* method is primarily for setting the field to an undocumented or not yet supported value.
120122
*/
121-
fun success(success: JsonField<Success>) = apply { this.success = success }
123+
fun success(success: JsonField<Boolean>) = apply { this.success = success }
122124

123125
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
124126
this.additionalProperties.clear()
@@ -168,7 +170,7 @@ private constructor(
168170
}
169171

170172
data().validate()
171-
success().validate()
173+
success()
172174
validated = true
173175
}
174176

@@ -187,8 +189,7 @@ private constructor(
187189
*/
188190
@JvmSynthetic
189191
internal fun validity(): Int =
190-
(data.asKnown().getOrNull()?.validity() ?: 0) +
191-
(success.asKnown().getOrNull()?.validity() ?: 0)
192+
(data.asKnown().getOrNull()?.validity() ?: 0) + (if (success.asKnown().isPresent) 1 else 0)
192193

193194
class Data
194195
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
@@ -690,124 +691,6 @@ private constructor(
690691
"Data{result=$result, actionId=$actionId, additionalProperties=$additionalProperties}"
691692
}
692693

693-
class Success @JsonCreator private constructor(private val value: JsonField<Boolean>) : Enum {
694-
695-
/**
696-
* Returns this class instance's raw value.
697-
*
698-
* This is usually only useful if this instance was deserialized from data that doesn't
699-
* match any known member, and you want to know that value. For example, if the SDK is on an
700-
* older version than the API, then the API may respond with new members that the SDK is
701-
* unaware of.
702-
*/
703-
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<Boolean> = value
704-
705-
companion object {
706-
707-
@JvmField val TRUE = of(true)
708-
709-
@JvmStatic fun of(value: Boolean) = Success(JsonField.of(value))
710-
}
711-
712-
/** An enum containing [Success]'s known values. */
713-
enum class Known {
714-
TRUE
715-
}
716-
717-
/**
718-
* An enum containing [Success]'s known values, as well as an [_UNKNOWN] member.
719-
*
720-
* An instance of [Success] can contain an unknown value in a couple of cases:
721-
* - It was deserialized from data that doesn't match any known member. For example, if the
722-
* SDK is on an older version than the API, then the API may respond with new members that
723-
* the SDK is unaware of.
724-
* - It was constructed with an arbitrary value using the [of] method.
725-
*/
726-
enum class Value {
727-
TRUE,
728-
/** An enum member indicating that [Success] was instantiated with an unknown value. */
729-
_UNKNOWN,
730-
}
731-
732-
/**
733-
* Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
734-
* if the class was instantiated with an unknown value.
735-
*
736-
* Use the [known] method instead if you're certain the value is always known or if you want
737-
* to throw for the unknown case.
738-
*/
739-
fun value(): Value =
740-
when (this) {
741-
TRUE -> Value.TRUE
742-
else -> Value._UNKNOWN
743-
}
744-
745-
/**
746-
* Returns an enum member corresponding to this class instance's value.
747-
*
748-
* Use the [value] method instead if you're uncertain the value is always known and don't
749-
* want to throw for the unknown case.
750-
*
751-
* @throws StagehandInvalidDataException if this class instance's value is a not a known
752-
* member.
753-
*/
754-
fun known(): Known =
755-
when (this) {
756-
TRUE -> Known.TRUE
757-
else -> throw StagehandInvalidDataException("Unknown Success: $value")
758-
}
759-
760-
/**
761-
* Returns this class instance's primitive wire representation.
762-
*
763-
* @throws StagehandInvalidDataException if this class instance's value does not have the
764-
* expected primitive type.
765-
*/
766-
fun asBoolean(): Boolean =
767-
_value().asBoolean().orElseThrow {
768-
StagehandInvalidDataException("Value is not a Boolean")
769-
}
770-
771-
private var validated: Boolean = false
772-
773-
fun validate(): Success = apply {
774-
if (validated) {
775-
return@apply
776-
}
777-
778-
known()
779-
validated = true
780-
}
781-
782-
fun isValid(): Boolean =
783-
try {
784-
validate()
785-
true
786-
} catch (e: StagehandInvalidDataException) {
787-
false
788-
}
789-
790-
/**
791-
* Returns a score indicating how many valid values are contained in this object
792-
* recursively.
793-
*
794-
* Used for best match union deserialization.
795-
*/
796-
@JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
797-
798-
override fun equals(other: Any?): Boolean {
799-
if (this === other) {
800-
return true
801-
}
802-
803-
return other is Success && value == other.value
804-
}
805-
806-
override fun hashCode() = value.hashCode()
807-
808-
override fun toString() = value.toString()
809-
}
810-
811694
override fun equals(other: Any?): Boolean {
812695
if (this === other) {
813696
return true

0 commit comments

Comments
 (0)