Skip to content

Commit bb94f57

Browse files
feat(api): api update
1 parent 161104e commit bb94f57

4 files changed

Lines changed: 73 additions & 5 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 30
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/arcade-ai%2Farcade-engine-13d86377193e2e23549d605928c608b47324ee6923f2c4e0204b3139e8c383c6.yml
3-
openapi_spec_hash: caf4bb03bc42b9a2ba718a2251f4e5f0
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/arcade-ai%2Farcade-engine-e2406b137c0832ecf581d8fd503dd200e992eaf6eed4c47e5ed2d177ca545021.yml
3+
openapi_spec_hash: d1b41a744c92f5a1d8faa9398e3df446
44
config_hash: bf64816643634a621cd0ffd93d9c4347

arcade-java-core/src/main/kotlin/dev/arcade/models/workers/WorkerResponse.kt

Lines changed: 65 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import dev.arcade.core.ExcludeMissing
1111
import dev.arcade.core.JsonField
1212
import dev.arcade.core.JsonMissing
1313
import dev.arcade.core.JsonValue
14+
import dev.arcade.core.checkKnown
1415
import dev.arcade.core.toImmutable
1516
import dev.arcade.errors.ArcadeInvalidDataException
1617
import java.util.Collections
@@ -1683,6 +1684,7 @@ private constructor(
16831684
private val clientId: JsonField<String>,
16841685
private val clientSecret: JsonField<ClientSecret>,
16851686
private val redirectUri: JsonField<String>,
1687+
private val supportedScopes: JsonField<List<String>>,
16861688
private val additionalProperties: MutableMap<String, JsonValue>,
16871689
) {
16881690

@@ -1700,7 +1702,17 @@ private constructor(
17001702
@JsonProperty("redirect_uri")
17011703
@ExcludeMissing
17021704
redirectUri: JsonField<String> = JsonMissing.of(),
1703-
) : this(authorizationUrl, clientId, clientSecret, redirectUri, mutableMapOf())
1705+
@JsonProperty("supported_scopes")
1706+
@ExcludeMissing
1707+
supportedScopes: JsonField<List<String>> = JsonMissing.of(),
1708+
) : this(
1709+
authorizationUrl,
1710+
clientId,
1711+
clientSecret,
1712+
redirectUri,
1713+
supportedScopes,
1714+
mutableMapOf(),
1715+
)
17041716

17051717
/**
17061718
* @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if
@@ -1727,6 +1739,13 @@ private constructor(
17271739
*/
17281740
fun redirectUri(): Optional<String> = redirectUri.getOptional("redirect_uri")
17291741

1742+
/**
1743+
* @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if
1744+
* the server responded with an unexpected value).
1745+
*/
1746+
fun supportedScopes(): Optional<List<String>> =
1747+
supportedScopes.getOptional("supported_scopes")
1748+
17301749
/**
17311750
* Returns the raw JSON value of [authorizationUrl].
17321751
*
@@ -1765,6 +1784,16 @@ private constructor(
17651784
@ExcludeMissing
17661785
fun _redirectUri(): JsonField<String> = redirectUri
17671786

1787+
/**
1788+
* Returns the raw JSON value of [supportedScopes].
1789+
*
1790+
* Unlike [supportedScopes], this method doesn't throw if the JSON field has an
1791+
* unexpected type.
1792+
*/
1793+
@JsonProperty("supported_scopes")
1794+
@ExcludeMissing
1795+
fun _supportedScopes(): JsonField<List<String>> = supportedScopes
1796+
17681797
@JsonAnySetter
17691798
private fun putAdditionalProperty(key: String, value: JsonValue) {
17701799
additionalProperties.put(key, value)
@@ -1790,6 +1819,7 @@ private constructor(
17901819
private var clientId: JsonField<String> = JsonMissing.of()
17911820
private var clientSecret: JsonField<ClientSecret> = JsonMissing.of()
17921821
private var redirectUri: JsonField<String> = JsonMissing.of()
1822+
private var supportedScopes: JsonField<MutableList<String>>? = null
17931823
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
17941824

17951825
@JvmSynthetic
@@ -1798,6 +1828,7 @@ private constructor(
17981828
clientId = oauth2.clientId
17991829
clientSecret = oauth2.clientSecret
18001830
redirectUri = oauth2.redirectUri
1831+
supportedScopes = oauth2.supportedScopes.map { it.toMutableList() }
18011832
additionalProperties = oauth2.additionalProperties.toMutableMap()
18021833
}
18031834

@@ -1853,6 +1884,32 @@ private constructor(
18531884
this.redirectUri = redirectUri
18541885
}
18551886

1887+
fun supportedScopes(supportedScopes: List<String>) =
1888+
supportedScopes(JsonField.of(supportedScopes))
1889+
1890+
/**
1891+
* Sets [Builder.supportedScopes] to an arbitrary JSON value.
1892+
*
1893+
* You should usually call [Builder.supportedScopes] with a well-typed
1894+
* `List<String>` value instead. This method is primarily for setting the field to
1895+
* an undocumented or not yet supported value.
1896+
*/
1897+
fun supportedScopes(supportedScopes: JsonField<List<String>>) = apply {
1898+
this.supportedScopes = supportedScopes.map { it.toMutableList() }
1899+
}
1900+
1901+
/**
1902+
* Adds a single [String] to [supportedScopes].
1903+
*
1904+
* @throws IllegalStateException if the field was previously set to a non-list.
1905+
*/
1906+
fun addSupportedScope(supportedScope: String) = apply {
1907+
supportedScopes =
1908+
(supportedScopes ?: JsonField.of(mutableListOf())).also {
1909+
checkKnown("supportedScopes", it).add(supportedScope)
1910+
}
1911+
}
1912+
18561913
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
18571914
this.additionalProperties.clear()
18581915
putAllAdditionalProperties(additionalProperties)
@@ -1886,6 +1943,7 @@ private constructor(
18861943
clientId,
18871944
clientSecret,
18881945
redirectUri,
1946+
(supportedScopes ?: JsonMissing.of()).map { it.toImmutable() },
18891947
additionalProperties.toMutableMap(),
18901948
)
18911949
}
@@ -1901,6 +1959,7 @@ private constructor(
19011959
clientId()
19021960
clientSecret().ifPresent { it.validate() }
19031961
redirectUri()
1962+
supportedScopes()
19041963
validated = true
19051964
}
19061965

@@ -1923,7 +1982,8 @@ private constructor(
19231982
(if (authorizationUrl.asKnown().isPresent) 1 else 0) +
19241983
(if (clientId.asKnown().isPresent) 1 else 0) +
19251984
(clientSecret.asKnown().getOrNull()?.validity() ?: 0) +
1926-
(if (redirectUri.asKnown().isPresent) 1 else 0)
1985+
(if (redirectUri.asKnown().isPresent) 1 else 0) +
1986+
(supportedScopes.asKnown().getOrNull()?.size ?: 0)
19271987

19281988
class ClientSecret
19291989
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
@@ -2342,6 +2402,7 @@ private constructor(
23422402
clientId == other.clientId &&
23432403
clientSecret == other.clientSecret &&
23442404
redirectUri == other.redirectUri &&
2405+
supportedScopes == other.supportedScopes &&
23452406
additionalProperties == other.additionalProperties
23462407
}
23472408

@@ -2351,14 +2412,15 @@ private constructor(
23512412
clientId,
23522413
clientSecret,
23532414
redirectUri,
2415+
supportedScopes,
23542416
additionalProperties,
23552417
)
23562418
}
23572419

23582420
override fun hashCode(): Int = hashCode
23592421

23602422
override fun toString() =
2361-
"Oauth2{authorizationUrl=$authorizationUrl, clientId=$clientId, clientSecret=$clientSecret, redirectUri=$redirectUri, additionalProperties=$additionalProperties}"
2423+
"Oauth2{authorizationUrl=$authorizationUrl, clientId=$clientId, clientSecret=$clientSecret, redirectUri=$redirectUri, supportedScopes=$supportedScopes, additionalProperties=$additionalProperties}"
23622424
}
23632425

23642426
class Secrets

arcade-java-core/src/test/kotlin/dev/arcade/models/workers/WorkerListPageResponseTest.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ internal class WorkerListPageResponseTest {
6464
.build()
6565
)
6666
.redirectUri("redirect_uri")
67+
.addSupportedScope("string")
6768
.build()
6869
)
6970
.retry(0L)
@@ -161,6 +162,7 @@ internal class WorkerListPageResponseTest {
161162
.build()
162163
)
163164
.redirectUri("redirect_uri")
165+
.addSupportedScope("string")
164166
.build()
165167
)
166168
.retry(0L)
@@ -261,6 +263,7 @@ internal class WorkerListPageResponseTest {
261263
.build()
262264
)
263265
.redirectUri("redirect_uri")
266+
.addSupportedScope("string")
264267
.build()
265268
)
266269
.retry(0L)

arcade-java-core/src/test/kotlin/dev/arcade/models/workers/WorkerResponseTest.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ internal class WorkerResponseTest {
6060
.build()
6161
)
6262
.redirectUri("redirect_uri")
63+
.addSupportedScope("string")
6364
.build()
6465
)
6566
.retry(0L)
@@ -147,6 +148,7 @@ internal class WorkerResponseTest {
147148
.build()
148149
)
149150
.redirectUri("redirect_uri")
151+
.addSupportedScope("string")
150152
.build()
151153
)
152154
.retry(0L)
@@ -239,6 +241,7 @@ internal class WorkerResponseTest {
239241
.build()
240242
)
241243
.redirectUri("redirect_uri")
244+
.addSupportedScope("string")
242245
.build()
243246
)
244247
.retry(0L)

0 commit comments

Comments
 (0)