@@ -4,8 +4,6 @@ package com.braintrustdata.api.models
44
55import com.braintrustdata.api.core.BaseDeserializer
66import com.braintrustdata.api.core.BaseSerializer
7- import com.braintrustdata.api.core.Enum
8- import com.braintrustdata.api.core.JsonField
97import com.braintrustdata.api.core.JsonValue
108import com.braintrustdata.api.core.NoAutoDetect
119import com.braintrustdata.api.core.Params
@@ -14,7 +12,6 @@ import com.braintrustdata.api.core.getOrThrow
1412import com.braintrustdata.api.core.http.Headers
1513import com.braintrustdata.api.core.http.QueryParams
1614import com.braintrustdata.api.errors.BraintrustInvalidDataException
17- import com.fasterxml.jackson.annotation.JsonCreator
1815import com.fasterxml.jackson.core.JsonGenerator
1916import com.fasterxml.jackson.core.ObjectCodec
2017import com.fasterxml.jackson.databind.JsonNode
@@ -33,7 +30,7 @@ import kotlin.jvm.optionals.getOrNull
3330class AclListParams
3431private 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
0 commit comments