@@ -6,6 +6,7 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter
66import com.fasterxml.jackson.annotation.JsonAnySetter
77import com.fasterxml.jackson.annotation.JsonCreator
88import com.fasterxml.jackson.annotation.JsonProperty
9+ import com.langchain.smith.core.Enum
910import com.langchain.smith.core.ExcludeMissing
1011import com.langchain.smith.core.JsonField
1112import com.langchain.smith.core.JsonMissing
@@ -54,6 +55,12 @@ private constructor(
5455 */
5556 fun readme (): Optional <String > = body.readme()
5657
58+ /* *
59+ * @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
60+ * server responded with an unexpected value).
61+ */
62+ fun repoType (): Optional <RepoType > = body.repoType()
63+
5764 /* *
5865 * @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
5966 * server responded with an unexpected value).
@@ -88,6 +95,13 @@ private constructor(
8895 */
8996 fun _readme (): JsonField <String > = body._readme ()
9097
98+ /* *
99+ * Returns the raw JSON value of [repoType].
100+ *
101+ * Unlike [repoType], this method doesn't throw if the JSON field has an unexpected type.
102+ */
103+ fun _repoType (): JsonField <RepoType > = body._repoType ()
104+
91105 /* *
92106 * Returns the raw JSON value of [tags].
93107 *
@@ -142,7 +156,7 @@ private constructor(
142156 * - [repoHandle]
143157 * - [description]
144158 * - [readme]
145- * - [tags ]
159+ * - [repoType ]
146160 * - etc.
147161 */
148162 fun body (body : Body ) = apply { this .body = body.toBuilder() }
@@ -196,6 +210,17 @@ private constructor(
196210 */
197211 fun readme (readme : JsonField <String >) = apply { body.readme(readme) }
198212
213+ fun repoType (repoType : RepoType ) = apply { body.repoType(repoType) }
214+
215+ /* *
216+ * Sets [Builder.repoType] to an arbitrary JSON value.
217+ *
218+ * You should usually call [Builder.repoType] with a well-typed [RepoType] value instead.
219+ * This method is primarily for setting the field to an undocumented or not yet supported
220+ * value.
221+ */
222+ fun repoType (repoType : JsonField <RepoType >) = apply { body.repoType(repoType) }
223+
199224 fun tags (tags : List <String >? ) = apply { body.tags(tags) }
200225
201226 /* * Alias for calling [Builder.tags] with `tags.orElse(null)`. */
@@ -365,6 +390,7 @@ private constructor(
365390 private val repoHandle: JsonField <String >,
366391 private val description: JsonField <String >,
367392 private val readme: JsonField <String >,
393+ private val repoType: JsonField <RepoType >,
368394 private val tags: JsonField <List <String >>,
369395 private val additionalProperties: MutableMap <String , JsonValue >,
370396 ) {
@@ -381,8 +407,11 @@ private constructor(
381407 @ExcludeMissing
382408 description: JsonField <String > = JsonMissing .of(),
383409 @JsonProperty(" readme" ) @ExcludeMissing readme: JsonField <String > = JsonMissing .of(),
410+ @JsonProperty(" repo_type" )
411+ @ExcludeMissing
412+ repoType: JsonField <RepoType > = JsonMissing .of(),
384413 @JsonProperty(" tags" ) @ExcludeMissing tags: JsonField <List <String >> = JsonMissing .of(),
385- ) : this (isPublic, repoHandle, description, readme, tags, mutableMapOf ())
414+ ) : this (isPublic, repoHandle, description, readme, repoType, tags, mutableMapOf ())
386415
387416 /* *
388417 * @throws LangChainInvalidDataException if the JSON field has an unexpected type or is
@@ -408,6 +437,12 @@ private constructor(
408437 */
409438 fun readme (): Optional <String > = readme.getOptional(" readme" )
410439
440+ /* *
441+ * @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
442+ * the server responded with an unexpected value).
443+ */
444+ fun repoType (): Optional <RepoType > = repoType.getOptional(" repo_type" )
445+
411446 /* *
412447 * @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
413448 * the server responded with an unexpected value).
@@ -446,6 +481,13 @@ private constructor(
446481 */
447482 @JsonProperty(" readme" ) @ExcludeMissing fun _readme (): JsonField <String > = readme
448483
484+ /* *
485+ * Returns the raw JSON value of [repoType].
486+ *
487+ * Unlike [repoType], this method doesn't throw if the JSON field has an unexpected type.
488+ */
489+ @JsonProperty(" repo_type" ) @ExcludeMissing fun _repoType (): JsonField <RepoType > = repoType
490+
449491 /* *
450492 * Returns the raw JSON value of [tags].
451493 *
@@ -486,6 +528,7 @@ private constructor(
486528 private var repoHandle: JsonField <String >? = null
487529 private var description: JsonField <String > = JsonMissing .of()
488530 private var readme: JsonField <String > = JsonMissing .of()
531+ private var repoType: JsonField <RepoType > = JsonMissing .of()
489532 private var tags: JsonField <MutableList <String >>? = null
490533 private var additionalProperties: MutableMap <String , JsonValue > = mutableMapOf ()
491534
@@ -495,6 +538,7 @@ private constructor(
495538 repoHandle = body.repoHandle
496539 description = body.description
497540 readme = body.readme
541+ repoType = body.repoType
498542 tags = body.tags.map { it.toMutableList() }
499543 additionalProperties = body.additionalProperties.toMutableMap()
500544 }
@@ -551,6 +595,17 @@ private constructor(
551595 */
552596 fun readme (readme : JsonField <String >) = apply { this .readme = readme }
553597
598+ fun repoType (repoType : RepoType ) = repoType(JsonField .of(repoType))
599+
600+ /* *
601+ * Sets [Builder.repoType] to an arbitrary JSON value.
602+ *
603+ * You should usually call [Builder.repoType] with a well-typed [RepoType] value
604+ * instead. This method is primarily for setting the field to an undocumented or not yet
605+ * supported value.
606+ */
607+ fun repoType (repoType : JsonField <RepoType >) = apply { this .repoType = repoType }
608+
554609 fun tags (tags : List <String >? ) = tags(JsonField .ofNullable(tags))
555610
556611 /* * Alias for calling [Builder.tags] with `tags.orElse(null)`. */
@@ -615,6 +670,7 @@ private constructor(
615670 checkRequired(" repoHandle" , repoHandle),
616671 description,
617672 readme,
673+ repoType,
618674 (tags ? : JsonMissing .of()).map { it.toImmutable() },
619675 additionalProperties.toMutableMap(),
620676 )
@@ -631,6 +687,7 @@ private constructor(
631687 repoHandle()
632688 description()
633689 readme()
690+ repoType().ifPresent { it.validate() }
634691 tags()
635692 validated = true
636693 }
@@ -655,6 +712,7 @@ private constructor(
655712 (if (repoHandle.asKnown().isPresent) 1 else 0 ) +
656713 (if (description.asKnown().isPresent) 1 else 0 ) +
657714 (if (readme.asKnown().isPresent) 1 else 0 ) +
715+ (repoType.asKnown().getOrNull()?.validity() ? : 0 ) +
658716 (tags.asKnown().getOrNull()?.size ? : 0 )
659717
660718 override fun equals (other : Any? ): Boolean {
@@ -667,18 +725,166 @@ private constructor(
667725 repoHandle == other.repoHandle &&
668726 description == other.description &&
669727 readme == other.readme &&
728+ repoType == other.repoType &&
670729 tags == other.tags &&
671730 additionalProperties == other.additionalProperties
672731 }
673732
674733 private val hashCode: Int by lazy {
675- Objects .hash(isPublic, repoHandle, description, readme, tags, additionalProperties)
734+ Objects .hash(
735+ isPublic,
736+ repoHandle,
737+ description,
738+ readme,
739+ repoType,
740+ tags,
741+ additionalProperties,
742+ )
676743 }
677744
678745 override fun hashCode (): Int = hashCode
679746
680747 override fun toString () =
681- " Body{isPublic=$isPublic , repoHandle=$repoHandle , description=$description , readme=$readme , tags=$tags , additionalProperties=$additionalProperties }"
748+ " Body{isPublic=$isPublic , repoHandle=$repoHandle , description=$description , readme=$readme , repoType=$repoType , tags=$tags , additionalProperties=$additionalProperties }"
749+ }
750+
751+ class RepoType @JsonCreator private constructor(private val value : JsonField <String >) : Enum {
752+
753+ /* *
754+ * Returns this class instance's raw value.
755+ *
756+ * This is usually only useful if this instance was deserialized from data that doesn't
757+ * match any known member, and you want to know that value. For example, if the SDK is on an
758+ * older version than the API, then the API may respond with new members that the SDK is
759+ * unaware of.
760+ */
761+ @com.fasterxml.jackson.annotation.JsonValue fun _value (): JsonField <String > = value
762+
763+ companion object {
764+
765+ @JvmField val PROMPT = of(" prompt" )
766+
767+ @JvmField val FILE = of(" file" )
768+
769+ @JvmField val AGENT = of(" agent" )
770+
771+ @JvmField val SKILL = of(" skill" )
772+
773+ @JvmStatic fun of (value : String ) = RepoType (JsonField .of(value))
774+ }
775+
776+ /* * An enum containing [RepoType]'s known values. */
777+ enum class Known {
778+ PROMPT ,
779+ FILE ,
780+ AGENT ,
781+ SKILL ,
782+ }
783+
784+ /* *
785+ * An enum containing [RepoType]'s known values, as well as an [_UNKNOWN] member.
786+ *
787+ * An instance of [RepoType] can contain an unknown value in a couple of cases:
788+ * - It was deserialized from data that doesn't match any known member. For example, if the
789+ * SDK is on an older version than the API, then the API may respond with new members that
790+ * the SDK is unaware of.
791+ * - It was constructed with an arbitrary value using the [of] method.
792+ */
793+ enum class Value {
794+ PROMPT ,
795+ FILE ,
796+ AGENT ,
797+ SKILL ,
798+ /* * An enum member indicating that [RepoType] was instantiated with an unknown value. */
799+ _UNKNOWN ,
800+ }
801+
802+ /* *
803+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
804+ * if the class was instantiated with an unknown value.
805+ *
806+ * Use the [known] method instead if you're certain the value is always known or if you want
807+ * to throw for the unknown case.
808+ */
809+ fun value (): Value =
810+ when (this ) {
811+ PROMPT -> Value .PROMPT
812+ FILE -> Value .FILE
813+ AGENT -> Value .AGENT
814+ SKILL -> Value .SKILL
815+ else -> Value ._UNKNOWN
816+ }
817+
818+ /* *
819+ * Returns an enum member corresponding to this class instance's value.
820+ *
821+ * Use the [value] method instead if you're uncertain the value is always known and don't
822+ * want to throw for the unknown case.
823+ *
824+ * @throws LangChainInvalidDataException if this class instance's value is a not a known
825+ * member.
826+ */
827+ fun known (): Known =
828+ when (this ) {
829+ PROMPT -> Known .PROMPT
830+ FILE -> Known .FILE
831+ AGENT -> Known .AGENT
832+ SKILL -> Known .SKILL
833+ else -> throw LangChainInvalidDataException (" Unknown RepoType: $value " )
834+ }
835+
836+ /* *
837+ * Returns this class instance's primitive wire representation.
838+ *
839+ * This differs from the [toString] method because that method is primarily for debugging
840+ * and generally doesn't throw.
841+ *
842+ * @throws LangChainInvalidDataException if this class instance's value does not have the
843+ * expected primitive type.
844+ */
845+ fun asString (): String =
846+ _value ().asString().orElseThrow {
847+ LangChainInvalidDataException (" Value is not a String" )
848+ }
849+
850+ private var validated: Boolean = false
851+
852+ fun validate (): RepoType = apply {
853+ if (validated) {
854+ return @apply
855+ }
856+
857+ known()
858+ validated = true
859+ }
860+
861+ fun isValid (): Boolean =
862+ try {
863+ validate()
864+ true
865+ } catch (e: LangChainInvalidDataException ) {
866+ false
867+ }
868+
869+ /* *
870+ * Returns a score indicating how many valid values are contained in this object
871+ * recursively.
872+ *
873+ * Used for best match union deserialization.
874+ */
875+ @JvmSynthetic internal fun validity (): Int = if (value() == Value ._UNKNOWN ) 0 else 1
876+
877+ override fun equals (other : Any? ): Boolean {
878+ if (this == = other) {
879+ return true
880+ }
881+
882+ return other is RepoType && value == other.value
883+ }
884+
885+ override fun hashCode () = value.hashCode()
886+
887+ override fun toString () = value.toString()
682888 }
683889
684890 override fun equals (other : Any? ): Boolean {
0 commit comments