Skip to content

Commit be0354d

Browse files
feat(api): manual updates (#151)
1 parent be6e2a6 commit be0354d

83 files changed

Lines changed: 1378 additions & 7414 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Acl.kt

Lines changed: 15 additions & 474 deletions
Large diffs are not rendered by default.

braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AclBatchUpdateParams.kt

Lines changed: 26 additions & 960 deletions
Large diffs are not rendered by default.

braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AclCreateParams.kt

Lines changed: 22 additions & 483 deletions
Large diffs are not rendered by default.

braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AclFindAndDeleteParams.kt

Lines changed: 22 additions & 483 deletions
Large diffs are not rendered by default.

braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AclListParams.kt

Lines changed: 4 additions & 164 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ package com.braintrustdata.api.models
44

55
import com.braintrustdata.api.core.BaseDeserializer
66
import com.braintrustdata.api.core.BaseSerializer
7-
import com.braintrustdata.api.core.Enum
8-
import com.braintrustdata.api.core.JsonField
97
import com.braintrustdata.api.core.JsonValue
108
import com.braintrustdata.api.core.NoAutoDetect
119
import com.braintrustdata.api.core.Params
@@ -14,7 +12,6 @@ import com.braintrustdata.api.core.getOrThrow
1412
import com.braintrustdata.api.core.http.Headers
1513
import com.braintrustdata.api.core.http.QueryParams
1614
import com.braintrustdata.api.errors.BraintrustInvalidDataException
17-
import com.fasterxml.jackson.annotation.JsonCreator
1815
import com.fasterxml.jackson.core.JsonGenerator
1916
import com.fasterxml.jackson.core.ObjectCodec
2017
import com.fasterxml.jackson.databind.JsonNode
@@ -33,7 +30,7 @@ import kotlin.jvm.optionals.getOrNull
3330
class AclListParams
3431
private constructor(
3532
private val objectId: String,
36-
private val objectType: ObjectType,
33+
private val objectType: AclObjectType,
3734
private val endingBefore: String?,
3835
private val ids: Ids?,
3936
private val limit: Long?,
@@ -46,7 +43,7 @@ private constructor(
4643
fun objectId(): String = objectId
4744

4845
/** The object type that the ACL applies to */
49-
fun objectType(): ObjectType = objectType
46+
fun objectType(): AclObjectType = objectType
5047

5148
/**
5249
* Pagination cursor id.
@@ -114,7 +111,7 @@ private constructor(
114111
class Builder internal constructor() {
115112

116113
private var objectId: String? = null
117-
private var objectType: ObjectType? = null
114+
private var objectType: AclObjectType? = null
118115
private var endingBefore: String? = null
119116
private var ids: Ids? = null
120117
private var limit: Long? = null
@@ -138,7 +135,7 @@ private constructor(
138135
fun objectId(objectId: String) = apply { this.objectId = objectId }
139136

140137
/** The object type that the ACL applies to */
141-
fun objectType(objectType: ObjectType) = apply { this.objectType = objectType }
138+
fun objectType(objectType: AclObjectType) = apply { this.objectType = objectType }
142139

143140
/**
144141
* Pagination cursor id.
@@ -321,163 +318,6 @@ private constructor(
321318
)
322319
}
323320

324-
/** The object type that the ACL applies to */
325-
class ObjectType @JsonCreator private constructor(private val value: JsonField<String>) : Enum {
326-
327-
/**
328-
* Returns this class instance's raw value.
329-
*
330-
* This is usually only useful if this instance was deserialized from data that doesn't
331-
* match any known member, and you want to know that value. For example, if the SDK is on an
332-
* older version than the API, then the API may respond with new members that the SDK is
333-
* unaware of.
334-
*/
335-
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value
336-
337-
companion object {
338-
339-
@JvmField val ORGANIZATION = of("organization")
340-
341-
@JvmField val PROJECT = of("project")
342-
343-
@JvmField val EXPERIMENT = of("experiment")
344-
345-
@JvmField val DATASET = of("dataset")
346-
347-
@JvmField val PROMPT = of("prompt")
348-
349-
@JvmField val PROMPT_SESSION = of("prompt_session")
350-
351-
@JvmField val GROUP = of("group")
352-
353-
@JvmField val ROLE = of("role")
354-
355-
@JvmField val ORG_MEMBER = of("org_member")
356-
357-
@JvmField val PROJECT_LOG = of("project_log")
358-
359-
@JvmField val ORG_PROJECT = of("org_project")
360-
361-
@JvmStatic fun of(value: String) = ObjectType(JsonField.of(value))
362-
}
363-
364-
/** An enum containing [ObjectType]'s known values. */
365-
enum class Known {
366-
ORGANIZATION,
367-
PROJECT,
368-
EXPERIMENT,
369-
DATASET,
370-
PROMPT,
371-
PROMPT_SESSION,
372-
GROUP,
373-
ROLE,
374-
ORG_MEMBER,
375-
PROJECT_LOG,
376-
ORG_PROJECT,
377-
}
378-
379-
/**
380-
* An enum containing [ObjectType]'s known values, as well as an [_UNKNOWN] member.
381-
*
382-
* An instance of [ObjectType] can contain an unknown value in a couple of cases:
383-
* - It was deserialized from data that doesn't match any known member. For example, if the
384-
* SDK is on an older version than the API, then the API may respond with new members that
385-
* the SDK is unaware of.
386-
* - It was constructed with an arbitrary value using the [of] method.
387-
*/
388-
enum class Value {
389-
ORGANIZATION,
390-
PROJECT,
391-
EXPERIMENT,
392-
DATASET,
393-
PROMPT,
394-
PROMPT_SESSION,
395-
GROUP,
396-
ROLE,
397-
ORG_MEMBER,
398-
PROJECT_LOG,
399-
ORG_PROJECT,
400-
/**
401-
* An enum member indicating that [ObjectType] was instantiated with an unknown value.
402-
*/
403-
_UNKNOWN,
404-
}
405-
406-
/**
407-
* Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
408-
* if the class was instantiated with an unknown value.
409-
*
410-
* Use the [known] method instead if you're certain the value is always known or if you want
411-
* to throw for the unknown case.
412-
*/
413-
fun value(): Value =
414-
when (this) {
415-
ORGANIZATION -> Value.ORGANIZATION
416-
PROJECT -> Value.PROJECT
417-
EXPERIMENT -> Value.EXPERIMENT
418-
DATASET -> Value.DATASET
419-
PROMPT -> Value.PROMPT
420-
PROMPT_SESSION -> Value.PROMPT_SESSION
421-
GROUP -> Value.GROUP
422-
ROLE -> Value.ROLE
423-
ORG_MEMBER -> Value.ORG_MEMBER
424-
PROJECT_LOG -> Value.PROJECT_LOG
425-
ORG_PROJECT -> Value.ORG_PROJECT
426-
else -> Value._UNKNOWN
427-
}
428-
429-
/**
430-
* Returns an enum member corresponding to this class instance's value.
431-
*
432-
* Use the [value] method instead if you're uncertain the value is always known and don't
433-
* want to throw for the unknown case.
434-
*
435-
* @throws BraintrustInvalidDataException if this class instance's value is a not a known
436-
* member.
437-
*/
438-
fun known(): Known =
439-
when (this) {
440-
ORGANIZATION -> Known.ORGANIZATION
441-
PROJECT -> Known.PROJECT
442-
EXPERIMENT -> Known.EXPERIMENT
443-
DATASET -> Known.DATASET
444-
PROMPT -> Known.PROMPT
445-
PROMPT_SESSION -> Known.PROMPT_SESSION
446-
GROUP -> Known.GROUP
447-
ROLE -> Known.ROLE
448-
ORG_MEMBER -> Known.ORG_MEMBER
449-
PROJECT_LOG -> Known.PROJECT_LOG
450-
ORG_PROJECT -> Known.ORG_PROJECT
451-
else -> throw BraintrustInvalidDataException("Unknown ObjectType: $value")
452-
}
453-
454-
/**
455-
* Returns this class instance's primitive wire representation.
456-
*
457-
* This differs from the [toString] method because that method is primarily for debugging
458-
* and generally doesn't throw.
459-
*
460-
* @throws BraintrustInvalidDataException if this class instance's value does not have the
461-
* expected primitive type.
462-
*/
463-
fun asString(): String =
464-
_value().asString().orElseThrow {
465-
BraintrustInvalidDataException("Value is not a String")
466-
}
467-
468-
override fun equals(other: Any?): Boolean {
469-
if (this === other) {
470-
return true
471-
}
472-
473-
return /* spotless:off */ other is ObjectType && value == other.value /* spotless:on */
474-
}
475-
476-
override fun hashCode() = value.hashCode()
477-
478-
override fun toString() = value.toString()
479-
}
480-
481321
/**
482322
* Filter search results to a particular set of object IDs. To specify a list of IDs, include
483323
* the query param multiple times
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
// File generated from our OpenAPI spec by Stainless.
2+
3+
package com.braintrustdata.api.models
4+
5+
import com.braintrustdata.api.core.Enum
6+
import com.braintrustdata.api.core.JsonField
7+
import com.braintrustdata.api.errors.BraintrustInvalidDataException
8+
import com.fasterxml.jackson.annotation.JsonCreator
9+
10+
/** The object type that the ACL applies to */
11+
class AclObjectType @JsonCreator private constructor(private val value: JsonField<String>) : Enum {
12+
13+
/**
14+
* Returns this class instance's raw value.
15+
*
16+
* This is usually only useful if this instance was deserialized from data that doesn't match
17+
* any known member, and you want to know that value. For example, if the SDK is on an older
18+
* version than the API, then the API may respond with new members that the SDK is unaware of.
19+
*/
20+
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value
21+
22+
companion object {
23+
24+
@JvmField val ORGANIZATION = of("organization")
25+
26+
@JvmField val PROJECT = of("project")
27+
28+
@JvmField val EXPERIMENT = of("experiment")
29+
30+
@JvmField val DATASET = of("dataset")
31+
32+
@JvmField val PROMPT = of("prompt")
33+
34+
@JvmField val PROMPT_SESSION = of("prompt_session")
35+
36+
@JvmField val GROUP = of("group")
37+
38+
@JvmField val ROLE = of("role")
39+
40+
@JvmField val ORG_MEMBER = of("org_member")
41+
42+
@JvmField val PROJECT_LOG = of("project_log")
43+
44+
@JvmField val ORG_PROJECT = of("org_project")
45+
46+
@JvmStatic fun of(value: String) = AclObjectType(JsonField.of(value))
47+
}
48+
49+
/** An enum containing [AclObjectType]'s known values. */
50+
enum class Known {
51+
ORGANIZATION,
52+
PROJECT,
53+
EXPERIMENT,
54+
DATASET,
55+
PROMPT,
56+
PROMPT_SESSION,
57+
GROUP,
58+
ROLE,
59+
ORG_MEMBER,
60+
PROJECT_LOG,
61+
ORG_PROJECT,
62+
}
63+
64+
/**
65+
* An enum containing [AclObjectType]'s known values, as well as an [_UNKNOWN] member.
66+
*
67+
* An instance of [AclObjectType] can contain an unknown value in a couple of cases:
68+
* - It was deserialized from data that doesn't match any known member. For example, if the SDK
69+
* is on an older version than the API, then the API may respond with new members that the SDK
70+
* is unaware of.
71+
* - It was constructed with an arbitrary value using the [of] method.
72+
*/
73+
enum class Value {
74+
ORGANIZATION,
75+
PROJECT,
76+
EXPERIMENT,
77+
DATASET,
78+
PROMPT,
79+
PROMPT_SESSION,
80+
GROUP,
81+
ROLE,
82+
ORG_MEMBER,
83+
PROJECT_LOG,
84+
ORG_PROJECT,
85+
/**
86+
* An enum member indicating that [AclObjectType] was instantiated with an unknown value.
87+
*/
88+
_UNKNOWN,
89+
}
90+
91+
/**
92+
* Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] if
93+
* the class was instantiated with an unknown value.
94+
*
95+
* Use the [known] method instead if you're certain the value is always known or if you want to
96+
* throw for the unknown case.
97+
*/
98+
fun value(): Value =
99+
when (this) {
100+
ORGANIZATION -> Value.ORGANIZATION
101+
PROJECT -> Value.PROJECT
102+
EXPERIMENT -> Value.EXPERIMENT
103+
DATASET -> Value.DATASET
104+
PROMPT -> Value.PROMPT
105+
PROMPT_SESSION -> Value.PROMPT_SESSION
106+
GROUP -> Value.GROUP
107+
ROLE -> Value.ROLE
108+
ORG_MEMBER -> Value.ORG_MEMBER
109+
PROJECT_LOG -> Value.PROJECT_LOG
110+
ORG_PROJECT -> Value.ORG_PROJECT
111+
else -> Value._UNKNOWN
112+
}
113+
114+
/**
115+
* Returns an enum member corresponding to this class instance's value.
116+
*
117+
* Use the [value] method instead if you're uncertain the value is always known and don't want
118+
* to throw for the unknown case.
119+
*
120+
* @throws BraintrustInvalidDataException if this class instance's value is a not a known
121+
* member.
122+
*/
123+
fun known(): Known =
124+
when (this) {
125+
ORGANIZATION -> Known.ORGANIZATION
126+
PROJECT -> Known.PROJECT
127+
EXPERIMENT -> Known.EXPERIMENT
128+
DATASET -> Known.DATASET
129+
PROMPT -> Known.PROMPT
130+
PROMPT_SESSION -> Known.PROMPT_SESSION
131+
GROUP -> Known.GROUP
132+
ROLE -> Known.ROLE
133+
ORG_MEMBER -> Known.ORG_MEMBER
134+
PROJECT_LOG -> Known.PROJECT_LOG
135+
ORG_PROJECT -> Known.ORG_PROJECT
136+
else -> throw BraintrustInvalidDataException("Unknown AclObjectType: $value")
137+
}
138+
139+
/**
140+
* Returns this class instance's primitive wire representation.
141+
*
142+
* This differs from the [toString] method because that method is primarily for debugging and
143+
* generally doesn't throw.
144+
*
145+
* @throws BraintrustInvalidDataException if this class instance's value does not have the
146+
* expected primitive type.
147+
*/
148+
fun asString(): String =
149+
_value().asString().orElseThrow { BraintrustInvalidDataException("Value is not a String") }
150+
151+
override fun equals(other: Any?): Boolean {
152+
if (this === other) {
153+
return true
154+
}
155+
156+
return /* spotless:off */ other is AclObjectType && value == other.value /* spotless:on */
157+
}
158+
159+
override fun hashCode() = value.hashCode()
160+
161+
override fun toString() = value.toString()
162+
}

0 commit comments

Comments
 (0)