mirror of
https://github.com/langchain-ai/langsmith-java.git
synced 2026-08-24 12:22:55 -04:00
feat: expose annotation queue item APIs publicly [LSE-2550]
Stainless-Generated-From: 398b0fdecf4307af3af7cea4f223d52f9dc1919f
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
||||
configured_endpoints: 149
|
||||
configured_endpoints: 156
|
||||
|
||||
+997
@@ -0,0 +1,997 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.models.annotationqueues.items
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnyGetter
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter
|
||||
import com.fasterxml.jackson.annotation.JsonCreator
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.langchain.smith.core.Enum
|
||||
import com.langchain.smith.core.ExcludeMissing
|
||||
import com.langchain.smith.core.JsonField
|
||||
import com.langchain.smith.core.JsonMissing
|
||||
import com.langchain.smith.core.JsonValue
|
||||
import com.langchain.smith.core.Params
|
||||
import com.langchain.smith.core.checkKnown
|
||||
import com.langchain.smith.core.http.Headers
|
||||
import com.langchain.smith.core.http.QueryParams
|
||||
import com.langchain.smith.core.toImmutable
|
||||
import com.langchain.smith.errors.LangChainInvalidDataException
|
||||
import java.time.OffsetDateTime
|
||||
import java.util.Collections
|
||||
import java.util.Objects
|
||||
import java.util.Optional
|
||||
import kotlin.jvm.optionals.getOrNull
|
||||
|
||||
/**
|
||||
* Add RUN or THREAD items to a single annotation queue. THREAD items require thread_id and
|
||||
* session_id; RUN items require run_id, or source_proposed_example_id with lookup coordinates when
|
||||
* applicable.
|
||||
*/
|
||||
class ItemCreateParams
|
||||
private constructor(
|
||||
private val queueId: String?,
|
||||
private val extendTraceRetention: Boolean?,
|
||||
private val body: Body,
|
||||
private val additionalHeaders: Headers,
|
||||
private val additionalQueryParams: QueryParams,
|
||||
) : Params {
|
||||
|
||||
fun queueId(): Optional<String> = Optional.ofNullable(queueId)
|
||||
|
||||
/** Extend trace retention for added run items */
|
||||
fun extendTraceRetention(): Optional<Boolean> = Optional.ofNullable(extendTraceRetention)
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun items(): Optional<List<Item>> = body.items()
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [items].
|
||||
*
|
||||
* Unlike [items], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
fun _items(): JsonField<List<Item>> = body._items()
|
||||
|
||||
fun _additionalBodyProperties(): Map<String, JsonValue> = body._additionalProperties()
|
||||
|
||||
/** Additional headers to send with the request. */
|
||||
fun _additionalHeaders(): Headers = additionalHeaders
|
||||
|
||||
/** Additional query param to send with the request. */
|
||||
fun _additionalQueryParams(): QueryParams = additionalQueryParams
|
||||
|
||||
fun toBuilder() = Builder().from(this)
|
||||
|
||||
companion object {
|
||||
|
||||
@JvmStatic fun none(): ItemCreateParams = builder().build()
|
||||
|
||||
/** Returns a mutable builder for constructing an instance of [ItemCreateParams]. */
|
||||
@JvmStatic fun builder() = Builder()
|
||||
}
|
||||
|
||||
/** A builder for [ItemCreateParams]. */
|
||||
class Builder internal constructor() {
|
||||
|
||||
private var queueId: String? = null
|
||||
private var extendTraceRetention: Boolean? = null
|
||||
private var body: Body.Builder = Body.builder()
|
||||
private var additionalHeaders: Headers.Builder = Headers.builder()
|
||||
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
|
||||
|
||||
@JvmSynthetic
|
||||
internal fun from(itemCreateParams: ItemCreateParams) = apply {
|
||||
queueId = itemCreateParams.queueId
|
||||
extendTraceRetention = itemCreateParams.extendTraceRetention
|
||||
body = itemCreateParams.body.toBuilder()
|
||||
additionalHeaders = itemCreateParams.additionalHeaders.toBuilder()
|
||||
additionalQueryParams = itemCreateParams.additionalQueryParams.toBuilder()
|
||||
}
|
||||
|
||||
fun queueId(queueId: String?) = apply { this.queueId = queueId }
|
||||
|
||||
/** Alias for calling [Builder.queueId] with `queueId.orElse(null)`. */
|
||||
fun queueId(queueId: Optional<String>) = queueId(queueId.getOrNull())
|
||||
|
||||
/** Extend trace retention for added run items */
|
||||
fun extendTraceRetention(extendTraceRetention: Boolean?) = apply {
|
||||
this.extendTraceRetention = extendTraceRetention
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias for [Builder.extendTraceRetention].
|
||||
*
|
||||
* This unboxed primitive overload exists for backwards compatibility.
|
||||
*/
|
||||
fun extendTraceRetention(extendTraceRetention: Boolean) =
|
||||
extendTraceRetention(extendTraceRetention as Boolean?)
|
||||
|
||||
/**
|
||||
* Alias for calling [Builder.extendTraceRetention] with
|
||||
* `extendTraceRetention.orElse(null)`.
|
||||
*/
|
||||
fun extendTraceRetention(extendTraceRetention: Optional<Boolean>) =
|
||||
extendTraceRetention(extendTraceRetention.getOrNull())
|
||||
|
||||
/**
|
||||
* Sets the entire request body.
|
||||
*
|
||||
* This is generally only useful if you are already constructing the body separately.
|
||||
* Otherwise, it's more convenient to use the top-level setters instead:
|
||||
* - [items]
|
||||
*/
|
||||
fun body(body: Body) = apply { this.body = body.toBuilder() }
|
||||
|
||||
fun items(items: List<Item>) = apply { body.items(items) }
|
||||
|
||||
/**
|
||||
* Sets [Builder.items] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.items] with a well-typed `List<Item>` value instead.
|
||||
* This method is primarily for setting the field to an undocumented or not yet supported
|
||||
* value.
|
||||
*/
|
||||
fun items(items: JsonField<List<Item>>) = apply { body.items(items) }
|
||||
|
||||
/**
|
||||
* Adds a single [Item] to [items].
|
||||
*
|
||||
* @throws IllegalStateException if the field was previously set to a non-list.
|
||||
*/
|
||||
fun addItem(item: Item) = apply { body.addItem(item) }
|
||||
|
||||
fun additionalBodyProperties(additionalBodyProperties: Map<String, JsonValue>) = apply {
|
||||
body.additionalProperties(additionalBodyProperties)
|
||||
}
|
||||
|
||||
fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply {
|
||||
body.putAdditionalProperty(key, value)
|
||||
}
|
||||
|
||||
fun putAllAdditionalBodyProperties(additionalBodyProperties: Map<String, JsonValue>) =
|
||||
apply {
|
||||
body.putAllAdditionalProperties(additionalBodyProperties)
|
||||
}
|
||||
|
||||
fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) }
|
||||
|
||||
fun removeAllAdditionalBodyProperties(keys: Set<String>) = apply {
|
||||
body.removeAllAdditionalProperties(keys)
|
||||
}
|
||||
|
||||
fun additionalHeaders(additionalHeaders: Headers) = apply {
|
||||
this.additionalHeaders.clear()
|
||||
putAllAdditionalHeaders(additionalHeaders)
|
||||
}
|
||||
|
||||
fun additionalHeaders(additionalHeaders: Map<String, Iterable<String>>) = apply {
|
||||
this.additionalHeaders.clear()
|
||||
putAllAdditionalHeaders(additionalHeaders)
|
||||
}
|
||||
|
||||
fun putAdditionalHeader(name: String, value: String) = apply {
|
||||
additionalHeaders.put(name, value)
|
||||
}
|
||||
|
||||
fun putAdditionalHeaders(name: String, values: Iterable<String>) = apply {
|
||||
additionalHeaders.put(name, values)
|
||||
}
|
||||
|
||||
fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply {
|
||||
this.additionalHeaders.putAll(additionalHeaders)
|
||||
}
|
||||
|
||||
fun putAllAdditionalHeaders(additionalHeaders: Map<String, Iterable<String>>) = apply {
|
||||
this.additionalHeaders.putAll(additionalHeaders)
|
||||
}
|
||||
|
||||
fun replaceAdditionalHeaders(name: String, value: String) = apply {
|
||||
additionalHeaders.replace(name, value)
|
||||
}
|
||||
|
||||
fun replaceAdditionalHeaders(name: String, values: Iterable<String>) = apply {
|
||||
additionalHeaders.replace(name, values)
|
||||
}
|
||||
|
||||
fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply {
|
||||
this.additionalHeaders.replaceAll(additionalHeaders)
|
||||
}
|
||||
|
||||
fun replaceAllAdditionalHeaders(additionalHeaders: Map<String, Iterable<String>>) = apply {
|
||||
this.additionalHeaders.replaceAll(additionalHeaders)
|
||||
}
|
||||
|
||||
fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) }
|
||||
|
||||
fun removeAllAdditionalHeaders(names: Set<String>) = apply {
|
||||
additionalHeaders.removeAll(names)
|
||||
}
|
||||
|
||||
fun additionalQueryParams(additionalQueryParams: QueryParams) = apply {
|
||||
this.additionalQueryParams.clear()
|
||||
putAllAdditionalQueryParams(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun additionalQueryParams(additionalQueryParams: Map<String, Iterable<String>>) = apply {
|
||||
this.additionalQueryParams.clear()
|
||||
putAllAdditionalQueryParams(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun putAdditionalQueryParam(key: String, value: String) = apply {
|
||||
additionalQueryParams.put(key, value)
|
||||
}
|
||||
|
||||
fun putAdditionalQueryParams(key: String, values: Iterable<String>) = apply {
|
||||
additionalQueryParams.put(key, values)
|
||||
}
|
||||
|
||||
fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
|
||||
this.additionalQueryParams.putAll(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun putAllAdditionalQueryParams(additionalQueryParams: Map<String, Iterable<String>>) =
|
||||
apply {
|
||||
this.additionalQueryParams.putAll(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun replaceAdditionalQueryParams(key: String, value: String) = apply {
|
||||
additionalQueryParams.replace(key, value)
|
||||
}
|
||||
|
||||
fun replaceAdditionalQueryParams(key: String, values: Iterable<String>) = apply {
|
||||
additionalQueryParams.replace(key, values)
|
||||
}
|
||||
|
||||
fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
|
||||
this.additionalQueryParams.replaceAll(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun replaceAllAdditionalQueryParams(additionalQueryParams: Map<String, Iterable<String>>) =
|
||||
apply {
|
||||
this.additionalQueryParams.replaceAll(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) }
|
||||
|
||||
fun removeAllAdditionalQueryParams(keys: Set<String>) = apply {
|
||||
additionalQueryParams.removeAll(keys)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an immutable instance of [ItemCreateParams].
|
||||
*
|
||||
* Further updates to this [Builder] will not mutate the returned instance.
|
||||
*/
|
||||
fun build(): ItemCreateParams =
|
||||
ItemCreateParams(
|
||||
queueId,
|
||||
extendTraceRetention,
|
||||
body.build(),
|
||||
additionalHeaders.build(),
|
||||
additionalQueryParams.build(),
|
||||
)
|
||||
}
|
||||
|
||||
fun _body(): Body = body
|
||||
|
||||
fun _pathParam(index: Int): String =
|
||||
when (index) {
|
||||
0 -> queueId ?: ""
|
||||
else -> ""
|
||||
}
|
||||
|
||||
override fun _headers(): Headers = additionalHeaders
|
||||
|
||||
override fun _queryParams(): QueryParams =
|
||||
QueryParams.builder()
|
||||
.apply {
|
||||
extendTraceRetention?.let { put("extend_trace_retention", it.toString()) }
|
||||
putAll(additionalQueryParams)
|
||||
}
|
||||
.build()
|
||||
|
||||
class Body
|
||||
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
|
||||
private constructor(
|
||||
private val items: JsonField<List<Item>>,
|
||||
private val additionalProperties: MutableMap<String, JsonValue>,
|
||||
) {
|
||||
|
||||
@JsonCreator
|
||||
private constructor(
|
||||
@JsonProperty("items") @ExcludeMissing items: JsonField<List<Item>> = JsonMissing.of()
|
||||
) : this(items, mutableMapOf())
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
|
||||
* the server responded with an unexpected value).
|
||||
*/
|
||||
fun items(): Optional<List<Item>> = items.getOptional("items")
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [items].
|
||||
*
|
||||
* Unlike [items], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("items") @ExcludeMissing fun _items(): JsonField<List<Item>> = items
|
||||
|
||||
@JsonAnySetter
|
||||
private fun putAdditionalProperty(key: String, value: JsonValue) {
|
||||
additionalProperties.put(key, value)
|
||||
}
|
||||
|
||||
@JsonAnyGetter
|
||||
@ExcludeMissing
|
||||
fun _additionalProperties(): Map<String, JsonValue> =
|
||||
Collections.unmodifiableMap(additionalProperties)
|
||||
|
||||
fun toBuilder() = Builder().from(this)
|
||||
|
||||
companion object {
|
||||
|
||||
/** Returns a mutable builder for constructing an instance of [Body]. */
|
||||
@JvmStatic fun builder() = Builder()
|
||||
}
|
||||
|
||||
/** A builder for [Body]. */
|
||||
class Builder internal constructor() {
|
||||
|
||||
private var items: JsonField<MutableList<Item>>? = null
|
||||
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
|
||||
|
||||
@JvmSynthetic
|
||||
internal fun from(body: Body) = apply {
|
||||
items = body.items.map { it.toMutableList() }
|
||||
additionalProperties = body.additionalProperties.toMutableMap()
|
||||
}
|
||||
|
||||
fun items(items: List<Item>) = items(JsonField.of(items))
|
||||
|
||||
/**
|
||||
* Sets [Builder.items] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.items] with a well-typed `List<Item>` value instead.
|
||||
* This method is primarily for setting the field to an undocumented or not yet
|
||||
* supported value.
|
||||
*/
|
||||
fun items(items: JsonField<List<Item>>) = apply {
|
||||
this.items = items.map { it.toMutableList() }
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a single [Item] to [items].
|
||||
*
|
||||
* @throws IllegalStateException if the field was previously set to a non-list.
|
||||
*/
|
||||
fun addItem(item: Item) = apply {
|
||||
items =
|
||||
(items ?: JsonField.of(mutableListOf())).also {
|
||||
checkKnown("items", it).add(item)
|
||||
}
|
||||
}
|
||||
|
||||
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
|
||||
this.additionalProperties.clear()
|
||||
putAllAdditionalProperties(additionalProperties)
|
||||
}
|
||||
|
||||
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
|
||||
additionalProperties.put(key, value)
|
||||
}
|
||||
|
||||
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
|
||||
this.additionalProperties.putAll(additionalProperties)
|
||||
}
|
||||
|
||||
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
|
||||
|
||||
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
|
||||
keys.forEach(::removeAdditionalProperty)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an immutable instance of [Body].
|
||||
*
|
||||
* Further updates to this [Builder] will not mutate the returned instance.
|
||||
*/
|
||||
fun build(): Body =
|
||||
Body(
|
||||
(items ?: JsonMissing.of()).map { it.toImmutable() },
|
||||
additionalProperties.toMutableMap(),
|
||||
)
|
||||
}
|
||||
|
||||
private var validated: Boolean = false
|
||||
|
||||
/**
|
||||
* Validates that the types of all values in this object match their expected types
|
||||
* recursively.
|
||||
*
|
||||
* This method is _not_ forwards compatible with new types from the API for existing fields.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if any value type in this object doesn't match its
|
||||
* expected type.
|
||||
*/
|
||||
fun validate(): Body = apply {
|
||||
if (validated) {
|
||||
return@apply
|
||||
}
|
||||
|
||||
items().ifPresent { it.forEach { it.validate() } }
|
||||
validated = true
|
||||
}
|
||||
|
||||
fun isValid(): Boolean =
|
||||
try {
|
||||
validate()
|
||||
true
|
||||
} catch (e: LangChainInvalidDataException) {
|
||||
false
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a score indicating how many valid values are contained in this object
|
||||
* recursively.
|
||||
*
|
||||
* Used for best match union deserialization.
|
||||
*/
|
||||
@JvmSynthetic
|
||||
internal fun validity(): Int =
|
||||
(items.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
|
||||
return other is Body &&
|
||||
items == other.items &&
|
||||
additionalProperties == other.additionalProperties
|
||||
}
|
||||
|
||||
private val hashCode: Int by lazy { Objects.hash(items, additionalProperties) }
|
||||
|
||||
override fun hashCode(): Int = hashCode
|
||||
|
||||
override fun toString() = "Body{items=$items, additionalProperties=$additionalProperties}"
|
||||
}
|
||||
|
||||
class Item
|
||||
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
|
||||
private constructor(
|
||||
private val itemType: JsonField<ItemType>,
|
||||
private val runId: JsonField<String>,
|
||||
private val sessionId: JsonField<String>,
|
||||
private val sourceProposedExampleId: JsonField<String>,
|
||||
private val startTime: JsonField<OffsetDateTime>,
|
||||
private val threadId: JsonField<String>,
|
||||
private val additionalProperties: MutableMap<String, JsonValue>,
|
||||
) {
|
||||
|
||||
@JsonCreator
|
||||
private constructor(
|
||||
@JsonProperty("item_type")
|
||||
@ExcludeMissing
|
||||
itemType: JsonField<ItemType> = JsonMissing.of(),
|
||||
@JsonProperty("run_id") @ExcludeMissing runId: JsonField<String> = JsonMissing.of(),
|
||||
@JsonProperty("session_id")
|
||||
@ExcludeMissing
|
||||
sessionId: JsonField<String> = JsonMissing.of(),
|
||||
@JsonProperty("source_proposed_example_id")
|
||||
@ExcludeMissing
|
||||
sourceProposedExampleId: JsonField<String> = JsonMissing.of(),
|
||||
@JsonProperty("start_time")
|
||||
@ExcludeMissing
|
||||
startTime: JsonField<OffsetDateTime> = JsonMissing.of(),
|
||||
@JsonProperty("thread_id")
|
||||
@ExcludeMissing
|
||||
threadId: JsonField<String> = JsonMissing.of(),
|
||||
) : this(
|
||||
itemType,
|
||||
runId,
|
||||
sessionId,
|
||||
sourceProposedExampleId,
|
||||
startTime,
|
||||
threadId,
|
||||
mutableMapOf(),
|
||||
)
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
|
||||
* the server responded with an unexpected value).
|
||||
*/
|
||||
fun itemType(): Optional<ItemType> = itemType.getOptional("item_type")
|
||||
|
||||
/**
|
||||
* RUN fields
|
||||
*
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
|
||||
* the server responded with an unexpected value).
|
||||
*/
|
||||
fun runId(): Optional<String> = runId.getOptional("run_id")
|
||||
|
||||
/**
|
||||
* Shared optional SmithDB lookup coords. StartTime uses FlexTime because smith-backend and
|
||||
* ClickHouse emit naive UTC timestamps (no timezone suffix) that strict *time.Time JSON
|
||||
* unmarshaling rejects.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
|
||||
* the server responded with an unexpected value).
|
||||
*/
|
||||
fun sessionId(): Optional<String> = sessionId.getOptional("session_id")
|
||||
|
||||
/**
|
||||
* SourceProposedExampleID is usually unset. When Issues Board / Engine suggested examples
|
||||
* are added to a queue, the UI sets this to the tracer_session_issue_proposed_examples row
|
||||
* so the queue item can point back at that suggestion.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
|
||||
* the server responded with an unexpected value).
|
||||
*/
|
||||
fun sourceProposedExampleId(): Optional<String> =
|
||||
sourceProposedExampleId.getOptional("source_proposed_example_id")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
|
||||
* the server responded with an unexpected value).
|
||||
*/
|
||||
fun startTime(): Optional<OffsetDateTime> = startTime.getOptional("start_time")
|
||||
|
||||
/**
|
||||
* THREAD fields (thread_id + session_id required)
|
||||
*
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
|
||||
* the server responded with an unexpected value).
|
||||
*/
|
||||
fun threadId(): Optional<String> = threadId.getOptional("thread_id")
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [itemType].
|
||||
*
|
||||
* Unlike [itemType], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("item_type") @ExcludeMissing fun _itemType(): JsonField<ItemType> = itemType
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [runId].
|
||||
*
|
||||
* Unlike [runId], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("run_id") @ExcludeMissing fun _runId(): JsonField<String> = runId
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [sessionId].
|
||||
*
|
||||
* Unlike [sessionId], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("session_id") @ExcludeMissing fun _sessionId(): JsonField<String> = sessionId
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [sourceProposedExampleId].
|
||||
*
|
||||
* Unlike [sourceProposedExampleId], this method doesn't throw if the JSON field has an
|
||||
* unexpected type.
|
||||
*/
|
||||
@JsonProperty("source_proposed_example_id")
|
||||
@ExcludeMissing
|
||||
fun _sourceProposedExampleId(): JsonField<String> = sourceProposedExampleId
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [startTime].
|
||||
*
|
||||
* Unlike [startTime], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("start_time")
|
||||
@ExcludeMissing
|
||||
fun _startTime(): JsonField<OffsetDateTime> = startTime
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [threadId].
|
||||
*
|
||||
* Unlike [threadId], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("thread_id") @ExcludeMissing fun _threadId(): JsonField<String> = threadId
|
||||
|
||||
@JsonAnySetter
|
||||
private fun putAdditionalProperty(key: String, value: JsonValue) {
|
||||
additionalProperties.put(key, value)
|
||||
}
|
||||
|
||||
@JsonAnyGetter
|
||||
@ExcludeMissing
|
||||
fun _additionalProperties(): Map<String, JsonValue> =
|
||||
Collections.unmodifiableMap(additionalProperties)
|
||||
|
||||
fun toBuilder() = Builder().from(this)
|
||||
|
||||
companion object {
|
||||
|
||||
/** Returns a mutable builder for constructing an instance of [Item]. */
|
||||
@JvmStatic fun builder() = Builder()
|
||||
}
|
||||
|
||||
/** A builder for [Item]. */
|
||||
class Builder internal constructor() {
|
||||
|
||||
private var itemType: JsonField<ItemType> = JsonMissing.of()
|
||||
private var runId: JsonField<String> = JsonMissing.of()
|
||||
private var sessionId: JsonField<String> = JsonMissing.of()
|
||||
private var sourceProposedExampleId: JsonField<String> = JsonMissing.of()
|
||||
private var startTime: JsonField<OffsetDateTime> = JsonMissing.of()
|
||||
private var threadId: JsonField<String> = JsonMissing.of()
|
||||
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
|
||||
|
||||
@JvmSynthetic
|
||||
internal fun from(item: Item) = apply {
|
||||
itemType = item.itemType
|
||||
runId = item.runId
|
||||
sessionId = item.sessionId
|
||||
sourceProposedExampleId = item.sourceProposedExampleId
|
||||
startTime = item.startTime
|
||||
threadId = item.threadId
|
||||
additionalProperties = item.additionalProperties.toMutableMap()
|
||||
}
|
||||
|
||||
fun itemType(itemType: ItemType) = itemType(JsonField.of(itemType))
|
||||
|
||||
/**
|
||||
* Sets [Builder.itemType] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.itemType] with a well-typed [ItemType] value
|
||||
* instead. This method is primarily for setting the field to an undocumented or not yet
|
||||
* supported value.
|
||||
*/
|
||||
fun itemType(itemType: JsonField<ItemType>) = apply { this.itemType = itemType }
|
||||
|
||||
/** RUN fields */
|
||||
fun runId(runId: String) = runId(JsonField.of(runId))
|
||||
|
||||
/**
|
||||
* Sets [Builder.runId] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.runId] with a well-typed [String] value instead.
|
||||
* This method is primarily for setting the field to an undocumented or not yet
|
||||
* supported value.
|
||||
*/
|
||||
fun runId(runId: JsonField<String>) = apply { this.runId = runId }
|
||||
|
||||
/**
|
||||
* Shared optional SmithDB lookup coords. StartTime uses FlexTime because smith-backend
|
||||
* and ClickHouse emit naive UTC timestamps (no timezone suffix) that strict *time.Time
|
||||
* JSON unmarshaling rejects.
|
||||
*/
|
||||
fun sessionId(sessionId: String) = sessionId(JsonField.of(sessionId))
|
||||
|
||||
/**
|
||||
* Sets [Builder.sessionId] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.sessionId] with a well-typed [String] value instead.
|
||||
* This method is primarily for setting the field to an undocumented or not yet
|
||||
* supported value.
|
||||
*/
|
||||
fun sessionId(sessionId: JsonField<String>) = apply { this.sessionId = sessionId }
|
||||
|
||||
/**
|
||||
* SourceProposedExampleID is usually unset. When Issues Board / Engine suggested
|
||||
* examples are added to a queue, the UI sets this to the
|
||||
* tracer_session_issue_proposed_examples row so the queue item can point back at that
|
||||
* suggestion.
|
||||
*/
|
||||
fun sourceProposedExampleId(sourceProposedExampleId: String) =
|
||||
sourceProposedExampleId(JsonField.of(sourceProposedExampleId))
|
||||
|
||||
/**
|
||||
* Sets [Builder.sourceProposedExampleId] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.sourceProposedExampleId] with a well-typed [String]
|
||||
* value instead. This method is primarily for setting the field to an undocumented or
|
||||
* not yet supported value.
|
||||
*/
|
||||
fun sourceProposedExampleId(sourceProposedExampleId: JsonField<String>) = apply {
|
||||
this.sourceProposedExampleId = sourceProposedExampleId
|
||||
}
|
||||
|
||||
fun startTime(startTime: OffsetDateTime) = startTime(JsonField.of(startTime))
|
||||
|
||||
/**
|
||||
* Sets [Builder.startTime] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.startTime] with a well-typed [OffsetDateTime] value
|
||||
* instead. This method is primarily for setting the field to an undocumented or not yet
|
||||
* supported value.
|
||||
*/
|
||||
fun startTime(startTime: JsonField<OffsetDateTime>) = apply {
|
||||
this.startTime = startTime
|
||||
}
|
||||
|
||||
/** THREAD fields (thread_id + session_id required) */
|
||||
fun threadId(threadId: String) = threadId(JsonField.of(threadId))
|
||||
|
||||
/**
|
||||
* Sets [Builder.threadId] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.threadId] with a well-typed [String] value instead.
|
||||
* This method is primarily for setting the field to an undocumented or not yet
|
||||
* supported value.
|
||||
*/
|
||||
fun threadId(threadId: JsonField<String>) = apply { this.threadId = threadId }
|
||||
|
||||
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
|
||||
this.additionalProperties.clear()
|
||||
putAllAdditionalProperties(additionalProperties)
|
||||
}
|
||||
|
||||
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
|
||||
additionalProperties.put(key, value)
|
||||
}
|
||||
|
||||
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
|
||||
this.additionalProperties.putAll(additionalProperties)
|
||||
}
|
||||
|
||||
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
|
||||
|
||||
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
|
||||
keys.forEach(::removeAdditionalProperty)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an immutable instance of [Item].
|
||||
*
|
||||
* Further updates to this [Builder] will not mutate the returned instance.
|
||||
*/
|
||||
fun build(): Item =
|
||||
Item(
|
||||
itemType,
|
||||
runId,
|
||||
sessionId,
|
||||
sourceProposedExampleId,
|
||||
startTime,
|
||||
threadId,
|
||||
additionalProperties.toMutableMap(),
|
||||
)
|
||||
}
|
||||
|
||||
private var validated: Boolean = false
|
||||
|
||||
/**
|
||||
* Validates that the types of all values in this object match their expected types
|
||||
* recursively.
|
||||
*
|
||||
* This method is _not_ forwards compatible with new types from the API for existing fields.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if any value type in this object doesn't match its
|
||||
* expected type.
|
||||
*/
|
||||
fun validate(): Item = apply {
|
||||
if (validated) {
|
||||
return@apply
|
||||
}
|
||||
|
||||
itemType().ifPresent { it.validate() }
|
||||
runId()
|
||||
sessionId()
|
||||
sourceProposedExampleId()
|
||||
startTime()
|
||||
threadId()
|
||||
validated = true
|
||||
}
|
||||
|
||||
fun isValid(): Boolean =
|
||||
try {
|
||||
validate()
|
||||
true
|
||||
} catch (e: LangChainInvalidDataException) {
|
||||
false
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a score indicating how many valid values are contained in this object
|
||||
* recursively.
|
||||
*
|
||||
* Used for best match union deserialization.
|
||||
*/
|
||||
@JvmSynthetic
|
||||
internal fun validity(): Int =
|
||||
(itemType.asKnown().getOrNull()?.validity() ?: 0) +
|
||||
(if (runId.asKnown().isPresent) 1 else 0) +
|
||||
(if (sessionId.asKnown().isPresent) 1 else 0) +
|
||||
(if (sourceProposedExampleId.asKnown().isPresent) 1 else 0) +
|
||||
(if (startTime.asKnown().isPresent) 1 else 0) +
|
||||
(if (threadId.asKnown().isPresent) 1 else 0)
|
||||
|
||||
class ItemType @JsonCreator private constructor(private val value: JsonField<String>) :
|
||||
Enum {
|
||||
|
||||
/**
|
||||
* Returns this class instance's raw value.
|
||||
*
|
||||
* This is usually only useful if this instance was deserialized from data that doesn't
|
||||
* match any known member, and you want to know that value. For example, if the SDK is
|
||||
* on an older version than the API, then the API may respond with new members that the
|
||||
* SDK is unaware of.
|
||||
*/
|
||||
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value
|
||||
|
||||
companion object {
|
||||
|
||||
@JvmField val RUN = of("RUN")
|
||||
|
||||
@JvmField val THREAD = of("THREAD")
|
||||
|
||||
@JvmStatic fun of(value: String) = ItemType(JsonField.of(value))
|
||||
}
|
||||
|
||||
/** An enum containing [ItemType]'s known values. */
|
||||
enum class Known {
|
||||
RUN,
|
||||
THREAD,
|
||||
}
|
||||
|
||||
/**
|
||||
* An enum containing [ItemType]'s known values, as well as an [_UNKNOWN] member.
|
||||
*
|
||||
* An instance of [ItemType] can contain an unknown value in a couple of cases:
|
||||
* - It was deserialized from data that doesn't match any known member. For example, if
|
||||
* the SDK is on an older version than the API, then the API may respond with new
|
||||
* members that the SDK is unaware of.
|
||||
* - It was constructed with an arbitrary value using the [of] method.
|
||||
*/
|
||||
enum class Value {
|
||||
RUN,
|
||||
THREAD,
|
||||
/**
|
||||
* An enum member indicating that [ItemType] was instantiated with an unknown value.
|
||||
*/
|
||||
_UNKNOWN,
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an enum member corresponding to this class instance's value, or
|
||||
* [Value._UNKNOWN] if the class was instantiated with an unknown value.
|
||||
*
|
||||
* Use the [known] method instead if you're certain the value is always known or if you
|
||||
* want to throw for the unknown case.
|
||||
*/
|
||||
fun value(): Value =
|
||||
when (this) {
|
||||
RUN -> Value.RUN
|
||||
THREAD -> Value.THREAD
|
||||
else -> Value._UNKNOWN
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an enum member corresponding to this class instance's value.
|
||||
*
|
||||
* Use the [value] method instead if you're uncertain the value is always known and
|
||||
* don't want to throw for the unknown case.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if this class instance's value is a not a known
|
||||
* member.
|
||||
*/
|
||||
fun known(): Known =
|
||||
when (this) {
|
||||
RUN -> Known.RUN
|
||||
THREAD -> Known.THREAD
|
||||
else -> throw LangChainInvalidDataException("Unknown ItemType: $value")
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns this class instance's primitive wire representation.
|
||||
*
|
||||
* This differs from the [toString] method because that method is primarily for
|
||||
* debugging and generally doesn't throw.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if this class instance's value does not have
|
||||
* the expected primitive type.
|
||||
*/
|
||||
fun asString(): String =
|
||||
_value().asString().orElseThrow {
|
||||
LangChainInvalidDataException("Value is not a String")
|
||||
}
|
||||
|
||||
private var validated: Boolean = false
|
||||
|
||||
/**
|
||||
* Validates that the types of all values in this object match their expected types
|
||||
* recursively.
|
||||
*
|
||||
* This method is _not_ forwards compatible with new types from the API for existing
|
||||
* fields.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if any value type in this object doesn't match
|
||||
* its expected type.
|
||||
*/
|
||||
fun validate(): ItemType = apply {
|
||||
if (validated) {
|
||||
return@apply
|
||||
}
|
||||
|
||||
known()
|
||||
validated = true
|
||||
}
|
||||
|
||||
fun isValid(): Boolean =
|
||||
try {
|
||||
validate()
|
||||
true
|
||||
} catch (e: LangChainInvalidDataException) {
|
||||
false
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a score indicating how many valid values are contained in this object
|
||||
* recursively.
|
||||
*
|
||||
* Used for best match union deserialization.
|
||||
*/
|
||||
@JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
|
||||
return other is ItemType && value == other.value
|
||||
}
|
||||
|
||||
override fun hashCode() = value.hashCode()
|
||||
|
||||
override fun toString() = value.toString()
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
|
||||
return other is Item &&
|
||||
itemType == other.itemType &&
|
||||
runId == other.runId &&
|
||||
sessionId == other.sessionId &&
|
||||
sourceProposedExampleId == other.sourceProposedExampleId &&
|
||||
startTime == other.startTime &&
|
||||
threadId == other.threadId &&
|
||||
additionalProperties == other.additionalProperties
|
||||
}
|
||||
|
||||
private val hashCode: Int by lazy {
|
||||
Objects.hash(
|
||||
itemType,
|
||||
runId,
|
||||
sessionId,
|
||||
sourceProposedExampleId,
|
||||
startTime,
|
||||
threadId,
|
||||
additionalProperties,
|
||||
)
|
||||
}
|
||||
|
||||
override fun hashCode(): Int = hashCode
|
||||
|
||||
override fun toString() =
|
||||
"Item{itemType=$itemType, runId=$runId, sessionId=$sessionId, sourceProposedExampleId=$sourceProposedExampleId, startTime=$startTime, threadId=$threadId, additionalProperties=$additionalProperties}"
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
|
||||
return other is ItemCreateParams &&
|
||||
queueId == other.queueId &&
|
||||
extendTraceRetention == other.extendTraceRetention &&
|
||||
body == other.body &&
|
||||
additionalHeaders == other.additionalHeaders &&
|
||||
additionalQueryParams == other.additionalQueryParams
|
||||
}
|
||||
|
||||
override fun hashCode(): Int =
|
||||
Objects.hash(queueId, extendTraceRetention, body, additionalHeaders, additionalQueryParams)
|
||||
|
||||
override fun toString() =
|
||||
"ItemCreateParams{queueId=$queueId, extendTraceRetention=$extendTraceRetention, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
|
||||
}
|
||||
+819
@@ -0,0 +1,819 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.models.annotationqueues.items
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnyGetter
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter
|
||||
import com.fasterxml.jackson.annotation.JsonCreator
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.langchain.smith.core.Enum
|
||||
import com.langchain.smith.core.ExcludeMissing
|
||||
import com.langchain.smith.core.JsonField
|
||||
import com.langchain.smith.core.JsonMissing
|
||||
import com.langchain.smith.core.JsonValue
|
||||
import com.langchain.smith.core.checkKnown
|
||||
import com.langchain.smith.core.toImmutable
|
||||
import com.langchain.smith.errors.LangChainInvalidDataException
|
||||
import java.util.Collections
|
||||
import java.util.Objects
|
||||
import java.util.Optional
|
||||
import kotlin.jvm.optionals.getOrNull
|
||||
|
||||
class ItemCreateResponse
|
||||
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
|
||||
private constructor(
|
||||
private val items: JsonField<List<Item>>,
|
||||
private val additionalProperties: MutableMap<String, JsonValue>,
|
||||
) {
|
||||
|
||||
@JsonCreator
|
||||
private constructor(
|
||||
@JsonProperty("items") @ExcludeMissing items: JsonField<List<Item>> = JsonMissing.of()
|
||||
) : this(items, mutableMapOf())
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun items(): Optional<List<Item>> = items.getOptional("items")
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [items].
|
||||
*
|
||||
* Unlike [items], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("items") @ExcludeMissing fun _items(): JsonField<List<Item>> = items
|
||||
|
||||
@JsonAnySetter
|
||||
private fun putAdditionalProperty(key: String, value: JsonValue) {
|
||||
additionalProperties.put(key, value)
|
||||
}
|
||||
|
||||
@JsonAnyGetter
|
||||
@ExcludeMissing
|
||||
fun _additionalProperties(): Map<String, JsonValue> =
|
||||
Collections.unmodifiableMap(additionalProperties)
|
||||
|
||||
fun toBuilder() = Builder().from(this)
|
||||
|
||||
companion object {
|
||||
|
||||
/** Returns a mutable builder for constructing an instance of [ItemCreateResponse]. */
|
||||
@JvmStatic fun builder() = Builder()
|
||||
}
|
||||
|
||||
/** A builder for [ItemCreateResponse]. */
|
||||
class Builder internal constructor() {
|
||||
|
||||
private var items: JsonField<MutableList<Item>>? = null
|
||||
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
|
||||
|
||||
@JvmSynthetic
|
||||
internal fun from(itemCreateResponse: ItemCreateResponse) = apply {
|
||||
items = itemCreateResponse.items.map { it.toMutableList() }
|
||||
additionalProperties = itemCreateResponse.additionalProperties.toMutableMap()
|
||||
}
|
||||
|
||||
fun items(items: List<Item>) = items(JsonField.of(items))
|
||||
|
||||
/**
|
||||
* Sets [Builder.items] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.items] with a well-typed `List<Item>` value instead.
|
||||
* This method is primarily for setting the field to an undocumented or not yet supported
|
||||
* value.
|
||||
*/
|
||||
fun items(items: JsonField<List<Item>>) = apply {
|
||||
this.items = items.map { it.toMutableList() }
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a single [Item] to [items].
|
||||
*
|
||||
* @throws IllegalStateException if the field was previously set to a non-list.
|
||||
*/
|
||||
fun addItem(item: Item) = apply {
|
||||
items =
|
||||
(items ?: JsonField.of(mutableListOf())).also { checkKnown("items", it).add(item) }
|
||||
}
|
||||
|
||||
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
|
||||
this.additionalProperties.clear()
|
||||
putAllAdditionalProperties(additionalProperties)
|
||||
}
|
||||
|
||||
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
|
||||
additionalProperties.put(key, value)
|
||||
}
|
||||
|
||||
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
|
||||
this.additionalProperties.putAll(additionalProperties)
|
||||
}
|
||||
|
||||
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
|
||||
|
||||
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
|
||||
keys.forEach(::removeAdditionalProperty)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an immutable instance of [ItemCreateResponse].
|
||||
*
|
||||
* Further updates to this [Builder] will not mutate the returned instance.
|
||||
*/
|
||||
fun build(): ItemCreateResponse =
|
||||
ItemCreateResponse(
|
||||
(items ?: JsonMissing.of()).map { it.toImmutable() },
|
||||
additionalProperties.toMutableMap(),
|
||||
)
|
||||
}
|
||||
|
||||
private var validated: Boolean = false
|
||||
|
||||
/**
|
||||
* Validates that the types of all values in this object match their expected types recursively.
|
||||
*
|
||||
* This method is _not_ forwards compatible with new types from the API for existing fields.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if any value type in this object doesn't match its
|
||||
* expected type.
|
||||
*/
|
||||
fun validate(): ItemCreateResponse = apply {
|
||||
if (validated) {
|
||||
return@apply
|
||||
}
|
||||
|
||||
items().ifPresent { it.forEach { it.validate() } }
|
||||
validated = true
|
||||
}
|
||||
|
||||
fun isValid(): Boolean =
|
||||
try {
|
||||
validate()
|
||||
true
|
||||
} catch (e: LangChainInvalidDataException) {
|
||||
false
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a score indicating how many valid values are contained in this object recursively.
|
||||
*
|
||||
* Used for best match union deserialization.
|
||||
*/
|
||||
@JvmSynthetic
|
||||
internal fun validity(): Int =
|
||||
(items.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
|
||||
|
||||
class Item
|
||||
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
|
||||
private constructor(
|
||||
private val id: JsonField<String>,
|
||||
private val addedAt: JsonField<String>,
|
||||
private val itemType: JsonField<ItemType>,
|
||||
private val lastReviewedTime: JsonField<String>,
|
||||
private val queueId: JsonField<String>,
|
||||
private val runId: JsonField<String>,
|
||||
private val sessionId: JsonField<String>,
|
||||
private val sourceProposedExampleId: JsonField<String>,
|
||||
private val startTime: JsonField<String>,
|
||||
private val threadId: JsonField<String>,
|
||||
private val additionalProperties: MutableMap<String, JsonValue>,
|
||||
) {
|
||||
|
||||
@JsonCreator
|
||||
private constructor(
|
||||
@JsonProperty("id") @ExcludeMissing id: JsonField<String> = JsonMissing.of(),
|
||||
@JsonProperty("added_at") @ExcludeMissing addedAt: JsonField<String> = JsonMissing.of(),
|
||||
@JsonProperty("item_type")
|
||||
@ExcludeMissing
|
||||
itemType: JsonField<ItemType> = JsonMissing.of(),
|
||||
@JsonProperty("last_reviewed_time")
|
||||
@ExcludeMissing
|
||||
lastReviewedTime: JsonField<String> = JsonMissing.of(),
|
||||
@JsonProperty("queue_id") @ExcludeMissing queueId: JsonField<String> = JsonMissing.of(),
|
||||
@JsonProperty("run_id") @ExcludeMissing runId: JsonField<String> = JsonMissing.of(),
|
||||
@JsonProperty("session_id")
|
||||
@ExcludeMissing
|
||||
sessionId: JsonField<String> = JsonMissing.of(),
|
||||
@JsonProperty("source_proposed_example_id")
|
||||
@ExcludeMissing
|
||||
sourceProposedExampleId: JsonField<String> = JsonMissing.of(),
|
||||
@JsonProperty("start_time")
|
||||
@ExcludeMissing
|
||||
startTime: JsonField<String> = JsonMissing.of(),
|
||||
@JsonProperty("thread_id")
|
||||
@ExcludeMissing
|
||||
threadId: JsonField<String> = JsonMissing.of(),
|
||||
) : this(
|
||||
id,
|
||||
addedAt,
|
||||
itemType,
|
||||
lastReviewedTime,
|
||||
queueId,
|
||||
runId,
|
||||
sessionId,
|
||||
sourceProposedExampleId,
|
||||
startTime,
|
||||
threadId,
|
||||
mutableMapOf(),
|
||||
)
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
|
||||
* the server responded with an unexpected value).
|
||||
*/
|
||||
fun id(): Optional<String> = id.getOptional("id")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
|
||||
* the server responded with an unexpected value).
|
||||
*/
|
||||
fun addedAt(): Optional<String> = addedAt.getOptional("added_at")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
|
||||
* the server responded with an unexpected value).
|
||||
*/
|
||||
fun itemType(): Optional<ItemType> = itemType.getOptional("item_type")
|
||||
|
||||
/**
|
||||
* LastReviewedTime is always present on the wire (null until reviewed).
|
||||
*
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
|
||||
* the server responded with an unexpected value).
|
||||
*/
|
||||
fun lastReviewedTime(): Optional<String> =
|
||||
lastReviewedTime.getOptional("last_reviewed_time")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
|
||||
* the server responded with an unexpected value).
|
||||
*/
|
||||
fun queueId(): Optional<String> = queueId.getOptional("queue_id")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
|
||||
* the server responded with an unexpected value).
|
||||
*/
|
||||
fun runId(): Optional<String> = runId.getOptional("run_id")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
|
||||
* the server responded with an unexpected value).
|
||||
*/
|
||||
fun sessionId(): Optional<String> = sessionId.getOptional("session_id")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
|
||||
* the server responded with an unexpected value).
|
||||
*/
|
||||
fun sourceProposedExampleId(): Optional<String> =
|
||||
sourceProposedExampleId.getOptional("source_proposed_example_id")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
|
||||
* the server responded with an unexpected value).
|
||||
*/
|
||||
fun startTime(): Optional<String> = startTime.getOptional("start_time")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
|
||||
* the server responded with an unexpected value).
|
||||
*/
|
||||
fun threadId(): Optional<String> = threadId.getOptional("thread_id")
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [id].
|
||||
*
|
||||
* Unlike [id], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("id") @ExcludeMissing fun _id(): JsonField<String> = id
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [addedAt].
|
||||
*
|
||||
* Unlike [addedAt], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("added_at") @ExcludeMissing fun _addedAt(): JsonField<String> = addedAt
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [itemType].
|
||||
*
|
||||
* Unlike [itemType], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("item_type") @ExcludeMissing fun _itemType(): JsonField<ItemType> = itemType
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [lastReviewedTime].
|
||||
*
|
||||
* Unlike [lastReviewedTime], this method doesn't throw if the JSON field has an unexpected
|
||||
* type.
|
||||
*/
|
||||
@JsonProperty("last_reviewed_time")
|
||||
@ExcludeMissing
|
||||
fun _lastReviewedTime(): JsonField<String> = lastReviewedTime
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [queueId].
|
||||
*
|
||||
* Unlike [queueId], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("queue_id") @ExcludeMissing fun _queueId(): JsonField<String> = queueId
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [runId].
|
||||
*
|
||||
* Unlike [runId], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("run_id") @ExcludeMissing fun _runId(): JsonField<String> = runId
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [sessionId].
|
||||
*
|
||||
* Unlike [sessionId], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("session_id") @ExcludeMissing fun _sessionId(): JsonField<String> = sessionId
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [sourceProposedExampleId].
|
||||
*
|
||||
* Unlike [sourceProposedExampleId], this method doesn't throw if the JSON field has an
|
||||
* unexpected type.
|
||||
*/
|
||||
@JsonProperty("source_proposed_example_id")
|
||||
@ExcludeMissing
|
||||
fun _sourceProposedExampleId(): JsonField<String> = sourceProposedExampleId
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [startTime].
|
||||
*
|
||||
* Unlike [startTime], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("start_time") @ExcludeMissing fun _startTime(): JsonField<String> = startTime
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [threadId].
|
||||
*
|
||||
* Unlike [threadId], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("thread_id") @ExcludeMissing fun _threadId(): JsonField<String> = threadId
|
||||
|
||||
@JsonAnySetter
|
||||
private fun putAdditionalProperty(key: String, value: JsonValue) {
|
||||
additionalProperties.put(key, value)
|
||||
}
|
||||
|
||||
@JsonAnyGetter
|
||||
@ExcludeMissing
|
||||
fun _additionalProperties(): Map<String, JsonValue> =
|
||||
Collections.unmodifiableMap(additionalProperties)
|
||||
|
||||
fun toBuilder() = Builder().from(this)
|
||||
|
||||
companion object {
|
||||
|
||||
/** Returns a mutable builder for constructing an instance of [Item]. */
|
||||
@JvmStatic fun builder() = Builder()
|
||||
}
|
||||
|
||||
/** A builder for [Item]. */
|
||||
class Builder internal constructor() {
|
||||
|
||||
private var id: JsonField<String> = JsonMissing.of()
|
||||
private var addedAt: JsonField<String> = JsonMissing.of()
|
||||
private var itemType: JsonField<ItemType> = JsonMissing.of()
|
||||
private var lastReviewedTime: JsonField<String> = JsonMissing.of()
|
||||
private var queueId: JsonField<String> = JsonMissing.of()
|
||||
private var runId: JsonField<String> = JsonMissing.of()
|
||||
private var sessionId: JsonField<String> = JsonMissing.of()
|
||||
private var sourceProposedExampleId: JsonField<String> = JsonMissing.of()
|
||||
private var startTime: JsonField<String> = JsonMissing.of()
|
||||
private var threadId: JsonField<String> = JsonMissing.of()
|
||||
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
|
||||
|
||||
@JvmSynthetic
|
||||
internal fun from(item: Item) = apply {
|
||||
id = item.id
|
||||
addedAt = item.addedAt
|
||||
itemType = item.itemType
|
||||
lastReviewedTime = item.lastReviewedTime
|
||||
queueId = item.queueId
|
||||
runId = item.runId
|
||||
sessionId = item.sessionId
|
||||
sourceProposedExampleId = item.sourceProposedExampleId
|
||||
startTime = item.startTime
|
||||
threadId = item.threadId
|
||||
additionalProperties = item.additionalProperties.toMutableMap()
|
||||
}
|
||||
|
||||
fun id(id: String) = id(JsonField.of(id))
|
||||
|
||||
/**
|
||||
* Sets [Builder.id] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.id] with a well-typed [String] value instead. This
|
||||
* method is primarily for setting the field to an undocumented or not yet supported
|
||||
* value.
|
||||
*/
|
||||
fun id(id: JsonField<String>) = apply { this.id = id }
|
||||
|
||||
fun addedAt(addedAt: String) = addedAt(JsonField.of(addedAt))
|
||||
|
||||
/**
|
||||
* Sets [Builder.addedAt] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.addedAt] with a well-typed [String] value instead.
|
||||
* This method is primarily for setting the field to an undocumented or not yet
|
||||
* supported value.
|
||||
*/
|
||||
fun addedAt(addedAt: JsonField<String>) = apply { this.addedAt = addedAt }
|
||||
|
||||
fun itemType(itemType: ItemType) = itemType(JsonField.of(itemType))
|
||||
|
||||
/**
|
||||
* Sets [Builder.itemType] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.itemType] with a well-typed [ItemType] value
|
||||
* instead. This method is primarily for setting the field to an undocumented or not yet
|
||||
* supported value.
|
||||
*/
|
||||
fun itemType(itemType: JsonField<ItemType>) = apply { this.itemType = itemType }
|
||||
|
||||
/** LastReviewedTime is always present on the wire (null until reviewed). */
|
||||
fun lastReviewedTime(lastReviewedTime: String) =
|
||||
lastReviewedTime(JsonField.of(lastReviewedTime))
|
||||
|
||||
/**
|
||||
* Sets [Builder.lastReviewedTime] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.lastReviewedTime] with a well-typed [String] value
|
||||
* instead. This method is primarily for setting the field to an undocumented or not yet
|
||||
* supported value.
|
||||
*/
|
||||
fun lastReviewedTime(lastReviewedTime: JsonField<String>) = apply {
|
||||
this.lastReviewedTime = lastReviewedTime
|
||||
}
|
||||
|
||||
fun queueId(queueId: String) = queueId(JsonField.of(queueId))
|
||||
|
||||
/**
|
||||
* Sets [Builder.queueId] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.queueId] with a well-typed [String] value instead.
|
||||
* This method is primarily for setting the field to an undocumented or not yet
|
||||
* supported value.
|
||||
*/
|
||||
fun queueId(queueId: JsonField<String>) = apply { this.queueId = queueId }
|
||||
|
||||
fun runId(runId: String) = runId(JsonField.of(runId))
|
||||
|
||||
/**
|
||||
* Sets [Builder.runId] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.runId] with a well-typed [String] value instead.
|
||||
* This method is primarily for setting the field to an undocumented or not yet
|
||||
* supported value.
|
||||
*/
|
||||
fun runId(runId: JsonField<String>) = apply { this.runId = runId }
|
||||
|
||||
fun sessionId(sessionId: String) = sessionId(JsonField.of(sessionId))
|
||||
|
||||
/**
|
||||
* Sets [Builder.sessionId] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.sessionId] with a well-typed [String] value instead.
|
||||
* This method is primarily for setting the field to an undocumented or not yet
|
||||
* supported value.
|
||||
*/
|
||||
fun sessionId(sessionId: JsonField<String>) = apply { this.sessionId = sessionId }
|
||||
|
||||
fun sourceProposedExampleId(sourceProposedExampleId: String) =
|
||||
sourceProposedExampleId(JsonField.of(sourceProposedExampleId))
|
||||
|
||||
/**
|
||||
* Sets [Builder.sourceProposedExampleId] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.sourceProposedExampleId] with a well-typed [String]
|
||||
* value instead. This method is primarily for setting the field to an undocumented or
|
||||
* not yet supported value.
|
||||
*/
|
||||
fun sourceProposedExampleId(sourceProposedExampleId: JsonField<String>) = apply {
|
||||
this.sourceProposedExampleId = sourceProposedExampleId
|
||||
}
|
||||
|
||||
fun startTime(startTime: String) = startTime(JsonField.of(startTime))
|
||||
|
||||
/**
|
||||
* Sets [Builder.startTime] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.startTime] with a well-typed [String] value instead.
|
||||
* This method is primarily for setting the field to an undocumented or not yet
|
||||
* supported value.
|
||||
*/
|
||||
fun startTime(startTime: JsonField<String>) = apply { this.startTime = startTime }
|
||||
|
||||
fun threadId(threadId: String) = threadId(JsonField.of(threadId))
|
||||
|
||||
/**
|
||||
* Sets [Builder.threadId] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.threadId] with a well-typed [String] value instead.
|
||||
* This method is primarily for setting the field to an undocumented or not yet
|
||||
* supported value.
|
||||
*/
|
||||
fun threadId(threadId: JsonField<String>) = apply { this.threadId = threadId }
|
||||
|
||||
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
|
||||
this.additionalProperties.clear()
|
||||
putAllAdditionalProperties(additionalProperties)
|
||||
}
|
||||
|
||||
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
|
||||
additionalProperties.put(key, value)
|
||||
}
|
||||
|
||||
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
|
||||
this.additionalProperties.putAll(additionalProperties)
|
||||
}
|
||||
|
||||
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
|
||||
|
||||
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
|
||||
keys.forEach(::removeAdditionalProperty)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an immutable instance of [Item].
|
||||
*
|
||||
* Further updates to this [Builder] will not mutate the returned instance.
|
||||
*/
|
||||
fun build(): Item =
|
||||
Item(
|
||||
id,
|
||||
addedAt,
|
||||
itemType,
|
||||
lastReviewedTime,
|
||||
queueId,
|
||||
runId,
|
||||
sessionId,
|
||||
sourceProposedExampleId,
|
||||
startTime,
|
||||
threadId,
|
||||
additionalProperties.toMutableMap(),
|
||||
)
|
||||
}
|
||||
|
||||
private var validated: Boolean = false
|
||||
|
||||
/**
|
||||
* Validates that the types of all values in this object match their expected types
|
||||
* recursively.
|
||||
*
|
||||
* This method is _not_ forwards compatible with new types from the API for existing fields.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if any value type in this object doesn't match its
|
||||
* expected type.
|
||||
*/
|
||||
fun validate(): Item = apply {
|
||||
if (validated) {
|
||||
return@apply
|
||||
}
|
||||
|
||||
id()
|
||||
addedAt()
|
||||
itemType().ifPresent { it.validate() }
|
||||
lastReviewedTime()
|
||||
queueId()
|
||||
runId()
|
||||
sessionId()
|
||||
sourceProposedExampleId()
|
||||
startTime()
|
||||
threadId()
|
||||
validated = true
|
||||
}
|
||||
|
||||
fun isValid(): Boolean =
|
||||
try {
|
||||
validate()
|
||||
true
|
||||
} catch (e: LangChainInvalidDataException) {
|
||||
false
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a score indicating how many valid values are contained in this object
|
||||
* recursively.
|
||||
*
|
||||
* Used for best match union deserialization.
|
||||
*/
|
||||
@JvmSynthetic
|
||||
internal fun validity(): Int =
|
||||
(if (id.asKnown().isPresent) 1 else 0) +
|
||||
(if (addedAt.asKnown().isPresent) 1 else 0) +
|
||||
(itemType.asKnown().getOrNull()?.validity() ?: 0) +
|
||||
(if (lastReviewedTime.asKnown().isPresent) 1 else 0) +
|
||||
(if (queueId.asKnown().isPresent) 1 else 0) +
|
||||
(if (runId.asKnown().isPresent) 1 else 0) +
|
||||
(if (sessionId.asKnown().isPresent) 1 else 0) +
|
||||
(if (sourceProposedExampleId.asKnown().isPresent) 1 else 0) +
|
||||
(if (startTime.asKnown().isPresent) 1 else 0) +
|
||||
(if (threadId.asKnown().isPresent) 1 else 0)
|
||||
|
||||
class ItemType @JsonCreator private constructor(private val value: JsonField<String>) :
|
||||
Enum {
|
||||
|
||||
/**
|
||||
* Returns this class instance's raw value.
|
||||
*
|
||||
* This is usually only useful if this instance was deserialized from data that doesn't
|
||||
* match any known member, and you want to know that value. For example, if the SDK is
|
||||
* on an older version than the API, then the API may respond with new members that the
|
||||
* SDK is unaware of.
|
||||
*/
|
||||
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value
|
||||
|
||||
companion object {
|
||||
|
||||
@JvmField val RUN = of("RUN")
|
||||
|
||||
@JvmField val THREAD = of("THREAD")
|
||||
|
||||
@JvmStatic fun of(value: String) = ItemType(JsonField.of(value))
|
||||
}
|
||||
|
||||
/** An enum containing [ItemType]'s known values. */
|
||||
enum class Known {
|
||||
RUN,
|
||||
THREAD,
|
||||
}
|
||||
|
||||
/**
|
||||
* An enum containing [ItemType]'s known values, as well as an [_UNKNOWN] member.
|
||||
*
|
||||
* An instance of [ItemType] can contain an unknown value in a couple of cases:
|
||||
* - It was deserialized from data that doesn't match any known member. For example, if
|
||||
* the SDK is on an older version than the API, then the API may respond with new
|
||||
* members that the SDK is unaware of.
|
||||
* - It was constructed with an arbitrary value using the [of] method.
|
||||
*/
|
||||
enum class Value {
|
||||
RUN,
|
||||
THREAD,
|
||||
/**
|
||||
* An enum member indicating that [ItemType] was instantiated with an unknown value.
|
||||
*/
|
||||
_UNKNOWN,
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an enum member corresponding to this class instance's value, or
|
||||
* [Value._UNKNOWN] if the class was instantiated with an unknown value.
|
||||
*
|
||||
* Use the [known] method instead if you're certain the value is always known or if you
|
||||
* want to throw for the unknown case.
|
||||
*/
|
||||
fun value(): Value =
|
||||
when (this) {
|
||||
RUN -> Value.RUN
|
||||
THREAD -> Value.THREAD
|
||||
else -> Value._UNKNOWN
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an enum member corresponding to this class instance's value.
|
||||
*
|
||||
* Use the [value] method instead if you're uncertain the value is always known and
|
||||
* don't want to throw for the unknown case.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if this class instance's value is a not a known
|
||||
* member.
|
||||
*/
|
||||
fun known(): Known =
|
||||
when (this) {
|
||||
RUN -> Known.RUN
|
||||
THREAD -> Known.THREAD
|
||||
else -> throw LangChainInvalidDataException("Unknown ItemType: $value")
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns this class instance's primitive wire representation.
|
||||
*
|
||||
* This differs from the [toString] method because that method is primarily for
|
||||
* debugging and generally doesn't throw.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if this class instance's value does not have
|
||||
* the expected primitive type.
|
||||
*/
|
||||
fun asString(): String =
|
||||
_value().asString().orElseThrow {
|
||||
LangChainInvalidDataException("Value is not a String")
|
||||
}
|
||||
|
||||
private var validated: Boolean = false
|
||||
|
||||
/**
|
||||
* Validates that the types of all values in this object match their expected types
|
||||
* recursively.
|
||||
*
|
||||
* This method is _not_ forwards compatible with new types from the API for existing
|
||||
* fields.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if any value type in this object doesn't match
|
||||
* its expected type.
|
||||
*/
|
||||
fun validate(): ItemType = apply {
|
||||
if (validated) {
|
||||
return@apply
|
||||
}
|
||||
|
||||
known()
|
||||
validated = true
|
||||
}
|
||||
|
||||
fun isValid(): Boolean =
|
||||
try {
|
||||
validate()
|
||||
true
|
||||
} catch (e: LangChainInvalidDataException) {
|
||||
false
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a score indicating how many valid values are contained in this object
|
||||
* recursively.
|
||||
*
|
||||
* Used for best match union deserialization.
|
||||
*/
|
||||
@JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
|
||||
return other is ItemType && value == other.value
|
||||
}
|
||||
|
||||
override fun hashCode() = value.hashCode()
|
||||
|
||||
override fun toString() = value.toString()
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
|
||||
return other is Item &&
|
||||
id == other.id &&
|
||||
addedAt == other.addedAt &&
|
||||
itemType == other.itemType &&
|
||||
lastReviewedTime == other.lastReviewedTime &&
|
||||
queueId == other.queueId &&
|
||||
runId == other.runId &&
|
||||
sessionId == other.sessionId &&
|
||||
sourceProposedExampleId == other.sourceProposedExampleId &&
|
||||
startTime == other.startTime &&
|
||||
threadId == other.threadId &&
|
||||
additionalProperties == other.additionalProperties
|
||||
}
|
||||
|
||||
private val hashCode: Int by lazy {
|
||||
Objects.hash(
|
||||
id,
|
||||
addedAt,
|
||||
itemType,
|
||||
lastReviewedTime,
|
||||
queueId,
|
||||
runId,
|
||||
sessionId,
|
||||
sourceProposedExampleId,
|
||||
startTime,
|
||||
threadId,
|
||||
additionalProperties,
|
||||
)
|
||||
}
|
||||
|
||||
override fun hashCode(): Int = hashCode
|
||||
|
||||
override fun toString() =
|
||||
"Item{id=$id, addedAt=$addedAt, itemType=$itemType, lastReviewedTime=$lastReviewedTime, queueId=$queueId, runId=$runId, sessionId=$sessionId, sourceProposedExampleId=$sourceProposedExampleId, startTime=$startTime, threadId=$threadId, additionalProperties=$additionalProperties}"
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
|
||||
return other is ItemCreateResponse &&
|
||||
items == other.items &&
|
||||
additionalProperties == other.additionalProperties
|
||||
}
|
||||
|
||||
private val hashCode: Int by lazy { Objects.hash(items, additionalProperties) }
|
||||
|
||||
override fun hashCode(): Int = hashCode
|
||||
|
||||
override fun toString() =
|
||||
"ItemCreateResponse{items=$items, additionalProperties=$additionalProperties}"
|
||||
}
|
||||
+623
@@ -0,0 +1,623 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.models.annotationqueues.items
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnyGetter
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter
|
||||
import com.fasterxml.jackson.annotation.JsonCreator
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.langchain.smith.core.Enum
|
||||
import com.langchain.smith.core.ExcludeMissing
|
||||
import com.langchain.smith.core.JsonField
|
||||
import com.langchain.smith.core.JsonMissing
|
||||
import com.langchain.smith.core.JsonValue
|
||||
import com.langchain.smith.core.Params
|
||||
import com.langchain.smith.core.http.Headers
|
||||
import com.langchain.smith.core.http.QueryParams
|
||||
import com.langchain.smith.errors.LangChainInvalidDataException
|
||||
import java.util.Collections
|
||||
import java.util.Objects
|
||||
import java.util.Optional
|
||||
import kotlin.jvm.optionals.getOrNull
|
||||
|
||||
/**
|
||||
* Log the caller's reviewer status for a RUN or THREAD annotation queue item. A null status
|
||||
* re-shows the item for this reviewer.
|
||||
*/
|
||||
class ItemCreateStatusParams
|
||||
private constructor(
|
||||
private val queueItemId: String?,
|
||||
private val body: Body,
|
||||
private val additionalHeaders: Headers,
|
||||
private val additionalQueryParams: QueryParams,
|
||||
) : Params {
|
||||
|
||||
fun queueItemId(): Optional<String> = Optional.ofNullable(queueItemId)
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun overrideAddedAt(): Optional<String> = body.overrideAddedAt()
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun status(): Optional<Status> = body.status()
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [overrideAddedAt].
|
||||
*
|
||||
* Unlike [overrideAddedAt], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
fun _overrideAddedAt(): JsonField<String> = body._overrideAddedAt()
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [status].
|
||||
*
|
||||
* Unlike [status], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
fun _status(): JsonField<Status> = body._status()
|
||||
|
||||
fun _additionalBodyProperties(): Map<String, JsonValue> = body._additionalProperties()
|
||||
|
||||
/** Additional headers to send with the request. */
|
||||
fun _additionalHeaders(): Headers = additionalHeaders
|
||||
|
||||
/** Additional query param to send with the request. */
|
||||
fun _additionalQueryParams(): QueryParams = additionalQueryParams
|
||||
|
||||
fun toBuilder() = Builder().from(this)
|
||||
|
||||
companion object {
|
||||
|
||||
@JvmStatic fun none(): ItemCreateStatusParams = builder().build()
|
||||
|
||||
/** Returns a mutable builder for constructing an instance of [ItemCreateStatusParams]. */
|
||||
@JvmStatic fun builder() = Builder()
|
||||
}
|
||||
|
||||
/** A builder for [ItemCreateStatusParams]. */
|
||||
class Builder internal constructor() {
|
||||
|
||||
private var queueItemId: String? = null
|
||||
private var body: Body.Builder = Body.builder()
|
||||
private var additionalHeaders: Headers.Builder = Headers.builder()
|
||||
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
|
||||
|
||||
@JvmSynthetic
|
||||
internal fun from(itemCreateStatusParams: ItemCreateStatusParams) = apply {
|
||||
queueItemId = itemCreateStatusParams.queueItemId
|
||||
body = itemCreateStatusParams.body.toBuilder()
|
||||
additionalHeaders = itemCreateStatusParams.additionalHeaders.toBuilder()
|
||||
additionalQueryParams = itemCreateStatusParams.additionalQueryParams.toBuilder()
|
||||
}
|
||||
|
||||
fun queueItemId(queueItemId: String?) = apply { this.queueItemId = queueItemId }
|
||||
|
||||
/** Alias for calling [Builder.queueItemId] with `queueItemId.orElse(null)`. */
|
||||
fun queueItemId(queueItemId: Optional<String>) = queueItemId(queueItemId.getOrNull())
|
||||
|
||||
/**
|
||||
* Sets the entire request body.
|
||||
*
|
||||
* This is generally only useful if you are already constructing the body separately.
|
||||
* Otherwise, it's more convenient to use the top-level setters instead:
|
||||
* - [overrideAddedAt]
|
||||
* - [status]
|
||||
*/
|
||||
fun body(body: Body) = apply { this.body = body.toBuilder() }
|
||||
|
||||
fun overrideAddedAt(overrideAddedAt: String) = apply {
|
||||
body.overrideAddedAt(overrideAddedAt)
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets [Builder.overrideAddedAt] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.overrideAddedAt] with a well-typed [String] value
|
||||
* instead. This method is primarily for setting the field to an undocumented or not yet
|
||||
* supported value.
|
||||
*/
|
||||
fun overrideAddedAt(overrideAddedAt: JsonField<String>) = apply {
|
||||
body.overrideAddedAt(overrideAddedAt)
|
||||
}
|
||||
|
||||
fun status(status: Status) = apply { body.status(status) }
|
||||
|
||||
/**
|
||||
* Sets [Builder.status] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.status] with a well-typed [Status] value instead. This
|
||||
* method is primarily for setting the field to an undocumented or not yet supported value.
|
||||
*/
|
||||
fun status(status: JsonField<Status>) = apply { body.status(status) }
|
||||
|
||||
fun additionalBodyProperties(additionalBodyProperties: Map<String, JsonValue>) = apply {
|
||||
body.additionalProperties(additionalBodyProperties)
|
||||
}
|
||||
|
||||
fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply {
|
||||
body.putAdditionalProperty(key, value)
|
||||
}
|
||||
|
||||
fun putAllAdditionalBodyProperties(additionalBodyProperties: Map<String, JsonValue>) =
|
||||
apply {
|
||||
body.putAllAdditionalProperties(additionalBodyProperties)
|
||||
}
|
||||
|
||||
fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) }
|
||||
|
||||
fun removeAllAdditionalBodyProperties(keys: Set<String>) = apply {
|
||||
body.removeAllAdditionalProperties(keys)
|
||||
}
|
||||
|
||||
fun additionalHeaders(additionalHeaders: Headers) = apply {
|
||||
this.additionalHeaders.clear()
|
||||
putAllAdditionalHeaders(additionalHeaders)
|
||||
}
|
||||
|
||||
fun additionalHeaders(additionalHeaders: Map<String, Iterable<String>>) = apply {
|
||||
this.additionalHeaders.clear()
|
||||
putAllAdditionalHeaders(additionalHeaders)
|
||||
}
|
||||
|
||||
fun putAdditionalHeader(name: String, value: String) = apply {
|
||||
additionalHeaders.put(name, value)
|
||||
}
|
||||
|
||||
fun putAdditionalHeaders(name: String, values: Iterable<String>) = apply {
|
||||
additionalHeaders.put(name, values)
|
||||
}
|
||||
|
||||
fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply {
|
||||
this.additionalHeaders.putAll(additionalHeaders)
|
||||
}
|
||||
|
||||
fun putAllAdditionalHeaders(additionalHeaders: Map<String, Iterable<String>>) = apply {
|
||||
this.additionalHeaders.putAll(additionalHeaders)
|
||||
}
|
||||
|
||||
fun replaceAdditionalHeaders(name: String, value: String) = apply {
|
||||
additionalHeaders.replace(name, value)
|
||||
}
|
||||
|
||||
fun replaceAdditionalHeaders(name: String, values: Iterable<String>) = apply {
|
||||
additionalHeaders.replace(name, values)
|
||||
}
|
||||
|
||||
fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply {
|
||||
this.additionalHeaders.replaceAll(additionalHeaders)
|
||||
}
|
||||
|
||||
fun replaceAllAdditionalHeaders(additionalHeaders: Map<String, Iterable<String>>) = apply {
|
||||
this.additionalHeaders.replaceAll(additionalHeaders)
|
||||
}
|
||||
|
||||
fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) }
|
||||
|
||||
fun removeAllAdditionalHeaders(names: Set<String>) = apply {
|
||||
additionalHeaders.removeAll(names)
|
||||
}
|
||||
|
||||
fun additionalQueryParams(additionalQueryParams: QueryParams) = apply {
|
||||
this.additionalQueryParams.clear()
|
||||
putAllAdditionalQueryParams(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun additionalQueryParams(additionalQueryParams: Map<String, Iterable<String>>) = apply {
|
||||
this.additionalQueryParams.clear()
|
||||
putAllAdditionalQueryParams(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun putAdditionalQueryParam(key: String, value: String) = apply {
|
||||
additionalQueryParams.put(key, value)
|
||||
}
|
||||
|
||||
fun putAdditionalQueryParams(key: String, values: Iterable<String>) = apply {
|
||||
additionalQueryParams.put(key, values)
|
||||
}
|
||||
|
||||
fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
|
||||
this.additionalQueryParams.putAll(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun putAllAdditionalQueryParams(additionalQueryParams: Map<String, Iterable<String>>) =
|
||||
apply {
|
||||
this.additionalQueryParams.putAll(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun replaceAdditionalQueryParams(key: String, value: String) = apply {
|
||||
additionalQueryParams.replace(key, value)
|
||||
}
|
||||
|
||||
fun replaceAdditionalQueryParams(key: String, values: Iterable<String>) = apply {
|
||||
additionalQueryParams.replace(key, values)
|
||||
}
|
||||
|
||||
fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
|
||||
this.additionalQueryParams.replaceAll(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun replaceAllAdditionalQueryParams(additionalQueryParams: Map<String, Iterable<String>>) =
|
||||
apply {
|
||||
this.additionalQueryParams.replaceAll(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) }
|
||||
|
||||
fun removeAllAdditionalQueryParams(keys: Set<String>) = apply {
|
||||
additionalQueryParams.removeAll(keys)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an immutable instance of [ItemCreateStatusParams].
|
||||
*
|
||||
* Further updates to this [Builder] will not mutate the returned instance.
|
||||
*/
|
||||
fun build(): ItemCreateStatusParams =
|
||||
ItemCreateStatusParams(
|
||||
queueItemId,
|
||||
body.build(),
|
||||
additionalHeaders.build(),
|
||||
additionalQueryParams.build(),
|
||||
)
|
||||
}
|
||||
|
||||
fun _body(): Body = body
|
||||
|
||||
fun _pathParam(index: Int): String =
|
||||
when (index) {
|
||||
0 -> queueItemId ?: ""
|
||||
else -> ""
|
||||
}
|
||||
|
||||
override fun _headers(): Headers = additionalHeaders
|
||||
|
||||
override fun _queryParams(): QueryParams = additionalQueryParams
|
||||
|
||||
class Body
|
||||
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
|
||||
private constructor(
|
||||
private val overrideAddedAt: JsonField<String>,
|
||||
private val status: JsonField<Status>,
|
||||
private val additionalProperties: MutableMap<String, JsonValue>,
|
||||
) {
|
||||
|
||||
@JsonCreator
|
||||
private constructor(
|
||||
@JsonProperty("override_added_at")
|
||||
@ExcludeMissing
|
||||
overrideAddedAt: JsonField<String> = JsonMissing.of(),
|
||||
@JsonProperty("status") @ExcludeMissing status: JsonField<Status> = JsonMissing.of(),
|
||||
) : this(overrideAddedAt, status, mutableMapOf())
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
|
||||
* the server responded with an unexpected value).
|
||||
*/
|
||||
fun overrideAddedAt(): Optional<String> = overrideAddedAt.getOptional("override_added_at")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
|
||||
* the server responded with an unexpected value).
|
||||
*/
|
||||
fun status(): Optional<Status> = status.getOptional("status")
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [overrideAddedAt].
|
||||
*
|
||||
* Unlike [overrideAddedAt], this method doesn't throw if the JSON field has an unexpected
|
||||
* type.
|
||||
*/
|
||||
@JsonProperty("override_added_at")
|
||||
@ExcludeMissing
|
||||
fun _overrideAddedAt(): JsonField<String> = overrideAddedAt
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [status].
|
||||
*
|
||||
* Unlike [status], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("status") @ExcludeMissing fun _status(): JsonField<Status> = status
|
||||
|
||||
@JsonAnySetter
|
||||
private fun putAdditionalProperty(key: String, value: JsonValue) {
|
||||
additionalProperties.put(key, value)
|
||||
}
|
||||
|
||||
@JsonAnyGetter
|
||||
@ExcludeMissing
|
||||
fun _additionalProperties(): Map<String, JsonValue> =
|
||||
Collections.unmodifiableMap(additionalProperties)
|
||||
|
||||
fun toBuilder() = Builder().from(this)
|
||||
|
||||
companion object {
|
||||
|
||||
/** Returns a mutable builder for constructing an instance of [Body]. */
|
||||
@JvmStatic fun builder() = Builder()
|
||||
}
|
||||
|
||||
/** A builder for [Body]. */
|
||||
class Builder internal constructor() {
|
||||
|
||||
private var overrideAddedAt: JsonField<String> = JsonMissing.of()
|
||||
private var status: JsonField<Status> = JsonMissing.of()
|
||||
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
|
||||
|
||||
@JvmSynthetic
|
||||
internal fun from(body: Body) = apply {
|
||||
overrideAddedAt = body.overrideAddedAt
|
||||
status = body.status
|
||||
additionalProperties = body.additionalProperties.toMutableMap()
|
||||
}
|
||||
|
||||
fun overrideAddedAt(overrideAddedAt: String) =
|
||||
overrideAddedAt(JsonField.of(overrideAddedAt))
|
||||
|
||||
/**
|
||||
* Sets [Builder.overrideAddedAt] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.overrideAddedAt] with a well-typed [String] value
|
||||
* instead. This method is primarily for setting the field to an undocumented or not yet
|
||||
* supported value.
|
||||
*/
|
||||
fun overrideAddedAt(overrideAddedAt: JsonField<String>) = apply {
|
||||
this.overrideAddedAt = overrideAddedAt
|
||||
}
|
||||
|
||||
fun status(status: Status) = status(JsonField.of(status))
|
||||
|
||||
/**
|
||||
* Sets [Builder.status] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.status] with a well-typed [Status] value instead.
|
||||
* This method is primarily for setting the field to an undocumented or not yet
|
||||
* supported value.
|
||||
*/
|
||||
fun status(status: JsonField<Status>) = apply { this.status = status }
|
||||
|
||||
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
|
||||
this.additionalProperties.clear()
|
||||
putAllAdditionalProperties(additionalProperties)
|
||||
}
|
||||
|
||||
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
|
||||
additionalProperties.put(key, value)
|
||||
}
|
||||
|
||||
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
|
||||
this.additionalProperties.putAll(additionalProperties)
|
||||
}
|
||||
|
||||
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
|
||||
|
||||
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
|
||||
keys.forEach(::removeAdditionalProperty)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an immutable instance of [Body].
|
||||
*
|
||||
* Further updates to this [Builder] will not mutate the returned instance.
|
||||
*/
|
||||
fun build(): Body = Body(overrideAddedAt, status, additionalProperties.toMutableMap())
|
||||
}
|
||||
|
||||
private var validated: Boolean = false
|
||||
|
||||
/**
|
||||
* Validates that the types of all values in this object match their expected types
|
||||
* recursively.
|
||||
*
|
||||
* This method is _not_ forwards compatible with new types from the API for existing fields.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if any value type in this object doesn't match its
|
||||
* expected type.
|
||||
*/
|
||||
fun validate(): Body = apply {
|
||||
if (validated) {
|
||||
return@apply
|
||||
}
|
||||
|
||||
overrideAddedAt()
|
||||
status().ifPresent { it.validate() }
|
||||
validated = true
|
||||
}
|
||||
|
||||
fun isValid(): Boolean =
|
||||
try {
|
||||
validate()
|
||||
true
|
||||
} catch (e: LangChainInvalidDataException) {
|
||||
false
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a score indicating how many valid values are contained in this object
|
||||
* recursively.
|
||||
*
|
||||
* Used for best match union deserialization.
|
||||
*/
|
||||
@JvmSynthetic
|
||||
internal fun validity(): Int =
|
||||
(if (overrideAddedAt.asKnown().isPresent) 1 else 0) +
|
||||
(status.asKnown().getOrNull()?.validity() ?: 0)
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
|
||||
return other is Body &&
|
||||
overrideAddedAt == other.overrideAddedAt &&
|
||||
status == other.status &&
|
||||
additionalProperties == other.additionalProperties
|
||||
}
|
||||
|
||||
private val hashCode: Int by lazy {
|
||||
Objects.hash(overrideAddedAt, status, additionalProperties)
|
||||
}
|
||||
|
||||
override fun hashCode(): Int = hashCode
|
||||
|
||||
override fun toString() =
|
||||
"Body{overrideAddedAt=$overrideAddedAt, status=$status, additionalProperties=$additionalProperties}"
|
||||
}
|
||||
|
||||
class Status @JsonCreator private constructor(private val value: JsonField<String>) : Enum {
|
||||
|
||||
/**
|
||||
* Returns this class instance's raw value.
|
||||
*
|
||||
* This is usually only useful if this instance was deserialized from data that doesn't
|
||||
* match any known member, and you want to know that value. For example, if the SDK is on an
|
||||
* older version than the API, then the API may respond with new members that the SDK is
|
||||
* unaware of.
|
||||
*/
|
||||
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value
|
||||
|
||||
companion object {
|
||||
|
||||
@JvmField val VIEWED = of("viewed")
|
||||
|
||||
@JvmField val COMPLETED = of("completed")
|
||||
|
||||
@JvmStatic fun of(value: String) = Status(JsonField.of(value))
|
||||
}
|
||||
|
||||
/** An enum containing [Status]'s known values. */
|
||||
enum class Known {
|
||||
VIEWED,
|
||||
COMPLETED,
|
||||
}
|
||||
|
||||
/**
|
||||
* An enum containing [Status]'s known values, as well as an [_UNKNOWN] member.
|
||||
*
|
||||
* An instance of [Status] can contain an unknown value in a couple of cases:
|
||||
* - It was deserialized from data that doesn't match any known member. For example, if the
|
||||
* SDK is on an older version than the API, then the API may respond with new members that
|
||||
* the SDK is unaware of.
|
||||
* - It was constructed with an arbitrary value using the [of] method.
|
||||
*/
|
||||
enum class Value {
|
||||
VIEWED,
|
||||
COMPLETED,
|
||||
/** An enum member indicating that [Status] was instantiated with an unknown value. */
|
||||
_UNKNOWN,
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
|
||||
* if the class was instantiated with an unknown value.
|
||||
*
|
||||
* Use the [known] method instead if you're certain the value is always known or if you want
|
||||
* to throw for the unknown case.
|
||||
*/
|
||||
fun value(): Value =
|
||||
when (this) {
|
||||
VIEWED -> Value.VIEWED
|
||||
COMPLETED -> Value.COMPLETED
|
||||
else -> Value._UNKNOWN
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an enum member corresponding to this class instance's value.
|
||||
*
|
||||
* Use the [value] method instead if you're uncertain the value is always known and don't
|
||||
* want to throw for the unknown case.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if this class instance's value is a not a known
|
||||
* member.
|
||||
*/
|
||||
fun known(): Known =
|
||||
when (this) {
|
||||
VIEWED -> Known.VIEWED
|
||||
COMPLETED -> Known.COMPLETED
|
||||
else -> throw LangChainInvalidDataException("Unknown Status: $value")
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns this class instance's primitive wire representation.
|
||||
*
|
||||
* This differs from the [toString] method because that method is primarily for debugging
|
||||
* and generally doesn't throw.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if this class instance's value does not have the
|
||||
* expected primitive type.
|
||||
*/
|
||||
fun asString(): String =
|
||||
_value().asString().orElseThrow {
|
||||
LangChainInvalidDataException("Value is not a String")
|
||||
}
|
||||
|
||||
private var validated: Boolean = false
|
||||
|
||||
/**
|
||||
* Validates that the types of all values in this object match their expected types
|
||||
* recursively.
|
||||
*
|
||||
* This method is _not_ forwards compatible with new types from the API for existing fields.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if any value type in this object doesn't match its
|
||||
* expected type.
|
||||
*/
|
||||
fun validate(): Status = apply {
|
||||
if (validated) {
|
||||
return@apply
|
||||
}
|
||||
|
||||
known()
|
||||
validated = true
|
||||
}
|
||||
|
||||
fun isValid(): Boolean =
|
||||
try {
|
||||
validate()
|
||||
true
|
||||
} catch (e: LangChainInvalidDataException) {
|
||||
false
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a score indicating how many valid values are contained in this object
|
||||
* recursively.
|
||||
*
|
||||
* Used for best match union deserialization.
|
||||
*/
|
||||
@JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
|
||||
return other is Status && value == other.value
|
||||
}
|
||||
|
||||
override fun hashCode() = value.hashCode()
|
||||
|
||||
override fun toString() = value.toString()
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
|
||||
return other is ItemCreateStatusParams &&
|
||||
queueItemId == other.queueItemId &&
|
||||
body == other.body &&
|
||||
additionalHeaders == other.additionalHeaders &&
|
||||
additionalQueryParams == other.additionalQueryParams
|
||||
}
|
||||
|
||||
override fun hashCode(): Int =
|
||||
Objects.hash(queueItemId, body, additionalHeaders, additionalQueryParams)
|
||||
|
||||
override fun toString() =
|
||||
"ItemCreateStatusParams{queueItemId=$queueItemId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
|
||||
}
|
||||
+415
@@ -0,0 +1,415 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.models.annotationqueues.items
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnyGetter
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter
|
||||
import com.fasterxml.jackson.annotation.JsonCreator
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.langchain.smith.core.Enum
|
||||
import com.langchain.smith.core.ExcludeMissing
|
||||
import com.langchain.smith.core.JsonField
|
||||
import com.langchain.smith.core.JsonMissing
|
||||
import com.langchain.smith.core.JsonValue
|
||||
import com.langchain.smith.errors.LangChainInvalidDataException
|
||||
import java.util.Collections
|
||||
import java.util.Objects
|
||||
import java.util.Optional
|
||||
import kotlin.jvm.optionals.getOrNull
|
||||
|
||||
class ItemCreateStatusResponse
|
||||
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
|
||||
private constructor(
|
||||
private val isArchived: JsonField<Boolean>,
|
||||
private val overrideAddedAt: JsonField<String>,
|
||||
private val queueItemId: JsonField<String>,
|
||||
private val status: JsonField<Status>,
|
||||
private val additionalProperties: MutableMap<String, JsonValue>,
|
||||
) {
|
||||
|
||||
@JsonCreator
|
||||
private constructor(
|
||||
@JsonProperty("is_archived")
|
||||
@ExcludeMissing
|
||||
isArchived: JsonField<Boolean> = JsonMissing.of(),
|
||||
@JsonProperty("override_added_at")
|
||||
@ExcludeMissing
|
||||
overrideAddedAt: JsonField<String> = JsonMissing.of(),
|
||||
@JsonProperty("queue_item_id")
|
||||
@ExcludeMissing
|
||||
queueItemId: JsonField<String> = JsonMissing.of(),
|
||||
@JsonProperty("status") @ExcludeMissing status: JsonField<Status> = JsonMissing.of(),
|
||||
) : this(isArchived, overrideAddedAt, queueItemId, status, mutableMapOf())
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun isArchived(): Optional<Boolean> = isArchived.getOptional("is_archived")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun overrideAddedAt(): Optional<String> = overrideAddedAt.getOptional("override_added_at")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun queueItemId(): Optional<String> = queueItemId.getOptional("queue_item_id")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun status(): Optional<Status> = status.getOptional("status")
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [isArchived].
|
||||
*
|
||||
* Unlike [isArchived], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("is_archived") @ExcludeMissing fun _isArchived(): JsonField<Boolean> = isArchived
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [overrideAddedAt].
|
||||
*
|
||||
* Unlike [overrideAddedAt], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("override_added_at")
|
||||
@ExcludeMissing
|
||||
fun _overrideAddedAt(): JsonField<String> = overrideAddedAt
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [queueItemId].
|
||||
*
|
||||
* Unlike [queueItemId], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("queue_item_id")
|
||||
@ExcludeMissing
|
||||
fun _queueItemId(): JsonField<String> = queueItemId
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [status].
|
||||
*
|
||||
* Unlike [status], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("status") @ExcludeMissing fun _status(): JsonField<Status> = status
|
||||
|
||||
@JsonAnySetter
|
||||
private fun putAdditionalProperty(key: String, value: JsonValue) {
|
||||
additionalProperties.put(key, value)
|
||||
}
|
||||
|
||||
@JsonAnyGetter
|
||||
@ExcludeMissing
|
||||
fun _additionalProperties(): Map<String, JsonValue> =
|
||||
Collections.unmodifiableMap(additionalProperties)
|
||||
|
||||
fun toBuilder() = Builder().from(this)
|
||||
|
||||
companion object {
|
||||
|
||||
/** Returns a mutable builder for constructing an instance of [ItemCreateStatusResponse]. */
|
||||
@JvmStatic fun builder() = Builder()
|
||||
}
|
||||
|
||||
/** A builder for [ItemCreateStatusResponse]. */
|
||||
class Builder internal constructor() {
|
||||
|
||||
private var isArchived: JsonField<Boolean> = JsonMissing.of()
|
||||
private var overrideAddedAt: JsonField<String> = JsonMissing.of()
|
||||
private var queueItemId: JsonField<String> = JsonMissing.of()
|
||||
private var status: JsonField<Status> = JsonMissing.of()
|
||||
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
|
||||
|
||||
@JvmSynthetic
|
||||
internal fun from(itemCreateStatusResponse: ItemCreateStatusResponse) = apply {
|
||||
isArchived = itemCreateStatusResponse.isArchived
|
||||
overrideAddedAt = itemCreateStatusResponse.overrideAddedAt
|
||||
queueItemId = itemCreateStatusResponse.queueItemId
|
||||
status = itemCreateStatusResponse.status
|
||||
additionalProperties = itemCreateStatusResponse.additionalProperties.toMutableMap()
|
||||
}
|
||||
|
||||
fun isArchived(isArchived: Boolean) = isArchived(JsonField.of(isArchived))
|
||||
|
||||
/**
|
||||
* Sets [Builder.isArchived] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.isArchived] with a well-typed [Boolean] value instead.
|
||||
* This method is primarily for setting the field to an undocumented or not yet supported
|
||||
* value.
|
||||
*/
|
||||
fun isArchived(isArchived: JsonField<Boolean>) = apply { this.isArchived = isArchived }
|
||||
|
||||
fun overrideAddedAt(overrideAddedAt: String) =
|
||||
overrideAddedAt(JsonField.of(overrideAddedAt))
|
||||
|
||||
/**
|
||||
* Sets [Builder.overrideAddedAt] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.overrideAddedAt] with a well-typed [String] value
|
||||
* instead. This method is primarily for setting the field to an undocumented or not yet
|
||||
* supported value.
|
||||
*/
|
||||
fun overrideAddedAt(overrideAddedAt: JsonField<String>) = apply {
|
||||
this.overrideAddedAt = overrideAddedAt
|
||||
}
|
||||
|
||||
fun queueItemId(queueItemId: String) = queueItemId(JsonField.of(queueItemId))
|
||||
|
||||
/**
|
||||
* Sets [Builder.queueItemId] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.queueItemId] with a well-typed [String] value instead.
|
||||
* This method is primarily for setting the field to an undocumented or not yet supported
|
||||
* value.
|
||||
*/
|
||||
fun queueItemId(queueItemId: JsonField<String>) = apply { this.queueItemId = queueItemId }
|
||||
|
||||
fun status(status: Status) = status(JsonField.of(status))
|
||||
|
||||
/**
|
||||
* Sets [Builder.status] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.status] with a well-typed [Status] value instead. This
|
||||
* method is primarily for setting the field to an undocumented or not yet supported value.
|
||||
*/
|
||||
fun status(status: JsonField<Status>) = apply { this.status = status }
|
||||
|
||||
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
|
||||
this.additionalProperties.clear()
|
||||
putAllAdditionalProperties(additionalProperties)
|
||||
}
|
||||
|
||||
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
|
||||
additionalProperties.put(key, value)
|
||||
}
|
||||
|
||||
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
|
||||
this.additionalProperties.putAll(additionalProperties)
|
||||
}
|
||||
|
||||
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
|
||||
|
||||
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
|
||||
keys.forEach(::removeAdditionalProperty)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an immutable instance of [ItemCreateStatusResponse].
|
||||
*
|
||||
* Further updates to this [Builder] will not mutate the returned instance.
|
||||
*/
|
||||
fun build(): ItemCreateStatusResponse =
|
||||
ItemCreateStatusResponse(
|
||||
isArchived,
|
||||
overrideAddedAt,
|
||||
queueItemId,
|
||||
status,
|
||||
additionalProperties.toMutableMap(),
|
||||
)
|
||||
}
|
||||
|
||||
private var validated: Boolean = false
|
||||
|
||||
/**
|
||||
* Validates that the types of all values in this object match their expected types recursively.
|
||||
*
|
||||
* This method is _not_ forwards compatible with new types from the API for existing fields.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if any value type in this object doesn't match its
|
||||
* expected type.
|
||||
*/
|
||||
fun validate(): ItemCreateStatusResponse = apply {
|
||||
if (validated) {
|
||||
return@apply
|
||||
}
|
||||
|
||||
isArchived()
|
||||
overrideAddedAt()
|
||||
queueItemId()
|
||||
status().ifPresent { it.validate() }
|
||||
validated = true
|
||||
}
|
||||
|
||||
fun isValid(): Boolean =
|
||||
try {
|
||||
validate()
|
||||
true
|
||||
} catch (e: LangChainInvalidDataException) {
|
||||
false
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a score indicating how many valid values are contained in this object recursively.
|
||||
*
|
||||
* Used for best match union deserialization.
|
||||
*/
|
||||
@JvmSynthetic
|
||||
internal fun validity(): Int =
|
||||
(if (isArchived.asKnown().isPresent) 1 else 0) +
|
||||
(if (overrideAddedAt.asKnown().isPresent) 1 else 0) +
|
||||
(if (queueItemId.asKnown().isPresent) 1 else 0) +
|
||||
(status.asKnown().getOrNull()?.validity() ?: 0)
|
||||
|
||||
class Status @JsonCreator private constructor(private val value: JsonField<String>) : Enum {
|
||||
|
||||
/**
|
||||
* Returns this class instance's raw value.
|
||||
*
|
||||
* This is usually only useful if this instance was deserialized from data that doesn't
|
||||
* match any known member, and you want to know that value. For example, if the SDK is on an
|
||||
* older version than the API, then the API may respond with new members that the SDK is
|
||||
* unaware of.
|
||||
*/
|
||||
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value
|
||||
|
||||
companion object {
|
||||
|
||||
@JvmField val VIEWED = of("viewed")
|
||||
|
||||
@JvmField val COMPLETED = of("completed")
|
||||
|
||||
@JvmStatic fun of(value: String) = Status(JsonField.of(value))
|
||||
}
|
||||
|
||||
/** An enum containing [Status]'s known values. */
|
||||
enum class Known {
|
||||
VIEWED,
|
||||
COMPLETED,
|
||||
}
|
||||
|
||||
/**
|
||||
* An enum containing [Status]'s known values, as well as an [_UNKNOWN] member.
|
||||
*
|
||||
* An instance of [Status] can contain an unknown value in a couple of cases:
|
||||
* - It was deserialized from data that doesn't match any known member. For example, if the
|
||||
* SDK is on an older version than the API, then the API may respond with new members that
|
||||
* the SDK is unaware of.
|
||||
* - It was constructed with an arbitrary value using the [of] method.
|
||||
*/
|
||||
enum class Value {
|
||||
VIEWED,
|
||||
COMPLETED,
|
||||
/** An enum member indicating that [Status] was instantiated with an unknown value. */
|
||||
_UNKNOWN,
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
|
||||
* if the class was instantiated with an unknown value.
|
||||
*
|
||||
* Use the [known] method instead if you're certain the value is always known or if you want
|
||||
* to throw for the unknown case.
|
||||
*/
|
||||
fun value(): Value =
|
||||
when (this) {
|
||||
VIEWED -> Value.VIEWED
|
||||
COMPLETED -> Value.COMPLETED
|
||||
else -> Value._UNKNOWN
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an enum member corresponding to this class instance's value.
|
||||
*
|
||||
* Use the [value] method instead if you're uncertain the value is always known and don't
|
||||
* want to throw for the unknown case.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if this class instance's value is a not a known
|
||||
* member.
|
||||
*/
|
||||
fun known(): Known =
|
||||
when (this) {
|
||||
VIEWED -> Known.VIEWED
|
||||
COMPLETED -> Known.COMPLETED
|
||||
else -> throw LangChainInvalidDataException("Unknown Status: $value")
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns this class instance's primitive wire representation.
|
||||
*
|
||||
* This differs from the [toString] method because that method is primarily for debugging
|
||||
* and generally doesn't throw.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if this class instance's value does not have the
|
||||
* expected primitive type.
|
||||
*/
|
||||
fun asString(): String =
|
||||
_value().asString().orElseThrow {
|
||||
LangChainInvalidDataException("Value is not a String")
|
||||
}
|
||||
|
||||
private var validated: Boolean = false
|
||||
|
||||
/**
|
||||
* Validates that the types of all values in this object match their expected types
|
||||
* recursively.
|
||||
*
|
||||
* This method is _not_ forwards compatible with new types from the API for existing fields.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if any value type in this object doesn't match its
|
||||
* expected type.
|
||||
*/
|
||||
fun validate(): Status = apply {
|
||||
if (validated) {
|
||||
return@apply
|
||||
}
|
||||
|
||||
known()
|
||||
validated = true
|
||||
}
|
||||
|
||||
fun isValid(): Boolean =
|
||||
try {
|
||||
validate()
|
||||
true
|
||||
} catch (e: LangChainInvalidDataException) {
|
||||
false
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a score indicating how many valid values are contained in this object
|
||||
* recursively.
|
||||
*
|
||||
* Used for best match union deserialization.
|
||||
*/
|
||||
@JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
|
||||
return other is Status && value == other.value
|
||||
}
|
||||
|
||||
override fun hashCode() = value.hashCode()
|
||||
|
||||
override fun toString() = value.toString()
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
|
||||
return other is ItemCreateStatusResponse &&
|
||||
isArchived == other.isArchived &&
|
||||
overrideAddedAt == other.overrideAddedAt &&
|
||||
queueItemId == other.queueItemId &&
|
||||
status == other.status &&
|
||||
additionalProperties == other.additionalProperties
|
||||
}
|
||||
|
||||
private val hashCode: Int by lazy {
|
||||
Objects.hash(isArchived, overrideAddedAt, queueItemId, status, additionalProperties)
|
||||
}
|
||||
|
||||
override fun hashCode(): Int = hashCode
|
||||
|
||||
override fun toString() =
|
||||
"ItemCreateStatusResponse{isArchived=$isArchived, overrideAddedAt=$overrideAddedAt, queueItemId=$queueItemId, status=$status, additionalProperties=$additionalProperties}"
|
||||
}
|
||||
+441
@@ -0,0 +1,441 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.models.annotationqueues.items
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnyGetter
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter
|
||||
import com.fasterxml.jackson.annotation.JsonCreator
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.langchain.smith.core.ExcludeMissing
|
||||
import com.langchain.smith.core.JsonField
|
||||
import com.langchain.smith.core.JsonMissing
|
||||
import com.langchain.smith.core.JsonValue
|
||||
import com.langchain.smith.core.Params
|
||||
import com.langchain.smith.core.checkKnown
|
||||
import com.langchain.smith.core.http.Headers
|
||||
import com.langchain.smith.core.http.QueryParams
|
||||
import com.langchain.smith.core.toImmutable
|
||||
import com.langchain.smith.errors.LangChainInvalidDataException
|
||||
import java.util.Collections
|
||||
import java.util.Objects
|
||||
import java.util.Optional
|
||||
import kotlin.jvm.optionals.getOrNull
|
||||
|
||||
/** Remove RUN or THREAD items from a single annotation queue by membership ID. */
|
||||
class ItemDeleteAllParams
|
||||
private constructor(
|
||||
private val queueId: String?,
|
||||
private val body: Body,
|
||||
private val additionalHeaders: Headers,
|
||||
private val additionalQueryParams: QueryParams,
|
||||
) : Params {
|
||||
|
||||
fun queueId(): Optional<String> = Optional.ofNullable(queueId)
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun itemIds(): Optional<List<String>> = body.itemIds()
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [itemIds].
|
||||
*
|
||||
* Unlike [itemIds], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
fun _itemIds(): JsonField<List<String>> = body._itemIds()
|
||||
|
||||
fun _additionalBodyProperties(): Map<String, JsonValue> = body._additionalProperties()
|
||||
|
||||
/** Additional headers to send with the request. */
|
||||
fun _additionalHeaders(): Headers = additionalHeaders
|
||||
|
||||
/** Additional query param to send with the request. */
|
||||
fun _additionalQueryParams(): QueryParams = additionalQueryParams
|
||||
|
||||
fun toBuilder() = Builder().from(this)
|
||||
|
||||
companion object {
|
||||
|
||||
@JvmStatic fun none(): ItemDeleteAllParams = builder().build()
|
||||
|
||||
/** Returns a mutable builder for constructing an instance of [ItemDeleteAllParams]. */
|
||||
@JvmStatic fun builder() = Builder()
|
||||
}
|
||||
|
||||
/** A builder for [ItemDeleteAllParams]. */
|
||||
class Builder internal constructor() {
|
||||
|
||||
private var queueId: String? = null
|
||||
private var body: Body.Builder = Body.builder()
|
||||
private var additionalHeaders: Headers.Builder = Headers.builder()
|
||||
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
|
||||
|
||||
@JvmSynthetic
|
||||
internal fun from(itemDeleteAllParams: ItemDeleteAllParams) = apply {
|
||||
queueId = itemDeleteAllParams.queueId
|
||||
body = itemDeleteAllParams.body.toBuilder()
|
||||
additionalHeaders = itemDeleteAllParams.additionalHeaders.toBuilder()
|
||||
additionalQueryParams = itemDeleteAllParams.additionalQueryParams.toBuilder()
|
||||
}
|
||||
|
||||
fun queueId(queueId: String?) = apply { this.queueId = queueId }
|
||||
|
||||
/** Alias for calling [Builder.queueId] with `queueId.orElse(null)`. */
|
||||
fun queueId(queueId: Optional<String>) = queueId(queueId.getOrNull())
|
||||
|
||||
/**
|
||||
* Sets the entire request body.
|
||||
*
|
||||
* This is generally only useful if you are already constructing the body separately.
|
||||
* Otherwise, it's more convenient to use the top-level setters instead:
|
||||
* - [itemIds]
|
||||
*/
|
||||
fun body(body: Body) = apply { this.body = body.toBuilder() }
|
||||
|
||||
fun itemIds(itemIds: List<String>) = apply { body.itemIds(itemIds) }
|
||||
|
||||
/**
|
||||
* Sets [Builder.itemIds] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.itemIds] with a well-typed `List<String>` value instead.
|
||||
* This method is primarily for setting the field to an undocumented or not yet supported
|
||||
* value.
|
||||
*/
|
||||
fun itemIds(itemIds: JsonField<List<String>>) = apply { body.itemIds(itemIds) }
|
||||
|
||||
/**
|
||||
* Adds a single [String] to [itemIds].
|
||||
*
|
||||
* @throws IllegalStateException if the field was previously set to a non-list.
|
||||
*/
|
||||
fun addItemId(itemId: String) = apply { body.addItemId(itemId) }
|
||||
|
||||
fun additionalBodyProperties(additionalBodyProperties: Map<String, JsonValue>) = apply {
|
||||
body.additionalProperties(additionalBodyProperties)
|
||||
}
|
||||
|
||||
fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply {
|
||||
body.putAdditionalProperty(key, value)
|
||||
}
|
||||
|
||||
fun putAllAdditionalBodyProperties(additionalBodyProperties: Map<String, JsonValue>) =
|
||||
apply {
|
||||
body.putAllAdditionalProperties(additionalBodyProperties)
|
||||
}
|
||||
|
||||
fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) }
|
||||
|
||||
fun removeAllAdditionalBodyProperties(keys: Set<String>) = apply {
|
||||
body.removeAllAdditionalProperties(keys)
|
||||
}
|
||||
|
||||
fun additionalHeaders(additionalHeaders: Headers) = apply {
|
||||
this.additionalHeaders.clear()
|
||||
putAllAdditionalHeaders(additionalHeaders)
|
||||
}
|
||||
|
||||
fun additionalHeaders(additionalHeaders: Map<String, Iterable<String>>) = apply {
|
||||
this.additionalHeaders.clear()
|
||||
putAllAdditionalHeaders(additionalHeaders)
|
||||
}
|
||||
|
||||
fun putAdditionalHeader(name: String, value: String) = apply {
|
||||
additionalHeaders.put(name, value)
|
||||
}
|
||||
|
||||
fun putAdditionalHeaders(name: String, values: Iterable<String>) = apply {
|
||||
additionalHeaders.put(name, values)
|
||||
}
|
||||
|
||||
fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply {
|
||||
this.additionalHeaders.putAll(additionalHeaders)
|
||||
}
|
||||
|
||||
fun putAllAdditionalHeaders(additionalHeaders: Map<String, Iterable<String>>) = apply {
|
||||
this.additionalHeaders.putAll(additionalHeaders)
|
||||
}
|
||||
|
||||
fun replaceAdditionalHeaders(name: String, value: String) = apply {
|
||||
additionalHeaders.replace(name, value)
|
||||
}
|
||||
|
||||
fun replaceAdditionalHeaders(name: String, values: Iterable<String>) = apply {
|
||||
additionalHeaders.replace(name, values)
|
||||
}
|
||||
|
||||
fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply {
|
||||
this.additionalHeaders.replaceAll(additionalHeaders)
|
||||
}
|
||||
|
||||
fun replaceAllAdditionalHeaders(additionalHeaders: Map<String, Iterable<String>>) = apply {
|
||||
this.additionalHeaders.replaceAll(additionalHeaders)
|
||||
}
|
||||
|
||||
fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) }
|
||||
|
||||
fun removeAllAdditionalHeaders(names: Set<String>) = apply {
|
||||
additionalHeaders.removeAll(names)
|
||||
}
|
||||
|
||||
fun additionalQueryParams(additionalQueryParams: QueryParams) = apply {
|
||||
this.additionalQueryParams.clear()
|
||||
putAllAdditionalQueryParams(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun additionalQueryParams(additionalQueryParams: Map<String, Iterable<String>>) = apply {
|
||||
this.additionalQueryParams.clear()
|
||||
putAllAdditionalQueryParams(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun putAdditionalQueryParam(key: String, value: String) = apply {
|
||||
additionalQueryParams.put(key, value)
|
||||
}
|
||||
|
||||
fun putAdditionalQueryParams(key: String, values: Iterable<String>) = apply {
|
||||
additionalQueryParams.put(key, values)
|
||||
}
|
||||
|
||||
fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
|
||||
this.additionalQueryParams.putAll(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun putAllAdditionalQueryParams(additionalQueryParams: Map<String, Iterable<String>>) =
|
||||
apply {
|
||||
this.additionalQueryParams.putAll(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun replaceAdditionalQueryParams(key: String, value: String) = apply {
|
||||
additionalQueryParams.replace(key, value)
|
||||
}
|
||||
|
||||
fun replaceAdditionalQueryParams(key: String, values: Iterable<String>) = apply {
|
||||
additionalQueryParams.replace(key, values)
|
||||
}
|
||||
|
||||
fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
|
||||
this.additionalQueryParams.replaceAll(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun replaceAllAdditionalQueryParams(additionalQueryParams: Map<String, Iterable<String>>) =
|
||||
apply {
|
||||
this.additionalQueryParams.replaceAll(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) }
|
||||
|
||||
fun removeAllAdditionalQueryParams(keys: Set<String>) = apply {
|
||||
additionalQueryParams.removeAll(keys)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an immutable instance of [ItemDeleteAllParams].
|
||||
*
|
||||
* Further updates to this [Builder] will not mutate the returned instance.
|
||||
*/
|
||||
fun build(): ItemDeleteAllParams =
|
||||
ItemDeleteAllParams(
|
||||
queueId,
|
||||
body.build(),
|
||||
additionalHeaders.build(),
|
||||
additionalQueryParams.build(),
|
||||
)
|
||||
}
|
||||
|
||||
fun _body(): Body = body
|
||||
|
||||
fun _pathParam(index: Int): String =
|
||||
when (index) {
|
||||
0 -> queueId ?: ""
|
||||
else -> ""
|
||||
}
|
||||
|
||||
override fun _headers(): Headers = additionalHeaders
|
||||
|
||||
override fun _queryParams(): QueryParams = additionalQueryParams
|
||||
|
||||
class Body
|
||||
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
|
||||
private constructor(
|
||||
private val itemIds: JsonField<List<String>>,
|
||||
private val additionalProperties: MutableMap<String, JsonValue>,
|
||||
) {
|
||||
|
||||
@JsonCreator
|
||||
private constructor(
|
||||
@JsonProperty("item_ids")
|
||||
@ExcludeMissing
|
||||
itemIds: JsonField<List<String>> = JsonMissing.of()
|
||||
) : this(itemIds, mutableMapOf())
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
|
||||
* the server responded with an unexpected value).
|
||||
*/
|
||||
fun itemIds(): Optional<List<String>> = itemIds.getOptional("item_ids")
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [itemIds].
|
||||
*
|
||||
* Unlike [itemIds], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("item_ids") @ExcludeMissing fun _itemIds(): JsonField<List<String>> = itemIds
|
||||
|
||||
@JsonAnySetter
|
||||
private fun putAdditionalProperty(key: String, value: JsonValue) {
|
||||
additionalProperties.put(key, value)
|
||||
}
|
||||
|
||||
@JsonAnyGetter
|
||||
@ExcludeMissing
|
||||
fun _additionalProperties(): Map<String, JsonValue> =
|
||||
Collections.unmodifiableMap(additionalProperties)
|
||||
|
||||
fun toBuilder() = Builder().from(this)
|
||||
|
||||
companion object {
|
||||
|
||||
/** Returns a mutable builder for constructing an instance of [Body]. */
|
||||
@JvmStatic fun builder() = Builder()
|
||||
}
|
||||
|
||||
/** A builder for [Body]. */
|
||||
class Builder internal constructor() {
|
||||
|
||||
private var itemIds: JsonField<MutableList<String>>? = null
|
||||
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
|
||||
|
||||
@JvmSynthetic
|
||||
internal fun from(body: Body) = apply {
|
||||
itemIds = body.itemIds.map { it.toMutableList() }
|
||||
additionalProperties = body.additionalProperties.toMutableMap()
|
||||
}
|
||||
|
||||
fun itemIds(itemIds: List<String>) = itemIds(JsonField.of(itemIds))
|
||||
|
||||
/**
|
||||
* Sets [Builder.itemIds] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.itemIds] with a well-typed `List<String>` value
|
||||
* instead. This method is primarily for setting the field to an undocumented or not yet
|
||||
* supported value.
|
||||
*/
|
||||
fun itemIds(itemIds: JsonField<List<String>>) = apply {
|
||||
this.itemIds = itemIds.map { it.toMutableList() }
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a single [String] to [itemIds].
|
||||
*
|
||||
* @throws IllegalStateException if the field was previously set to a non-list.
|
||||
*/
|
||||
fun addItemId(itemId: String) = apply {
|
||||
itemIds =
|
||||
(itemIds ?: JsonField.of(mutableListOf())).also {
|
||||
checkKnown("itemIds", it).add(itemId)
|
||||
}
|
||||
}
|
||||
|
||||
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
|
||||
this.additionalProperties.clear()
|
||||
putAllAdditionalProperties(additionalProperties)
|
||||
}
|
||||
|
||||
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
|
||||
additionalProperties.put(key, value)
|
||||
}
|
||||
|
||||
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
|
||||
this.additionalProperties.putAll(additionalProperties)
|
||||
}
|
||||
|
||||
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
|
||||
|
||||
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
|
||||
keys.forEach(::removeAdditionalProperty)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an immutable instance of [Body].
|
||||
*
|
||||
* Further updates to this [Builder] will not mutate the returned instance.
|
||||
*/
|
||||
fun build(): Body =
|
||||
Body(
|
||||
(itemIds ?: JsonMissing.of()).map { it.toImmutable() },
|
||||
additionalProperties.toMutableMap(),
|
||||
)
|
||||
}
|
||||
|
||||
private var validated: Boolean = false
|
||||
|
||||
/**
|
||||
* Validates that the types of all values in this object match their expected types
|
||||
* recursively.
|
||||
*
|
||||
* This method is _not_ forwards compatible with new types from the API for existing fields.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if any value type in this object doesn't match its
|
||||
* expected type.
|
||||
*/
|
||||
fun validate(): Body = apply {
|
||||
if (validated) {
|
||||
return@apply
|
||||
}
|
||||
|
||||
itemIds()
|
||||
validated = true
|
||||
}
|
||||
|
||||
fun isValid(): Boolean =
|
||||
try {
|
||||
validate()
|
||||
true
|
||||
} catch (e: LangChainInvalidDataException) {
|
||||
false
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a score indicating how many valid values are contained in this object
|
||||
* recursively.
|
||||
*
|
||||
* Used for best match union deserialization.
|
||||
*/
|
||||
@JvmSynthetic internal fun validity(): Int = (itemIds.asKnown().getOrNull()?.size ?: 0)
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
|
||||
return other is Body &&
|
||||
itemIds == other.itemIds &&
|
||||
additionalProperties == other.additionalProperties
|
||||
}
|
||||
|
||||
private val hashCode: Int by lazy { Objects.hash(itemIds, additionalProperties) }
|
||||
|
||||
override fun hashCode(): Int = hashCode
|
||||
|
||||
override fun toString() =
|
||||
"Body{itemIds=$itemIds, additionalProperties=$additionalProperties}"
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
|
||||
return other is ItemDeleteAllParams &&
|
||||
queueId == other.queueId &&
|
||||
body == other.body &&
|
||||
additionalHeaders == other.additionalHeaders &&
|
||||
additionalQueryParams == other.additionalQueryParams
|
||||
}
|
||||
|
||||
override fun hashCode(): Int =
|
||||
Objects.hash(queueId, body, additionalHeaders, additionalQueryParams)
|
||||
|
||||
override fun toString() =
|
||||
"ItemDeleteAllParams{queueId=$queueId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
|
||||
}
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.models.annotationqueues.items
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnyGetter
|
||||
import com.fasterxml.jackson.annotation.JsonCreator
|
||||
import com.langchain.smith.core.ExcludeMissing
|
||||
import com.langchain.smith.core.JsonValue
|
||||
import com.langchain.smith.core.toImmutable
|
||||
import com.langchain.smith.errors.LangChainInvalidDataException
|
||||
import java.util.Objects
|
||||
|
||||
class ItemDeleteAllResponse
|
||||
@JsonCreator
|
||||
private constructor(
|
||||
@com.fasterxml.jackson.annotation.JsonValue
|
||||
private val additionalProperties: Map<String, JsonValue>
|
||||
) {
|
||||
|
||||
@JsonAnyGetter
|
||||
@ExcludeMissing
|
||||
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
|
||||
|
||||
fun toBuilder() = Builder().from(this)
|
||||
|
||||
companion object {
|
||||
|
||||
/** Returns a mutable builder for constructing an instance of [ItemDeleteAllResponse]. */
|
||||
@JvmStatic fun builder() = Builder()
|
||||
}
|
||||
|
||||
/** A builder for [ItemDeleteAllResponse]. */
|
||||
class Builder internal constructor() {
|
||||
|
||||
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
|
||||
|
||||
@JvmSynthetic
|
||||
internal fun from(itemDeleteAllResponse: ItemDeleteAllResponse) = apply {
|
||||
additionalProperties = itemDeleteAllResponse.additionalProperties.toMutableMap()
|
||||
}
|
||||
|
||||
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
|
||||
this.additionalProperties.clear()
|
||||
putAllAdditionalProperties(additionalProperties)
|
||||
}
|
||||
|
||||
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
|
||||
additionalProperties.put(key, value)
|
||||
}
|
||||
|
||||
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
|
||||
this.additionalProperties.putAll(additionalProperties)
|
||||
}
|
||||
|
||||
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
|
||||
|
||||
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
|
||||
keys.forEach(::removeAdditionalProperty)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an immutable instance of [ItemDeleteAllResponse].
|
||||
*
|
||||
* Further updates to this [Builder] will not mutate the returned instance.
|
||||
*/
|
||||
fun build(): ItemDeleteAllResponse =
|
||||
ItemDeleteAllResponse(additionalProperties.toImmutable())
|
||||
}
|
||||
|
||||
private var validated: Boolean = false
|
||||
|
||||
/**
|
||||
* Validates that the types of all values in this object match their expected types recursively.
|
||||
*
|
||||
* This method is _not_ forwards compatible with new types from the API for existing fields.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if any value type in this object doesn't match its
|
||||
* expected type.
|
||||
*/
|
||||
fun validate(): ItemDeleteAllResponse = apply {
|
||||
if (validated) {
|
||||
return@apply
|
||||
}
|
||||
|
||||
validated = true
|
||||
}
|
||||
|
||||
fun isValid(): Boolean =
|
||||
try {
|
||||
validate()
|
||||
true
|
||||
} catch (e: LangChainInvalidDataException) {
|
||||
false
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a score indicating how many valid values are contained in this object recursively.
|
||||
*
|
||||
* Used for best match union deserialization.
|
||||
*/
|
||||
@JvmSynthetic
|
||||
internal fun validity(): Int =
|
||||
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
|
||||
return other is ItemDeleteAllResponse && additionalProperties == other.additionalProperties
|
||||
}
|
||||
|
||||
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
|
||||
|
||||
override fun hashCode(): Int = hashCode
|
||||
|
||||
override fun toString() = "ItemDeleteAllResponse{additionalProperties=$additionalProperties}"
|
||||
}
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.models.annotationqueues.items
|
||||
|
||||
import com.langchain.smith.core.AutoPager
|
||||
import com.langchain.smith.core.Page
|
||||
import com.langchain.smith.core.checkRequired
|
||||
import com.langchain.smith.services.blocking.annotationqueues.ItemService
|
||||
import java.util.Objects
|
||||
import java.util.Optional
|
||||
import kotlin.jvm.optionals.getOrNull
|
||||
|
||||
/** @see ItemService.list */
|
||||
class ItemListPage
|
||||
private constructor(
|
||||
private val service: ItemService,
|
||||
private val params: ItemListParams,
|
||||
private val response: ItemListPageResponse,
|
||||
) : Page<ItemListResponse> {
|
||||
|
||||
/**
|
||||
* Delegates to [ItemListPageResponse], but gracefully handles missing data.
|
||||
*
|
||||
* @see ItemListPageResponse.items
|
||||
*/
|
||||
override fun items(): List<ItemListResponse> =
|
||||
response._items().getOptional("items").getOrNull() ?: emptyList()
|
||||
|
||||
/**
|
||||
* Delegates to [ItemListPageResponse], but gracefully handles missing data.
|
||||
*
|
||||
* @see ItemListPageResponse.nextCursor
|
||||
*/
|
||||
fun nextCursor(): Optional<String> = response._nextCursor().getOptional("next_cursor")
|
||||
|
||||
override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent
|
||||
|
||||
fun nextPageParams(): ItemListParams {
|
||||
val nextCursor =
|
||||
nextCursor().getOrNull()
|
||||
?: throw IllegalStateException("Cannot construct next page params")
|
||||
return params.toBuilder().cursor(nextCursor).build()
|
||||
}
|
||||
|
||||
override fun nextPage(): ItemListPage = service.list(nextPageParams())
|
||||
|
||||
fun autoPager(): AutoPager<ItemListResponse> = AutoPager.from(this)
|
||||
|
||||
/** The parameters that were used to request this page. */
|
||||
fun params(): ItemListParams = params
|
||||
|
||||
/** The response that this page was parsed from. */
|
||||
fun response(): ItemListPageResponse = response
|
||||
|
||||
fun toBuilder() = Builder().from(this)
|
||||
|
||||
companion object {
|
||||
|
||||
/**
|
||||
* Returns a mutable builder for constructing an instance of [ItemListPage].
|
||||
*
|
||||
* The following fields are required:
|
||||
* ```java
|
||||
* .service()
|
||||
* .params()
|
||||
* .response()
|
||||
* ```
|
||||
*/
|
||||
@JvmStatic fun builder() = Builder()
|
||||
}
|
||||
|
||||
/** A builder for [ItemListPage]. */
|
||||
class Builder internal constructor() {
|
||||
|
||||
private var service: ItemService? = null
|
||||
private var params: ItemListParams? = null
|
||||
private var response: ItemListPageResponse? = null
|
||||
|
||||
@JvmSynthetic
|
||||
internal fun from(itemListPage: ItemListPage) = apply {
|
||||
service = itemListPage.service
|
||||
params = itemListPage.params
|
||||
response = itemListPage.response
|
||||
}
|
||||
|
||||
fun service(service: ItemService) = apply { this.service = service }
|
||||
|
||||
/** The parameters that were used to request this page. */
|
||||
fun params(params: ItemListParams) = apply { this.params = params }
|
||||
|
||||
/** The response that this page was parsed from. */
|
||||
fun response(response: ItemListPageResponse) = apply { this.response = response }
|
||||
|
||||
/**
|
||||
* Returns an immutable instance of [ItemListPage].
|
||||
*
|
||||
* Further updates to this [Builder] will not mutate the returned instance.
|
||||
*
|
||||
* The following fields are required:
|
||||
* ```java
|
||||
* .service()
|
||||
* .params()
|
||||
* .response()
|
||||
* ```
|
||||
*
|
||||
* @throws IllegalStateException if any required field is unset.
|
||||
*/
|
||||
fun build(): ItemListPage =
|
||||
ItemListPage(
|
||||
checkRequired("service", service),
|
||||
checkRequired("params", params),
|
||||
checkRequired("response", response),
|
||||
)
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
|
||||
return other is ItemListPage &&
|
||||
service == other.service &&
|
||||
params == other.params &&
|
||||
response == other.response
|
||||
}
|
||||
|
||||
override fun hashCode(): Int = Objects.hash(service, params, response)
|
||||
|
||||
override fun toString() = "ItemListPage{service=$service, params=$params, response=$response}"
|
||||
}
|
||||
+145
@@ -0,0 +1,145 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.models.annotationqueues.items
|
||||
|
||||
import com.langchain.smith.core.AutoPagerAsync
|
||||
import com.langchain.smith.core.PageAsync
|
||||
import com.langchain.smith.core.checkRequired
|
||||
import com.langchain.smith.services.async.annotationqueues.ItemServiceAsync
|
||||
import java.util.Objects
|
||||
import java.util.Optional
|
||||
import java.util.concurrent.CompletableFuture
|
||||
import java.util.concurrent.Executor
|
||||
import kotlin.jvm.optionals.getOrNull
|
||||
|
||||
/** @see ItemServiceAsync.list */
|
||||
class ItemListPageAsync
|
||||
private constructor(
|
||||
private val service: ItemServiceAsync,
|
||||
private val streamHandlerExecutor: Executor,
|
||||
private val params: ItemListParams,
|
||||
private val response: ItemListPageResponse,
|
||||
) : PageAsync<ItemListResponse> {
|
||||
|
||||
/**
|
||||
* Delegates to [ItemListPageResponse], but gracefully handles missing data.
|
||||
*
|
||||
* @see ItemListPageResponse.items
|
||||
*/
|
||||
override fun items(): List<ItemListResponse> =
|
||||
response._items().getOptional("items").getOrNull() ?: emptyList()
|
||||
|
||||
/**
|
||||
* Delegates to [ItemListPageResponse], but gracefully handles missing data.
|
||||
*
|
||||
* @see ItemListPageResponse.nextCursor
|
||||
*/
|
||||
fun nextCursor(): Optional<String> = response._nextCursor().getOptional("next_cursor")
|
||||
|
||||
override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent
|
||||
|
||||
fun nextPageParams(): ItemListParams {
|
||||
val nextCursor =
|
||||
nextCursor().getOrNull()
|
||||
?: throw IllegalStateException("Cannot construct next page params")
|
||||
return params.toBuilder().cursor(nextCursor).build()
|
||||
}
|
||||
|
||||
override fun nextPage(): CompletableFuture<ItemListPageAsync> = service.list(nextPageParams())
|
||||
|
||||
fun autoPager(): AutoPagerAsync<ItemListResponse> =
|
||||
AutoPagerAsync.from(this, streamHandlerExecutor)
|
||||
|
||||
/** The parameters that were used to request this page. */
|
||||
fun params(): ItemListParams = params
|
||||
|
||||
/** The response that this page was parsed from. */
|
||||
fun response(): ItemListPageResponse = response
|
||||
|
||||
fun toBuilder() = Builder().from(this)
|
||||
|
||||
companion object {
|
||||
|
||||
/**
|
||||
* Returns a mutable builder for constructing an instance of [ItemListPageAsync].
|
||||
*
|
||||
* The following fields are required:
|
||||
* ```java
|
||||
* .service()
|
||||
* .streamHandlerExecutor()
|
||||
* .params()
|
||||
* .response()
|
||||
* ```
|
||||
*/
|
||||
@JvmStatic fun builder() = Builder()
|
||||
}
|
||||
|
||||
/** A builder for [ItemListPageAsync]. */
|
||||
class Builder internal constructor() {
|
||||
|
||||
private var service: ItemServiceAsync? = null
|
||||
private var streamHandlerExecutor: Executor? = null
|
||||
private var params: ItemListParams? = null
|
||||
private var response: ItemListPageResponse? = null
|
||||
|
||||
@JvmSynthetic
|
||||
internal fun from(itemListPageAsync: ItemListPageAsync) = apply {
|
||||
service = itemListPageAsync.service
|
||||
streamHandlerExecutor = itemListPageAsync.streamHandlerExecutor
|
||||
params = itemListPageAsync.params
|
||||
response = itemListPageAsync.response
|
||||
}
|
||||
|
||||
fun service(service: ItemServiceAsync) = apply { this.service = service }
|
||||
|
||||
fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply {
|
||||
this.streamHandlerExecutor = streamHandlerExecutor
|
||||
}
|
||||
|
||||
/** The parameters that were used to request this page. */
|
||||
fun params(params: ItemListParams) = apply { this.params = params }
|
||||
|
||||
/** The response that this page was parsed from. */
|
||||
fun response(response: ItemListPageResponse) = apply { this.response = response }
|
||||
|
||||
/**
|
||||
* Returns an immutable instance of [ItemListPageAsync].
|
||||
*
|
||||
* Further updates to this [Builder] will not mutate the returned instance.
|
||||
*
|
||||
* The following fields are required:
|
||||
* ```java
|
||||
* .service()
|
||||
* .streamHandlerExecutor()
|
||||
* .params()
|
||||
* .response()
|
||||
* ```
|
||||
*
|
||||
* @throws IllegalStateException if any required field is unset.
|
||||
*/
|
||||
fun build(): ItemListPageAsync =
|
||||
ItemListPageAsync(
|
||||
checkRequired("service", service),
|
||||
checkRequired("streamHandlerExecutor", streamHandlerExecutor),
|
||||
checkRequired("params", params),
|
||||
checkRequired("response", response),
|
||||
)
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
|
||||
return other is ItemListPageAsync &&
|
||||
service == other.service &&
|
||||
streamHandlerExecutor == other.streamHandlerExecutor &&
|
||||
params == other.params &&
|
||||
response == other.response
|
||||
}
|
||||
|
||||
override fun hashCode(): Int = Objects.hash(service, streamHandlerExecutor, params, response)
|
||||
|
||||
override fun toString() =
|
||||
"ItemListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}"
|
||||
}
|
||||
+258
@@ -0,0 +1,258 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.models.annotationqueues.items
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnyGetter
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter
|
||||
import com.fasterxml.jackson.annotation.JsonCreator
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.langchain.smith.core.ExcludeMissing
|
||||
import com.langchain.smith.core.JsonField
|
||||
import com.langchain.smith.core.JsonMissing
|
||||
import com.langchain.smith.core.JsonValue
|
||||
import com.langchain.smith.core.checkKnown
|
||||
import com.langchain.smith.core.toImmutable
|
||||
import com.langchain.smith.errors.LangChainInvalidDataException
|
||||
import java.util.Collections
|
||||
import java.util.Objects
|
||||
import java.util.Optional
|
||||
import kotlin.jvm.optionals.getOrNull
|
||||
|
||||
class ItemListPageResponse
|
||||
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
|
||||
private constructor(
|
||||
private val items: JsonField<List<ItemListResponse>>,
|
||||
private val nextCursor: JsonField<String>,
|
||||
private val previousCursor: JsonField<String>,
|
||||
private val additionalProperties: MutableMap<String, JsonValue>,
|
||||
) {
|
||||
|
||||
@JsonCreator
|
||||
private constructor(
|
||||
@JsonProperty("items")
|
||||
@ExcludeMissing
|
||||
items: JsonField<List<ItemListResponse>> = JsonMissing.of(),
|
||||
@JsonProperty("next_cursor")
|
||||
@ExcludeMissing
|
||||
nextCursor: JsonField<String> = JsonMissing.of(),
|
||||
@JsonProperty("previous_cursor")
|
||||
@ExcludeMissing
|
||||
previousCursor: JsonField<String> = JsonMissing.of(),
|
||||
) : this(items, nextCursor, previousCursor, mutableMapOf())
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun items(): Optional<List<ItemListResponse>> = items.getOptional("items")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun nextCursor(): Optional<String> = nextCursor.getOptional("next_cursor")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun previousCursor(): Optional<String> = previousCursor.getOptional("previous_cursor")
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [items].
|
||||
*
|
||||
* Unlike [items], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("items") @ExcludeMissing fun _items(): JsonField<List<ItemListResponse>> = items
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [nextCursor].
|
||||
*
|
||||
* Unlike [nextCursor], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("next_cursor") @ExcludeMissing fun _nextCursor(): JsonField<String> = nextCursor
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [previousCursor].
|
||||
*
|
||||
* Unlike [previousCursor], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("previous_cursor")
|
||||
@ExcludeMissing
|
||||
fun _previousCursor(): JsonField<String> = previousCursor
|
||||
|
||||
@JsonAnySetter
|
||||
private fun putAdditionalProperty(key: String, value: JsonValue) {
|
||||
additionalProperties.put(key, value)
|
||||
}
|
||||
|
||||
@JsonAnyGetter
|
||||
@ExcludeMissing
|
||||
fun _additionalProperties(): Map<String, JsonValue> =
|
||||
Collections.unmodifiableMap(additionalProperties)
|
||||
|
||||
fun toBuilder() = Builder().from(this)
|
||||
|
||||
companion object {
|
||||
|
||||
/** Returns a mutable builder for constructing an instance of [ItemListPageResponse]. */
|
||||
@JvmStatic fun builder() = Builder()
|
||||
}
|
||||
|
||||
/** A builder for [ItemListPageResponse]. */
|
||||
class Builder internal constructor() {
|
||||
|
||||
private var items: JsonField<MutableList<ItemListResponse>>? = null
|
||||
private var nextCursor: JsonField<String> = JsonMissing.of()
|
||||
private var previousCursor: JsonField<String> = JsonMissing.of()
|
||||
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
|
||||
|
||||
@JvmSynthetic
|
||||
internal fun from(itemListPageResponse: ItemListPageResponse) = apply {
|
||||
items = itemListPageResponse.items.map { it.toMutableList() }
|
||||
nextCursor = itemListPageResponse.nextCursor
|
||||
previousCursor = itemListPageResponse.previousCursor
|
||||
additionalProperties = itemListPageResponse.additionalProperties.toMutableMap()
|
||||
}
|
||||
|
||||
fun items(items: List<ItemListResponse>) = items(JsonField.of(items))
|
||||
|
||||
/**
|
||||
* Sets [Builder.items] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.items] with a well-typed `List<ItemListResponse>` value
|
||||
* instead. This method is primarily for setting the field to an undocumented or not yet
|
||||
* supported value.
|
||||
*/
|
||||
fun items(items: JsonField<List<ItemListResponse>>) = apply {
|
||||
this.items = items.map { it.toMutableList() }
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a single [ItemListResponse] to [items].
|
||||
*
|
||||
* @throws IllegalStateException if the field was previously set to a non-list.
|
||||
*/
|
||||
fun addItem(item: ItemListResponse) = apply {
|
||||
items =
|
||||
(items ?: JsonField.of(mutableListOf())).also { checkKnown("items", it).add(item) }
|
||||
}
|
||||
|
||||
fun nextCursor(nextCursor: String) = nextCursor(JsonField.of(nextCursor))
|
||||
|
||||
/**
|
||||
* Sets [Builder.nextCursor] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.nextCursor] with a well-typed [String] value instead.
|
||||
* This method is primarily for setting the field to an undocumented or not yet supported
|
||||
* value.
|
||||
*/
|
||||
fun nextCursor(nextCursor: JsonField<String>) = apply { this.nextCursor = nextCursor }
|
||||
|
||||
fun previousCursor(previousCursor: String) = previousCursor(JsonField.of(previousCursor))
|
||||
|
||||
/**
|
||||
* Sets [Builder.previousCursor] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.previousCursor] with a well-typed [String] value
|
||||
* instead. This method is primarily for setting the field to an undocumented or not yet
|
||||
* supported value.
|
||||
*/
|
||||
fun previousCursor(previousCursor: JsonField<String>) = apply {
|
||||
this.previousCursor = previousCursor
|
||||
}
|
||||
|
||||
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
|
||||
this.additionalProperties.clear()
|
||||
putAllAdditionalProperties(additionalProperties)
|
||||
}
|
||||
|
||||
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
|
||||
additionalProperties.put(key, value)
|
||||
}
|
||||
|
||||
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
|
||||
this.additionalProperties.putAll(additionalProperties)
|
||||
}
|
||||
|
||||
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
|
||||
|
||||
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
|
||||
keys.forEach(::removeAdditionalProperty)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an immutable instance of [ItemListPageResponse].
|
||||
*
|
||||
* Further updates to this [Builder] will not mutate the returned instance.
|
||||
*/
|
||||
fun build(): ItemListPageResponse =
|
||||
ItemListPageResponse(
|
||||
(items ?: JsonMissing.of()).map { it.toImmutable() },
|
||||
nextCursor,
|
||||
previousCursor,
|
||||
additionalProperties.toMutableMap(),
|
||||
)
|
||||
}
|
||||
|
||||
private var validated: Boolean = false
|
||||
|
||||
/**
|
||||
* Validates that the types of all values in this object match their expected types recursively.
|
||||
*
|
||||
* This method is _not_ forwards compatible with new types from the API for existing fields.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if any value type in this object doesn't match its
|
||||
* expected type.
|
||||
*/
|
||||
fun validate(): ItemListPageResponse = apply {
|
||||
if (validated) {
|
||||
return@apply
|
||||
}
|
||||
|
||||
items().ifPresent { it.forEach { it.validate() } }
|
||||
nextCursor()
|
||||
previousCursor()
|
||||
validated = true
|
||||
}
|
||||
|
||||
fun isValid(): Boolean =
|
||||
try {
|
||||
validate()
|
||||
true
|
||||
} catch (e: LangChainInvalidDataException) {
|
||||
false
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a score indicating how many valid values are contained in this object recursively.
|
||||
*
|
||||
* Used for best match union deserialization.
|
||||
*/
|
||||
@JvmSynthetic
|
||||
internal fun validity(): Int =
|
||||
(items.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
|
||||
(if (nextCursor.asKnown().isPresent) 1 else 0) +
|
||||
(if (previousCursor.asKnown().isPresent) 1 else 0)
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
|
||||
return other is ItemListPageResponse &&
|
||||
items == other.items &&
|
||||
nextCursor == other.nextCursor &&
|
||||
previousCursor == other.previousCursor &&
|
||||
additionalProperties == other.additionalProperties
|
||||
}
|
||||
|
||||
private val hashCode: Int by lazy {
|
||||
Objects.hash(items, nextCursor, previousCursor, additionalProperties)
|
||||
}
|
||||
|
||||
override fun hashCode(): Int = hashCode
|
||||
|
||||
override fun toString() =
|
||||
"ItemListPageResponse{items=$items, nextCursor=$nextCursor, previousCursor=$previousCursor, additionalProperties=$additionalProperties}"
|
||||
}
|
||||
+729
@@ -0,0 +1,729 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.models.annotationqueues.items
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator
|
||||
import com.langchain.smith.core.Enum
|
||||
import com.langchain.smith.core.JsonField
|
||||
import com.langchain.smith.core.Params
|
||||
import com.langchain.smith.core.checkRequired
|
||||
import com.langchain.smith.core.http.Headers
|
||||
import com.langchain.smith.core.http.QueryParams
|
||||
import com.langchain.smith.errors.LangChainInvalidDataException
|
||||
import java.util.Objects
|
||||
import java.util.Optional
|
||||
import kotlin.jvm.optionals.getOrNull
|
||||
|
||||
/**
|
||||
* List RUN and THREAD items in a single annotation queue for one review status section, with opaque
|
||||
* cursor pagination. Optional item_type=RUN|THREAD filters the page. direction=backward returns
|
||||
* items before the supplied cursor. Response is membership metadata only (no nested run/thread
|
||||
* store payloads). status=archived returns items in annotation_queue_runs_archive (queue completion
|
||||
* rule met), not merely items the caller personally marked completed.
|
||||
*/
|
||||
class ItemListParams
|
||||
private constructor(
|
||||
private val queueId: String?,
|
||||
private val status: Status,
|
||||
private val cursor: String?,
|
||||
private val direction: Direction?,
|
||||
private val itemType: ItemType?,
|
||||
private val pageSize: Long?,
|
||||
private val additionalHeaders: Headers,
|
||||
private val additionalQueryParams: QueryParams,
|
||||
) : Params {
|
||||
|
||||
fun queueId(): Optional<String> = Optional.ofNullable(queueId)
|
||||
|
||||
/** Review section: needs_my_review, needs_others_review, or archived */
|
||||
fun status(): Status = status
|
||||
|
||||
/** Opaque pagination cursor */
|
||||
fun cursor(): Optional<String> = Optional.ofNullable(cursor)
|
||||
|
||||
/** Pagination direction. backward requires cursor */
|
||||
fun direction(): Optional<Direction> = Optional.ofNullable(direction)
|
||||
|
||||
/** Filter to RUN or THREAD */
|
||||
fun itemType(): Optional<ItemType> = Optional.ofNullable(itemType)
|
||||
|
||||
/** Page size (max 100) */
|
||||
fun pageSize(): Optional<Long> = Optional.ofNullable(pageSize)
|
||||
|
||||
/** Additional headers to send with the request. */
|
||||
fun _additionalHeaders(): Headers = additionalHeaders
|
||||
|
||||
/** Additional query param to send with the request. */
|
||||
fun _additionalQueryParams(): QueryParams = additionalQueryParams
|
||||
|
||||
fun toBuilder() = Builder().from(this)
|
||||
|
||||
companion object {
|
||||
|
||||
/**
|
||||
* Returns a mutable builder for constructing an instance of [ItemListParams].
|
||||
*
|
||||
* The following fields are required:
|
||||
* ```java
|
||||
* .status()
|
||||
* ```
|
||||
*/
|
||||
@JvmStatic fun builder() = Builder()
|
||||
}
|
||||
|
||||
/** A builder for [ItemListParams]. */
|
||||
class Builder internal constructor() {
|
||||
|
||||
private var queueId: String? = null
|
||||
private var status: Status? = null
|
||||
private var cursor: String? = null
|
||||
private var direction: Direction? = null
|
||||
private var itemType: ItemType? = null
|
||||
private var pageSize: Long? = null
|
||||
private var additionalHeaders: Headers.Builder = Headers.builder()
|
||||
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
|
||||
|
||||
@JvmSynthetic
|
||||
internal fun from(itemListParams: ItemListParams) = apply {
|
||||
queueId = itemListParams.queueId
|
||||
status = itemListParams.status
|
||||
cursor = itemListParams.cursor
|
||||
direction = itemListParams.direction
|
||||
itemType = itemListParams.itemType
|
||||
pageSize = itemListParams.pageSize
|
||||
additionalHeaders = itemListParams.additionalHeaders.toBuilder()
|
||||
additionalQueryParams = itemListParams.additionalQueryParams.toBuilder()
|
||||
}
|
||||
|
||||
fun queueId(queueId: String?) = apply { this.queueId = queueId }
|
||||
|
||||
/** Alias for calling [Builder.queueId] with `queueId.orElse(null)`. */
|
||||
fun queueId(queueId: Optional<String>) = queueId(queueId.getOrNull())
|
||||
|
||||
/** Review section: needs_my_review, needs_others_review, or archived */
|
||||
fun status(status: Status) = apply { this.status = status }
|
||||
|
||||
/** Opaque pagination cursor */
|
||||
fun cursor(cursor: String?) = apply { this.cursor = cursor }
|
||||
|
||||
/** Alias for calling [Builder.cursor] with `cursor.orElse(null)`. */
|
||||
fun cursor(cursor: Optional<String>) = cursor(cursor.getOrNull())
|
||||
|
||||
/** Pagination direction. backward requires cursor */
|
||||
fun direction(direction: Direction?) = apply { this.direction = direction }
|
||||
|
||||
/** Alias for calling [Builder.direction] with `direction.orElse(null)`. */
|
||||
fun direction(direction: Optional<Direction>) = direction(direction.getOrNull())
|
||||
|
||||
/** Filter to RUN or THREAD */
|
||||
fun itemType(itemType: ItemType?) = apply { this.itemType = itemType }
|
||||
|
||||
/** Alias for calling [Builder.itemType] with `itemType.orElse(null)`. */
|
||||
fun itemType(itemType: Optional<ItemType>) = itemType(itemType.getOrNull())
|
||||
|
||||
/** Page size (max 100) */
|
||||
fun pageSize(pageSize: Long?) = apply { this.pageSize = pageSize }
|
||||
|
||||
/**
|
||||
* Alias for [Builder.pageSize].
|
||||
*
|
||||
* This unboxed primitive overload exists for backwards compatibility.
|
||||
*/
|
||||
fun pageSize(pageSize: Long) = pageSize(pageSize as Long?)
|
||||
|
||||
/** Alias for calling [Builder.pageSize] with `pageSize.orElse(null)`. */
|
||||
fun pageSize(pageSize: Optional<Long>) = pageSize(pageSize.getOrNull())
|
||||
|
||||
fun additionalHeaders(additionalHeaders: Headers) = apply {
|
||||
this.additionalHeaders.clear()
|
||||
putAllAdditionalHeaders(additionalHeaders)
|
||||
}
|
||||
|
||||
fun additionalHeaders(additionalHeaders: Map<String, Iterable<String>>) = apply {
|
||||
this.additionalHeaders.clear()
|
||||
putAllAdditionalHeaders(additionalHeaders)
|
||||
}
|
||||
|
||||
fun putAdditionalHeader(name: String, value: String) = apply {
|
||||
additionalHeaders.put(name, value)
|
||||
}
|
||||
|
||||
fun putAdditionalHeaders(name: String, values: Iterable<String>) = apply {
|
||||
additionalHeaders.put(name, values)
|
||||
}
|
||||
|
||||
fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply {
|
||||
this.additionalHeaders.putAll(additionalHeaders)
|
||||
}
|
||||
|
||||
fun putAllAdditionalHeaders(additionalHeaders: Map<String, Iterable<String>>) = apply {
|
||||
this.additionalHeaders.putAll(additionalHeaders)
|
||||
}
|
||||
|
||||
fun replaceAdditionalHeaders(name: String, value: String) = apply {
|
||||
additionalHeaders.replace(name, value)
|
||||
}
|
||||
|
||||
fun replaceAdditionalHeaders(name: String, values: Iterable<String>) = apply {
|
||||
additionalHeaders.replace(name, values)
|
||||
}
|
||||
|
||||
fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply {
|
||||
this.additionalHeaders.replaceAll(additionalHeaders)
|
||||
}
|
||||
|
||||
fun replaceAllAdditionalHeaders(additionalHeaders: Map<String, Iterable<String>>) = apply {
|
||||
this.additionalHeaders.replaceAll(additionalHeaders)
|
||||
}
|
||||
|
||||
fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) }
|
||||
|
||||
fun removeAllAdditionalHeaders(names: Set<String>) = apply {
|
||||
additionalHeaders.removeAll(names)
|
||||
}
|
||||
|
||||
fun additionalQueryParams(additionalQueryParams: QueryParams) = apply {
|
||||
this.additionalQueryParams.clear()
|
||||
putAllAdditionalQueryParams(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun additionalQueryParams(additionalQueryParams: Map<String, Iterable<String>>) = apply {
|
||||
this.additionalQueryParams.clear()
|
||||
putAllAdditionalQueryParams(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun putAdditionalQueryParam(key: String, value: String) = apply {
|
||||
additionalQueryParams.put(key, value)
|
||||
}
|
||||
|
||||
fun putAdditionalQueryParams(key: String, values: Iterable<String>) = apply {
|
||||
additionalQueryParams.put(key, values)
|
||||
}
|
||||
|
||||
fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
|
||||
this.additionalQueryParams.putAll(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun putAllAdditionalQueryParams(additionalQueryParams: Map<String, Iterable<String>>) =
|
||||
apply {
|
||||
this.additionalQueryParams.putAll(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun replaceAdditionalQueryParams(key: String, value: String) = apply {
|
||||
additionalQueryParams.replace(key, value)
|
||||
}
|
||||
|
||||
fun replaceAdditionalQueryParams(key: String, values: Iterable<String>) = apply {
|
||||
additionalQueryParams.replace(key, values)
|
||||
}
|
||||
|
||||
fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
|
||||
this.additionalQueryParams.replaceAll(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun replaceAllAdditionalQueryParams(additionalQueryParams: Map<String, Iterable<String>>) =
|
||||
apply {
|
||||
this.additionalQueryParams.replaceAll(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) }
|
||||
|
||||
fun removeAllAdditionalQueryParams(keys: Set<String>) = apply {
|
||||
additionalQueryParams.removeAll(keys)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an immutable instance of [ItemListParams].
|
||||
*
|
||||
* Further updates to this [Builder] will not mutate the returned instance.
|
||||
*
|
||||
* The following fields are required:
|
||||
* ```java
|
||||
* .status()
|
||||
* ```
|
||||
*
|
||||
* @throws IllegalStateException if any required field is unset.
|
||||
*/
|
||||
fun build(): ItemListParams =
|
||||
ItemListParams(
|
||||
queueId,
|
||||
checkRequired("status", status),
|
||||
cursor,
|
||||
direction,
|
||||
itemType,
|
||||
pageSize,
|
||||
additionalHeaders.build(),
|
||||
additionalQueryParams.build(),
|
||||
)
|
||||
}
|
||||
|
||||
fun _pathParam(index: Int): String =
|
||||
when (index) {
|
||||
0 -> queueId ?: ""
|
||||
else -> ""
|
||||
}
|
||||
|
||||
override fun _headers(): Headers = additionalHeaders
|
||||
|
||||
override fun _queryParams(): QueryParams =
|
||||
QueryParams.builder()
|
||||
.apply {
|
||||
put("status", status.toString())
|
||||
cursor?.let { put("cursor", it) }
|
||||
direction?.let { put("direction", it.toString()) }
|
||||
itemType?.let { put("item_type", it.toString()) }
|
||||
pageSize?.let { put("page_size", it.toString()) }
|
||||
putAll(additionalQueryParams)
|
||||
}
|
||||
.build()
|
||||
|
||||
/** Review section: needs_my_review, needs_others_review, or archived */
|
||||
class Status @JsonCreator private constructor(private val value: JsonField<String>) : Enum {
|
||||
|
||||
/**
|
||||
* Returns this class instance's raw value.
|
||||
*
|
||||
* This is usually only useful if this instance was deserialized from data that doesn't
|
||||
* match any known member, and you want to know that value. For example, if the SDK is on an
|
||||
* older version than the API, then the API may respond with new members that the SDK is
|
||||
* unaware of.
|
||||
*/
|
||||
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value
|
||||
|
||||
companion object {
|
||||
|
||||
@JvmField val NEEDS_MY_REVIEW = of("needs_my_review")
|
||||
|
||||
@JvmField val NEEDS_OTHERS_REVIEW = of("needs_others_review")
|
||||
|
||||
@JvmField val ARCHIVED = of("archived")
|
||||
|
||||
@JvmStatic fun of(value: String) = Status(JsonField.of(value))
|
||||
}
|
||||
|
||||
/** An enum containing [Status]'s known values. */
|
||||
enum class Known {
|
||||
NEEDS_MY_REVIEW,
|
||||
NEEDS_OTHERS_REVIEW,
|
||||
ARCHIVED,
|
||||
}
|
||||
|
||||
/**
|
||||
* An enum containing [Status]'s known values, as well as an [_UNKNOWN] member.
|
||||
*
|
||||
* An instance of [Status] can contain an unknown value in a couple of cases:
|
||||
* - It was deserialized from data that doesn't match any known member. For example, if the
|
||||
* SDK is on an older version than the API, then the API may respond with new members that
|
||||
* the SDK is unaware of.
|
||||
* - It was constructed with an arbitrary value using the [of] method.
|
||||
*/
|
||||
enum class Value {
|
||||
NEEDS_MY_REVIEW,
|
||||
NEEDS_OTHERS_REVIEW,
|
||||
ARCHIVED,
|
||||
/** An enum member indicating that [Status] was instantiated with an unknown value. */
|
||||
_UNKNOWN,
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
|
||||
* if the class was instantiated with an unknown value.
|
||||
*
|
||||
* Use the [known] method instead if you're certain the value is always known or if you want
|
||||
* to throw for the unknown case.
|
||||
*/
|
||||
fun value(): Value =
|
||||
when (this) {
|
||||
NEEDS_MY_REVIEW -> Value.NEEDS_MY_REVIEW
|
||||
NEEDS_OTHERS_REVIEW -> Value.NEEDS_OTHERS_REVIEW
|
||||
ARCHIVED -> Value.ARCHIVED
|
||||
else -> Value._UNKNOWN
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an enum member corresponding to this class instance's value.
|
||||
*
|
||||
* Use the [value] method instead if you're uncertain the value is always known and don't
|
||||
* want to throw for the unknown case.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if this class instance's value is a not a known
|
||||
* member.
|
||||
*/
|
||||
fun known(): Known =
|
||||
when (this) {
|
||||
NEEDS_MY_REVIEW -> Known.NEEDS_MY_REVIEW
|
||||
NEEDS_OTHERS_REVIEW -> Known.NEEDS_OTHERS_REVIEW
|
||||
ARCHIVED -> Known.ARCHIVED
|
||||
else -> throw LangChainInvalidDataException("Unknown Status: $value")
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns this class instance's primitive wire representation.
|
||||
*
|
||||
* This differs from the [toString] method because that method is primarily for debugging
|
||||
* and generally doesn't throw.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if this class instance's value does not have the
|
||||
* expected primitive type.
|
||||
*/
|
||||
fun asString(): String =
|
||||
_value().asString().orElseThrow {
|
||||
LangChainInvalidDataException("Value is not a String")
|
||||
}
|
||||
|
||||
private var validated: Boolean = false
|
||||
|
||||
/**
|
||||
* Validates that the types of all values in this object match their expected types
|
||||
* recursively.
|
||||
*
|
||||
* This method is _not_ forwards compatible with new types from the API for existing fields.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if any value type in this object doesn't match its
|
||||
* expected type.
|
||||
*/
|
||||
fun validate(): Status = apply {
|
||||
if (validated) {
|
||||
return@apply
|
||||
}
|
||||
|
||||
known()
|
||||
validated = true
|
||||
}
|
||||
|
||||
fun isValid(): Boolean =
|
||||
try {
|
||||
validate()
|
||||
true
|
||||
} catch (e: LangChainInvalidDataException) {
|
||||
false
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a score indicating how many valid values are contained in this object
|
||||
* recursively.
|
||||
*
|
||||
* Used for best match union deserialization.
|
||||
*/
|
||||
@JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
|
||||
return other is Status && value == other.value
|
||||
}
|
||||
|
||||
override fun hashCode() = value.hashCode()
|
||||
|
||||
override fun toString() = value.toString()
|
||||
}
|
||||
|
||||
/** Pagination direction. backward requires cursor */
|
||||
class Direction @JsonCreator private constructor(private val value: JsonField<String>) : Enum {
|
||||
|
||||
/**
|
||||
* Returns this class instance's raw value.
|
||||
*
|
||||
* This is usually only useful if this instance was deserialized from data that doesn't
|
||||
* match any known member, and you want to know that value. For example, if the SDK is on an
|
||||
* older version than the API, then the API may respond with new members that the SDK is
|
||||
* unaware of.
|
||||
*/
|
||||
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value
|
||||
|
||||
companion object {
|
||||
|
||||
@JvmField val FORWARD = of("forward")
|
||||
|
||||
@JvmField val BACKWARD = of("backward")
|
||||
|
||||
@JvmStatic fun of(value: String) = Direction(JsonField.of(value))
|
||||
}
|
||||
|
||||
/** An enum containing [Direction]'s known values. */
|
||||
enum class Known {
|
||||
FORWARD,
|
||||
BACKWARD,
|
||||
}
|
||||
|
||||
/**
|
||||
* An enum containing [Direction]'s known values, as well as an [_UNKNOWN] member.
|
||||
*
|
||||
* An instance of [Direction] can contain an unknown value in a couple of cases:
|
||||
* - It was deserialized from data that doesn't match any known member. For example, if the
|
||||
* SDK is on an older version than the API, then the API may respond with new members that
|
||||
* the SDK is unaware of.
|
||||
* - It was constructed with an arbitrary value using the [of] method.
|
||||
*/
|
||||
enum class Value {
|
||||
FORWARD,
|
||||
BACKWARD,
|
||||
/**
|
||||
* An enum member indicating that [Direction] was instantiated with an unknown value.
|
||||
*/
|
||||
_UNKNOWN,
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
|
||||
* if the class was instantiated with an unknown value.
|
||||
*
|
||||
* Use the [known] method instead if you're certain the value is always known or if you want
|
||||
* to throw for the unknown case.
|
||||
*/
|
||||
fun value(): Value =
|
||||
when (this) {
|
||||
FORWARD -> Value.FORWARD
|
||||
BACKWARD -> Value.BACKWARD
|
||||
else -> Value._UNKNOWN
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an enum member corresponding to this class instance's value.
|
||||
*
|
||||
* Use the [value] method instead if you're uncertain the value is always known and don't
|
||||
* want to throw for the unknown case.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if this class instance's value is a not a known
|
||||
* member.
|
||||
*/
|
||||
fun known(): Known =
|
||||
when (this) {
|
||||
FORWARD -> Known.FORWARD
|
||||
BACKWARD -> Known.BACKWARD
|
||||
else -> throw LangChainInvalidDataException("Unknown Direction: $value")
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns this class instance's primitive wire representation.
|
||||
*
|
||||
* This differs from the [toString] method because that method is primarily for debugging
|
||||
* and generally doesn't throw.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if this class instance's value does not have the
|
||||
* expected primitive type.
|
||||
*/
|
||||
fun asString(): String =
|
||||
_value().asString().orElseThrow {
|
||||
LangChainInvalidDataException("Value is not a String")
|
||||
}
|
||||
|
||||
private var validated: Boolean = false
|
||||
|
||||
/**
|
||||
* Validates that the types of all values in this object match their expected types
|
||||
* recursively.
|
||||
*
|
||||
* This method is _not_ forwards compatible with new types from the API for existing fields.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if any value type in this object doesn't match its
|
||||
* expected type.
|
||||
*/
|
||||
fun validate(): Direction = apply {
|
||||
if (validated) {
|
||||
return@apply
|
||||
}
|
||||
|
||||
known()
|
||||
validated = true
|
||||
}
|
||||
|
||||
fun isValid(): Boolean =
|
||||
try {
|
||||
validate()
|
||||
true
|
||||
} catch (e: LangChainInvalidDataException) {
|
||||
false
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a score indicating how many valid values are contained in this object
|
||||
* recursively.
|
||||
*
|
||||
* Used for best match union deserialization.
|
||||
*/
|
||||
@JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
|
||||
return other is Direction && value == other.value
|
||||
}
|
||||
|
||||
override fun hashCode() = value.hashCode()
|
||||
|
||||
override fun toString() = value.toString()
|
||||
}
|
||||
|
||||
/** Filter to RUN or THREAD */
|
||||
class ItemType @JsonCreator private constructor(private val value: JsonField<String>) : Enum {
|
||||
|
||||
/**
|
||||
* Returns this class instance's raw value.
|
||||
*
|
||||
* This is usually only useful if this instance was deserialized from data that doesn't
|
||||
* match any known member, and you want to know that value. For example, if the SDK is on an
|
||||
* older version than the API, then the API may respond with new members that the SDK is
|
||||
* unaware of.
|
||||
*/
|
||||
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value
|
||||
|
||||
companion object {
|
||||
|
||||
@JvmField val RUN = of("RUN")
|
||||
|
||||
@JvmField val THREAD = of("THREAD")
|
||||
|
||||
@JvmStatic fun of(value: String) = ItemType(JsonField.of(value))
|
||||
}
|
||||
|
||||
/** An enum containing [ItemType]'s known values. */
|
||||
enum class Known {
|
||||
RUN,
|
||||
THREAD,
|
||||
}
|
||||
|
||||
/**
|
||||
* An enum containing [ItemType]'s known values, as well as an [_UNKNOWN] member.
|
||||
*
|
||||
* An instance of [ItemType] can contain an unknown value in a couple of cases:
|
||||
* - It was deserialized from data that doesn't match any known member. For example, if the
|
||||
* SDK is on an older version than the API, then the API may respond with new members that
|
||||
* the SDK is unaware of.
|
||||
* - It was constructed with an arbitrary value using the [of] method.
|
||||
*/
|
||||
enum class Value {
|
||||
RUN,
|
||||
THREAD,
|
||||
/** An enum member indicating that [ItemType] was instantiated with an unknown value. */
|
||||
_UNKNOWN,
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
|
||||
* if the class was instantiated with an unknown value.
|
||||
*
|
||||
* Use the [known] method instead if you're certain the value is always known or if you want
|
||||
* to throw for the unknown case.
|
||||
*/
|
||||
fun value(): Value =
|
||||
when (this) {
|
||||
RUN -> Value.RUN
|
||||
THREAD -> Value.THREAD
|
||||
else -> Value._UNKNOWN
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an enum member corresponding to this class instance's value.
|
||||
*
|
||||
* Use the [value] method instead if you're uncertain the value is always known and don't
|
||||
* want to throw for the unknown case.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if this class instance's value is a not a known
|
||||
* member.
|
||||
*/
|
||||
fun known(): Known =
|
||||
when (this) {
|
||||
RUN -> Known.RUN
|
||||
THREAD -> Known.THREAD
|
||||
else -> throw LangChainInvalidDataException("Unknown ItemType: $value")
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns this class instance's primitive wire representation.
|
||||
*
|
||||
* This differs from the [toString] method because that method is primarily for debugging
|
||||
* and generally doesn't throw.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if this class instance's value does not have the
|
||||
* expected primitive type.
|
||||
*/
|
||||
fun asString(): String =
|
||||
_value().asString().orElseThrow {
|
||||
LangChainInvalidDataException("Value is not a String")
|
||||
}
|
||||
|
||||
private var validated: Boolean = false
|
||||
|
||||
/**
|
||||
* Validates that the types of all values in this object match their expected types
|
||||
* recursively.
|
||||
*
|
||||
* This method is _not_ forwards compatible with new types from the API for existing fields.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if any value type in this object doesn't match its
|
||||
* expected type.
|
||||
*/
|
||||
fun validate(): ItemType = apply {
|
||||
if (validated) {
|
||||
return@apply
|
||||
}
|
||||
|
||||
known()
|
||||
validated = true
|
||||
}
|
||||
|
||||
fun isValid(): Boolean =
|
||||
try {
|
||||
validate()
|
||||
true
|
||||
} catch (e: LangChainInvalidDataException) {
|
||||
false
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a score indicating how many valid values are contained in this object
|
||||
* recursively.
|
||||
*
|
||||
* Used for best match union deserialization.
|
||||
*/
|
||||
@JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
|
||||
return other is ItemType && value == other.value
|
||||
}
|
||||
|
||||
override fun hashCode() = value.hashCode()
|
||||
|
||||
override fun toString() = value.toString()
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
|
||||
return other is ItemListParams &&
|
||||
queueId == other.queueId &&
|
||||
status == other.status &&
|
||||
cursor == other.cursor &&
|
||||
direction == other.direction &&
|
||||
itemType == other.itemType &&
|
||||
pageSize == other.pageSize &&
|
||||
additionalHeaders == other.additionalHeaders &&
|
||||
additionalQueryParams == other.additionalQueryParams
|
||||
}
|
||||
|
||||
override fun hashCode(): Int =
|
||||
Objects.hash(
|
||||
queueId,
|
||||
status,
|
||||
cursor,
|
||||
direction,
|
||||
itemType,
|
||||
pageSize,
|
||||
additionalHeaders,
|
||||
additionalQueryParams,
|
||||
)
|
||||
|
||||
override fun toString() =
|
||||
"ItemListParams{queueId=$queueId, status=$status, cursor=$cursor, direction=$direction, itemType=$itemType, pageSize=$pageSize, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
|
||||
}
|
||||
+782
@@ -0,0 +1,782 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.models.annotationqueues.items
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnyGetter
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter
|
||||
import com.fasterxml.jackson.annotation.JsonCreator
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.langchain.smith.core.Enum
|
||||
import com.langchain.smith.core.ExcludeMissing
|
||||
import com.langchain.smith.core.JsonField
|
||||
import com.langchain.smith.core.JsonMissing
|
||||
import com.langchain.smith.core.JsonValue
|
||||
import com.langchain.smith.core.checkKnown
|
||||
import com.langchain.smith.core.toImmutable
|
||||
import com.langchain.smith.errors.LangChainInvalidDataException
|
||||
import java.util.Collections
|
||||
import java.util.Objects
|
||||
import java.util.Optional
|
||||
import kotlin.jvm.optionals.getOrNull
|
||||
|
||||
class ItemListResponse
|
||||
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
|
||||
private constructor(
|
||||
private val id: JsonField<String>,
|
||||
private val addedAt: JsonField<String>,
|
||||
private val completedBy: JsonField<List<String>>,
|
||||
private val effectiveAddedAt: JsonField<String>,
|
||||
private val itemType: JsonField<ItemType>,
|
||||
private val lastReviewedTime: JsonField<String>,
|
||||
private val queueId: JsonField<String>,
|
||||
private val reservedBy: JsonField<List<String>>,
|
||||
private val runId: JsonField<String>,
|
||||
private val sessionId: JsonField<String>,
|
||||
private val sourceProposedExampleId: JsonField<String>,
|
||||
private val startTime: JsonField<String>,
|
||||
private val threadId: JsonField<String>,
|
||||
private val additionalProperties: MutableMap<String, JsonValue>,
|
||||
) {
|
||||
|
||||
@JsonCreator
|
||||
private constructor(
|
||||
@JsonProperty("id") @ExcludeMissing id: JsonField<String> = JsonMissing.of(),
|
||||
@JsonProperty("added_at") @ExcludeMissing addedAt: JsonField<String> = JsonMissing.of(),
|
||||
@JsonProperty("completed_by")
|
||||
@ExcludeMissing
|
||||
completedBy: JsonField<List<String>> = JsonMissing.of(),
|
||||
@JsonProperty("effective_added_at")
|
||||
@ExcludeMissing
|
||||
effectiveAddedAt: JsonField<String> = JsonMissing.of(),
|
||||
@JsonProperty("item_type") @ExcludeMissing itemType: JsonField<ItemType> = JsonMissing.of(),
|
||||
@JsonProperty("last_reviewed_time")
|
||||
@ExcludeMissing
|
||||
lastReviewedTime: JsonField<String> = JsonMissing.of(),
|
||||
@JsonProperty("queue_id") @ExcludeMissing queueId: JsonField<String> = JsonMissing.of(),
|
||||
@JsonProperty("reserved_by")
|
||||
@ExcludeMissing
|
||||
reservedBy: JsonField<List<String>> = JsonMissing.of(),
|
||||
@JsonProperty("run_id") @ExcludeMissing runId: JsonField<String> = JsonMissing.of(),
|
||||
@JsonProperty("session_id") @ExcludeMissing sessionId: JsonField<String> = JsonMissing.of(),
|
||||
@JsonProperty("source_proposed_example_id")
|
||||
@ExcludeMissing
|
||||
sourceProposedExampleId: JsonField<String> = JsonMissing.of(),
|
||||
@JsonProperty("start_time") @ExcludeMissing startTime: JsonField<String> = JsonMissing.of(),
|
||||
@JsonProperty("thread_id") @ExcludeMissing threadId: JsonField<String> = JsonMissing.of(),
|
||||
) : this(
|
||||
id,
|
||||
addedAt,
|
||||
completedBy,
|
||||
effectiveAddedAt,
|
||||
itemType,
|
||||
lastReviewedTime,
|
||||
queueId,
|
||||
reservedBy,
|
||||
runId,
|
||||
sessionId,
|
||||
sourceProposedExampleId,
|
||||
startTime,
|
||||
threadId,
|
||||
mutableMapOf(),
|
||||
)
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun id(): Optional<String> = id.getOptional("id")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun addedAt(): Optional<String> = addedAt.getOptional("added_at")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun completedBy(): Optional<List<String>> = completedBy.getOptional("completed_by")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun effectiveAddedAt(): Optional<String> = effectiveAddedAt.getOptional("effective_added_at")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun itemType(): Optional<ItemType> = itemType.getOptional("item_type")
|
||||
|
||||
/**
|
||||
* LastReviewedTime is always present on the wire (null until reviewed).
|
||||
*
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun lastReviewedTime(): Optional<String> = lastReviewedTime.getOptional("last_reviewed_time")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun queueId(): Optional<String> = queueId.getOptional("queue_id")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun reservedBy(): Optional<List<String>> = reservedBy.getOptional("reserved_by")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun runId(): Optional<String> = runId.getOptional("run_id")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun sessionId(): Optional<String> = sessionId.getOptional("session_id")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun sourceProposedExampleId(): Optional<String> =
|
||||
sourceProposedExampleId.getOptional("source_proposed_example_id")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun startTime(): Optional<String> = startTime.getOptional("start_time")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun threadId(): Optional<String> = threadId.getOptional("thread_id")
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [id].
|
||||
*
|
||||
* Unlike [id], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("id") @ExcludeMissing fun _id(): JsonField<String> = id
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [addedAt].
|
||||
*
|
||||
* Unlike [addedAt], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("added_at") @ExcludeMissing fun _addedAt(): JsonField<String> = addedAt
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [completedBy].
|
||||
*
|
||||
* Unlike [completedBy], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("completed_by")
|
||||
@ExcludeMissing
|
||||
fun _completedBy(): JsonField<List<String>> = completedBy
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [effectiveAddedAt].
|
||||
*
|
||||
* Unlike [effectiveAddedAt], this method doesn't throw if the JSON field has an unexpected
|
||||
* type.
|
||||
*/
|
||||
@JsonProperty("effective_added_at")
|
||||
@ExcludeMissing
|
||||
fun _effectiveAddedAt(): JsonField<String> = effectiveAddedAt
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [itemType].
|
||||
*
|
||||
* Unlike [itemType], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("item_type") @ExcludeMissing fun _itemType(): JsonField<ItemType> = itemType
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [lastReviewedTime].
|
||||
*
|
||||
* Unlike [lastReviewedTime], this method doesn't throw if the JSON field has an unexpected
|
||||
* type.
|
||||
*/
|
||||
@JsonProperty("last_reviewed_time")
|
||||
@ExcludeMissing
|
||||
fun _lastReviewedTime(): JsonField<String> = lastReviewedTime
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [queueId].
|
||||
*
|
||||
* Unlike [queueId], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("queue_id") @ExcludeMissing fun _queueId(): JsonField<String> = queueId
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [reservedBy].
|
||||
*
|
||||
* Unlike [reservedBy], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("reserved_by")
|
||||
@ExcludeMissing
|
||||
fun _reservedBy(): JsonField<List<String>> = reservedBy
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [runId].
|
||||
*
|
||||
* Unlike [runId], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("run_id") @ExcludeMissing fun _runId(): JsonField<String> = runId
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [sessionId].
|
||||
*
|
||||
* Unlike [sessionId], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("session_id") @ExcludeMissing fun _sessionId(): JsonField<String> = sessionId
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [sourceProposedExampleId].
|
||||
*
|
||||
* Unlike [sourceProposedExampleId], this method doesn't throw if the JSON field has an
|
||||
* unexpected type.
|
||||
*/
|
||||
@JsonProperty("source_proposed_example_id")
|
||||
@ExcludeMissing
|
||||
fun _sourceProposedExampleId(): JsonField<String> = sourceProposedExampleId
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [startTime].
|
||||
*
|
||||
* Unlike [startTime], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("start_time") @ExcludeMissing fun _startTime(): JsonField<String> = startTime
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [threadId].
|
||||
*
|
||||
* Unlike [threadId], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("thread_id") @ExcludeMissing fun _threadId(): JsonField<String> = threadId
|
||||
|
||||
@JsonAnySetter
|
||||
private fun putAdditionalProperty(key: String, value: JsonValue) {
|
||||
additionalProperties.put(key, value)
|
||||
}
|
||||
|
||||
@JsonAnyGetter
|
||||
@ExcludeMissing
|
||||
fun _additionalProperties(): Map<String, JsonValue> =
|
||||
Collections.unmodifiableMap(additionalProperties)
|
||||
|
||||
fun toBuilder() = Builder().from(this)
|
||||
|
||||
companion object {
|
||||
|
||||
/** Returns a mutable builder for constructing an instance of [ItemListResponse]. */
|
||||
@JvmStatic fun builder() = Builder()
|
||||
}
|
||||
|
||||
/** A builder for [ItemListResponse]. */
|
||||
class Builder internal constructor() {
|
||||
|
||||
private var id: JsonField<String> = JsonMissing.of()
|
||||
private var addedAt: JsonField<String> = JsonMissing.of()
|
||||
private var completedBy: JsonField<MutableList<String>>? = null
|
||||
private var effectiveAddedAt: JsonField<String> = JsonMissing.of()
|
||||
private var itemType: JsonField<ItemType> = JsonMissing.of()
|
||||
private var lastReviewedTime: JsonField<String> = JsonMissing.of()
|
||||
private var queueId: JsonField<String> = JsonMissing.of()
|
||||
private var reservedBy: JsonField<MutableList<String>>? = null
|
||||
private var runId: JsonField<String> = JsonMissing.of()
|
||||
private var sessionId: JsonField<String> = JsonMissing.of()
|
||||
private var sourceProposedExampleId: JsonField<String> = JsonMissing.of()
|
||||
private var startTime: JsonField<String> = JsonMissing.of()
|
||||
private var threadId: JsonField<String> = JsonMissing.of()
|
||||
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
|
||||
|
||||
@JvmSynthetic
|
||||
internal fun from(itemListResponse: ItemListResponse) = apply {
|
||||
id = itemListResponse.id
|
||||
addedAt = itemListResponse.addedAt
|
||||
completedBy = itemListResponse.completedBy.map { it.toMutableList() }
|
||||
effectiveAddedAt = itemListResponse.effectiveAddedAt
|
||||
itemType = itemListResponse.itemType
|
||||
lastReviewedTime = itemListResponse.lastReviewedTime
|
||||
queueId = itemListResponse.queueId
|
||||
reservedBy = itemListResponse.reservedBy.map { it.toMutableList() }
|
||||
runId = itemListResponse.runId
|
||||
sessionId = itemListResponse.sessionId
|
||||
sourceProposedExampleId = itemListResponse.sourceProposedExampleId
|
||||
startTime = itemListResponse.startTime
|
||||
threadId = itemListResponse.threadId
|
||||
additionalProperties = itemListResponse.additionalProperties.toMutableMap()
|
||||
}
|
||||
|
||||
fun id(id: String) = id(JsonField.of(id))
|
||||
|
||||
/**
|
||||
* Sets [Builder.id] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.id] with a well-typed [String] value instead. This
|
||||
* method is primarily for setting the field to an undocumented or not yet supported value.
|
||||
*/
|
||||
fun id(id: JsonField<String>) = apply { this.id = id }
|
||||
|
||||
fun addedAt(addedAt: String) = addedAt(JsonField.of(addedAt))
|
||||
|
||||
/**
|
||||
* Sets [Builder.addedAt] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.addedAt] with a well-typed [String] value instead. This
|
||||
* method is primarily for setting the field to an undocumented or not yet supported value.
|
||||
*/
|
||||
fun addedAt(addedAt: JsonField<String>) = apply { this.addedAt = addedAt }
|
||||
|
||||
fun completedBy(completedBy: List<String>) = completedBy(JsonField.of(completedBy))
|
||||
|
||||
/**
|
||||
* Sets [Builder.completedBy] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.completedBy] with a well-typed `List<String>` value
|
||||
* instead. This method is primarily for setting the field to an undocumented or not yet
|
||||
* supported value.
|
||||
*/
|
||||
fun completedBy(completedBy: JsonField<List<String>>) = apply {
|
||||
this.completedBy = completedBy.map { it.toMutableList() }
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a single [String] to [Builder.completedBy].
|
||||
*
|
||||
* @throws IllegalStateException if the field was previously set to a non-list.
|
||||
*/
|
||||
fun addCompletedBy(completedBy: String) = apply {
|
||||
this.completedBy =
|
||||
(this.completedBy ?: JsonField.of(mutableListOf())).also {
|
||||
checkKnown("completedBy", it).add(completedBy)
|
||||
}
|
||||
}
|
||||
|
||||
fun effectiveAddedAt(effectiveAddedAt: String) =
|
||||
effectiveAddedAt(JsonField.of(effectiveAddedAt))
|
||||
|
||||
/**
|
||||
* Sets [Builder.effectiveAddedAt] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.effectiveAddedAt] with a well-typed [String] value
|
||||
* instead. This method is primarily for setting the field to an undocumented or not yet
|
||||
* supported value.
|
||||
*/
|
||||
fun effectiveAddedAt(effectiveAddedAt: JsonField<String>) = apply {
|
||||
this.effectiveAddedAt = effectiveAddedAt
|
||||
}
|
||||
|
||||
fun itemType(itemType: ItemType) = itemType(JsonField.of(itemType))
|
||||
|
||||
/**
|
||||
* Sets [Builder.itemType] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.itemType] with a well-typed [ItemType] value instead.
|
||||
* This method is primarily for setting the field to an undocumented or not yet supported
|
||||
* value.
|
||||
*/
|
||||
fun itemType(itemType: JsonField<ItemType>) = apply { this.itemType = itemType }
|
||||
|
||||
/** LastReviewedTime is always present on the wire (null until reviewed). */
|
||||
fun lastReviewedTime(lastReviewedTime: String) =
|
||||
lastReviewedTime(JsonField.of(lastReviewedTime))
|
||||
|
||||
/**
|
||||
* Sets [Builder.lastReviewedTime] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.lastReviewedTime] with a well-typed [String] value
|
||||
* instead. This method is primarily for setting the field to an undocumented or not yet
|
||||
* supported value.
|
||||
*/
|
||||
fun lastReviewedTime(lastReviewedTime: JsonField<String>) = apply {
|
||||
this.lastReviewedTime = lastReviewedTime
|
||||
}
|
||||
|
||||
fun queueId(queueId: String) = queueId(JsonField.of(queueId))
|
||||
|
||||
/**
|
||||
* Sets [Builder.queueId] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.queueId] with a well-typed [String] value instead. This
|
||||
* method is primarily for setting the field to an undocumented or not yet supported value.
|
||||
*/
|
||||
fun queueId(queueId: JsonField<String>) = apply { this.queueId = queueId }
|
||||
|
||||
fun reservedBy(reservedBy: List<String>) = reservedBy(JsonField.of(reservedBy))
|
||||
|
||||
/**
|
||||
* Sets [Builder.reservedBy] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.reservedBy] with a well-typed `List<String>` value
|
||||
* instead. This method is primarily for setting the field to an undocumented or not yet
|
||||
* supported value.
|
||||
*/
|
||||
fun reservedBy(reservedBy: JsonField<List<String>>) = apply {
|
||||
this.reservedBy = reservedBy.map { it.toMutableList() }
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a single [String] to [Builder.reservedBy].
|
||||
*
|
||||
* @throws IllegalStateException if the field was previously set to a non-list.
|
||||
*/
|
||||
fun addReservedBy(reservedBy: String) = apply {
|
||||
this.reservedBy =
|
||||
(this.reservedBy ?: JsonField.of(mutableListOf())).also {
|
||||
checkKnown("reservedBy", it).add(reservedBy)
|
||||
}
|
||||
}
|
||||
|
||||
fun runId(runId: String) = runId(JsonField.of(runId))
|
||||
|
||||
/**
|
||||
* Sets [Builder.runId] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.runId] with a well-typed [String] value instead. This
|
||||
* method is primarily for setting the field to an undocumented or not yet supported value.
|
||||
*/
|
||||
fun runId(runId: JsonField<String>) = apply { this.runId = runId }
|
||||
|
||||
fun sessionId(sessionId: String) = sessionId(JsonField.of(sessionId))
|
||||
|
||||
/**
|
||||
* Sets [Builder.sessionId] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.sessionId] with a well-typed [String] value instead.
|
||||
* This method is primarily for setting the field to an undocumented or not yet supported
|
||||
* value.
|
||||
*/
|
||||
fun sessionId(sessionId: JsonField<String>) = apply { this.sessionId = sessionId }
|
||||
|
||||
fun sourceProposedExampleId(sourceProposedExampleId: String) =
|
||||
sourceProposedExampleId(JsonField.of(sourceProposedExampleId))
|
||||
|
||||
/**
|
||||
* Sets [Builder.sourceProposedExampleId] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.sourceProposedExampleId] with a well-typed [String]
|
||||
* value instead. This method is primarily for setting the field to an undocumented or not
|
||||
* yet supported value.
|
||||
*/
|
||||
fun sourceProposedExampleId(sourceProposedExampleId: JsonField<String>) = apply {
|
||||
this.sourceProposedExampleId = sourceProposedExampleId
|
||||
}
|
||||
|
||||
fun startTime(startTime: String) = startTime(JsonField.of(startTime))
|
||||
|
||||
/**
|
||||
* Sets [Builder.startTime] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.startTime] with a well-typed [String] value instead.
|
||||
* This method is primarily for setting the field to an undocumented or not yet supported
|
||||
* value.
|
||||
*/
|
||||
fun startTime(startTime: JsonField<String>) = apply { this.startTime = startTime }
|
||||
|
||||
fun threadId(threadId: String) = threadId(JsonField.of(threadId))
|
||||
|
||||
/**
|
||||
* Sets [Builder.threadId] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.threadId] with a well-typed [String] value instead. This
|
||||
* method is primarily for setting the field to an undocumented or not yet supported value.
|
||||
*/
|
||||
fun threadId(threadId: JsonField<String>) = apply { this.threadId = threadId }
|
||||
|
||||
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
|
||||
this.additionalProperties.clear()
|
||||
putAllAdditionalProperties(additionalProperties)
|
||||
}
|
||||
|
||||
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
|
||||
additionalProperties.put(key, value)
|
||||
}
|
||||
|
||||
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
|
||||
this.additionalProperties.putAll(additionalProperties)
|
||||
}
|
||||
|
||||
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
|
||||
|
||||
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
|
||||
keys.forEach(::removeAdditionalProperty)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an immutable instance of [ItemListResponse].
|
||||
*
|
||||
* Further updates to this [Builder] will not mutate the returned instance.
|
||||
*/
|
||||
fun build(): ItemListResponse =
|
||||
ItemListResponse(
|
||||
id,
|
||||
addedAt,
|
||||
(completedBy ?: JsonMissing.of()).map { it.toImmutable() },
|
||||
effectiveAddedAt,
|
||||
itemType,
|
||||
lastReviewedTime,
|
||||
queueId,
|
||||
(reservedBy ?: JsonMissing.of()).map { it.toImmutable() },
|
||||
runId,
|
||||
sessionId,
|
||||
sourceProposedExampleId,
|
||||
startTime,
|
||||
threadId,
|
||||
additionalProperties.toMutableMap(),
|
||||
)
|
||||
}
|
||||
|
||||
private var validated: Boolean = false
|
||||
|
||||
/**
|
||||
* Validates that the types of all values in this object match their expected types recursively.
|
||||
*
|
||||
* This method is _not_ forwards compatible with new types from the API for existing fields.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if any value type in this object doesn't match its
|
||||
* expected type.
|
||||
*/
|
||||
fun validate(): ItemListResponse = apply {
|
||||
if (validated) {
|
||||
return@apply
|
||||
}
|
||||
|
||||
id()
|
||||
addedAt()
|
||||
completedBy()
|
||||
effectiveAddedAt()
|
||||
itemType().ifPresent { it.validate() }
|
||||
lastReviewedTime()
|
||||
queueId()
|
||||
reservedBy()
|
||||
runId()
|
||||
sessionId()
|
||||
sourceProposedExampleId()
|
||||
startTime()
|
||||
threadId()
|
||||
validated = true
|
||||
}
|
||||
|
||||
fun isValid(): Boolean =
|
||||
try {
|
||||
validate()
|
||||
true
|
||||
} catch (e: LangChainInvalidDataException) {
|
||||
false
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a score indicating how many valid values are contained in this object recursively.
|
||||
*
|
||||
* Used for best match union deserialization.
|
||||
*/
|
||||
@JvmSynthetic
|
||||
internal fun validity(): Int =
|
||||
(if (id.asKnown().isPresent) 1 else 0) +
|
||||
(if (addedAt.asKnown().isPresent) 1 else 0) +
|
||||
(completedBy.asKnown().getOrNull()?.size ?: 0) +
|
||||
(if (effectiveAddedAt.asKnown().isPresent) 1 else 0) +
|
||||
(itemType.asKnown().getOrNull()?.validity() ?: 0) +
|
||||
(if (lastReviewedTime.asKnown().isPresent) 1 else 0) +
|
||||
(if (queueId.asKnown().isPresent) 1 else 0) +
|
||||
(reservedBy.asKnown().getOrNull()?.size ?: 0) +
|
||||
(if (runId.asKnown().isPresent) 1 else 0) +
|
||||
(if (sessionId.asKnown().isPresent) 1 else 0) +
|
||||
(if (sourceProposedExampleId.asKnown().isPresent) 1 else 0) +
|
||||
(if (startTime.asKnown().isPresent) 1 else 0) +
|
||||
(if (threadId.asKnown().isPresent) 1 else 0)
|
||||
|
||||
class ItemType @JsonCreator private constructor(private val value: JsonField<String>) : Enum {
|
||||
|
||||
/**
|
||||
* Returns this class instance's raw value.
|
||||
*
|
||||
* This is usually only useful if this instance was deserialized from data that doesn't
|
||||
* match any known member, and you want to know that value. For example, if the SDK is on an
|
||||
* older version than the API, then the API may respond with new members that the SDK is
|
||||
* unaware of.
|
||||
*/
|
||||
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value
|
||||
|
||||
companion object {
|
||||
|
||||
@JvmField val RUN = of("RUN")
|
||||
|
||||
@JvmField val THREAD = of("THREAD")
|
||||
|
||||
@JvmStatic fun of(value: String) = ItemType(JsonField.of(value))
|
||||
}
|
||||
|
||||
/** An enum containing [ItemType]'s known values. */
|
||||
enum class Known {
|
||||
RUN,
|
||||
THREAD,
|
||||
}
|
||||
|
||||
/**
|
||||
* An enum containing [ItemType]'s known values, as well as an [_UNKNOWN] member.
|
||||
*
|
||||
* An instance of [ItemType] can contain an unknown value in a couple of cases:
|
||||
* - It was deserialized from data that doesn't match any known member. For example, if the
|
||||
* SDK is on an older version than the API, then the API may respond with new members that
|
||||
* the SDK is unaware of.
|
||||
* - It was constructed with an arbitrary value using the [of] method.
|
||||
*/
|
||||
enum class Value {
|
||||
RUN,
|
||||
THREAD,
|
||||
/** An enum member indicating that [ItemType] was instantiated with an unknown value. */
|
||||
_UNKNOWN,
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
|
||||
* if the class was instantiated with an unknown value.
|
||||
*
|
||||
* Use the [known] method instead if you're certain the value is always known or if you want
|
||||
* to throw for the unknown case.
|
||||
*/
|
||||
fun value(): Value =
|
||||
when (this) {
|
||||
RUN -> Value.RUN
|
||||
THREAD -> Value.THREAD
|
||||
else -> Value._UNKNOWN
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an enum member corresponding to this class instance's value.
|
||||
*
|
||||
* Use the [value] method instead if you're uncertain the value is always known and don't
|
||||
* want to throw for the unknown case.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if this class instance's value is a not a known
|
||||
* member.
|
||||
*/
|
||||
fun known(): Known =
|
||||
when (this) {
|
||||
RUN -> Known.RUN
|
||||
THREAD -> Known.THREAD
|
||||
else -> throw LangChainInvalidDataException("Unknown ItemType: $value")
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns this class instance's primitive wire representation.
|
||||
*
|
||||
* This differs from the [toString] method because that method is primarily for debugging
|
||||
* and generally doesn't throw.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if this class instance's value does not have the
|
||||
* expected primitive type.
|
||||
*/
|
||||
fun asString(): String =
|
||||
_value().asString().orElseThrow {
|
||||
LangChainInvalidDataException("Value is not a String")
|
||||
}
|
||||
|
||||
private var validated: Boolean = false
|
||||
|
||||
/**
|
||||
* Validates that the types of all values in this object match their expected types
|
||||
* recursively.
|
||||
*
|
||||
* This method is _not_ forwards compatible with new types from the API for existing fields.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if any value type in this object doesn't match its
|
||||
* expected type.
|
||||
*/
|
||||
fun validate(): ItemType = apply {
|
||||
if (validated) {
|
||||
return@apply
|
||||
}
|
||||
|
||||
known()
|
||||
validated = true
|
||||
}
|
||||
|
||||
fun isValid(): Boolean =
|
||||
try {
|
||||
validate()
|
||||
true
|
||||
} catch (e: LangChainInvalidDataException) {
|
||||
false
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a score indicating how many valid values are contained in this object
|
||||
* recursively.
|
||||
*
|
||||
* Used for best match union deserialization.
|
||||
*/
|
||||
@JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
|
||||
return other is ItemType && value == other.value
|
||||
}
|
||||
|
||||
override fun hashCode() = value.hashCode()
|
||||
|
||||
override fun toString() = value.toString()
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
|
||||
return other is ItemListResponse &&
|
||||
id == other.id &&
|
||||
addedAt == other.addedAt &&
|
||||
completedBy == other.completedBy &&
|
||||
effectiveAddedAt == other.effectiveAddedAt &&
|
||||
itemType == other.itemType &&
|
||||
lastReviewedTime == other.lastReviewedTime &&
|
||||
queueId == other.queueId &&
|
||||
reservedBy == other.reservedBy &&
|
||||
runId == other.runId &&
|
||||
sessionId == other.sessionId &&
|
||||
sourceProposedExampleId == other.sourceProposedExampleId &&
|
||||
startTime == other.startTime &&
|
||||
threadId == other.threadId &&
|
||||
additionalProperties == other.additionalProperties
|
||||
}
|
||||
|
||||
private val hashCode: Int by lazy {
|
||||
Objects.hash(
|
||||
id,
|
||||
addedAt,
|
||||
completedBy,
|
||||
effectiveAddedAt,
|
||||
itemType,
|
||||
lastReviewedTime,
|
||||
queueId,
|
||||
reservedBy,
|
||||
runId,
|
||||
sessionId,
|
||||
sourceProposedExampleId,
|
||||
startTime,
|
||||
threadId,
|
||||
additionalProperties,
|
||||
)
|
||||
}
|
||||
|
||||
override fun hashCode(): Int = hashCode
|
||||
|
||||
override fun toString() =
|
||||
"ItemListResponse{id=$id, addedAt=$addedAt, completedBy=$completedBy, effectiveAddedAt=$effectiveAddedAt, itemType=$itemType, lastReviewedTime=$lastReviewedTime, queueId=$queueId, reservedBy=$reservedBy, runId=$runId, sessionId=$sessionId, sourceProposedExampleId=$sourceProposedExampleId, startTime=$startTime, threadId=$threadId, additionalProperties=$additionalProperties}"
|
||||
}
|
||||
+257
@@ -0,0 +1,257 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.models.annotationqueues.items
|
||||
|
||||
import com.langchain.smith.core.Params
|
||||
import com.langchain.smith.core.checkRequired
|
||||
import com.langchain.smith.core.http.Headers
|
||||
import com.langchain.smith.core.http.QueryParams
|
||||
import java.util.Objects
|
||||
import java.util.Optional
|
||||
import kotlin.jvm.optionals.getOrNull
|
||||
|
||||
/**
|
||||
* Returns the number of annotation queue items for the requested reviewer-specific or archived
|
||||
* bucket.
|
||||
*/
|
||||
class ItemRetrieveCountParams
|
||||
private constructor(
|
||||
private val queueId: String?,
|
||||
private val status: String,
|
||||
private val endTime: String?,
|
||||
private val startTime: String?,
|
||||
private val additionalHeaders: Headers,
|
||||
private val additionalQueryParams: QueryParams,
|
||||
) : Params {
|
||||
|
||||
fun queueId(): Optional<String> = Optional.ofNullable(queueId)
|
||||
|
||||
/** Count bucket: all, needs_my_review, needs_others_review, or archived. */
|
||||
fun status(): String = status
|
||||
|
||||
/** Exclusive upper bound for archived item timestamp */
|
||||
fun endTime(): Optional<String> = Optional.ofNullable(endTime)
|
||||
|
||||
/** Exclusive lower bound for archived item timestamp */
|
||||
fun startTime(): Optional<String> = Optional.ofNullable(startTime)
|
||||
|
||||
/** Additional headers to send with the request. */
|
||||
fun _additionalHeaders(): Headers = additionalHeaders
|
||||
|
||||
/** Additional query param to send with the request. */
|
||||
fun _additionalQueryParams(): QueryParams = additionalQueryParams
|
||||
|
||||
fun toBuilder() = Builder().from(this)
|
||||
|
||||
companion object {
|
||||
|
||||
/**
|
||||
* Returns a mutable builder for constructing an instance of [ItemRetrieveCountParams].
|
||||
*
|
||||
* The following fields are required:
|
||||
* ```java
|
||||
* .status()
|
||||
* ```
|
||||
*/
|
||||
@JvmStatic fun builder() = Builder()
|
||||
}
|
||||
|
||||
/** A builder for [ItemRetrieveCountParams]. */
|
||||
class Builder internal constructor() {
|
||||
|
||||
private var queueId: String? = null
|
||||
private var status: String? = null
|
||||
private var endTime: String? = null
|
||||
private var startTime: String? = null
|
||||
private var additionalHeaders: Headers.Builder = Headers.builder()
|
||||
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
|
||||
|
||||
@JvmSynthetic
|
||||
internal fun from(itemRetrieveCountParams: ItemRetrieveCountParams) = apply {
|
||||
queueId = itemRetrieveCountParams.queueId
|
||||
status = itemRetrieveCountParams.status
|
||||
endTime = itemRetrieveCountParams.endTime
|
||||
startTime = itemRetrieveCountParams.startTime
|
||||
additionalHeaders = itemRetrieveCountParams.additionalHeaders.toBuilder()
|
||||
additionalQueryParams = itemRetrieveCountParams.additionalQueryParams.toBuilder()
|
||||
}
|
||||
|
||||
fun queueId(queueId: String?) = apply { this.queueId = queueId }
|
||||
|
||||
/** Alias for calling [Builder.queueId] with `queueId.orElse(null)`. */
|
||||
fun queueId(queueId: Optional<String>) = queueId(queueId.getOrNull())
|
||||
|
||||
/** Count bucket: all, needs_my_review, needs_others_review, or archived. */
|
||||
fun status(status: String) = apply { this.status = status }
|
||||
|
||||
/** Exclusive upper bound for archived item timestamp */
|
||||
fun endTime(endTime: String?) = apply { this.endTime = endTime }
|
||||
|
||||
/** Alias for calling [Builder.endTime] with `endTime.orElse(null)`. */
|
||||
fun endTime(endTime: Optional<String>) = endTime(endTime.getOrNull())
|
||||
|
||||
/** Exclusive lower bound for archived item timestamp */
|
||||
fun startTime(startTime: String?) = apply { this.startTime = startTime }
|
||||
|
||||
/** Alias for calling [Builder.startTime] with `startTime.orElse(null)`. */
|
||||
fun startTime(startTime: Optional<String>) = startTime(startTime.getOrNull())
|
||||
|
||||
fun additionalHeaders(additionalHeaders: Headers) = apply {
|
||||
this.additionalHeaders.clear()
|
||||
putAllAdditionalHeaders(additionalHeaders)
|
||||
}
|
||||
|
||||
fun additionalHeaders(additionalHeaders: Map<String, Iterable<String>>) = apply {
|
||||
this.additionalHeaders.clear()
|
||||
putAllAdditionalHeaders(additionalHeaders)
|
||||
}
|
||||
|
||||
fun putAdditionalHeader(name: String, value: String) = apply {
|
||||
additionalHeaders.put(name, value)
|
||||
}
|
||||
|
||||
fun putAdditionalHeaders(name: String, values: Iterable<String>) = apply {
|
||||
additionalHeaders.put(name, values)
|
||||
}
|
||||
|
||||
fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply {
|
||||
this.additionalHeaders.putAll(additionalHeaders)
|
||||
}
|
||||
|
||||
fun putAllAdditionalHeaders(additionalHeaders: Map<String, Iterable<String>>) = apply {
|
||||
this.additionalHeaders.putAll(additionalHeaders)
|
||||
}
|
||||
|
||||
fun replaceAdditionalHeaders(name: String, value: String) = apply {
|
||||
additionalHeaders.replace(name, value)
|
||||
}
|
||||
|
||||
fun replaceAdditionalHeaders(name: String, values: Iterable<String>) = apply {
|
||||
additionalHeaders.replace(name, values)
|
||||
}
|
||||
|
||||
fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply {
|
||||
this.additionalHeaders.replaceAll(additionalHeaders)
|
||||
}
|
||||
|
||||
fun replaceAllAdditionalHeaders(additionalHeaders: Map<String, Iterable<String>>) = apply {
|
||||
this.additionalHeaders.replaceAll(additionalHeaders)
|
||||
}
|
||||
|
||||
fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) }
|
||||
|
||||
fun removeAllAdditionalHeaders(names: Set<String>) = apply {
|
||||
additionalHeaders.removeAll(names)
|
||||
}
|
||||
|
||||
fun additionalQueryParams(additionalQueryParams: QueryParams) = apply {
|
||||
this.additionalQueryParams.clear()
|
||||
putAllAdditionalQueryParams(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun additionalQueryParams(additionalQueryParams: Map<String, Iterable<String>>) = apply {
|
||||
this.additionalQueryParams.clear()
|
||||
putAllAdditionalQueryParams(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun putAdditionalQueryParam(key: String, value: String) = apply {
|
||||
additionalQueryParams.put(key, value)
|
||||
}
|
||||
|
||||
fun putAdditionalQueryParams(key: String, values: Iterable<String>) = apply {
|
||||
additionalQueryParams.put(key, values)
|
||||
}
|
||||
|
||||
fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
|
||||
this.additionalQueryParams.putAll(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun putAllAdditionalQueryParams(additionalQueryParams: Map<String, Iterable<String>>) =
|
||||
apply {
|
||||
this.additionalQueryParams.putAll(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun replaceAdditionalQueryParams(key: String, value: String) = apply {
|
||||
additionalQueryParams.replace(key, value)
|
||||
}
|
||||
|
||||
fun replaceAdditionalQueryParams(key: String, values: Iterable<String>) = apply {
|
||||
additionalQueryParams.replace(key, values)
|
||||
}
|
||||
|
||||
fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
|
||||
this.additionalQueryParams.replaceAll(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun replaceAllAdditionalQueryParams(additionalQueryParams: Map<String, Iterable<String>>) =
|
||||
apply {
|
||||
this.additionalQueryParams.replaceAll(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) }
|
||||
|
||||
fun removeAllAdditionalQueryParams(keys: Set<String>) = apply {
|
||||
additionalQueryParams.removeAll(keys)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an immutable instance of [ItemRetrieveCountParams].
|
||||
*
|
||||
* Further updates to this [Builder] will not mutate the returned instance.
|
||||
*
|
||||
* The following fields are required:
|
||||
* ```java
|
||||
* .status()
|
||||
* ```
|
||||
*
|
||||
* @throws IllegalStateException if any required field is unset.
|
||||
*/
|
||||
fun build(): ItemRetrieveCountParams =
|
||||
ItemRetrieveCountParams(
|
||||
queueId,
|
||||
checkRequired("status", status),
|
||||
endTime,
|
||||
startTime,
|
||||
additionalHeaders.build(),
|
||||
additionalQueryParams.build(),
|
||||
)
|
||||
}
|
||||
|
||||
fun _pathParam(index: Int): String =
|
||||
when (index) {
|
||||
0 -> queueId ?: ""
|
||||
else -> ""
|
||||
}
|
||||
|
||||
override fun _headers(): Headers = additionalHeaders
|
||||
|
||||
override fun _queryParams(): QueryParams =
|
||||
QueryParams.builder()
|
||||
.apply {
|
||||
put("status", status)
|
||||
endTime?.let { put("end_time", it) }
|
||||
startTime?.let { put("start_time", it) }
|
||||
putAll(additionalQueryParams)
|
||||
}
|
||||
.build()
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
|
||||
return other is ItemRetrieveCountParams &&
|
||||
queueId == other.queueId &&
|
||||
status == other.status &&
|
||||
endTime == other.endTime &&
|
||||
startTime == other.startTime &&
|
||||
additionalHeaders == other.additionalHeaders &&
|
||||
additionalQueryParams == other.additionalQueryParams
|
||||
}
|
||||
|
||||
override fun hashCode(): Int =
|
||||
Objects.hash(queueId, status, endTime, startTime, additionalHeaders, additionalQueryParams)
|
||||
|
||||
override fun toString() =
|
||||
"ItemRetrieveCountParams{queueId=$queueId, status=$status, endTime=$endTime, startTime=$startTime, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
|
||||
}
|
||||
+163
@@ -0,0 +1,163 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.models.annotationqueues.items
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnyGetter
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter
|
||||
import com.fasterxml.jackson.annotation.JsonCreator
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.langchain.smith.core.ExcludeMissing
|
||||
import com.langchain.smith.core.JsonField
|
||||
import com.langchain.smith.core.JsonMissing
|
||||
import com.langchain.smith.core.JsonValue
|
||||
import com.langchain.smith.errors.LangChainInvalidDataException
|
||||
import java.util.Collections
|
||||
import java.util.Objects
|
||||
import java.util.Optional
|
||||
|
||||
class ItemRetrieveCountResponse
|
||||
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
|
||||
private constructor(
|
||||
private val count: JsonField<Long>,
|
||||
private val additionalProperties: MutableMap<String, JsonValue>,
|
||||
) {
|
||||
|
||||
@JsonCreator
|
||||
private constructor(
|
||||
@JsonProperty("count") @ExcludeMissing count: JsonField<Long> = JsonMissing.of()
|
||||
) : this(count, mutableMapOf())
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun count(): Optional<Long> = count.getOptional("count")
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [count].
|
||||
*
|
||||
* Unlike [count], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("count") @ExcludeMissing fun _count(): JsonField<Long> = count
|
||||
|
||||
@JsonAnySetter
|
||||
private fun putAdditionalProperty(key: String, value: JsonValue) {
|
||||
additionalProperties.put(key, value)
|
||||
}
|
||||
|
||||
@JsonAnyGetter
|
||||
@ExcludeMissing
|
||||
fun _additionalProperties(): Map<String, JsonValue> =
|
||||
Collections.unmodifiableMap(additionalProperties)
|
||||
|
||||
fun toBuilder() = Builder().from(this)
|
||||
|
||||
companion object {
|
||||
|
||||
/**
|
||||
* Returns a mutable builder for constructing an instance of [ItemRetrieveCountResponse].
|
||||
*/
|
||||
@JvmStatic fun builder() = Builder()
|
||||
}
|
||||
|
||||
/** A builder for [ItemRetrieveCountResponse]. */
|
||||
class Builder internal constructor() {
|
||||
|
||||
private var count: JsonField<Long> = JsonMissing.of()
|
||||
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
|
||||
|
||||
@JvmSynthetic
|
||||
internal fun from(itemRetrieveCountResponse: ItemRetrieveCountResponse) = apply {
|
||||
count = itemRetrieveCountResponse.count
|
||||
additionalProperties = itemRetrieveCountResponse.additionalProperties.toMutableMap()
|
||||
}
|
||||
|
||||
fun count(count: Long) = count(JsonField.of(count))
|
||||
|
||||
/**
|
||||
* Sets [Builder.count] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.count] with a well-typed [Long] value instead. This
|
||||
* method is primarily for setting the field to an undocumented or not yet supported value.
|
||||
*/
|
||||
fun count(count: JsonField<Long>) = apply { this.count = count }
|
||||
|
||||
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
|
||||
this.additionalProperties.clear()
|
||||
putAllAdditionalProperties(additionalProperties)
|
||||
}
|
||||
|
||||
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
|
||||
additionalProperties.put(key, value)
|
||||
}
|
||||
|
||||
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
|
||||
this.additionalProperties.putAll(additionalProperties)
|
||||
}
|
||||
|
||||
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
|
||||
|
||||
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
|
||||
keys.forEach(::removeAdditionalProperty)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an immutable instance of [ItemRetrieveCountResponse].
|
||||
*
|
||||
* Further updates to this [Builder] will not mutate the returned instance.
|
||||
*/
|
||||
fun build(): ItemRetrieveCountResponse =
|
||||
ItemRetrieveCountResponse(count, additionalProperties.toMutableMap())
|
||||
}
|
||||
|
||||
private var validated: Boolean = false
|
||||
|
||||
/**
|
||||
* Validates that the types of all values in this object match their expected types recursively.
|
||||
*
|
||||
* This method is _not_ forwards compatible with new types from the API for existing fields.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if any value type in this object doesn't match its
|
||||
* expected type.
|
||||
*/
|
||||
fun validate(): ItemRetrieveCountResponse = apply {
|
||||
if (validated) {
|
||||
return@apply
|
||||
}
|
||||
|
||||
count()
|
||||
validated = true
|
||||
}
|
||||
|
||||
fun isValid(): Boolean =
|
||||
try {
|
||||
validate()
|
||||
true
|
||||
} catch (e: LangChainInvalidDataException) {
|
||||
false
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a score indicating how many valid values are contained in this object recursively.
|
||||
*
|
||||
* Used for best match union deserialization.
|
||||
*/
|
||||
@JvmSynthetic internal fun validity(): Int = (if (count.asKnown().isPresent) 1 else 0)
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
|
||||
return other is ItemRetrieveCountResponse &&
|
||||
count == other.count &&
|
||||
additionalProperties == other.additionalProperties
|
||||
}
|
||||
|
||||
private val hashCode: Int by lazy { Objects.hash(count, additionalProperties) }
|
||||
|
||||
override fun hashCode(): Int = hashCode
|
||||
|
||||
override fun toString() =
|
||||
"ItemRetrieveCountResponse{count=$count, additionalProperties=$additionalProperties}"
|
||||
}
|
||||
+220
@@ -0,0 +1,220 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.models.annotationqueues.items
|
||||
|
||||
import com.langchain.smith.core.Params
|
||||
import com.langchain.smith.core.checkRequired
|
||||
import com.langchain.smith.core.http.Headers
|
||||
import com.langchain.smith.core.http.QueryParams
|
||||
import java.util.Objects
|
||||
import java.util.Optional
|
||||
import kotlin.jvm.optionals.getOrNull
|
||||
|
||||
/**
|
||||
* Resolve a RUN or THREAD item to its current review section and zero-based position for deep
|
||||
* linking.
|
||||
*/
|
||||
class ItemRetrievePlacementParams
|
||||
private constructor(
|
||||
private val queueId: String,
|
||||
private val itemId: String?,
|
||||
private val additionalHeaders: Headers,
|
||||
private val additionalQueryParams: QueryParams,
|
||||
) : Params {
|
||||
|
||||
fun queueId(): String = queueId
|
||||
|
||||
fun itemId(): Optional<String> = Optional.ofNullable(itemId)
|
||||
|
||||
/** Additional headers to send with the request. */
|
||||
fun _additionalHeaders(): Headers = additionalHeaders
|
||||
|
||||
/** Additional query param to send with the request. */
|
||||
fun _additionalQueryParams(): QueryParams = additionalQueryParams
|
||||
|
||||
fun toBuilder() = Builder().from(this)
|
||||
|
||||
companion object {
|
||||
|
||||
/**
|
||||
* Returns a mutable builder for constructing an instance of [ItemRetrievePlacementParams].
|
||||
*
|
||||
* The following fields are required:
|
||||
* ```java
|
||||
* .queueId()
|
||||
* ```
|
||||
*/
|
||||
@JvmStatic fun builder() = Builder()
|
||||
}
|
||||
|
||||
/** A builder for [ItemRetrievePlacementParams]. */
|
||||
class Builder internal constructor() {
|
||||
|
||||
private var queueId: String? = null
|
||||
private var itemId: String? = null
|
||||
private var additionalHeaders: Headers.Builder = Headers.builder()
|
||||
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
|
||||
|
||||
@JvmSynthetic
|
||||
internal fun from(itemRetrievePlacementParams: ItemRetrievePlacementParams) = apply {
|
||||
queueId = itemRetrievePlacementParams.queueId
|
||||
itemId = itemRetrievePlacementParams.itemId
|
||||
additionalHeaders = itemRetrievePlacementParams.additionalHeaders.toBuilder()
|
||||
additionalQueryParams = itemRetrievePlacementParams.additionalQueryParams.toBuilder()
|
||||
}
|
||||
|
||||
fun queueId(queueId: String) = apply { this.queueId = queueId }
|
||||
|
||||
fun itemId(itemId: String?) = apply { this.itemId = itemId }
|
||||
|
||||
/** Alias for calling [Builder.itemId] with `itemId.orElse(null)`. */
|
||||
fun itemId(itemId: Optional<String>) = itemId(itemId.getOrNull())
|
||||
|
||||
fun additionalHeaders(additionalHeaders: Headers) = apply {
|
||||
this.additionalHeaders.clear()
|
||||
putAllAdditionalHeaders(additionalHeaders)
|
||||
}
|
||||
|
||||
fun additionalHeaders(additionalHeaders: Map<String, Iterable<String>>) = apply {
|
||||
this.additionalHeaders.clear()
|
||||
putAllAdditionalHeaders(additionalHeaders)
|
||||
}
|
||||
|
||||
fun putAdditionalHeader(name: String, value: String) = apply {
|
||||
additionalHeaders.put(name, value)
|
||||
}
|
||||
|
||||
fun putAdditionalHeaders(name: String, values: Iterable<String>) = apply {
|
||||
additionalHeaders.put(name, values)
|
||||
}
|
||||
|
||||
fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply {
|
||||
this.additionalHeaders.putAll(additionalHeaders)
|
||||
}
|
||||
|
||||
fun putAllAdditionalHeaders(additionalHeaders: Map<String, Iterable<String>>) = apply {
|
||||
this.additionalHeaders.putAll(additionalHeaders)
|
||||
}
|
||||
|
||||
fun replaceAdditionalHeaders(name: String, value: String) = apply {
|
||||
additionalHeaders.replace(name, value)
|
||||
}
|
||||
|
||||
fun replaceAdditionalHeaders(name: String, values: Iterable<String>) = apply {
|
||||
additionalHeaders.replace(name, values)
|
||||
}
|
||||
|
||||
fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply {
|
||||
this.additionalHeaders.replaceAll(additionalHeaders)
|
||||
}
|
||||
|
||||
fun replaceAllAdditionalHeaders(additionalHeaders: Map<String, Iterable<String>>) = apply {
|
||||
this.additionalHeaders.replaceAll(additionalHeaders)
|
||||
}
|
||||
|
||||
fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) }
|
||||
|
||||
fun removeAllAdditionalHeaders(names: Set<String>) = apply {
|
||||
additionalHeaders.removeAll(names)
|
||||
}
|
||||
|
||||
fun additionalQueryParams(additionalQueryParams: QueryParams) = apply {
|
||||
this.additionalQueryParams.clear()
|
||||
putAllAdditionalQueryParams(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun additionalQueryParams(additionalQueryParams: Map<String, Iterable<String>>) = apply {
|
||||
this.additionalQueryParams.clear()
|
||||
putAllAdditionalQueryParams(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun putAdditionalQueryParam(key: String, value: String) = apply {
|
||||
additionalQueryParams.put(key, value)
|
||||
}
|
||||
|
||||
fun putAdditionalQueryParams(key: String, values: Iterable<String>) = apply {
|
||||
additionalQueryParams.put(key, values)
|
||||
}
|
||||
|
||||
fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
|
||||
this.additionalQueryParams.putAll(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun putAllAdditionalQueryParams(additionalQueryParams: Map<String, Iterable<String>>) =
|
||||
apply {
|
||||
this.additionalQueryParams.putAll(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun replaceAdditionalQueryParams(key: String, value: String) = apply {
|
||||
additionalQueryParams.replace(key, value)
|
||||
}
|
||||
|
||||
fun replaceAdditionalQueryParams(key: String, values: Iterable<String>) = apply {
|
||||
additionalQueryParams.replace(key, values)
|
||||
}
|
||||
|
||||
fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
|
||||
this.additionalQueryParams.replaceAll(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun replaceAllAdditionalQueryParams(additionalQueryParams: Map<String, Iterable<String>>) =
|
||||
apply {
|
||||
this.additionalQueryParams.replaceAll(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) }
|
||||
|
||||
fun removeAllAdditionalQueryParams(keys: Set<String>) = apply {
|
||||
additionalQueryParams.removeAll(keys)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an immutable instance of [ItemRetrievePlacementParams].
|
||||
*
|
||||
* Further updates to this [Builder] will not mutate the returned instance.
|
||||
*
|
||||
* The following fields are required:
|
||||
* ```java
|
||||
* .queueId()
|
||||
* ```
|
||||
*
|
||||
* @throws IllegalStateException if any required field is unset.
|
||||
*/
|
||||
fun build(): ItemRetrievePlacementParams =
|
||||
ItemRetrievePlacementParams(
|
||||
checkRequired("queueId", queueId),
|
||||
itemId,
|
||||
additionalHeaders.build(),
|
||||
additionalQueryParams.build(),
|
||||
)
|
||||
}
|
||||
|
||||
fun _pathParam(index: Int): String =
|
||||
when (index) {
|
||||
0 -> queueId
|
||||
1 -> itemId ?: ""
|
||||
else -> ""
|
||||
}
|
||||
|
||||
override fun _headers(): Headers = additionalHeaders
|
||||
|
||||
override fun _queryParams(): QueryParams = additionalQueryParams
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
|
||||
return other is ItemRetrievePlacementParams &&
|
||||
queueId == other.queueId &&
|
||||
itemId == other.itemId &&
|
||||
additionalHeaders == other.additionalHeaders &&
|
||||
additionalQueryParams == other.additionalQueryParams
|
||||
}
|
||||
|
||||
override fun hashCode(): Int =
|
||||
Objects.hash(queueId, itemId, additionalHeaders, additionalQueryParams)
|
||||
|
||||
override fun toString() =
|
||||
"ItemRetrievePlacementParams{queueId=$queueId, itemId=$itemId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
|
||||
}
|
||||
+545
@@ -0,0 +1,545 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.models.annotationqueues.items
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnyGetter
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter
|
||||
import com.fasterxml.jackson.annotation.JsonCreator
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.langchain.smith.core.Enum
|
||||
import com.langchain.smith.core.ExcludeMissing
|
||||
import com.langchain.smith.core.JsonField
|
||||
import com.langchain.smith.core.JsonMissing
|
||||
import com.langchain.smith.core.JsonValue
|
||||
import com.langchain.smith.errors.LangChainInvalidDataException
|
||||
import java.util.Collections
|
||||
import java.util.Objects
|
||||
import java.util.Optional
|
||||
import kotlin.jvm.optionals.getOrNull
|
||||
|
||||
class ItemRetrievePlacementResponse
|
||||
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
|
||||
private constructor(
|
||||
private val cursor: JsonField<String>,
|
||||
private val itemType: JsonField<ItemType>,
|
||||
private val position: JsonField<Long>,
|
||||
private val section: JsonField<Section>,
|
||||
private val additionalProperties: MutableMap<String, JsonValue>,
|
||||
) {
|
||||
|
||||
@JsonCreator
|
||||
private constructor(
|
||||
@JsonProperty("cursor") @ExcludeMissing cursor: JsonField<String> = JsonMissing.of(),
|
||||
@JsonProperty("item_type") @ExcludeMissing itemType: JsonField<ItemType> = JsonMissing.of(),
|
||||
@JsonProperty("position") @ExcludeMissing position: JsonField<Long> = JsonMissing.of(),
|
||||
@JsonProperty("section") @ExcludeMissing section: JsonField<Section> = JsonMissing.of(),
|
||||
) : this(cursor, itemType, position, section, mutableMapOf())
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun cursor(): Optional<String> = cursor.getOptional("cursor")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun itemType(): Optional<ItemType> = itemType.getOptional("item_type")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun position(): Optional<Long> = position.getOptional("position")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun section(): Optional<Section> = section.getOptional("section")
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [cursor].
|
||||
*
|
||||
* Unlike [cursor], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("cursor") @ExcludeMissing fun _cursor(): JsonField<String> = cursor
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [itemType].
|
||||
*
|
||||
* Unlike [itemType], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("item_type") @ExcludeMissing fun _itemType(): JsonField<ItemType> = itemType
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [position].
|
||||
*
|
||||
* Unlike [position], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("position") @ExcludeMissing fun _position(): JsonField<Long> = position
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [section].
|
||||
*
|
||||
* Unlike [section], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("section") @ExcludeMissing fun _section(): JsonField<Section> = section
|
||||
|
||||
@JsonAnySetter
|
||||
private fun putAdditionalProperty(key: String, value: JsonValue) {
|
||||
additionalProperties.put(key, value)
|
||||
}
|
||||
|
||||
@JsonAnyGetter
|
||||
@ExcludeMissing
|
||||
fun _additionalProperties(): Map<String, JsonValue> =
|
||||
Collections.unmodifiableMap(additionalProperties)
|
||||
|
||||
fun toBuilder() = Builder().from(this)
|
||||
|
||||
companion object {
|
||||
|
||||
/**
|
||||
* Returns a mutable builder for constructing an instance of
|
||||
* [ItemRetrievePlacementResponse].
|
||||
*/
|
||||
@JvmStatic fun builder() = Builder()
|
||||
}
|
||||
|
||||
/** A builder for [ItemRetrievePlacementResponse]. */
|
||||
class Builder internal constructor() {
|
||||
|
||||
private var cursor: JsonField<String> = JsonMissing.of()
|
||||
private var itemType: JsonField<ItemType> = JsonMissing.of()
|
||||
private var position: JsonField<Long> = JsonMissing.of()
|
||||
private var section: JsonField<Section> = JsonMissing.of()
|
||||
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
|
||||
|
||||
@JvmSynthetic
|
||||
internal fun from(itemRetrievePlacementResponse: ItemRetrievePlacementResponse) = apply {
|
||||
cursor = itemRetrievePlacementResponse.cursor
|
||||
itemType = itemRetrievePlacementResponse.itemType
|
||||
position = itemRetrievePlacementResponse.position
|
||||
section = itemRetrievePlacementResponse.section
|
||||
additionalProperties = itemRetrievePlacementResponse.additionalProperties.toMutableMap()
|
||||
}
|
||||
|
||||
fun cursor(cursor: String) = cursor(JsonField.of(cursor))
|
||||
|
||||
/**
|
||||
* Sets [Builder.cursor] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.cursor] with a well-typed [String] value instead. This
|
||||
* method is primarily for setting the field to an undocumented or not yet supported value.
|
||||
*/
|
||||
fun cursor(cursor: JsonField<String>) = apply { this.cursor = cursor }
|
||||
|
||||
fun itemType(itemType: ItemType) = itemType(JsonField.of(itemType))
|
||||
|
||||
/**
|
||||
* Sets [Builder.itemType] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.itemType] with a well-typed [ItemType] value instead.
|
||||
* This method is primarily for setting the field to an undocumented or not yet supported
|
||||
* value.
|
||||
*/
|
||||
fun itemType(itemType: JsonField<ItemType>) = apply { this.itemType = itemType }
|
||||
|
||||
fun position(position: Long) = position(JsonField.of(position))
|
||||
|
||||
/**
|
||||
* Sets [Builder.position] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.position] with a well-typed [Long] value instead. This
|
||||
* method is primarily for setting the field to an undocumented or not yet supported value.
|
||||
*/
|
||||
fun position(position: JsonField<Long>) = apply { this.position = position }
|
||||
|
||||
fun section(section: Section) = section(JsonField.of(section))
|
||||
|
||||
/**
|
||||
* Sets [Builder.section] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.section] with a well-typed [Section] value instead. This
|
||||
* method is primarily for setting the field to an undocumented or not yet supported value.
|
||||
*/
|
||||
fun section(section: JsonField<Section>) = apply { this.section = section }
|
||||
|
||||
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
|
||||
this.additionalProperties.clear()
|
||||
putAllAdditionalProperties(additionalProperties)
|
||||
}
|
||||
|
||||
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
|
||||
additionalProperties.put(key, value)
|
||||
}
|
||||
|
||||
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
|
||||
this.additionalProperties.putAll(additionalProperties)
|
||||
}
|
||||
|
||||
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
|
||||
|
||||
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
|
||||
keys.forEach(::removeAdditionalProperty)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an immutable instance of [ItemRetrievePlacementResponse].
|
||||
*
|
||||
* Further updates to this [Builder] will not mutate the returned instance.
|
||||
*/
|
||||
fun build(): ItemRetrievePlacementResponse =
|
||||
ItemRetrievePlacementResponse(
|
||||
cursor,
|
||||
itemType,
|
||||
position,
|
||||
section,
|
||||
additionalProperties.toMutableMap(),
|
||||
)
|
||||
}
|
||||
|
||||
private var validated: Boolean = false
|
||||
|
||||
/**
|
||||
* Validates that the types of all values in this object match their expected types recursively.
|
||||
*
|
||||
* This method is _not_ forwards compatible with new types from the API for existing fields.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if any value type in this object doesn't match its
|
||||
* expected type.
|
||||
*/
|
||||
fun validate(): ItemRetrievePlacementResponse = apply {
|
||||
if (validated) {
|
||||
return@apply
|
||||
}
|
||||
|
||||
cursor()
|
||||
itemType().ifPresent { it.validate() }
|
||||
position()
|
||||
section().ifPresent { it.validate() }
|
||||
validated = true
|
||||
}
|
||||
|
||||
fun isValid(): Boolean =
|
||||
try {
|
||||
validate()
|
||||
true
|
||||
} catch (e: LangChainInvalidDataException) {
|
||||
false
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a score indicating how many valid values are contained in this object recursively.
|
||||
*
|
||||
* Used for best match union deserialization.
|
||||
*/
|
||||
@JvmSynthetic
|
||||
internal fun validity(): Int =
|
||||
(if (cursor.asKnown().isPresent) 1 else 0) +
|
||||
(itemType.asKnown().getOrNull()?.validity() ?: 0) +
|
||||
(if (position.asKnown().isPresent) 1 else 0) +
|
||||
(section.asKnown().getOrNull()?.validity() ?: 0)
|
||||
|
||||
class ItemType @JsonCreator private constructor(private val value: JsonField<String>) : Enum {
|
||||
|
||||
/**
|
||||
* Returns this class instance's raw value.
|
||||
*
|
||||
* This is usually only useful if this instance was deserialized from data that doesn't
|
||||
* match any known member, and you want to know that value. For example, if the SDK is on an
|
||||
* older version than the API, then the API may respond with new members that the SDK is
|
||||
* unaware of.
|
||||
*/
|
||||
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value
|
||||
|
||||
companion object {
|
||||
|
||||
@JvmField val RUN = of("RUN")
|
||||
|
||||
@JvmField val THREAD = of("THREAD")
|
||||
|
||||
@JvmStatic fun of(value: String) = ItemType(JsonField.of(value))
|
||||
}
|
||||
|
||||
/** An enum containing [ItemType]'s known values. */
|
||||
enum class Known {
|
||||
RUN,
|
||||
THREAD,
|
||||
}
|
||||
|
||||
/**
|
||||
* An enum containing [ItemType]'s known values, as well as an [_UNKNOWN] member.
|
||||
*
|
||||
* An instance of [ItemType] can contain an unknown value in a couple of cases:
|
||||
* - It was deserialized from data that doesn't match any known member. For example, if the
|
||||
* SDK is on an older version than the API, then the API may respond with new members that
|
||||
* the SDK is unaware of.
|
||||
* - It was constructed with an arbitrary value using the [of] method.
|
||||
*/
|
||||
enum class Value {
|
||||
RUN,
|
||||
THREAD,
|
||||
/** An enum member indicating that [ItemType] was instantiated with an unknown value. */
|
||||
_UNKNOWN,
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
|
||||
* if the class was instantiated with an unknown value.
|
||||
*
|
||||
* Use the [known] method instead if you're certain the value is always known or if you want
|
||||
* to throw for the unknown case.
|
||||
*/
|
||||
fun value(): Value =
|
||||
when (this) {
|
||||
RUN -> Value.RUN
|
||||
THREAD -> Value.THREAD
|
||||
else -> Value._UNKNOWN
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an enum member corresponding to this class instance's value.
|
||||
*
|
||||
* Use the [value] method instead if you're uncertain the value is always known and don't
|
||||
* want to throw for the unknown case.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if this class instance's value is a not a known
|
||||
* member.
|
||||
*/
|
||||
fun known(): Known =
|
||||
when (this) {
|
||||
RUN -> Known.RUN
|
||||
THREAD -> Known.THREAD
|
||||
else -> throw LangChainInvalidDataException("Unknown ItemType: $value")
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns this class instance's primitive wire representation.
|
||||
*
|
||||
* This differs from the [toString] method because that method is primarily for debugging
|
||||
* and generally doesn't throw.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if this class instance's value does not have the
|
||||
* expected primitive type.
|
||||
*/
|
||||
fun asString(): String =
|
||||
_value().asString().orElseThrow {
|
||||
LangChainInvalidDataException("Value is not a String")
|
||||
}
|
||||
|
||||
private var validated: Boolean = false
|
||||
|
||||
/**
|
||||
* Validates that the types of all values in this object match their expected types
|
||||
* recursively.
|
||||
*
|
||||
* This method is _not_ forwards compatible with new types from the API for existing fields.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if any value type in this object doesn't match its
|
||||
* expected type.
|
||||
*/
|
||||
fun validate(): ItemType = apply {
|
||||
if (validated) {
|
||||
return@apply
|
||||
}
|
||||
|
||||
known()
|
||||
validated = true
|
||||
}
|
||||
|
||||
fun isValid(): Boolean =
|
||||
try {
|
||||
validate()
|
||||
true
|
||||
} catch (e: LangChainInvalidDataException) {
|
||||
false
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a score indicating how many valid values are contained in this object
|
||||
* recursively.
|
||||
*
|
||||
* Used for best match union deserialization.
|
||||
*/
|
||||
@JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
|
||||
return other is ItemType && value == other.value
|
||||
}
|
||||
|
||||
override fun hashCode() = value.hashCode()
|
||||
|
||||
override fun toString() = value.toString()
|
||||
}
|
||||
|
||||
class Section @JsonCreator private constructor(private val value: JsonField<String>) : Enum {
|
||||
|
||||
/**
|
||||
* Returns this class instance's raw value.
|
||||
*
|
||||
* This is usually only useful if this instance was deserialized from data that doesn't
|
||||
* match any known member, and you want to know that value. For example, if the SDK is on an
|
||||
* older version than the API, then the API may respond with new members that the SDK is
|
||||
* unaware of.
|
||||
*/
|
||||
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value
|
||||
|
||||
companion object {
|
||||
|
||||
@JvmField val NEEDS_MY_REVIEW = of("needs_my_review")
|
||||
|
||||
@JvmField val NEEDS_OTHERS_REVIEW = of("needs_others_review")
|
||||
|
||||
@JvmField val ARCHIVED = of("archived")
|
||||
|
||||
@JvmStatic fun of(value: String) = Section(JsonField.of(value))
|
||||
}
|
||||
|
||||
/** An enum containing [Section]'s known values. */
|
||||
enum class Known {
|
||||
NEEDS_MY_REVIEW,
|
||||
NEEDS_OTHERS_REVIEW,
|
||||
ARCHIVED,
|
||||
}
|
||||
|
||||
/**
|
||||
* An enum containing [Section]'s known values, as well as an [_UNKNOWN] member.
|
||||
*
|
||||
* An instance of [Section] can contain an unknown value in a couple of cases:
|
||||
* - It was deserialized from data that doesn't match any known member. For example, if the
|
||||
* SDK is on an older version than the API, then the API may respond with new members that
|
||||
* the SDK is unaware of.
|
||||
* - It was constructed with an arbitrary value using the [of] method.
|
||||
*/
|
||||
enum class Value {
|
||||
NEEDS_MY_REVIEW,
|
||||
NEEDS_OTHERS_REVIEW,
|
||||
ARCHIVED,
|
||||
/** An enum member indicating that [Section] was instantiated with an unknown value. */
|
||||
_UNKNOWN,
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
|
||||
* if the class was instantiated with an unknown value.
|
||||
*
|
||||
* Use the [known] method instead if you're certain the value is always known or if you want
|
||||
* to throw for the unknown case.
|
||||
*/
|
||||
fun value(): Value =
|
||||
when (this) {
|
||||
NEEDS_MY_REVIEW -> Value.NEEDS_MY_REVIEW
|
||||
NEEDS_OTHERS_REVIEW -> Value.NEEDS_OTHERS_REVIEW
|
||||
ARCHIVED -> Value.ARCHIVED
|
||||
else -> Value._UNKNOWN
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an enum member corresponding to this class instance's value.
|
||||
*
|
||||
* Use the [value] method instead if you're uncertain the value is always known and don't
|
||||
* want to throw for the unknown case.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if this class instance's value is a not a known
|
||||
* member.
|
||||
*/
|
||||
fun known(): Known =
|
||||
when (this) {
|
||||
NEEDS_MY_REVIEW -> Known.NEEDS_MY_REVIEW
|
||||
NEEDS_OTHERS_REVIEW -> Known.NEEDS_OTHERS_REVIEW
|
||||
ARCHIVED -> Known.ARCHIVED
|
||||
else -> throw LangChainInvalidDataException("Unknown Section: $value")
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns this class instance's primitive wire representation.
|
||||
*
|
||||
* This differs from the [toString] method because that method is primarily for debugging
|
||||
* and generally doesn't throw.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if this class instance's value does not have the
|
||||
* expected primitive type.
|
||||
*/
|
||||
fun asString(): String =
|
||||
_value().asString().orElseThrow {
|
||||
LangChainInvalidDataException("Value is not a String")
|
||||
}
|
||||
|
||||
private var validated: Boolean = false
|
||||
|
||||
/**
|
||||
* Validates that the types of all values in this object match their expected types
|
||||
* recursively.
|
||||
*
|
||||
* This method is _not_ forwards compatible with new types from the API for existing fields.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if any value type in this object doesn't match its
|
||||
* expected type.
|
||||
*/
|
||||
fun validate(): Section = apply {
|
||||
if (validated) {
|
||||
return@apply
|
||||
}
|
||||
|
||||
known()
|
||||
validated = true
|
||||
}
|
||||
|
||||
fun isValid(): Boolean =
|
||||
try {
|
||||
validate()
|
||||
true
|
||||
} catch (e: LangChainInvalidDataException) {
|
||||
false
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a score indicating how many valid values are contained in this object
|
||||
* recursively.
|
||||
*
|
||||
* Used for best match union deserialization.
|
||||
*/
|
||||
@JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
|
||||
return other is Section && value == other.value
|
||||
}
|
||||
|
||||
override fun hashCode() = value.hashCode()
|
||||
|
||||
override fun toString() = value.toString()
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
|
||||
return other is ItemRetrievePlacementResponse &&
|
||||
cursor == other.cursor &&
|
||||
itemType == other.itemType &&
|
||||
position == other.position &&
|
||||
section == other.section &&
|
||||
additionalProperties == other.additionalProperties
|
||||
}
|
||||
|
||||
private val hashCode: Int by lazy {
|
||||
Objects.hash(cursor, itemType, position, section, additionalProperties)
|
||||
}
|
||||
|
||||
override fun hashCode(): Int = hashCode
|
||||
|
||||
override fun toString() =
|
||||
"ItemRetrievePlacementResponse{cursor=$cursor, itemType=$itemType, position=$position, section=$section, additionalProperties=$additionalProperties}"
|
||||
}
|
||||
+518
@@ -0,0 +1,518 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.models.annotationqueues.items
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnyGetter
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter
|
||||
import com.fasterxml.jackson.annotation.JsonCreator
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.langchain.smith.core.ExcludeMissing
|
||||
import com.langchain.smith.core.JsonField
|
||||
import com.langchain.smith.core.JsonMissing
|
||||
import com.langchain.smith.core.JsonValue
|
||||
import com.langchain.smith.core.Params
|
||||
import com.langchain.smith.core.checkRequired
|
||||
import com.langchain.smith.core.http.Headers
|
||||
import com.langchain.smith.core.http.QueryParams
|
||||
import com.langchain.smith.errors.LangChainInvalidDataException
|
||||
import java.time.OffsetDateTime
|
||||
import java.util.Collections
|
||||
import java.util.Objects
|
||||
import java.util.Optional
|
||||
import kotlin.jvm.optionals.getOrNull
|
||||
|
||||
/**
|
||||
* Partially update membership fields (added_at, last_reviewed_time) for a single annotation queue
|
||||
* item by membership id. Works for RUN and THREAD rows. Omit a field (or pass JSON null) to leave
|
||||
* it unchanged.
|
||||
*/
|
||||
class ItemUpdateParams
|
||||
private constructor(
|
||||
private val queueId: String,
|
||||
private val itemId: String?,
|
||||
private val body: Body,
|
||||
private val additionalHeaders: Headers,
|
||||
private val additionalQueryParams: QueryParams,
|
||||
) : Params {
|
||||
|
||||
fun queueId(): String = queueId
|
||||
|
||||
fun itemId(): Optional<String> = Optional.ofNullable(itemId)
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun addedAt(): Optional<OffsetDateTime> = body.addedAt()
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun lastReviewedTime(): Optional<OffsetDateTime> = body.lastReviewedTime()
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [addedAt].
|
||||
*
|
||||
* Unlike [addedAt], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
fun _addedAt(): JsonField<OffsetDateTime> = body._addedAt()
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [lastReviewedTime].
|
||||
*
|
||||
* Unlike [lastReviewedTime], this method doesn't throw if the JSON field has an unexpected
|
||||
* type.
|
||||
*/
|
||||
fun _lastReviewedTime(): JsonField<OffsetDateTime> = body._lastReviewedTime()
|
||||
|
||||
fun _additionalBodyProperties(): Map<String, JsonValue> = body._additionalProperties()
|
||||
|
||||
/** Additional headers to send with the request. */
|
||||
fun _additionalHeaders(): Headers = additionalHeaders
|
||||
|
||||
/** Additional query param to send with the request. */
|
||||
fun _additionalQueryParams(): QueryParams = additionalQueryParams
|
||||
|
||||
fun toBuilder() = Builder().from(this)
|
||||
|
||||
companion object {
|
||||
|
||||
/**
|
||||
* Returns a mutable builder for constructing an instance of [ItemUpdateParams].
|
||||
*
|
||||
* The following fields are required:
|
||||
* ```java
|
||||
* .queueId()
|
||||
* ```
|
||||
*/
|
||||
@JvmStatic fun builder() = Builder()
|
||||
}
|
||||
|
||||
/** A builder for [ItemUpdateParams]. */
|
||||
class Builder internal constructor() {
|
||||
|
||||
private var queueId: String? = null
|
||||
private var itemId: String? = null
|
||||
private var body: Body.Builder = Body.builder()
|
||||
private var additionalHeaders: Headers.Builder = Headers.builder()
|
||||
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
|
||||
|
||||
@JvmSynthetic
|
||||
internal fun from(itemUpdateParams: ItemUpdateParams) = apply {
|
||||
queueId = itemUpdateParams.queueId
|
||||
itemId = itemUpdateParams.itemId
|
||||
body = itemUpdateParams.body.toBuilder()
|
||||
additionalHeaders = itemUpdateParams.additionalHeaders.toBuilder()
|
||||
additionalQueryParams = itemUpdateParams.additionalQueryParams.toBuilder()
|
||||
}
|
||||
|
||||
fun queueId(queueId: String) = apply { this.queueId = queueId }
|
||||
|
||||
fun itemId(itemId: String?) = apply { this.itemId = itemId }
|
||||
|
||||
/** Alias for calling [Builder.itemId] with `itemId.orElse(null)`. */
|
||||
fun itemId(itemId: Optional<String>) = itemId(itemId.getOrNull())
|
||||
|
||||
/**
|
||||
* Sets the entire request body.
|
||||
*
|
||||
* This is generally only useful if you are already constructing the body separately.
|
||||
* Otherwise, it's more convenient to use the top-level setters instead:
|
||||
* - [addedAt]
|
||||
* - [lastReviewedTime]
|
||||
*/
|
||||
fun body(body: Body) = apply { this.body = body.toBuilder() }
|
||||
|
||||
fun addedAt(addedAt: OffsetDateTime) = apply { body.addedAt(addedAt) }
|
||||
|
||||
/**
|
||||
* Sets [Builder.addedAt] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.addedAt] with a well-typed [OffsetDateTime] value
|
||||
* instead. This method is primarily for setting the field to an undocumented or not yet
|
||||
* supported value.
|
||||
*/
|
||||
fun addedAt(addedAt: JsonField<OffsetDateTime>) = apply { body.addedAt(addedAt) }
|
||||
|
||||
fun lastReviewedTime(lastReviewedTime: OffsetDateTime) = apply {
|
||||
body.lastReviewedTime(lastReviewedTime)
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets [Builder.lastReviewedTime] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.lastReviewedTime] with a well-typed [OffsetDateTime]
|
||||
* value instead. This method is primarily for setting the field to an undocumented or not
|
||||
* yet supported value.
|
||||
*/
|
||||
fun lastReviewedTime(lastReviewedTime: JsonField<OffsetDateTime>) = apply {
|
||||
body.lastReviewedTime(lastReviewedTime)
|
||||
}
|
||||
|
||||
fun additionalBodyProperties(additionalBodyProperties: Map<String, JsonValue>) = apply {
|
||||
body.additionalProperties(additionalBodyProperties)
|
||||
}
|
||||
|
||||
fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply {
|
||||
body.putAdditionalProperty(key, value)
|
||||
}
|
||||
|
||||
fun putAllAdditionalBodyProperties(additionalBodyProperties: Map<String, JsonValue>) =
|
||||
apply {
|
||||
body.putAllAdditionalProperties(additionalBodyProperties)
|
||||
}
|
||||
|
||||
fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) }
|
||||
|
||||
fun removeAllAdditionalBodyProperties(keys: Set<String>) = apply {
|
||||
body.removeAllAdditionalProperties(keys)
|
||||
}
|
||||
|
||||
fun additionalHeaders(additionalHeaders: Headers) = apply {
|
||||
this.additionalHeaders.clear()
|
||||
putAllAdditionalHeaders(additionalHeaders)
|
||||
}
|
||||
|
||||
fun additionalHeaders(additionalHeaders: Map<String, Iterable<String>>) = apply {
|
||||
this.additionalHeaders.clear()
|
||||
putAllAdditionalHeaders(additionalHeaders)
|
||||
}
|
||||
|
||||
fun putAdditionalHeader(name: String, value: String) = apply {
|
||||
additionalHeaders.put(name, value)
|
||||
}
|
||||
|
||||
fun putAdditionalHeaders(name: String, values: Iterable<String>) = apply {
|
||||
additionalHeaders.put(name, values)
|
||||
}
|
||||
|
||||
fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply {
|
||||
this.additionalHeaders.putAll(additionalHeaders)
|
||||
}
|
||||
|
||||
fun putAllAdditionalHeaders(additionalHeaders: Map<String, Iterable<String>>) = apply {
|
||||
this.additionalHeaders.putAll(additionalHeaders)
|
||||
}
|
||||
|
||||
fun replaceAdditionalHeaders(name: String, value: String) = apply {
|
||||
additionalHeaders.replace(name, value)
|
||||
}
|
||||
|
||||
fun replaceAdditionalHeaders(name: String, values: Iterable<String>) = apply {
|
||||
additionalHeaders.replace(name, values)
|
||||
}
|
||||
|
||||
fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply {
|
||||
this.additionalHeaders.replaceAll(additionalHeaders)
|
||||
}
|
||||
|
||||
fun replaceAllAdditionalHeaders(additionalHeaders: Map<String, Iterable<String>>) = apply {
|
||||
this.additionalHeaders.replaceAll(additionalHeaders)
|
||||
}
|
||||
|
||||
fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) }
|
||||
|
||||
fun removeAllAdditionalHeaders(names: Set<String>) = apply {
|
||||
additionalHeaders.removeAll(names)
|
||||
}
|
||||
|
||||
fun additionalQueryParams(additionalQueryParams: QueryParams) = apply {
|
||||
this.additionalQueryParams.clear()
|
||||
putAllAdditionalQueryParams(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun additionalQueryParams(additionalQueryParams: Map<String, Iterable<String>>) = apply {
|
||||
this.additionalQueryParams.clear()
|
||||
putAllAdditionalQueryParams(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun putAdditionalQueryParam(key: String, value: String) = apply {
|
||||
additionalQueryParams.put(key, value)
|
||||
}
|
||||
|
||||
fun putAdditionalQueryParams(key: String, values: Iterable<String>) = apply {
|
||||
additionalQueryParams.put(key, values)
|
||||
}
|
||||
|
||||
fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
|
||||
this.additionalQueryParams.putAll(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun putAllAdditionalQueryParams(additionalQueryParams: Map<String, Iterable<String>>) =
|
||||
apply {
|
||||
this.additionalQueryParams.putAll(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun replaceAdditionalQueryParams(key: String, value: String) = apply {
|
||||
additionalQueryParams.replace(key, value)
|
||||
}
|
||||
|
||||
fun replaceAdditionalQueryParams(key: String, values: Iterable<String>) = apply {
|
||||
additionalQueryParams.replace(key, values)
|
||||
}
|
||||
|
||||
fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
|
||||
this.additionalQueryParams.replaceAll(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun replaceAllAdditionalQueryParams(additionalQueryParams: Map<String, Iterable<String>>) =
|
||||
apply {
|
||||
this.additionalQueryParams.replaceAll(additionalQueryParams)
|
||||
}
|
||||
|
||||
fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) }
|
||||
|
||||
fun removeAllAdditionalQueryParams(keys: Set<String>) = apply {
|
||||
additionalQueryParams.removeAll(keys)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an immutable instance of [ItemUpdateParams].
|
||||
*
|
||||
* Further updates to this [Builder] will not mutate the returned instance.
|
||||
*
|
||||
* The following fields are required:
|
||||
* ```java
|
||||
* .queueId()
|
||||
* ```
|
||||
*
|
||||
* @throws IllegalStateException if any required field is unset.
|
||||
*/
|
||||
fun build(): ItemUpdateParams =
|
||||
ItemUpdateParams(
|
||||
checkRequired("queueId", queueId),
|
||||
itemId,
|
||||
body.build(),
|
||||
additionalHeaders.build(),
|
||||
additionalQueryParams.build(),
|
||||
)
|
||||
}
|
||||
|
||||
fun _body(): Body = body
|
||||
|
||||
fun _pathParam(index: Int): String =
|
||||
when (index) {
|
||||
0 -> queueId
|
||||
1 -> itemId ?: ""
|
||||
else -> ""
|
||||
}
|
||||
|
||||
override fun _headers(): Headers = additionalHeaders
|
||||
|
||||
override fun _queryParams(): QueryParams = additionalQueryParams
|
||||
|
||||
class Body
|
||||
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
|
||||
private constructor(
|
||||
private val addedAt: JsonField<OffsetDateTime>,
|
||||
private val lastReviewedTime: JsonField<OffsetDateTime>,
|
||||
private val additionalProperties: MutableMap<String, JsonValue>,
|
||||
) {
|
||||
|
||||
@JsonCreator
|
||||
private constructor(
|
||||
@JsonProperty("added_at")
|
||||
@ExcludeMissing
|
||||
addedAt: JsonField<OffsetDateTime> = JsonMissing.of(),
|
||||
@JsonProperty("last_reviewed_time")
|
||||
@ExcludeMissing
|
||||
lastReviewedTime: JsonField<OffsetDateTime> = JsonMissing.of(),
|
||||
) : this(addedAt, lastReviewedTime, mutableMapOf())
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
|
||||
* the server responded with an unexpected value).
|
||||
*/
|
||||
fun addedAt(): Optional<OffsetDateTime> = addedAt.getOptional("added_at")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
|
||||
* the server responded with an unexpected value).
|
||||
*/
|
||||
fun lastReviewedTime(): Optional<OffsetDateTime> =
|
||||
lastReviewedTime.getOptional("last_reviewed_time")
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [addedAt].
|
||||
*
|
||||
* Unlike [addedAt], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("added_at")
|
||||
@ExcludeMissing
|
||||
fun _addedAt(): JsonField<OffsetDateTime> = addedAt
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [lastReviewedTime].
|
||||
*
|
||||
* Unlike [lastReviewedTime], this method doesn't throw if the JSON field has an unexpected
|
||||
* type.
|
||||
*/
|
||||
@JsonProperty("last_reviewed_time")
|
||||
@ExcludeMissing
|
||||
fun _lastReviewedTime(): JsonField<OffsetDateTime> = lastReviewedTime
|
||||
|
||||
@JsonAnySetter
|
||||
private fun putAdditionalProperty(key: String, value: JsonValue) {
|
||||
additionalProperties.put(key, value)
|
||||
}
|
||||
|
||||
@JsonAnyGetter
|
||||
@ExcludeMissing
|
||||
fun _additionalProperties(): Map<String, JsonValue> =
|
||||
Collections.unmodifiableMap(additionalProperties)
|
||||
|
||||
fun toBuilder() = Builder().from(this)
|
||||
|
||||
companion object {
|
||||
|
||||
/** Returns a mutable builder for constructing an instance of [Body]. */
|
||||
@JvmStatic fun builder() = Builder()
|
||||
}
|
||||
|
||||
/** A builder for [Body]. */
|
||||
class Builder internal constructor() {
|
||||
|
||||
private var addedAt: JsonField<OffsetDateTime> = JsonMissing.of()
|
||||
private var lastReviewedTime: JsonField<OffsetDateTime> = JsonMissing.of()
|
||||
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
|
||||
|
||||
@JvmSynthetic
|
||||
internal fun from(body: Body) = apply {
|
||||
addedAt = body.addedAt
|
||||
lastReviewedTime = body.lastReviewedTime
|
||||
additionalProperties = body.additionalProperties.toMutableMap()
|
||||
}
|
||||
|
||||
fun addedAt(addedAt: OffsetDateTime) = addedAt(JsonField.of(addedAt))
|
||||
|
||||
/**
|
||||
* Sets [Builder.addedAt] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.addedAt] with a well-typed [OffsetDateTime] value
|
||||
* instead. This method is primarily for setting the field to an undocumented or not yet
|
||||
* supported value.
|
||||
*/
|
||||
fun addedAt(addedAt: JsonField<OffsetDateTime>) = apply { this.addedAt = addedAt }
|
||||
|
||||
fun lastReviewedTime(lastReviewedTime: OffsetDateTime) =
|
||||
lastReviewedTime(JsonField.of(lastReviewedTime))
|
||||
|
||||
/**
|
||||
* Sets [Builder.lastReviewedTime] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.lastReviewedTime] with a well-typed [OffsetDateTime]
|
||||
* value instead. This method is primarily for setting the field to an undocumented or
|
||||
* not yet supported value.
|
||||
*/
|
||||
fun lastReviewedTime(lastReviewedTime: JsonField<OffsetDateTime>) = apply {
|
||||
this.lastReviewedTime = lastReviewedTime
|
||||
}
|
||||
|
||||
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
|
||||
this.additionalProperties.clear()
|
||||
putAllAdditionalProperties(additionalProperties)
|
||||
}
|
||||
|
||||
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
|
||||
additionalProperties.put(key, value)
|
||||
}
|
||||
|
||||
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
|
||||
this.additionalProperties.putAll(additionalProperties)
|
||||
}
|
||||
|
||||
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
|
||||
|
||||
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
|
||||
keys.forEach(::removeAdditionalProperty)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an immutable instance of [Body].
|
||||
*
|
||||
* Further updates to this [Builder] will not mutate the returned instance.
|
||||
*/
|
||||
fun build(): Body = Body(addedAt, lastReviewedTime, additionalProperties.toMutableMap())
|
||||
}
|
||||
|
||||
private var validated: Boolean = false
|
||||
|
||||
/**
|
||||
* Validates that the types of all values in this object match their expected types
|
||||
* recursively.
|
||||
*
|
||||
* This method is _not_ forwards compatible with new types from the API for existing fields.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if any value type in this object doesn't match its
|
||||
* expected type.
|
||||
*/
|
||||
fun validate(): Body = apply {
|
||||
if (validated) {
|
||||
return@apply
|
||||
}
|
||||
|
||||
addedAt()
|
||||
lastReviewedTime()
|
||||
validated = true
|
||||
}
|
||||
|
||||
fun isValid(): Boolean =
|
||||
try {
|
||||
validate()
|
||||
true
|
||||
} catch (e: LangChainInvalidDataException) {
|
||||
false
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a score indicating how many valid values are contained in this object
|
||||
* recursively.
|
||||
*
|
||||
* Used for best match union deserialization.
|
||||
*/
|
||||
@JvmSynthetic
|
||||
internal fun validity(): Int =
|
||||
(if (addedAt.asKnown().isPresent) 1 else 0) +
|
||||
(if (lastReviewedTime.asKnown().isPresent) 1 else 0)
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
|
||||
return other is Body &&
|
||||
addedAt == other.addedAt &&
|
||||
lastReviewedTime == other.lastReviewedTime &&
|
||||
additionalProperties == other.additionalProperties
|
||||
}
|
||||
|
||||
private val hashCode: Int by lazy {
|
||||
Objects.hash(addedAt, lastReviewedTime, additionalProperties)
|
||||
}
|
||||
|
||||
override fun hashCode(): Int = hashCode
|
||||
|
||||
override fun toString() =
|
||||
"Body{addedAt=$addedAt, lastReviewedTime=$lastReviewedTime, additionalProperties=$additionalProperties}"
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
|
||||
return other is ItemUpdateParams &&
|
||||
queueId == other.queueId &&
|
||||
itemId == other.itemId &&
|
||||
body == other.body &&
|
||||
additionalHeaders == other.additionalHeaders &&
|
||||
additionalQueryParams == other.additionalQueryParams
|
||||
}
|
||||
|
||||
override fun hashCode(): Int =
|
||||
Objects.hash(queueId, itemId, body, additionalHeaders, additionalQueryParams)
|
||||
|
||||
override fun toString() =
|
||||
"ItemUpdateParams{queueId=$queueId, itemId=$itemId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
|
||||
}
|
||||
+634
@@ -0,0 +1,634 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.models.annotationqueues.items
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnyGetter
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter
|
||||
import com.fasterxml.jackson.annotation.JsonCreator
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.langchain.smith.core.Enum
|
||||
import com.langchain.smith.core.ExcludeMissing
|
||||
import com.langchain.smith.core.JsonField
|
||||
import com.langchain.smith.core.JsonMissing
|
||||
import com.langchain.smith.core.JsonValue
|
||||
import com.langchain.smith.errors.LangChainInvalidDataException
|
||||
import java.util.Collections
|
||||
import java.util.Objects
|
||||
import java.util.Optional
|
||||
import kotlin.jvm.optionals.getOrNull
|
||||
|
||||
class ItemUpdateResponse
|
||||
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
|
||||
private constructor(
|
||||
private val id: JsonField<String>,
|
||||
private val addedAt: JsonField<String>,
|
||||
private val itemType: JsonField<ItemType>,
|
||||
private val lastReviewedTime: JsonField<String>,
|
||||
private val queueId: JsonField<String>,
|
||||
private val runId: JsonField<String>,
|
||||
private val sessionId: JsonField<String>,
|
||||
private val sourceProposedExampleId: JsonField<String>,
|
||||
private val startTime: JsonField<String>,
|
||||
private val threadId: JsonField<String>,
|
||||
private val additionalProperties: MutableMap<String, JsonValue>,
|
||||
) {
|
||||
|
||||
@JsonCreator
|
||||
private constructor(
|
||||
@JsonProperty("id") @ExcludeMissing id: JsonField<String> = JsonMissing.of(),
|
||||
@JsonProperty("added_at") @ExcludeMissing addedAt: JsonField<String> = JsonMissing.of(),
|
||||
@JsonProperty("item_type") @ExcludeMissing itemType: JsonField<ItemType> = JsonMissing.of(),
|
||||
@JsonProperty("last_reviewed_time")
|
||||
@ExcludeMissing
|
||||
lastReviewedTime: JsonField<String> = JsonMissing.of(),
|
||||
@JsonProperty("queue_id") @ExcludeMissing queueId: JsonField<String> = JsonMissing.of(),
|
||||
@JsonProperty("run_id") @ExcludeMissing runId: JsonField<String> = JsonMissing.of(),
|
||||
@JsonProperty("session_id") @ExcludeMissing sessionId: JsonField<String> = JsonMissing.of(),
|
||||
@JsonProperty("source_proposed_example_id")
|
||||
@ExcludeMissing
|
||||
sourceProposedExampleId: JsonField<String> = JsonMissing.of(),
|
||||
@JsonProperty("start_time") @ExcludeMissing startTime: JsonField<String> = JsonMissing.of(),
|
||||
@JsonProperty("thread_id") @ExcludeMissing threadId: JsonField<String> = JsonMissing.of(),
|
||||
) : this(
|
||||
id,
|
||||
addedAt,
|
||||
itemType,
|
||||
lastReviewedTime,
|
||||
queueId,
|
||||
runId,
|
||||
sessionId,
|
||||
sourceProposedExampleId,
|
||||
startTime,
|
||||
threadId,
|
||||
mutableMapOf(),
|
||||
)
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun id(): Optional<String> = id.getOptional("id")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun addedAt(): Optional<String> = addedAt.getOptional("added_at")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun itemType(): Optional<ItemType> = itemType.getOptional("item_type")
|
||||
|
||||
/**
|
||||
* LastReviewedTime is always present on the wire (null until reviewed).
|
||||
*
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun lastReviewedTime(): Optional<String> = lastReviewedTime.getOptional("last_reviewed_time")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun queueId(): Optional<String> = queueId.getOptional("queue_id")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun runId(): Optional<String> = runId.getOptional("run_id")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun sessionId(): Optional<String> = sessionId.getOptional("session_id")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun sourceProposedExampleId(): Optional<String> =
|
||||
sourceProposedExampleId.getOptional("source_proposed_example_id")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun startTime(): Optional<String> = startTime.getOptional("start_time")
|
||||
|
||||
/**
|
||||
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
|
||||
* server responded with an unexpected value).
|
||||
*/
|
||||
fun threadId(): Optional<String> = threadId.getOptional("thread_id")
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [id].
|
||||
*
|
||||
* Unlike [id], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("id") @ExcludeMissing fun _id(): JsonField<String> = id
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [addedAt].
|
||||
*
|
||||
* Unlike [addedAt], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("added_at") @ExcludeMissing fun _addedAt(): JsonField<String> = addedAt
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [itemType].
|
||||
*
|
||||
* Unlike [itemType], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("item_type") @ExcludeMissing fun _itemType(): JsonField<ItemType> = itemType
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [lastReviewedTime].
|
||||
*
|
||||
* Unlike [lastReviewedTime], this method doesn't throw if the JSON field has an unexpected
|
||||
* type.
|
||||
*/
|
||||
@JsonProperty("last_reviewed_time")
|
||||
@ExcludeMissing
|
||||
fun _lastReviewedTime(): JsonField<String> = lastReviewedTime
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [queueId].
|
||||
*
|
||||
* Unlike [queueId], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("queue_id") @ExcludeMissing fun _queueId(): JsonField<String> = queueId
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [runId].
|
||||
*
|
||||
* Unlike [runId], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("run_id") @ExcludeMissing fun _runId(): JsonField<String> = runId
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [sessionId].
|
||||
*
|
||||
* Unlike [sessionId], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("session_id") @ExcludeMissing fun _sessionId(): JsonField<String> = sessionId
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [sourceProposedExampleId].
|
||||
*
|
||||
* Unlike [sourceProposedExampleId], this method doesn't throw if the JSON field has an
|
||||
* unexpected type.
|
||||
*/
|
||||
@JsonProperty("source_proposed_example_id")
|
||||
@ExcludeMissing
|
||||
fun _sourceProposedExampleId(): JsonField<String> = sourceProposedExampleId
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [startTime].
|
||||
*
|
||||
* Unlike [startTime], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("start_time") @ExcludeMissing fun _startTime(): JsonField<String> = startTime
|
||||
|
||||
/**
|
||||
* Returns the raw JSON value of [threadId].
|
||||
*
|
||||
* Unlike [threadId], this method doesn't throw if the JSON field has an unexpected type.
|
||||
*/
|
||||
@JsonProperty("thread_id") @ExcludeMissing fun _threadId(): JsonField<String> = threadId
|
||||
|
||||
@JsonAnySetter
|
||||
private fun putAdditionalProperty(key: String, value: JsonValue) {
|
||||
additionalProperties.put(key, value)
|
||||
}
|
||||
|
||||
@JsonAnyGetter
|
||||
@ExcludeMissing
|
||||
fun _additionalProperties(): Map<String, JsonValue> =
|
||||
Collections.unmodifiableMap(additionalProperties)
|
||||
|
||||
fun toBuilder() = Builder().from(this)
|
||||
|
||||
companion object {
|
||||
|
||||
/** Returns a mutable builder for constructing an instance of [ItemUpdateResponse]. */
|
||||
@JvmStatic fun builder() = Builder()
|
||||
}
|
||||
|
||||
/** A builder for [ItemUpdateResponse]. */
|
||||
class Builder internal constructor() {
|
||||
|
||||
private var id: JsonField<String> = JsonMissing.of()
|
||||
private var addedAt: JsonField<String> = JsonMissing.of()
|
||||
private var itemType: JsonField<ItemType> = JsonMissing.of()
|
||||
private var lastReviewedTime: JsonField<String> = JsonMissing.of()
|
||||
private var queueId: JsonField<String> = JsonMissing.of()
|
||||
private var runId: JsonField<String> = JsonMissing.of()
|
||||
private var sessionId: JsonField<String> = JsonMissing.of()
|
||||
private var sourceProposedExampleId: JsonField<String> = JsonMissing.of()
|
||||
private var startTime: JsonField<String> = JsonMissing.of()
|
||||
private var threadId: JsonField<String> = JsonMissing.of()
|
||||
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
|
||||
|
||||
@JvmSynthetic
|
||||
internal fun from(itemUpdateResponse: ItemUpdateResponse) = apply {
|
||||
id = itemUpdateResponse.id
|
||||
addedAt = itemUpdateResponse.addedAt
|
||||
itemType = itemUpdateResponse.itemType
|
||||
lastReviewedTime = itemUpdateResponse.lastReviewedTime
|
||||
queueId = itemUpdateResponse.queueId
|
||||
runId = itemUpdateResponse.runId
|
||||
sessionId = itemUpdateResponse.sessionId
|
||||
sourceProposedExampleId = itemUpdateResponse.sourceProposedExampleId
|
||||
startTime = itemUpdateResponse.startTime
|
||||
threadId = itemUpdateResponse.threadId
|
||||
additionalProperties = itemUpdateResponse.additionalProperties.toMutableMap()
|
||||
}
|
||||
|
||||
fun id(id: String) = id(JsonField.of(id))
|
||||
|
||||
/**
|
||||
* Sets [Builder.id] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.id] with a well-typed [String] value instead. This
|
||||
* method is primarily for setting the field to an undocumented or not yet supported value.
|
||||
*/
|
||||
fun id(id: JsonField<String>) = apply { this.id = id }
|
||||
|
||||
fun addedAt(addedAt: String) = addedAt(JsonField.of(addedAt))
|
||||
|
||||
/**
|
||||
* Sets [Builder.addedAt] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.addedAt] with a well-typed [String] value instead. This
|
||||
* method is primarily for setting the field to an undocumented or not yet supported value.
|
||||
*/
|
||||
fun addedAt(addedAt: JsonField<String>) = apply { this.addedAt = addedAt }
|
||||
|
||||
fun itemType(itemType: ItemType) = itemType(JsonField.of(itemType))
|
||||
|
||||
/**
|
||||
* Sets [Builder.itemType] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.itemType] with a well-typed [ItemType] value instead.
|
||||
* This method is primarily for setting the field to an undocumented or not yet supported
|
||||
* value.
|
||||
*/
|
||||
fun itemType(itemType: JsonField<ItemType>) = apply { this.itemType = itemType }
|
||||
|
||||
/** LastReviewedTime is always present on the wire (null until reviewed). */
|
||||
fun lastReviewedTime(lastReviewedTime: String) =
|
||||
lastReviewedTime(JsonField.of(lastReviewedTime))
|
||||
|
||||
/**
|
||||
* Sets [Builder.lastReviewedTime] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.lastReviewedTime] with a well-typed [String] value
|
||||
* instead. This method is primarily for setting the field to an undocumented or not yet
|
||||
* supported value.
|
||||
*/
|
||||
fun lastReviewedTime(lastReviewedTime: JsonField<String>) = apply {
|
||||
this.lastReviewedTime = lastReviewedTime
|
||||
}
|
||||
|
||||
fun queueId(queueId: String) = queueId(JsonField.of(queueId))
|
||||
|
||||
/**
|
||||
* Sets [Builder.queueId] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.queueId] with a well-typed [String] value instead. This
|
||||
* method is primarily for setting the field to an undocumented or not yet supported value.
|
||||
*/
|
||||
fun queueId(queueId: JsonField<String>) = apply { this.queueId = queueId }
|
||||
|
||||
fun runId(runId: String) = runId(JsonField.of(runId))
|
||||
|
||||
/**
|
||||
* Sets [Builder.runId] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.runId] with a well-typed [String] value instead. This
|
||||
* method is primarily for setting the field to an undocumented or not yet supported value.
|
||||
*/
|
||||
fun runId(runId: JsonField<String>) = apply { this.runId = runId }
|
||||
|
||||
fun sessionId(sessionId: String) = sessionId(JsonField.of(sessionId))
|
||||
|
||||
/**
|
||||
* Sets [Builder.sessionId] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.sessionId] with a well-typed [String] value instead.
|
||||
* This method is primarily for setting the field to an undocumented or not yet supported
|
||||
* value.
|
||||
*/
|
||||
fun sessionId(sessionId: JsonField<String>) = apply { this.sessionId = sessionId }
|
||||
|
||||
fun sourceProposedExampleId(sourceProposedExampleId: String) =
|
||||
sourceProposedExampleId(JsonField.of(sourceProposedExampleId))
|
||||
|
||||
/**
|
||||
* Sets [Builder.sourceProposedExampleId] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.sourceProposedExampleId] with a well-typed [String]
|
||||
* value instead. This method is primarily for setting the field to an undocumented or not
|
||||
* yet supported value.
|
||||
*/
|
||||
fun sourceProposedExampleId(sourceProposedExampleId: JsonField<String>) = apply {
|
||||
this.sourceProposedExampleId = sourceProposedExampleId
|
||||
}
|
||||
|
||||
fun startTime(startTime: String) = startTime(JsonField.of(startTime))
|
||||
|
||||
/**
|
||||
* Sets [Builder.startTime] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.startTime] with a well-typed [String] value instead.
|
||||
* This method is primarily for setting the field to an undocumented or not yet supported
|
||||
* value.
|
||||
*/
|
||||
fun startTime(startTime: JsonField<String>) = apply { this.startTime = startTime }
|
||||
|
||||
fun threadId(threadId: String) = threadId(JsonField.of(threadId))
|
||||
|
||||
/**
|
||||
* Sets [Builder.threadId] to an arbitrary JSON value.
|
||||
*
|
||||
* You should usually call [Builder.threadId] with a well-typed [String] value instead. This
|
||||
* method is primarily for setting the field to an undocumented or not yet supported value.
|
||||
*/
|
||||
fun threadId(threadId: JsonField<String>) = apply { this.threadId = threadId }
|
||||
|
||||
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
|
||||
this.additionalProperties.clear()
|
||||
putAllAdditionalProperties(additionalProperties)
|
||||
}
|
||||
|
||||
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
|
||||
additionalProperties.put(key, value)
|
||||
}
|
||||
|
||||
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
|
||||
this.additionalProperties.putAll(additionalProperties)
|
||||
}
|
||||
|
||||
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
|
||||
|
||||
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
|
||||
keys.forEach(::removeAdditionalProperty)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an immutable instance of [ItemUpdateResponse].
|
||||
*
|
||||
* Further updates to this [Builder] will not mutate the returned instance.
|
||||
*/
|
||||
fun build(): ItemUpdateResponse =
|
||||
ItemUpdateResponse(
|
||||
id,
|
||||
addedAt,
|
||||
itemType,
|
||||
lastReviewedTime,
|
||||
queueId,
|
||||
runId,
|
||||
sessionId,
|
||||
sourceProposedExampleId,
|
||||
startTime,
|
||||
threadId,
|
||||
additionalProperties.toMutableMap(),
|
||||
)
|
||||
}
|
||||
|
||||
private var validated: Boolean = false
|
||||
|
||||
/**
|
||||
* Validates that the types of all values in this object match their expected types recursively.
|
||||
*
|
||||
* This method is _not_ forwards compatible with new types from the API for existing fields.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if any value type in this object doesn't match its
|
||||
* expected type.
|
||||
*/
|
||||
fun validate(): ItemUpdateResponse = apply {
|
||||
if (validated) {
|
||||
return@apply
|
||||
}
|
||||
|
||||
id()
|
||||
addedAt()
|
||||
itemType().ifPresent { it.validate() }
|
||||
lastReviewedTime()
|
||||
queueId()
|
||||
runId()
|
||||
sessionId()
|
||||
sourceProposedExampleId()
|
||||
startTime()
|
||||
threadId()
|
||||
validated = true
|
||||
}
|
||||
|
||||
fun isValid(): Boolean =
|
||||
try {
|
||||
validate()
|
||||
true
|
||||
} catch (e: LangChainInvalidDataException) {
|
||||
false
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a score indicating how many valid values are contained in this object recursively.
|
||||
*
|
||||
* Used for best match union deserialization.
|
||||
*/
|
||||
@JvmSynthetic
|
||||
internal fun validity(): Int =
|
||||
(if (id.asKnown().isPresent) 1 else 0) +
|
||||
(if (addedAt.asKnown().isPresent) 1 else 0) +
|
||||
(itemType.asKnown().getOrNull()?.validity() ?: 0) +
|
||||
(if (lastReviewedTime.asKnown().isPresent) 1 else 0) +
|
||||
(if (queueId.asKnown().isPresent) 1 else 0) +
|
||||
(if (runId.asKnown().isPresent) 1 else 0) +
|
||||
(if (sessionId.asKnown().isPresent) 1 else 0) +
|
||||
(if (sourceProposedExampleId.asKnown().isPresent) 1 else 0) +
|
||||
(if (startTime.asKnown().isPresent) 1 else 0) +
|
||||
(if (threadId.asKnown().isPresent) 1 else 0)
|
||||
|
||||
class ItemType @JsonCreator private constructor(private val value: JsonField<String>) : Enum {
|
||||
|
||||
/**
|
||||
* Returns this class instance's raw value.
|
||||
*
|
||||
* This is usually only useful if this instance was deserialized from data that doesn't
|
||||
* match any known member, and you want to know that value. For example, if the SDK is on an
|
||||
* older version than the API, then the API may respond with new members that the SDK is
|
||||
* unaware of.
|
||||
*/
|
||||
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value
|
||||
|
||||
companion object {
|
||||
|
||||
@JvmField val RUN = of("RUN")
|
||||
|
||||
@JvmField val THREAD = of("THREAD")
|
||||
|
||||
@JvmStatic fun of(value: String) = ItemType(JsonField.of(value))
|
||||
}
|
||||
|
||||
/** An enum containing [ItemType]'s known values. */
|
||||
enum class Known {
|
||||
RUN,
|
||||
THREAD,
|
||||
}
|
||||
|
||||
/**
|
||||
* An enum containing [ItemType]'s known values, as well as an [_UNKNOWN] member.
|
||||
*
|
||||
* An instance of [ItemType] can contain an unknown value in a couple of cases:
|
||||
* - It was deserialized from data that doesn't match any known member. For example, if the
|
||||
* SDK is on an older version than the API, then the API may respond with new members that
|
||||
* the SDK is unaware of.
|
||||
* - It was constructed with an arbitrary value using the [of] method.
|
||||
*/
|
||||
enum class Value {
|
||||
RUN,
|
||||
THREAD,
|
||||
/** An enum member indicating that [ItemType] was instantiated with an unknown value. */
|
||||
_UNKNOWN,
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
|
||||
* if the class was instantiated with an unknown value.
|
||||
*
|
||||
* Use the [known] method instead if you're certain the value is always known or if you want
|
||||
* to throw for the unknown case.
|
||||
*/
|
||||
fun value(): Value =
|
||||
when (this) {
|
||||
RUN -> Value.RUN
|
||||
THREAD -> Value.THREAD
|
||||
else -> Value._UNKNOWN
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an enum member corresponding to this class instance's value.
|
||||
*
|
||||
* Use the [value] method instead if you're uncertain the value is always known and don't
|
||||
* want to throw for the unknown case.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if this class instance's value is a not a known
|
||||
* member.
|
||||
*/
|
||||
fun known(): Known =
|
||||
when (this) {
|
||||
RUN -> Known.RUN
|
||||
THREAD -> Known.THREAD
|
||||
else -> throw LangChainInvalidDataException("Unknown ItemType: $value")
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns this class instance's primitive wire representation.
|
||||
*
|
||||
* This differs from the [toString] method because that method is primarily for debugging
|
||||
* and generally doesn't throw.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if this class instance's value does not have the
|
||||
* expected primitive type.
|
||||
*/
|
||||
fun asString(): String =
|
||||
_value().asString().orElseThrow {
|
||||
LangChainInvalidDataException("Value is not a String")
|
||||
}
|
||||
|
||||
private var validated: Boolean = false
|
||||
|
||||
/**
|
||||
* Validates that the types of all values in this object match their expected types
|
||||
* recursively.
|
||||
*
|
||||
* This method is _not_ forwards compatible with new types from the API for existing fields.
|
||||
*
|
||||
* @throws LangChainInvalidDataException if any value type in this object doesn't match its
|
||||
* expected type.
|
||||
*/
|
||||
fun validate(): ItemType = apply {
|
||||
if (validated) {
|
||||
return@apply
|
||||
}
|
||||
|
||||
known()
|
||||
validated = true
|
||||
}
|
||||
|
||||
fun isValid(): Boolean =
|
||||
try {
|
||||
validate()
|
||||
true
|
||||
} catch (e: LangChainInvalidDataException) {
|
||||
false
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a score indicating how many valid values are contained in this object
|
||||
* recursively.
|
||||
*
|
||||
* Used for best match union deserialization.
|
||||
*/
|
||||
@JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
|
||||
return other is ItemType && value == other.value
|
||||
}
|
||||
|
||||
override fun hashCode() = value.hashCode()
|
||||
|
||||
override fun toString() = value.toString()
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
|
||||
return other is ItemUpdateResponse &&
|
||||
id == other.id &&
|
||||
addedAt == other.addedAt &&
|
||||
itemType == other.itemType &&
|
||||
lastReviewedTime == other.lastReviewedTime &&
|
||||
queueId == other.queueId &&
|
||||
runId == other.runId &&
|
||||
sessionId == other.sessionId &&
|
||||
sourceProposedExampleId == other.sourceProposedExampleId &&
|
||||
startTime == other.startTime &&
|
||||
threadId == other.threadId &&
|
||||
additionalProperties == other.additionalProperties
|
||||
}
|
||||
|
||||
private val hashCode: Int by lazy {
|
||||
Objects.hash(
|
||||
id,
|
||||
addedAt,
|
||||
itemType,
|
||||
lastReviewedTime,
|
||||
queueId,
|
||||
runId,
|
||||
sessionId,
|
||||
sourceProposedExampleId,
|
||||
startTime,
|
||||
threadId,
|
||||
additionalProperties,
|
||||
)
|
||||
}
|
||||
|
||||
override fun hashCode(): Int = hashCode
|
||||
|
||||
override fun toString() =
|
||||
"ItemUpdateResponse{id=$id, addedAt=$addedAt, itemType=$itemType, lastReviewedTime=$lastReviewedTime, queueId=$queueId, runId=$runId, sessionId=$sessionId, sourceProposedExampleId=$sourceProposedExampleId, startTime=$startTime, threadId=$threadId, additionalProperties=$additionalProperties}"
|
||||
}
|
||||
+5
@@ -28,6 +28,7 @@ import com.langchain.smith.models.annotationqueues.AnnotationQueueSizeSchema
|
||||
import com.langchain.smith.models.annotationqueues.AnnotationQueueUpdateParams
|
||||
import com.langchain.smith.models.annotationqueues.AnnotationQueueUpdateResponse
|
||||
import com.langchain.smith.models.annotationqueues.RunSchemaWithAnnotationQueueInfo
|
||||
import com.langchain.smith.services.async.annotationqueues.ItemServiceAsync
|
||||
import com.langchain.smith.services.async.annotationqueues.RunServiceAsync
|
||||
import java.util.concurrent.CompletableFuture
|
||||
import java.util.function.Consumer
|
||||
@@ -48,6 +49,8 @@ interface AnnotationQueueServiceAsync {
|
||||
|
||||
fun runs(): RunServiceAsync
|
||||
|
||||
fun items(): ItemServiceAsync
|
||||
|
||||
/** Get Annotation Queue */
|
||||
fun retrieve(queueId: String): CompletableFuture<AnnotationQueueRetrieveResponse> =
|
||||
retrieve(queueId, AnnotationQueueRetrieveParams.none())
|
||||
@@ -496,6 +499,8 @@ interface AnnotationQueueServiceAsync {
|
||||
|
||||
fun runs(): RunServiceAsync.WithRawResponse
|
||||
|
||||
fun items(): ItemServiceAsync.WithRawResponse
|
||||
|
||||
/**
|
||||
* Returns a raw HTTP response for `get /api/v1/annotation-queues/{queue_id}`, but is
|
||||
* otherwise the same as [AnnotationQueueServiceAsync.retrieve].
|
||||
|
||||
+12
@@ -40,6 +40,8 @@ import com.langchain.smith.models.annotationqueues.AnnotationQueueSizeSchema
|
||||
import com.langchain.smith.models.annotationqueues.AnnotationQueueUpdateParams
|
||||
import com.langchain.smith.models.annotationqueues.AnnotationQueueUpdateResponse
|
||||
import com.langchain.smith.models.annotationqueues.RunSchemaWithAnnotationQueueInfo
|
||||
import com.langchain.smith.services.async.annotationqueues.ItemServiceAsync
|
||||
import com.langchain.smith.services.async.annotationqueues.ItemServiceAsyncImpl
|
||||
import com.langchain.smith.services.async.annotationqueues.RunServiceAsync
|
||||
import com.langchain.smith.services.async.annotationqueues.RunServiceAsyncImpl
|
||||
import java.util.concurrent.CompletableFuture
|
||||
@@ -55,6 +57,8 @@ internal constructor(private val clientOptions: ClientOptions) : AnnotationQueue
|
||||
|
||||
private val runs: RunServiceAsync by lazy { RunServiceAsyncImpl(clientOptions) }
|
||||
|
||||
private val items: ItemServiceAsync by lazy { ItemServiceAsyncImpl(clientOptions) }
|
||||
|
||||
override fun withRawResponse(): AnnotationQueueServiceAsync.WithRawResponse = withRawResponse
|
||||
|
||||
override fun withOptions(
|
||||
@@ -64,6 +68,8 @@ internal constructor(private val clientOptions: ClientOptions) : AnnotationQueue
|
||||
|
||||
override fun runs(): RunServiceAsync = runs
|
||||
|
||||
override fun items(): ItemServiceAsync = items
|
||||
|
||||
override fun retrieve(
|
||||
params: AnnotationQueueRetrieveParams,
|
||||
requestOptions: RequestOptions,
|
||||
@@ -165,6 +171,10 @@ internal constructor(private val clientOptions: ClientOptions) : AnnotationQueue
|
||||
RunServiceAsyncImpl.WithRawResponseImpl(clientOptions)
|
||||
}
|
||||
|
||||
private val items: ItemServiceAsync.WithRawResponse by lazy {
|
||||
ItemServiceAsyncImpl.WithRawResponseImpl(clientOptions)
|
||||
}
|
||||
|
||||
override fun withOptions(
|
||||
modifier: Consumer<ClientOptions.Builder>
|
||||
): AnnotationQueueServiceAsync.WithRawResponse =
|
||||
@@ -174,6 +184,8 @@ internal constructor(private val clientOptions: ClientOptions) : AnnotationQueue
|
||||
|
||||
override fun runs(): RunServiceAsync.WithRawResponse = runs
|
||||
|
||||
override fun items(): ItemServiceAsync.WithRawResponse = items
|
||||
|
||||
private val retrieveHandler: Handler<AnnotationQueueRetrieveResponse> =
|
||||
jsonHandler<AnnotationQueueRetrieveResponse>(clientOptions.jsonMapper)
|
||||
|
||||
|
||||
+521
@@ -0,0 +1,521 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.services.async.annotationqueues
|
||||
|
||||
import com.langchain.smith.core.ClientOptions
|
||||
import com.langchain.smith.core.RequestOptions
|
||||
import com.langchain.smith.core.http.HttpResponseFor
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemCreateParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemCreateResponse
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemCreateStatusParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemCreateStatusResponse
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemDeleteAllParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemDeleteAllResponse
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemListPageAsync
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemListParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemRetrieveCountParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemRetrieveCountResponse
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemRetrievePlacementParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemRetrievePlacementResponse
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemUpdateParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemUpdateResponse
|
||||
import java.util.concurrent.CompletableFuture
|
||||
import java.util.function.Consumer
|
||||
|
||||
interface ItemServiceAsync {
|
||||
|
||||
/**
|
||||
* Returns a view of this service that provides access to raw HTTP responses for each method.
|
||||
*/
|
||||
fun withRawResponse(): WithRawResponse
|
||||
|
||||
/**
|
||||
* Returns a view of this service with the given option modifications applied.
|
||||
*
|
||||
* The original service is not modified.
|
||||
*/
|
||||
fun withOptions(modifier: Consumer<ClientOptions.Builder>): ItemServiceAsync
|
||||
|
||||
/**
|
||||
* Add RUN or THREAD items to a single annotation queue. THREAD items require thread_id and
|
||||
* session_id; RUN items require run_id, or source_proposed_example_id with lookup coordinates
|
||||
* when applicable.
|
||||
*/
|
||||
fun create(queueId: String): CompletableFuture<ItemCreateResponse> =
|
||||
create(queueId, ItemCreateParams.none())
|
||||
|
||||
/** @see create */
|
||||
fun create(
|
||||
queueId: String,
|
||||
params: ItemCreateParams = ItemCreateParams.none(),
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): CompletableFuture<ItemCreateResponse> =
|
||||
create(params.toBuilder().queueId(queueId).build(), requestOptions)
|
||||
|
||||
/** @see create */
|
||||
fun create(
|
||||
queueId: String,
|
||||
params: ItemCreateParams = ItemCreateParams.none(),
|
||||
): CompletableFuture<ItemCreateResponse> = create(queueId, params, RequestOptions.none())
|
||||
|
||||
/** @see create */
|
||||
fun create(
|
||||
params: ItemCreateParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): CompletableFuture<ItemCreateResponse>
|
||||
|
||||
/** @see create */
|
||||
fun create(params: ItemCreateParams): CompletableFuture<ItemCreateResponse> =
|
||||
create(params, RequestOptions.none())
|
||||
|
||||
/** @see create */
|
||||
fun create(
|
||||
queueId: String,
|
||||
requestOptions: RequestOptions,
|
||||
): CompletableFuture<ItemCreateResponse> =
|
||||
create(queueId, ItemCreateParams.none(), requestOptions)
|
||||
|
||||
/**
|
||||
* Partially update membership fields (added_at, last_reviewed_time) for a single annotation
|
||||
* queue item by membership id. Works for RUN and THREAD rows. Omit a field (or pass JSON null)
|
||||
* to leave it unchanged.
|
||||
*/
|
||||
fun update(itemId: String, params: ItemUpdateParams): CompletableFuture<ItemUpdateResponse> =
|
||||
update(itemId, params, RequestOptions.none())
|
||||
|
||||
/** @see update */
|
||||
fun update(
|
||||
itemId: String,
|
||||
params: ItemUpdateParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): CompletableFuture<ItemUpdateResponse> =
|
||||
update(params.toBuilder().itemId(itemId).build(), requestOptions)
|
||||
|
||||
/** @see update */
|
||||
fun update(params: ItemUpdateParams): CompletableFuture<ItemUpdateResponse> =
|
||||
update(params, RequestOptions.none())
|
||||
|
||||
/** @see update */
|
||||
fun update(
|
||||
params: ItemUpdateParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): CompletableFuture<ItemUpdateResponse>
|
||||
|
||||
/**
|
||||
* List RUN and THREAD items in a single annotation queue for one review status section, with
|
||||
* opaque cursor pagination. Optional item_type=RUN|THREAD filters the page. direction=backward
|
||||
* returns items before the supplied cursor. Response is membership metadata only (no nested
|
||||
* run/thread store payloads). status=archived returns items in annotation_queue_runs_archive
|
||||
* (queue completion rule met), not merely items the caller personally marked completed.
|
||||
*/
|
||||
fun list(queueId: String, params: ItemListParams): CompletableFuture<ItemListPageAsync> =
|
||||
list(queueId, params, RequestOptions.none())
|
||||
|
||||
/** @see list */
|
||||
fun list(
|
||||
queueId: String,
|
||||
params: ItemListParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): CompletableFuture<ItemListPageAsync> =
|
||||
list(params.toBuilder().queueId(queueId).build(), requestOptions)
|
||||
|
||||
/** @see list */
|
||||
fun list(params: ItemListParams): CompletableFuture<ItemListPageAsync> =
|
||||
list(params, RequestOptions.none())
|
||||
|
||||
/** @see list */
|
||||
fun list(
|
||||
params: ItemListParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): CompletableFuture<ItemListPageAsync>
|
||||
|
||||
/**
|
||||
* Log the caller's reviewer status for a RUN or THREAD annotation queue item. A null status
|
||||
* re-shows the item for this reviewer.
|
||||
*/
|
||||
fun createStatus(queueItemId: String): CompletableFuture<ItemCreateStatusResponse> =
|
||||
createStatus(queueItemId, ItemCreateStatusParams.none())
|
||||
|
||||
/** @see createStatus */
|
||||
fun createStatus(
|
||||
queueItemId: String,
|
||||
params: ItemCreateStatusParams = ItemCreateStatusParams.none(),
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): CompletableFuture<ItemCreateStatusResponse> =
|
||||
createStatus(params.toBuilder().queueItemId(queueItemId).build(), requestOptions)
|
||||
|
||||
/** @see createStatus */
|
||||
fun createStatus(
|
||||
queueItemId: String,
|
||||
params: ItemCreateStatusParams = ItemCreateStatusParams.none(),
|
||||
): CompletableFuture<ItemCreateStatusResponse> =
|
||||
createStatus(queueItemId, params, RequestOptions.none())
|
||||
|
||||
/** @see createStatus */
|
||||
fun createStatus(
|
||||
params: ItemCreateStatusParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): CompletableFuture<ItemCreateStatusResponse>
|
||||
|
||||
/** @see createStatus */
|
||||
fun createStatus(params: ItemCreateStatusParams): CompletableFuture<ItemCreateStatusResponse> =
|
||||
createStatus(params, RequestOptions.none())
|
||||
|
||||
/** @see createStatus */
|
||||
fun createStatus(
|
||||
queueItemId: String,
|
||||
requestOptions: RequestOptions,
|
||||
): CompletableFuture<ItemCreateStatusResponse> =
|
||||
createStatus(queueItemId, ItemCreateStatusParams.none(), requestOptions)
|
||||
|
||||
/** Remove RUN or THREAD items from a single annotation queue by membership ID. */
|
||||
fun deleteAll(queueId: String): CompletableFuture<ItemDeleteAllResponse> =
|
||||
deleteAll(queueId, ItemDeleteAllParams.none())
|
||||
|
||||
/** @see deleteAll */
|
||||
fun deleteAll(
|
||||
queueId: String,
|
||||
params: ItemDeleteAllParams = ItemDeleteAllParams.none(),
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): CompletableFuture<ItemDeleteAllResponse> =
|
||||
deleteAll(params.toBuilder().queueId(queueId).build(), requestOptions)
|
||||
|
||||
/** @see deleteAll */
|
||||
fun deleteAll(
|
||||
queueId: String,
|
||||
params: ItemDeleteAllParams = ItemDeleteAllParams.none(),
|
||||
): CompletableFuture<ItemDeleteAllResponse> = deleteAll(queueId, params, RequestOptions.none())
|
||||
|
||||
/** @see deleteAll */
|
||||
fun deleteAll(
|
||||
params: ItemDeleteAllParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): CompletableFuture<ItemDeleteAllResponse>
|
||||
|
||||
/** @see deleteAll */
|
||||
fun deleteAll(params: ItemDeleteAllParams): CompletableFuture<ItemDeleteAllResponse> =
|
||||
deleteAll(params, RequestOptions.none())
|
||||
|
||||
/** @see deleteAll */
|
||||
fun deleteAll(
|
||||
queueId: String,
|
||||
requestOptions: RequestOptions,
|
||||
): CompletableFuture<ItemDeleteAllResponse> =
|
||||
deleteAll(queueId, ItemDeleteAllParams.none(), requestOptions)
|
||||
|
||||
/**
|
||||
* Returns the number of annotation queue items for the requested reviewer-specific or archived
|
||||
* bucket.
|
||||
*/
|
||||
fun retrieveCount(
|
||||
queueId: String,
|
||||
params: ItemRetrieveCountParams,
|
||||
): CompletableFuture<ItemRetrieveCountResponse> =
|
||||
retrieveCount(queueId, params, RequestOptions.none())
|
||||
|
||||
/** @see retrieveCount */
|
||||
fun retrieveCount(
|
||||
queueId: String,
|
||||
params: ItemRetrieveCountParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): CompletableFuture<ItemRetrieveCountResponse> =
|
||||
retrieveCount(params.toBuilder().queueId(queueId).build(), requestOptions)
|
||||
|
||||
/** @see retrieveCount */
|
||||
fun retrieveCount(
|
||||
params: ItemRetrieveCountParams
|
||||
): CompletableFuture<ItemRetrieveCountResponse> = retrieveCount(params, RequestOptions.none())
|
||||
|
||||
/** @see retrieveCount */
|
||||
fun retrieveCount(
|
||||
params: ItemRetrieveCountParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): CompletableFuture<ItemRetrieveCountResponse>
|
||||
|
||||
/**
|
||||
* Resolve a RUN or THREAD item to its current review section and zero-based position for deep
|
||||
* linking.
|
||||
*/
|
||||
fun retrievePlacement(
|
||||
itemId: String,
|
||||
params: ItemRetrievePlacementParams,
|
||||
): CompletableFuture<ItemRetrievePlacementResponse> =
|
||||
retrievePlacement(itemId, params, RequestOptions.none())
|
||||
|
||||
/** @see retrievePlacement */
|
||||
fun retrievePlacement(
|
||||
itemId: String,
|
||||
params: ItemRetrievePlacementParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): CompletableFuture<ItemRetrievePlacementResponse> =
|
||||
retrievePlacement(params.toBuilder().itemId(itemId).build(), requestOptions)
|
||||
|
||||
/** @see retrievePlacement */
|
||||
fun retrievePlacement(
|
||||
params: ItemRetrievePlacementParams
|
||||
): CompletableFuture<ItemRetrievePlacementResponse> =
|
||||
retrievePlacement(params, RequestOptions.none())
|
||||
|
||||
/** @see retrievePlacement */
|
||||
fun retrievePlacement(
|
||||
params: ItemRetrievePlacementParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): CompletableFuture<ItemRetrievePlacementResponse>
|
||||
|
||||
/** A view of [ItemServiceAsync] that provides access to raw HTTP responses for each method. */
|
||||
interface WithRawResponse {
|
||||
|
||||
/**
|
||||
* Returns a view of this service with the given option modifications applied.
|
||||
*
|
||||
* The original service is not modified.
|
||||
*/
|
||||
fun withOptions(modifier: Consumer<ClientOptions.Builder>): ItemServiceAsync.WithRawResponse
|
||||
|
||||
/**
|
||||
* Returns a raw HTTP response for `post /api/v1/annotation-queues/{queue_id}/items`, but is
|
||||
* otherwise the same as [ItemServiceAsync.create].
|
||||
*/
|
||||
fun create(queueId: String): CompletableFuture<HttpResponseFor<ItemCreateResponse>> =
|
||||
create(queueId, ItemCreateParams.none())
|
||||
|
||||
/** @see create */
|
||||
fun create(
|
||||
queueId: String,
|
||||
params: ItemCreateParams = ItemCreateParams.none(),
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): CompletableFuture<HttpResponseFor<ItemCreateResponse>> =
|
||||
create(params.toBuilder().queueId(queueId).build(), requestOptions)
|
||||
|
||||
/** @see create */
|
||||
fun create(
|
||||
queueId: String,
|
||||
params: ItemCreateParams = ItemCreateParams.none(),
|
||||
): CompletableFuture<HttpResponseFor<ItemCreateResponse>> =
|
||||
create(queueId, params, RequestOptions.none())
|
||||
|
||||
/** @see create */
|
||||
fun create(
|
||||
params: ItemCreateParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): CompletableFuture<HttpResponseFor<ItemCreateResponse>>
|
||||
|
||||
/** @see create */
|
||||
fun create(
|
||||
params: ItemCreateParams
|
||||
): CompletableFuture<HttpResponseFor<ItemCreateResponse>> =
|
||||
create(params, RequestOptions.none())
|
||||
|
||||
/** @see create */
|
||||
fun create(
|
||||
queueId: String,
|
||||
requestOptions: RequestOptions,
|
||||
): CompletableFuture<HttpResponseFor<ItemCreateResponse>> =
|
||||
create(queueId, ItemCreateParams.none(), requestOptions)
|
||||
|
||||
/**
|
||||
* Returns a raw HTTP response for `patch
|
||||
* /api/v1/annotation-queues/{queue_id}/items/{item_id}`, but is otherwise the same as
|
||||
* [ItemServiceAsync.update].
|
||||
*/
|
||||
fun update(
|
||||
itemId: String,
|
||||
params: ItemUpdateParams,
|
||||
): CompletableFuture<HttpResponseFor<ItemUpdateResponse>> =
|
||||
update(itemId, params, RequestOptions.none())
|
||||
|
||||
/** @see update */
|
||||
fun update(
|
||||
itemId: String,
|
||||
params: ItemUpdateParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): CompletableFuture<HttpResponseFor<ItemUpdateResponse>> =
|
||||
update(params.toBuilder().itemId(itemId).build(), requestOptions)
|
||||
|
||||
/** @see update */
|
||||
fun update(
|
||||
params: ItemUpdateParams
|
||||
): CompletableFuture<HttpResponseFor<ItemUpdateResponse>> =
|
||||
update(params, RequestOptions.none())
|
||||
|
||||
/** @see update */
|
||||
fun update(
|
||||
params: ItemUpdateParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): CompletableFuture<HttpResponseFor<ItemUpdateResponse>>
|
||||
|
||||
/**
|
||||
* Returns a raw HTTP response for `get /api/v1/annotation-queues/{queue_id}/items`, but is
|
||||
* otherwise the same as [ItemServiceAsync.list].
|
||||
*/
|
||||
fun list(
|
||||
queueId: String,
|
||||
params: ItemListParams,
|
||||
): CompletableFuture<HttpResponseFor<ItemListPageAsync>> =
|
||||
list(queueId, params, RequestOptions.none())
|
||||
|
||||
/** @see list */
|
||||
fun list(
|
||||
queueId: String,
|
||||
params: ItemListParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): CompletableFuture<HttpResponseFor<ItemListPageAsync>> =
|
||||
list(params.toBuilder().queueId(queueId).build(), requestOptions)
|
||||
|
||||
/** @see list */
|
||||
fun list(params: ItemListParams): CompletableFuture<HttpResponseFor<ItemListPageAsync>> =
|
||||
list(params, RequestOptions.none())
|
||||
|
||||
/** @see list */
|
||||
fun list(
|
||||
params: ItemListParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): CompletableFuture<HttpResponseFor<ItemListPageAsync>>
|
||||
|
||||
/**
|
||||
* Returns a raw HTTP response for `post
|
||||
* /api/v1/annotation-queues/items/{queue_item_id}/status`, but is otherwise the same as
|
||||
* [ItemServiceAsync.createStatus].
|
||||
*/
|
||||
fun createStatus(
|
||||
queueItemId: String
|
||||
): CompletableFuture<HttpResponseFor<ItemCreateStatusResponse>> =
|
||||
createStatus(queueItemId, ItemCreateStatusParams.none())
|
||||
|
||||
/** @see createStatus */
|
||||
fun createStatus(
|
||||
queueItemId: String,
|
||||
params: ItemCreateStatusParams = ItemCreateStatusParams.none(),
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): CompletableFuture<HttpResponseFor<ItemCreateStatusResponse>> =
|
||||
createStatus(params.toBuilder().queueItemId(queueItemId).build(), requestOptions)
|
||||
|
||||
/** @see createStatus */
|
||||
fun createStatus(
|
||||
queueItemId: String,
|
||||
params: ItemCreateStatusParams = ItemCreateStatusParams.none(),
|
||||
): CompletableFuture<HttpResponseFor<ItemCreateStatusResponse>> =
|
||||
createStatus(queueItemId, params, RequestOptions.none())
|
||||
|
||||
/** @see createStatus */
|
||||
fun createStatus(
|
||||
params: ItemCreateStatusParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): CompletableFuture<HttpResponseFor<ItemCreateStatusResponse>>
|
||||
|
||||
/** @see createStatus */
|
||||
fun createStatus(
|
||||
params: ItemCreateStatusParams
|
||||
): CompletableFuture<HttpResponseFor<ItemCreateStatusResponse>> =
|
||||
createStatus(params, RequestOptions.none())
|
||||
|
||||
/** @see createStatus */
|
||||
fun createStatus(
|
||||
queueItemId: String,
|
||||
requestOptions: RequestOptions,
|
||||
): CompletableFuture<HttpResponseFor<ItemCreateStatusResponse>> =
|
||||
createStatus(queueItemId, ItemCreateStatusParams.none(), requestOptions)
|
||||
|
||||
/**
|
||||
* Returns a raw HTTP response for `post /api/v1/annotation-queues/{queue_id}/items/delete`,
|
||||
* but is otherwise the same as [ItemServiceAsync.deleteAll].
|
||||
*/
|
||||
fun deleteAll(queueId: String): CompletableFuture<HttpResponseFor<ItemDeleteAllResponse>> =
|
||||
deleteAll(queueId, ItemDeleteAllParams.none())
|
||||
|
||||
/** @see deleteAll */
|
||||
fun deleteAll(
|
||||
queueId: String,
|
||||
params: ItemDeleteAllParams = ItemDeleteAllParams.none(),
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): CompletableFuture<HttpResponseFor<ItemDeleteAllResponse>> =
|
||||
deleteAll(params.toBuilder().queueId(queueId).build(), requestOptions)
|
||||
|
||||
/** @see deleteAll */
|
||||
fun deleteAll(
|
||||
queueId: String,
|
||||
params: ItemDeleteAllParams = ItemDeleteAllParams.none(),
|
||||
): CompletableFuture<HttpResponseFor<ItemDeleteAllResponse>> =
|
||||
deleteAll(queueId, params, RequestOptions.none())
|
||||
|
||||
/** @see deleteAll */
|
||||
fun deleteAll(
|
||||
params: ItemDeleteAllParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): CompletableFuture<HttpResponseFor<ItemDeleteAllResponse>>
|
||||
|
||||
/** @see deleteAll */
|
||||
fun deleteAll(
|
||||
params: ItemDeleteAllParams
|
||||
): CompletableFuture<HttpResponseFor<ItemDeleteAllResponse>> =
|
||||
deleteAll(params, RequestOptions.none())
|
||||
|
||||
/** @see deleteAll */
|
||||
fun deleteAll(
|
||||
queueId: String,
|
||||
requestOptions: RequestOptions,
|
||||
): CompletableFuture<HttpResponseFor<ItemDeleteAllResponse>> =
|
||||
deleteAll(queueId, ItemDeleteAllParams.none(), requestOptions)
|
||||
|
||||
/**
|
||||
* Returns a raw HTTP response for `get /api/v1/annotation-queues/{queue_id}/items/count`,
|
||||
* but is otherwise the same as [ItemServiceAsync.retrieveCount].
|
||||
*/
|
||||
fun retrieveCount(
|
||||
queueId: String,
|
||||
params: ItemRetrieveCountParams,
|
||||
): CompletableFuture<HttpResponseFor<ItemRetrieveCountResponse>> =
|
||||
retrieveCount(queueId, params, RequestOptions.none())
|
||||
|
||||
/** @see retrieveCount */
|
||||
fun retrieveCount(
|
||||
queueId: String,
|
||||
params: ItemRetrieveCountParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): CompletableFuture<HttpResponseFor<ItemRetrieveCountResponse>> =
|
||||
retrieveCount(params.toBuilder().queueId(queueId).build(), requestOptions)
|
||||
|
||||
/** @see retrieveCount */
|
||||
fun retrieveCount(
|
||||
params: ItemRetrieveCountParams
|
||||
): CompletableFuture<HttpResponseFor<ItemRetrieveCountResponse>> =
|
||||
retrieveCount(params, RequestOptions.none())
|
||||
|
||||
/** @see retrieveCount */
|
||||
fun retrieveCount(
|
||||
params: ItemRetrieveCountParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): CompletableFuture<HttpResponseFor<ItemRetrieveCountResponse>>
|
||||
|
||||
/**
|
||||
* Returns a raw HTTP response for `get
|
||||
* /api/v1/annotation-queues/{queue_id}/items/{item_id}/placement`, but is otherwise the
|
||||
* same as [ItemServiceAsync.retrievePlacement].
|
||||
*/
|
||||
fun retrievePlacement(
|
||||
itemId: String,
|
||||
params: ItemRetrievePlacementParams,
|
||||
): CompletableFuture<HttpResponseFor<ItemRetrievePlacementResponse>> =
|
||||
retrievePlacement(itemId, params, RequestOptions.none())
|
||||
|
||||
/** @see retrievePlacement */
|
||||
fun retrievePlacement(
|
||||
itemId: String,
|
||||
params: ItemRetrievePlacementParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): CompletableFuture<HttpResponseFor<ItemRetrievePlacementResponse>> =
|
||||
retrievePlacement(params.toBuilder().itemId(itemId).build(), requestOptions)
|
||||
|
||||
/** @see retrievePlacement */
|
||||
fun retrievePlacement(
|
||||
params: ItemRetrievePlacementParams
|
||||
): CompletableFuture<HttpResponseFor<ItemRetrievePlacementResponse>> =
|
||||
retrievePlacement(params, RequestOptions.none())
|
||||
|
||||
/** @see retrievePlacement */
|
||||
fun retrievePlacement(
|
||||
params: ItemRetrievePlacementParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): CompletableFuture<HttpResponseFor<ItemRetrievePlacementResponse>>
|
||||
}
|
||||
}
|
||||
+403
@@ -0,0 +1,403 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.services.async.annotationqueues
|
||||
|
||||
import com.langchain.smith.core.ClientOptions
|
||||
import com.langchain.smith.core.RequestOptions
|
||||
import com.langchain.smith.core.checkRequired
|
||||
import com.langchain.smith.core.handlers.errorBodyHandler
|
||||
import com.langchain.smith.core.handlers.errorHandler
|
||||
import com.langchain.smith.core.handlers.jsonHandler
|
||||
import com.langchain.smith.core.http.HttpMethod
|
||||
import com.langchain.smith.core.http.HttpRequest
|
||||
import com.langchain.smith.core.http.HttpResponse
|
||||
import com.langchain.smith.core.http.HttpResponse.Handler
|
||||
import com.langchain.smith.core.http.HttpResponseFor
|
||||
import com.langchain.smith.core.http.json
|
||||
import com.langchain.smith.core.http.parseable
|
||||
import com.langchain.smith.core.prepareAsync
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemCreateParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemCreateResponse
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemCreateStatusParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemCreateStatusResponse
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemDeleteAllParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemDeleteAllResponse
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemListPageAsync
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemListPageResponse
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemListParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemRetrieveCountParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemRetrieveCountResponse
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemRetrievePlacementParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemRetrievePlacementResponse
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemUpdateParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemUpdateResponse
|
||||
import java.util.concurrent.CompletableFuture
|
||||
import java.util.function.Consumer
|
||||
import kotlin.jvm.optionals.getOrNull
|
||||
|
||||
class ItemServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) :
|
||||
ItemServiceAsync {
|
||||
|
||||
private val withRawResponse: ItemServiceAsync.WithRawResponse by lazy {
|
||||
WithRawResponseImpl(clientOptions)
|
||||
}
|
||||
|
||||
override fun withRawResponse(): ItemServiceAsync.WithRawResponse = withRawResponse
|
||||
|
||||
override fun withOptions(modifier: Consumer<ClientOptions.Builder>): ItemServiceAsync =
|
||||
ItemServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build())
|
||||
|
||||
override fun create(
|
||||
params: ItemCreateParams,
|
||||
requestOptions: RequestOptions,
|
||||
): CompletableFuture<ItemCreateResponse> =
|
||||
// post /api/v1/annotation-queues/{queue_id}/items
|
||||
withRawResponse().create(params, requestOptions).thenApply { it.parse() }
|
||||
|
||||
override fun update(
|
||||
params: ItemUpdateParams,
|
||||
requestOptions: RequestOptions,
|
||||
): CompletableFuture<ItemUpdateResponse> =
|
||||
// patch /api/v1/annotation-queues/{queue_id}/items/{item_id}
|
||||
withRawResponse().update(params, requestOptions).thenApply { it.parse() }
|
||||
|
||||
override fun list(
|
||||
params: ItemListParams,
|
||||
requestOptions: RequestOptions,
|
||||
): CompletableFuture<ItemListPageAsync> =
|
||||
// get /api/v1/annotation-queues/{queue_id}/items
|
||||
withRawResponse().list(params, requestOptions).thenApply { it.parse() }
|
||||
|
||||
override fun createStatus(
|
||||
params: ItemCreateStatusParams,
|
||||
requestOptions: RequestOptions,
|
||||
): CompletableFuture<ItemCreateStatusResponse> =
|
||||
// post /api/v1/annotation-queues/items/{queue_item_id}/status
|
||||
withRawResponse().createStatus(params, requestOptions).thenApply { it.parse() }
|
||||
|
||||
override fun deleteAll(
|
||||
params: ItemDeleteAllParams,
|
||||
requestOptions: RequestOptions,
|
||||
): CompletableFuture<ItemDeleteAllResponse> =
|
||||
// post /api/v1/annotation-queues/{queue_id}/items/delete
|
||||
withRawResponse().deleteAll(params, requestOptions).thenApply { it.parse() }
|
||||
|
||||
override fun retrieveCount(
|
||||
params: ItemRetrieveCountParams,
|
||||
requestOptions: RequestOptions,
|
||||
): CompletableFuture<ItemRetrieveCountResponse> =
|
||||
// get /api/v1/annotation-queues/{queue_id}/items/count
|
||||
withRawResponse().retrieveCount(params, requestOptions).thenApply { it.parse() }
|
||||
|
||||
override fun retrievePlacement(
|
||||
params: ItemRetrievePlacementParams,
|
||||
requestOptions: RequestOptions,
|
||||
): CompletableFuture<ItemRetrievePlacementResponse> =
|
||||
// get /api/v1/annotation-queues/{queue_id}/items/{item_id}/placement
|
||||
withRawResponse().retrievePlacement(params, requestOptions).thenApply { it.parse() }
|
||||
|
||||
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
|
||||
ItemServiceAsync.WithRawResponse {
|
||||
|
||||
private val errorHandler: Handler<HttpResponse> =
|
||||
errorHandler(errorBodyHandler(clientOptions.jsonMapper))
|
||||
|
||||
override fun withOptions(
|
||||
modifier: Consumer<ClientOptions.Builder>
|
||||
): ItemServiceAsync.WithRawResponse =
|
||||
ItemServiceAsyncImpl.WithRawResponseImpl(
|
||||
clientOptions.toBuilder().apply(modifier::accept).build()
|
||||
)
|
||||
|
||||
private val createHandler: Handler<ItemCreateResponse> =
|
||||
jsonHandler<ItemCreateResponse>(clientOptions.jsonMapper)
|
||||
|
||||
override fun create(
|
||||
params: ItemCreateParams,
|
||||
requestOptions: RequestOptions,
|
||||
): CompletableFuture<HttpResponseFor<ItemCreateResponse>> {
|
||||
// We check here instead of in the params builder because this can be specified
|
||||
// positionally or in the params class.
|
||||
checkRequired("queueId", params.queueId().getOrNull())
|
||||
val request =
|
||||
HttpRequest.builder()
|
||||
.method(HttpMethod.POST)
|
||||
.baseUrl(clientOptions.baseUrl())
|
||||
.addPathSegments(
|
||||
"api",
|
||||
"v1",
|
||||
"annotation-queues",
|
||||
params._pathParam(0),
|
||||
"items",
|
||||
)
|
||||
.body(json(clientOptions.jsonMapper, params._body()))
|
||||
.build()
|
||||
.prepareAsync(clientOptions, params)
|
||||
val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions))
|
||||
return request
|
||||
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
|
||||
.thenApply { response ->
|
||||
errorHandler.handle(response).parseable {
|
||||
response
|
||||
.use { createHandler.handle(it) }
|
||||
.also {
|
||||
if (requestOptions.responseValidation!!) {
|
||||
it.validate()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val updateHandler: Handler<ItemUpdateResponse> =
|
||||
jsonHandler<ItemUpdateResponse>(clientOptions.jsonMapper)
|
||||
|
||||
override fun update(
|
||||
params: ItemUpdateParams,
|
||||
requestOptions: RequestOptions,
|
||||
): CompletableFuture<HttpResponseFor<ItemUpdateResponse>> {
|
||||
// We check here instead of in the params builder because this can be specified
|
||||
// positionally or in the params class.
|
||||
checkRequired("itemId", params.itemId().getOrNull())
|
||||
val request =
|
||||
HttpRequest.builder()
|
||||
.method(HttpMethod.PATCH)
|
||||
.baseUrl(clientOptions.baseUrl())
|
||||
.addPathSegments(
|
||||
"api",
|
||||
"v1",
|
||||
"annotation-queues",
|
||||
params._pathParam(0),
|
||||
"items",
|
||||
params._pathParam(1),
|
||||
)
|
||||
.body(json(clientOptions.jsonMapper, params._body()))
|
||||
.build()
|
||||
.prepareAsync(clientOptions, params)
|
||||
val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions))
|
||||
return request
|
||||
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
|
||||
.thenApply { response ->
|
||||
errorHandler.handle(response).parseable {
|
||||
response
|
||||
.use { updateHandler.handle(it) }
|
||||
.also {
|
||||
if (requestOptions.responseValidation!!) {
|
||||
it.validate()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val listHandler: Handler<ItemListPageResponse> =
|
||||
jsonHandler<ItemListPageResponse>(clientOptions.jsonMapper)
|
||||
|
||||
override fun list(
|
||||
params: ItemListParams,
|
||||
requestOptions: RequestOptions,
|
||||
): CompletableFuture<HttpResponseFor<ItemListPageAsync>> {
|
||||
// We check here instead of in the params builder because this can be specified
|
||||
// positionally or in the params class.
|
||||
checkRequired("queueId", params.queueId().getOrNull())
|
||||
val request =
|
||||
HttpRequest.builder()
|
||||
.method(HttpMethod.GET)
|
||||
.baseUrl(clientOptions.baseUrl())
|
||||
.addPathSegments(
|
||||
"api",
|
||||
"v1",
|
||||
"annotation-queues",
|
||||
params._pathParam(0),
|
||||
"items",
|
||||
)
|
||||
.build()
|
||||
.prepareAsync(clientOptions, params)
|
||||
val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions))
|
||||
return request
|
||||
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
|
||||
.thenApply { response ->
|
||||
errorHandler.handle(response).parseable {
|
||||
response
|
||||
.use { listHandler.handle(it) }
|
||||
.also {
|
||||
if (requestOptions.responseValidation!!) {
|
||||
it.validate()
|
||||
}
|
||||
}
|
||||
.let {
|
||||
ItemListPageAsync.builder()
|
||||
.service(ItemServiceAsyncImpl(clientOptions))
|
||||
.streamHandlerExecutor(clientOptions.streamHandlerExecutor)
|
||||
.params(params)
|
||||
.response(it)
|
||||
.build()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val createStatusHandler: Handler<ItemCreateStatusResponse> =
|
||||
jsonHandler<ItemCreateStatusResponse>(clientOptions.jsonMapper)
|
||||
|
||||
override fun createStatus(
|
||||
params: ItemCreateStatusParams,
|
||||
requestOptions: RequestOptions,
|
||||
): CompletableFuture<HttpResponseFor<ItemCreateStatusResponse>> {
|
||||
// We check here instead of in the params builder because this can be specified
|
||||
// positionally or in the params class.
|
||||
checkRequired("queueItemId", params.queueItemId().getOrNull())
|
||||
val request =
|
||||
HttpRequest.builder()
|
||||
.method(HttpMethod.POST)
|
||||
.baseUrl(clientOptions.baseUrl())
|
||||
.addPathSegments(
|
||||
"api",
|
||||
"v1",
|
||||
"annotation-queues",
|
||||
"items",
|
||||
params._pathParam(0),
|
||||
"status",
|
||||
)
|
||||
.body(json(clientOptions.jsonMapper, params._body()))
|
||||
.build()
|
||||
.prepareAsync(clientOptions, params)
|
||||
val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions))
|
||||
return request
|
||||
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
|
||||
.thenApply { response ->
|
||||
errorHandler.handle(response).parseable {
|
||||
response
|
||||
.use { createStatusHandler.handle(it) }
|
||||
.also {
|
||||
if (requestOptions.responseValidation!!) {
|
||||
it.validate()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val deleteAllHandler: Handler<ItemDeleteAllResponse> =
|
||||
jsonHandler<ItemDeleteAllResponse>(clientOptions.jsonMapper)
|
||||
|
||||
override fun deleteAll(
|
||||
params: ItemDeleteAllParams,
|
||||
requestOptions: RequestOptions,
|
||||
): CompletableFuture<HttpResponseFor<ItemDeleteAllResponse>> {
|
||||
// We check here instead of in the params builder because this can be specified
|
||||
// positionally or in the params class.
|
||||
checkRequired("queueId", params.queueId().getOrNull())
|
||||
val request =
|
||||
HttpRequest.builder()
|
||||
.method(HttpMethod.POST)
|
||||
.baseUrl(clientOptions.baseUrl())
|
||||
.addPathSegments(
|
||||
"api",
|
||||
"v1",
|
||||
"annotation-queues",
|
||||
params._pathParam(0),
|
||||
"items",
|
||||
"delete",
|
||||
)
|
||||
.body(json(clientOptions.jsonMapper, params._body()))
|
||||
.build()
|
||||
.prepareAsync(clientOptions, params)
|
||||
val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions))
|
||||
return request
|
||||
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
|
||||
.thenApply { response ->
|
||||
errorHandler.handle(response).parseable {
|
||||
response
|
||||
.use { deleteAllHandler.handle(it) }
|
||||
.also {
|
||||
if (requestOptions.responseValidation!!) {
|
||||
it.validate()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val retrieveCountHandler: Handler<ItemRetrieveCountResponse> =
|
||||
jsonHandler<ItemRetrieveCountResponse>(clientOptions.jsonMapper)
|
||||
|
||||
override fun retrieveCount(
|
||||
params: ItemRetrieveCountParams,
|
||||
requestOptions: RequestOptions,
|
||||
): CompletableFuture<HttpResponseFor<ItemRetrieveCountResponse>> {
|
||||
// We check here instead of in the params builder because this can be specified
|
||||
// positionally or in the params class.
|
||||
checkRequired("queueId", params.queueId().getOrNull())
|
||||
val request =
|
||||
HttpRequest.builder()
|
||||
.method(HttpMethod.GET)
|
||||
.baseUrl(clientOptions.baseUrl())
|
||||
.addPathSegments(
|
||||
"api",
|
||||
"v1",
|
||||
"annotation-queues",
|
||||
params._pathParam(0),
|
||||
"items",
|
||||
"count",
|
||||
)
|
||||
.build()
|
||||
.prepareAsync(clientOptions, params)
|
||||
val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions))
|
||||
return request
|
||||
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
|
||||
.thenApply { response ->
|
||||
errorHandler.handle(response).parseable {
|
||||
response
|
||||
.use { retrieveCountHandler.handle(it) }
|
||||
.also {
|
||||
if (requestOptions.responseValidation!!) {
|
||||
it.validate()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val retrievePlacementHandler: Handler<ItemRetrievePlacementResponse> =
|
||||
jsonHandler<ItemRetrievePlacementResponse>(clientOptions.jsonMapper)
|
||||
|
||||
override fun retrievePlacement(
|
||||
params: ItemRetrievePlacementParams,
|
||||
requestOptions: RequestOptions,
|
||||
): CompletableFuture<HttpResponseFor<ItemRetrievePlacementResponse>> {
|
||||
// We check here instead of in the params builder because this can be specified
|
||||
// positionally or in the params class.
|
||||
checkRequired("itemId", params.itemId().getOrNull())
|
||||
val request =
|
||||
HttpRequest.builder()
|
||||
.method(HttpMethod.GET)
|
||||
.baseUrl(clientOptions.baseUrl())
|
||||
.addPathSegments(
|
||||
"api",
|
||||
"v1",
|
||||
"annotation-queues",
|
||||
params._pathParam(0),
|
||||
"items",
|
||||
params._pathParam(1),
|
||||
"placement",
|
||||
)
|
||||
.build()
|
||||
.prepareAsync(clientOptions, params)
|
||||
val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions))
|
||||
return request
|
||||
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
|
||||
.thenApply { response ->
|
||||
errorHandler.handle(response).parseable {
|
||||
response
|
||||
.use { retrievePlacementHandler.handle(it) }
|
||||
.also {
|
||||
if (requestOptions.responseValidation!!) {
|
||||
it.validate()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
@@ -29,6 +29,7 @@ import com.langchain.smith.models.annotationqueues.AnnotationQueueSizeSchema
|
||||
import com.langchain.smith.models.annotationqueues.AnnotationQueueUpdateParams
|
||||
import com.langchain.smith.models.annotationqueues.AnnotationQueueUpdateResponse
|
||||
import com.langchain.smith.models.annotationqueues.RunSchemaWithAnnotationQueueInfo
|
||||
import com.langchain.smith.services.blocking.annotationqueues.ItemService
|
||||
import com.langchain.smith.services.blocking.annotationqueues.RunService
|
||||
import java.util.function.Consumer
|
||||
|
||||
@@ -48,6 +49,8 @@ interface AnnotationQueueService {
|
||||
|
||||
fun runs(): RunService
|
||||
|
||||
fun items(): ItemService
|
||||
|
||||
/** Get Annotation Queue */
|
||||
fun retrieve(queueId: String): AnnotationQueueRetrieveResponse =
|
||||
retrieve(queueId, AnnotationQueueRetrieveParams.none())
|
||||
@@ -452,6 +455,8 @@ interface AnnotationQueueService {
|
||||
|
||||
fun runs(): RunService.WithRawResponse
|
||||
|
||||
fun items(): ItemService.WithRawResponse
|
||||
|
||||
/**
|
||||
* Returns a raw HTTP response for `get /api/v1/annotation-queues/{queue_id}`, but is
|
||||
* otherwise the same as [AnnotationQueueService.retrieve].
|
||||
|
||||
+12
@@ -40,6 +40,8 @@ import com.langchain.smith.models.annotationqueues.AnnotationQueueSizeSchema
|
||||
import com.langchain.smith.models.annotationqueues.AnnotationQueueUpdateParams
|
||||
import com.langchain.smith.models.annotationqueues.AnnotationQueueUpdateResponse
|
||||
import com.langchain.smith.models.annotationqueues.RunSchemaWithAnnotationQueueInfo
|
||||
import com.langchain.smith.services.blocking.annotationqueues.ItemService
|
||||
import com.langchain.smith.services.blocking.annotationqueues.ItemServiceImpl
|
||||
import com.langchain.smith.services.blocking.annotationqueues.RunService
|
||||
import com.langchain.smith.services.blocking.annotationqueues.RunServiceImpl
|
||||
import java.util.function.Consumer
|
||||
@@ -54,6 +56,8 @@ class AnnotationQueueServiceImpl internal constructor(private val clientOptions:
|
||||
|
||||
private val runs: RunService by lazy { RunServiceImpl(clientOptions) }
|
||||
|
||||
private val items: ItemService by lazy { ItemServiceImpl(clientOptions) }
|
||||
|
||||
override fun withRawResponse(): AnnotationQueueService.WithRawResponse = withRawResponse
|
||||
|
||||
override fun withOptions(modifier: Consumer<ClientOptions.Builder>): AnnotationQueueService =
|
||||
@@ -61,6 +65,8 @@ class AnnotationQueueServiceImpl internal constructor(private val clientOptions:
|
||||
|
||||
override fun runs(): RunService = runs
|
||||
|
||||
override fun items(): ItemService = items
|
||||
|
||||
override fun retrieve(
|
||||
params: AnnotationQueueRetrieveParams,
|
||||
requestOptions: RequestOptions,
|
||||
@@ -162,6 +168,10 @@ class AnnotationQueueServiceImpl internal constructor(private val clientOptions:
|
||||
RunServiceImpl.WithRawResponseImpl(clientOptions)
|
||||
}
|
||||
|
||||
private val items: ItemService.WithRawResponse by lazy {
|
||||
ItemServiceImpl.WithRawResponseImpl(clientOptions)
|
||||
}
|
||||
|
||||
override fun withOptions(
|
||||
modifier: Consumer<ClientOptions.Builder>
|
||||
): AnnotationQueueService.WithRawResponse =
|
||||
@@ -171,6 +181,8 @@ class AnnotationQueueServiceImpl internal constructor(private val clientOptions:
|
||||
|
||||
override fun runs(): RunService.WithRawResponse = runs
|
||||
|
||||
override fun items(): ItemService.WithRawResponse = items
|
||||
|
||||
private val retrieveHandler: Handler<AnnotationQueueRetrieveResponse> =
|
||||
jsonHandler<AnnotationQueueRetrieveResponse>(clientOptions.jsonMapper)
|
||||
|
||||
|
||||
+517
@@ -0,0 +1,517 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.services.blocking.annotationqueues
|
||||
|
||||
import com.google.errorprone.annotations.MustBeClosed
|
||||
import com.langchain.smith.core.ClientOptions
|
||||
import com.langchain.smith.core.RequestOptions
|
||||
import com.langchain.smith.core.http.HttpResponseFor
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemCreateParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemCreateResponse
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemCreateStatusParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemCreateStatusResponse
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemDeleteAllParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemDeleteAllResponse
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemListPage
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemListParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemRetrieveCountParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemRetrieveCountResponse
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemRetrievePlacementParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemRetrievePlacementResponse
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemUpdateParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemUpdateResponse
|
||||
import java.util.function.Consumer
|
||||
|
||||
interface ItemService {
|
||||
|
||||
/**
|
||||
* Returns a view of this service that provides access to raw HTTP responses for each method.
|
||||
*/
|
||||
fun withRawResponse(): WithRawResponse
|
||||
|
||||
/**
|
||||
* Returns a view of this service with the given option modifications applied.
|
||||
*
|
||||
* The original service is not modified.
|
||||
*/
|
||||
fun withOptions(modifier: Consumer<ClientOptions.Builder>): ItemService
|
||||
|
||||
/**
|
||||
* Add RUN or THREAD items to a single annotation queue. THREAD items require thread_id and
|
||||
* session_id; RUN items require run_id, or source_proposed_example_id with lookup coordinates
|
||||
* when applicable.
|
||||
*/
|
||||
fun create(queueId: String): ItemCreateResponse = create(queueId, ItemCreateParams.none())
|
||||
|
||||
/** @see create */
|
||||
fun create(
|
||||
queueId: String,
|
||||
params: ItemCreateParams = ItemCreateParams.none(),
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): ItemCreateResponse = create(params.toBuilder().queueId(queueId).build(), requestOptions)
|
||||
|
||||
/** @see create */
|
||||
fun create(
|
||||
queueId: String,
|
||||
params: ItemCreateParams = ItemCreateParams.none(),
|
||||
): ItemCreateResponse = create(queueId, params, RequestOptions.none())
|
||||
|
||||
/** @see create */
|
||||
fun create(
|
||||
params: ItemCreateParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): ItemCreateResponse
|
||||
|
||||
/** @see create */
|
||||
fun create(params: ItemCreateParams): ItemCreateResponse = create(params, RequestOptions.none())
|
||||
|
||||
/** @see create */
|
||||
fun create(queueId: String, requestOptions: RequestOptions): ItemCreateResponse =
|
||||
create(queueId, ItemCreateParams.none(), requestOptions)
|
||||
|
||||
/**
|
||||
* Partially update membership fields (added_at, last_reviewed_time) for a single annotation
|
||||
* queue item by membership id. Works for RUN and THREAD rows. Omit a field (or pass JSON null)
|
||||
* to leave it unchanged.
|
||||
*/
|
||||
fun update(itemId: String, params: ItemUpdateParams): ItemUpdateResponse =
|
||||
update(itemId, params, RequestOptions.none())
|
||||
|
||||
/** @see update */
|
||||
fun update(
|
||||
itemId: String,
|
||||
params: ItemUpdateParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): ItemUpdateResponse = update(params.toBuilder().itemId(itemId).build(), requestOptions)
|
||||
|
||||
/** @see update */
|
||||
fun update(params: ItemUpdateParams): ItemUpdateResponse = update(params, RequestOptions.none())
|
||||
|
||||
/** @see update */
|
||||
fun update(
|
||||
params: ItemUpdateParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): ItemUpdateResponse
|
||||
|
||||
/**
|
||||
* List RUN and THREAD items in a single annotation queue for one review status section, with
|
||||
* opaque cursor pagination. Optional item_type=RUN|THREAD filters the page. direction=backward
|
||||
* returns items before the supplied cursor. Response is membership metadata only (no nested
|
||||
* run/thread store payloads). status=archived returns items in annotation_queue_runs_archive
|
||||
* (queue completion rule met), not merely items the caller personally marked completed.
|
||||
*/
|
||||
fun list(queueId: String, params: ItemListParams): ItemListPage =
|
||||
list(queueId, params, RequestOptions.none())
|
||||
|
||||
/** @see list */
|
||||
fun list(
|
||||
queueId: String,
|
||||
params: ItemListParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): ItemListPage = list(params.toBuilder().queueId(queueId).build(), requestOptions)
|
||||
|
||||
/** @see list */
|
||||
fun list(params: ItemListParams): ItemListPage = list(params, RequestOptions.none())
|
||||
|
||||
/** @see list */
|
||||
fun list(
|
||||
params: ItemListParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): ItemListPage
|
||||
|
||||
/**
|
||||
* Log the caller's reviewer status for a RUN or THREAD annotation queue item. A null status
|
||||
* re-shows the item for this reviewer.
|
||||
*/
|
||||
fun createStatus(queueItemId: String): ItemCreateStatusResponse =
|
||||
createStatus(queueItemId, ItemCreateStatusParams.none())
|
||||
|
||||
/** @see createStatus */
|
||||
fun createStatus(
|
||||
queueItemId: String,
|
||||
params: ItemCreateStatusParams = ItemCreateStatusParams.none(),
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): ItemCreateStatusResponse =
|
||||
createStatus(params.toBuilder().queueItemId(queueItemId).build(), requestOptions)
|
||||
|
||||
/** @see createStatus */
|
||||
fun createStatus(
|
||||
queueItemId: String,
|
||||
params: ItemCreateStatusParams = ItemCreateStatusParams.none(),
|
||||
): ItemCreateStatusResponse = createStatus(queueItemId, params, RequestOptions.none())
|
||||
|
||||
/** @see createStatus */
|
||||
fun createStatus(
|
||||
params: ItemCreateStatusParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): ItemCreateStatusResponse
|
||||
|
||||
/** @see createStatus */
|
||||
fun createStatus(params: ItemCreateStatusParams): ItemCreateStatusResponse =
|
||||
createStatus(params, RequestOptions.none())
|
||||
|
||||
/** @see createStatus */
|
||||
fun createStatus(
|
||||
queueItemId: String,
|
||||
requestOptions: RequestOptions,
|
||||
): ItemCreateStatusResponse =
|
||||
createStatus(queueItemId, ItemCreateStatusParams.none(), requestOptions)
|
||||
|
||||
/** Remove RUN or THREAD items from a single annotation queue by membership ID. */
|
||||
fun deleteAll(queueId: String): ItemDeleteAllResponse =
|
||||
deleteAll(queueId, ItemDeleteAllParams.none())
|
||||
|
||||
/** @see deleteAll */
|
||||
fun deleteAll(
|
||||
queueId: String,
|
||||
params: ItemDeleteAllParams = ItemDeleteAllParams.none(),
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): ItemDeleteAllResponse =
|
||||
deleteAll(params.toBuilder().queueId(queueId).build(), requestOptions)
|
||||
|
||||
/** @see deleteAll */
|
||||
fun deleteAll(
|
||||
queueId: String,
|
||||
params: ItemDeleteAllParams = ItemDeleteAllParams.none(),
|
||||
): ItemDeleteAllResponse = deleteAll(queueId, params, RequestOptions.none())
|
||||
|
||||
/** @see deleteAll */
|
||||
fun deleteAll(
|
||||
params: ItemDeleteAllParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): ItemDeleteAllResponse
|
||||
|
||||
/** @see deleteAll */
|
||||
fun deleteAll(params: ItemDeleteAllParams): ItemDeleteAllResponse =
|
||||
deleteAll(params, RequestOptions.none())
|
||||
|
||||
/** @see deleteAll */
|
||||
fun deleteAll(queueId: String, requestOptions: RequestOptions): ItemDeleteAllResponse =
|
||||
deleteAll(queueId, ItemDeleteAllParams.none(), requestOptions)
|
||||
|
||||
/**
|
||||
* Returns the number of annotation queue items for the requested reviewer-specific or archived
|
||||
* bucket.
|
||||
*/
|
||||
fun retrieveCount(queueId: String, params: ItemRetrieveCountParams): ItemRetrieveCountResponse =
|
||||
retrieveCount(queueId, params, RequestOptions.none())
|
||||
|
||||
/** @see retrieveCount */
|
||||
fun retrieveCount(
|
||||
queueId: String,
|
||||
params: ItemRetrieveCountParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): ItemRetrieveCountResponse =
|
||||
retrieveCount(params.toBuilder().queueId(queueId).build(), requestOptions)
|
||||
|
||||
/** @see retrieveCount */
|
||||
fun retrieveCount(params: ItemRetrieveCountParams): ItemRetrieveCountResponse =
|
||||
retrieveCount(params, RequestOptions.none())
|
||||
|
||||
/** @see retrieveCount */
|
||||
fun retrieveCount(
|
||||
params: ItemRetrieveCountParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): ItemRetrieveCountResponse
|
||||
|
||||
/**
|
||||
* Resolve a RUN or THREAD item to its current review section and zero-based position for deep
|
||||
* linking.
|
||||
*/
|
||||
fun retrievePlacement(
|
||||
itemId: String,
|
||||
params: ItemRetrievePlacementParams,
|
||||
): ItemRetrievePlacementResponse = retrievePlacement(itemId, params, RequestOptions.none())
|
||||
|
||||
/** @see retrievePlacement */
|
||||
fun retrievePlacement(
|
||||
itemId: String,
|
||||
params: ItemRetrievePlacementParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): ItemRetrievePlacementResponse =
|
||||
retrievePlacement(params.toBuilder().itemId(itemId).build(), requestOptions)
|
||||
|
||||
/** @see retrievePlacement */
|
||||
fun retrievePlacement(params: ItemRetrievePlacementParams): ItemRetrievePlacementResponse =
|
||||
retrievePlacement(params, RequestOptions.none())
|
||||
|
||||
/** @see retrievePlacement */
|
||||
fun retrievePlacement(
|
||||
params: ItemRetrievePlacementParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): ItemRetrievePlacementResponse
|
||||
|
||||
/** A view of [ItemService] that provides access to raw HTTP responses for each method. */
|
||||
interface WithRawResponse {
|
||||
|
||||
/**
|
||||
* Returns a view of this service with the given option modifications applied.
|
||||
*
|
||||
* The original service is not modified.
|
||||
*/
|
||||
fun withOptions(modifier: Consumer<ClientOptions.Builder>): ItemService.WithRawResponse
|
||||
|
||||
/**
|
||||
* Returns a raw HTTP response for `post /api/v1/annotation-queues/{queue_id}/items`, but is
|
||||
* otherwise the same as [ItemService.create].
|
||||
*/
|
||||
@MustBeClosed
|
||||
fun create(queueId: String): HttpResponseFor<ItemCreateResponse> =
|
||||
create(queueId, ItemCreateParams.none())
|
||||
|
||||
/** @see create */
|
||||
@MustBeClosed
|
||||
fun create(
|
||||
queueId: String,
|
||||
params: ItemCreateParams = ItemCreateParams.none(),
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): HttpResponseFor<ItemCreateResponse> =
|
||||
create(params.toBuilder().queueId(queueId).build(), requestOptions)
|
||||
|
||||
/** @see create */
|
||||
@MustBeClosed
|
||||
fun create(
|
||||
queueId: String,
|
||||
params: ItemCreateParams = ItemCreateParams.none(),
|
||||
): HttpResponseFor<ItemCreateResponse> = create(queueId, params, RequestOptions.none())
|
||||
|
||||
/** @see create */
|
||||
@MustBeClosed
|
||||
fun create(
|
||||
params: ItemCreateParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): HttpResponseFor<ItemCreateResponse>
|
||||
|
||||
/** @see create */
|
||||
@MustBeClosed
|
||||
fun create(params: ItemCreateParams): HttpResponseFor<ItemCreateResponse> =
|
||||
create(params, RequestOptions.none())
|
||||
|
||||
/** @see create */
|
||||
@MustBeClosed
|
||||
fun create(
|
||||
queueId: String,
|
||||
requestOptions: RequestOptions,
|
||||
): HttpResponseFor<ItemCreateResponse> =
|
||||
create(queueId, ItemCreateParams.none(), requestOptions)
|
||||
|
||||
/**
|
||||
* Returns a raw HTTP response for `patch
|
||||
* /api/v1/annotation-queues/{queue_id}/items/{item_id}`, but is otherwise the same as
|
||||
* [ItemService.update].
|
||||
*/
|
||||
@MustBeClosed
|
||||
fun update(itemId: String, params: ItemUpdateParams): HttpResponseFor<ItemUpdateResponse> =
|
||||
update(itemId, params, RequestOptions.none())
|
||||
|
||||
/** @see update */
|
||||
@MustBeClosed
|
||||
fun update(
|
||||
itemId: String,
|
||||
params: ItemUpdateParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): HttpResponseFor<ItemUpdateResponse> =
|
||||
update(params.toBuilder().itemId(itemId).build(), requestOptions)
|
||||
|
||||
/** @see update */
|
||||
@MustBeClosed
|
||||
fun update(params: ItemUpdateParams): HttpResponseFor<ItemUpdateResponse> =
|
||||
update(params, RequestOptions.none())
|
||||
|
||||
/** @see update */
|
||||
@MustBeClosed
|
||||
fun update(
|
||||
params: ItemUpdateParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): HttpResponseFor<ItemUpdateResponse>
|
||||
|
||||
/**
|
||||
* Returns a raw HTTP response for `get /api/v1/annotation-queues/{queue_id}/items`, but is
|
||||
* otherwise the same as [ItemService.list].
|
||||
*/
|
||||
@MustBeClosed
|
||||
fun list(queueId: String, params: ItemListParams): HttpResponseFor<ItemListPage> =
|
||||
list(queueId, params, RequestOptions.none())
|
||||
|
||||
/** @see list */
|
||||
@MustBeClosed
|
||||
fun list(
|
||||
queueId: String,
|
||||
params: ItemListParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): HttpResponseFor<ItemListPage> =
|
||||
list(params.toBuilder().queueId(queueId).build(), requestOptions)
|
||||
|
||||
/** @see list */
|
||||
@MustBeClosed
|
||||
fun list(params: ItemListParams): HttpResponseFor<ItemListPage> =
|
||||
list(params, RequestOptions.none())
|
||||
|
||||
/** @see list */
|
||||
@MustBeClosed
|
||||
fun list(
|
||||
params: ItemListParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): HttpResponseFor<ItemListPage>
|
||||
|
||||
/**
|
||||
* Returns a raw HTTP response for `post
|
||||
* /api/v1/annotation-queues/items/{queue_item_id}/status`, but is otherwise the same as
|
||||
* [ItemService.createStatus].
|
||||
*/
|
||||
@MustBeClosed
|
||||
fun createStatus(queueItemId: String): HttpResponseFor<ItemCreateStatusResponse> =
|
||||
createStatus(queueItemId, ItemCreateStatusParams.none())
|
||||
|
||||
/** @see createStatus */
|
||||
@MustBeClosed
|
||||
fun createStatus(
|
||||
queueItemId: String,
|
||||
params: ItemCreateStatusParams = ItemCreateStatusParams.none(),
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): HttpResponseFor<ItemCreateStatusResponse> =
|
||||
createStatus(params.toBuilder().queueItemId(queueItemId).build(), requestOptions)
|
||||
|
||||
/** @see createStatus */
|
||||
@MustBeClosed
|
||||
fun createStatus(
|
||||
queueItemId: String,
|
||||
params: ItemCreateStatusParams = ItemCreateStatusParams.none(),
|
||||
): HttpResponseFor<ItemCreateStatusResponse> =
|
||||
createStatus(queueItemId, params, RequestOptions.none())
|
||||
|
||||
/** @see createStatus */
|
||||
@MustBeClosed
|
||||
fun createStatus(
|
||||
params: ItemCreateStatusParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): HttpResponseFor<ItemCreateStatusResponse>
|
||||
|
||||
/** @see createStatus */
|
||||
@MustBeClosed
|
||||
fun createStatus(
|
||||
params: ItemCreateStatusParams
|
||||
): HttpResponseFor<ItemCreateStatusResponse> = createStatus(params, RequestOptions.none())
|
||||
|
||||
/** @see createStatus */
|
||||
@MustBeClosed
|
||||
fun createStatus(
|
||||
queueItemId: String,
|
||||
requestOptions: RequestOptions,
|
||||
): HttpResponseFor<ItemCreateStatusResponse> =
|
||||
createStatus(queueItemId, ItemCreateStatusParams.none(), requestOptions)
|
||||
|
||||
/**
|
||||
* Returns a raw HTTP response for `post /api/v1/annotation-queues/{queue_id}/items/delete`,
|
||||
* but is otherwise the same as [ItemService.deleteAll].
|
||||
*/
|
||||
@MustBeClosed
|
||||
fun deleteAll(queueId: String): HttpResponseFor<ItemDeleteAllResponse> =
|
||||
deleteAll(queueId, ItemDeleteAllParams.none())
|
||||
|
||||
/** @see deleteAll */
|
||||
@MustBeClosed
|
||||
fun deleteAll(
|
||||
queueId: String,
|
||||
params: ItemDeleteAllParams = ItemDeleteAllParams.none(),
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): HttpResponseFor<ItemDeleteAllResponse> =
|
||||
deleteAll(params.toBuilder().queueId(queueId).build(), requestOptions)
|
||||
|
||||
/** @see deleteAll */
|
||||
@MustBeClosed
|
||||
fun deleteAll(
|
||||
queueId: String,
|
||||
params: ItemDeleteAllParams = ItemDeleteAllParams.none(),
|
||||
): HttpResponseFor<ItemDeleteAllResponse> =
|
||||
deleteAll(queueId, params, RequestOptions.none())
|
||||
|
||||
/** @see deleteAll */
|
||||
@MustBeClosed
|
||||
fun deleteAll(
|
||||
params: ItemDeleteAllParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): HttpResponseFor<ItemDeleteAllResponse>
|
||||
|
||||
/** @see deleteAll */
|
||||
@MustBeClosed
|
||||
fun deleteAll(params: ItemDeleteAllParams): HttpResponseFor<ItemDeleteAllResponse> =
|
||||
deleteAll(params, RequestOptions.none())
|
||||
|
||||
/** @see deleteAll */
|
||||
@MustBeClosed
|
||||
fun deleteAll(
|
||||
queueId: String,
|
||||
requestOptions: RequestOptions,
|
||||
): HttpResponseFor<ItemDeleteAllResponse> =
|
||||
deleteAll(queueId, ItemDeleteAllParams.none(), requestOptions)
|
||||
|
||||
/**
|
||||
* Returns a raw HTTP response for `get /api/v1/annotation-queues/{queue_id}/items/count`,
|
||||
* but is otherwise the same as [ItemService.retrieveCount].
|
||||
*/
|
||||
@MustBeClosed
|
||||
fun retrieveCount(
|
||||
queueId: String,
|
||||
params: ItemRetrieveCountParams,
|
||||
): HttpResponseFor<ItemRetrieveCountResponse> =
|
||||
retrieveCount(queueId, params, RequestOptions.none())
|
||||
|
||||
/** @see retrieveCount */
|
||||
@MustBeClosed
|
||||
fun retrieveCount(
|
||||
queueId: String,
|
||||
params: ItemRetrieveCountParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): HttpResponseFor<ItemRetrieveCountResponse> =
|
||||
retrieveCount(params.toBuilder().queueId(queueId).build(), requestOptions)
|
||||
|
||||
/** @see retrieveCount */
|
||||
@MustBeClosed
|
||||
fun retrieveCount(
|
||||
params: ItemRetrieveCountParams
|
||||
): HttpResponseFor<ItemRetrieveCountResponse> = retrieveCount(params, RequestOptions.none())
|
||||
|
||||
/** @see retrieveCount */
|
||||
@MustBeClosed
|
||||
fun retrieveCount(
|
||||
params: ItemRetrieveCountParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): HttpResponseFor<ItemRetrieveCountResponse>
|
||||
|
||||
/**
|
||||
* Returns a raw HTTP response for `get
|
||||
* /api/v1/annotation-queues/{queue_id}/items/{item_id}/placement`, but is otherwise the
|
||||
* same as [ItemService.retrievePlacement].
|
||||
*/
|
||||
@MustBeClosed
|
||||
fun retrievePlacement(
|
||||
itemId: String,
|
||||
params: ItemRetrievePlacementParams,
|
||||
): HttpResponseFor<ItemRetrievePlacementResponse> =
|
||||
retrievePlacement(itemId, params, RequestOptions.none())
|
||||
|
||||
/** @see retrievePlacement */
|
||||
@MustBeClosed
|
||||
fun retrievePlacement(
|
||||
itemId: String,
|
||||
params: ItemRetrievePlacementParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): HttpResponseFor<ItemRetrievePlacementResponse> =
|
||||
retrievePlacement(params.toBuilder().itemId(itemId).build(), requestOptions)
|
||||
|
||||
/** @see retrievePlacement */
|
||||
@MustBeClosed
|
||||
fun retrievePlacement(
|
||||
params: ItemRetrievePlacementParams
|
||||
): HttpResponseFor<ItemRetrievePlacementResponse> =
|
||||
retrievePlacement(params, RequestOptions.none())
|
||||
|
||||
/** @see retrievePlacement */
|
||||
@MustBeClosed
|
||||
fun retrievePlacement(
|
||||
params: ItemRetrievePlacementParams,
|
||||
requestOptions: RequestOptions = RequestOptions.none(),
|
||||
): HttpResponseFor<ItemRetrievePlacementResponse>
|
||||
}
|
||||
}
|
||||
+376
@@ -0,0 +1,376 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.services.blocking.annotationqueues
|
||||
|
||||
import com.langchain.smith.core.ClientOptions
|
||||
import com.langchain.smith.core.RequestOptions
|
||||
import com.langchain.smith.core.checkRequired
|
||||
import com.langchain.smith.core.handlers.errorBodyHandler
|
||||
import com.langchain.smith.core.handlers.errorHandler
|
||||
import com.langchain.smith.core.handlers.jsonHandler
|
||||
import com.langchain.smith.core.http.HttpMethod
|
||||
import com.langchain.smith.core.http.HttpRequest
|
||||
import com.langchain.smith.core.http.HttpResponse
|
||||
import com.langchain.smith.core.http.HttpResponse.Handler
|
||||
import com.langchain.smith.core.http.HttpResponseFor
|
||||
import com.langchain.smith.core.http.json
|
||||
import com.langchain.smith.core.http.parseable
|
||||
import com.langchain.smith.core.prepare
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemCreateParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemCreateResponse
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemCreateStatusParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemCreateStatusResponse
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemDeleteAllParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemDeleteAllResponse
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemListPage
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemListPageResponse
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemListParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemRetrieveCountParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemRetrieveCountResponse
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemRetrievePlacementParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemRetrievePlacementResponse
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemUpdateParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemUpdateResponse
|
||||
import java.util.function.Consumer
|
||||
import kotlin.jvm.optionals.getOrNull
|
||||
|
||||
class ItemServiceImpl internal constructor(private val clientOptions: ClientOptions) : ItemService {
|
||||
|
||||
private val withRawResponse: ItemService.WithRawResponse by lazy {
|
||||
WithRawResponseImpl(clientOptions)
|
||||
}
|
||||
|
||||
override fun withRawResponse(): ItemService.WithRawResponse = withRawResponse
|
||||
|
||||
override fun withOptions(modifier: Consumer<ClientOptions.Builder>): ItemService =
|
||||
ItemServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build())
|
||||
|
||||
override fun create(
|
||||
params: ItemCreateParams,
|
||||
requestOptions: RequestOptions,
|
||||
): ItemCreateResponse =
|
||||
// post /api/v1/annotation-queues/{queue_id}/items
|
||||
withRawResponse().create(params, requestOptions).parse()
|
||||
|
||||
override fun update(
|
||||
params: ItemUpdateParams,
|
||||
requestOptions: RequestOptions,
|
||||
): ItemUpdateResponse =
|
||||
// patch /api/v1/annotation-queues/{queue_id}/items/{item_id}
|
||||
withRawResponse().update(params, requestOptions).parse()
|
||||
|
||||
override fun list(params: ItemListParams, requestOptions: RequestOptions): ItemListPage =
|
||||
// get /api/v1/annotation-queues/{queue_id}/items
|
||||
withRawResponse().list(params, requestOptions).parse()
|
||||
|
||||
override fun createStatus(
|
||||
params: ItemCreateStatusParams,
|
||||
requestOptions: RequestOptions,
|
||||
): ItemCreateStatusResponse =
|
||||
// post /api/v1/annotation-queues/items/{queue_item_id}/status
|
||||
withRawResponse().createStatus(params, requestOptions).parse()
|
||||
|
||||
override fun deleteAll(
|
||||
params: ItemDeleteAllParams,
|
||||
requestOptions: RequestOptions,
|
||||
): ItemDeleteAllResponse =
|
||||
// post /api/v1/annotation-queues/{queue_id}/items/delete
|
||||
withRawResponse().deleteAll(params, requestOptions).parse()
|
||||
|
||||
override fun retrieveCount(
|
||||
params: ItemRetrieveCountParams,
|
||||
requestOptions: RequestOptions,
|
||||
): ItemRetrieveCountResponse =
|
||||
// get /api/v1/annotation-queues/{queue_id}/items/count
|
||||
withRawResponse().retrieveCount(params, requestOptions).parse()
|
||||
|
||||
override fun retrievePlacement(
|
||||
params: ItemRetrievePlacementParams,
|
||||
requestOptions: RequestOptions,
|
||||
): ItemRetrievePlacementResponse =
|
||||
// get /api/v1/annotation-queues/{queue_id}/items/{item_id}/placement
|
||||
withRawResponse().retrievePlacement(params, requestOptions).parse()
|
||||
|
||||
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
|
||||
ItemService.WithRawResponse {
|
||||
|
||||
private val errorHandler: Handler<HttpResponse> =
|
||||
errorHandler(errorBodyHandler(clientOptions.jsonMapper))
|
||||
|
||||
override fun withOptions(
|
||||
modifier: Consumer<ClientOptions.Builder>
|
||||
): ItemService.WithRawResponse =
|
||||
ItemServiceImpl.WithRawResponseImpl(
|
||||
clientOptions.toBuilder().apply(modifier::accept).build()
|
||||
)
|
||||
|
||||
private val createHandler: Handler<ItemCreateResponse> =
|
||||
jsonHandler<ItemCreateResponse>(clientOptions.jsonMapper)
|
||||
|
||||
override fun create(
|
||||
params: ItemCreateParams,
|
||||
requestOptions: RequestOptions,
|
||||
): HttpResponseFor<ItemCreateResponse> {
|
||||
// We check here instead of in the params builder because this can be specified
|
||||
// positionally or in the params class.
|
||||
checkRequired("queueId", params.queueId().getOrNull())
|
||||
val request =
|
||||
HttpRequest.builder()
|
||||
.method(HttpMethod.POST)
|
||||
.baseUrl(clientOptions.baseUrl())
|
||||
.addPathSegments(
|
||||
"api",
|
||||
"v1",
|
||||
"annotation-queues",
|
||||
params._pathParam(0),
|
||||
"items",
|
||||
)
|
||||
.body(json(clientOptions.jsonMapper, params._body()))
|
||||
.build()
|
||||
.prepare(clientOptions, params)
|
||||
val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions))
|
||||
val response = clientOptions.httpClient.execute(request, requestOptions)
|
||||
return errorHandler.handle(response).parseable {
|
||||
response
|
||||
.use { createHandler.handle(it) }
|
||||
.also {
|
||||
if (requestOptions.responseValidation!!) {
|
||||
it.validate()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val updateHandler: Handler<ItemUpdateResponse> =
|
||||
jsonHandler<ItemUpdateResponse>(clientOptions.jsonMapper)
|
||||
|
||||
override fun update(
|
||||
params: ItemUpdateParams,
|
||||
requestOptions: RequestOptions,
|
||||
): HttpResponseFor<ItemUpdateResponse> {
|
||||
// We check here instead of in the params builder because this can be specified
|
||||
// positionally or in the params class.
|
||||
checkRequired("itemId", params.itemId().getOrNull())
|
||||
val request =
|
||||
HttpRequest.builder()
|
||||
.method(HttpMethod.PATCH)
|
||||
.baseUrl(clientOptions.baseUrl())
|
||||
.addPathSegments(
|
||||
"api",
|
||||
"v1",
|
||||
"annotation-queues",
|
||||
params._pathParam(0),
|
||||
"items",
|
||||
params._pathParam(1),
|
||||
)
|
||||
.body(json(clientOptions.jsonMapper, params._body()))
|
||||
.build()
|
||||
.prepare(clientOptions, params)
|
||||
val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions))
|
||||
val response = clientOptions.httpClient.execute(request, requestOptions)
|
||||
return errorHandler.handle(response).parseable {
|
||||
response
|
||||
.use { updateHandler.handle(it) }
|
||||
.also {
|
||||
if (requestOptions.responseValidation!!) {
|
||||
it.validate()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val listHandler: Handler<ItemListPageResponse> =
|
||||
jsonHandler<ItemListPageResponse>(clientOptions.jsonMapper)
|
||||
|
||||
override fun list(
|
||||
params: ItemListParams,
|
||||
requestOptions: RequestOptions,
|
||||
): HttpResponseFor<ItemListPage> {
|
||||
// We check here instead of in the params builder because this can be specified
|
||||
// positionally or in the params class.
|
||||
checkRequired("queueId", params.queueId().getOrNull())
|
||||
val request =
|
||||
HttpRequest.builder()
|
||||
.method(HttpMethod.GET)
|
||||
.baseUrl(clientOptions.baseUrl())
|
||||
.addPathSegments(
|
||||
"api",
|
||||
"v1",
|
||||
"annotation-queues",
|
||||
params._pathParam(0),
|
||||
"items",
|
||||
)
|
||||
.build()
|
||||
.prepare(clientOptions, params)
|
||||
val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions))
|
||||
val response = clientOptions.httpClient.execute(request, requestOptions)
|
||||
return errorHandler.handle(response).parseable {
|
||||
response
|
||||
.use { listHandler.handle(it) }
|
||||
.also {
|
||||
if (requestOptions.responseValidation!!) {
|
||||
it.validate()
|
||||
}
|
||||
}
|
||||
.let {
|
||||
ItemListPage.builder()
|
||||
.service(ItemServiceImpl(clientOptions))
|
||||
.params(params)
|
||||
.response(it)
|
||||
.build()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val createStatusHandler: Handler<ItemCreateStatusResponse> =
|
||||
jsonHandler<ItemCreateStatusResponse>(clientOptions.jsonMapper)
|
||||
|
||||
override fun createStatus(
|
||||
params: ItemCreateStatusParams,
|
||||
requestOptions: RequestOptions,
|
||||
): HttpResponseFor<ItemCreateStatusResponse> {
|
||||
// We check here instead of in the params builder because this can be specified
|
||||
// positionally or in the params class.
|
||||
checkRequired("queueItemId", params.queueItemId().getOrNull())
|
||||
val request =
|
||||
HttpRequest.builder()
|
||||
.method(HttpMethod.POST)
|
||||
.baseUrl(clientOptions.baseUrl())
|
||||
.addPathSegments(
|
||||
"api",
|
||||
"v1",
|
||||
"annotation-queues",
|
||||
"items",
|
||||
params._pathParam(0),
|
||||
"status",
|
||||
)
|
||||
.body(json(clientOptions.jsonMapper, params._body()))
|
||||
.build()
|
||||
.prepare(clientOptions, params)
|
||||
val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions))
|
||||
val response = clientOptions.httpClient.execute(request, requestOptions)
|
||||
return errorHandler.handle(response).parseable {
|
||||
response
|
||||
.use { createStatusHandler.handle(it) }
|
||||
.also {
|
||||
if (requestOptions.responseValidation!!) {
|
||||
it.validate()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val deleteAllHandler: Handler<ItemDeleteAllResponse> =
|
||||
jsonHandler<ItemDeleteAllResponse>(clientOptions.jsonMapper)
|
||||
|
||||
override fun deleteAll(
|
||||
params: ItemDeleteAllParams,
|
||||
requestOptions: RequestOptions,
|
||||
): HttpResponseFor<ItemDeleteAllResponse> {
|
||||
// We check here instead of in the params builder because this can be specified
|
||||
// positionally or in the params class.
|
||||
checkRequired("queueId", params.queueId().getOrNull())
|
||||
val request =
|
||||
HttpRequest.builder()
|
||||
.method(HttpMethod.POST)
|
||||
.baseUrl(clientOptions.baseUrl())
|
||||
.addPathSegments(
|
||||
"api",
|
||||
"v1",
|
||||
"annotation-queues",
|
||||
params._pathParam(0),
|
||||
"items",
|
||||
"delete",
|
||||
)
|
||||
.body(json(clientOptions.jsonMapper, params._body()))
|
||||
.build()
|
||||
.prepare(clientOptions, params)
|
||||
val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions))
|
||||
val response = clientOptions.httpClient.execute(request, requestOptions)
|
||||
return errorHandler.handle(response).parseable {
|
||||
response
|
||||
.use { deleteAllHandler.handle(it) }
|
||||
.also {
|
||||
if (requestOptions.responseValidation!!) {
|
||||
it.validate()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val retrieveCountHandler: Handler<ItemRetrieveCountResponse> =
|
||||
jsonHandler<ItemRetrieveCountResponse>(clientOptions.jsonMapper)
|
||||
|
||||
override fun retrieveCount(
|
||||
params: ItemRetrieveCountParams,
|
||||
requestOptions: RequestOptions,
|
||||
): HttpResponseFor<ItemRetrieveCountResponse> {
|
||||
// We check here instead of in the params builder because this can be specified
|
||||
// positionally or in the params class.
|
||||
checkRequired("queueId", params.queueId().getOrNull())
|
||||
val request =
|
||||
HttpRequest.builder()
|
||||
.method(HttpMethod.GET)
|
||||
.baseUrl(clientOptions.baseUrl())
|
||||
.addPathSegments(
|
||||
"api",
|
||||
"v1",
|
||||
"annotation-queues",
|
||||
params._pathParam(0),
|
||||
"items",
|
||||
"count",
|
||||
)
|
||||
.build()
|
||||
.prepare(clientOptions, params)
|
||||
val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions))
|
||||
val response = clientOptions.httpClient.execute(request, requestOptions)
|
||||
return errorHandler.handle(response).parseable {
|
||||
response
|
||||
.use { retrieveCountHandler.handle(it) }
|
||||
.also {
|
||||
if (requestOptions.responseValidation!!) {
|
||||
it.validate()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val retrievePlacementHandler: Handler<ItemRetrievePlacementResponse> =
|
||||
jsonHandler<ItemRetrievePlacementResponse>(clientOptions.jsonMapper)
|
||||
|
||||
override fun retrievePlacement(
|
||||
params: ItemRetrievePlacementParams,
|
||||
requestOptions: RequestOptions,
|
||||
): HttpResponseFor<ItemRetrievePlacementResponse> {
|
||||
// We check here instead of in the params builder because this can be specified
|
||||
// positionally or in the params class.
|
||||
checkRequired("itemId", params.itemId().getOrNull())
|
||||
val request =
|
||||
HttpRequest.builder()
|
||||
.method(HttpMethod.GET)
|
||||
.baseUrl(clientOptions.baseUrl())
|
||||
.addPathSegments(
|
||||
"api",
|
||||
"v1",
|
||||
"annotation-queues",
|
||||
params._pathParam(0),
|
||||
"items",
|
||||
params._pathParam(1),
|
||||
"placement",
|
||||
)
|
||||
.build()
|
||||
.prepare(clientOptions, params)
|
||||
val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions))
|
||||
val response = clientOptions.httpClient.execute(request, requestOptions)
|
||||
return errorHandler.handle(response).parseable {
|
||||
response
|
||||
.use { retrievePlacementHandler.handle(it) }
|
||||
.also {
|
||||
if (requestOptions.responseValidation!!) {
|
||||
it.validate()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.models.annotationqueues.items
|
||||
|
||||
import com.langchain.smith.core.http.QueryParams
|
||||
import java.time.OffsetDateTime
|
||||
import kotlin.jvm.optionals.getOrNull
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
internal class ItemCreateParamsTest {
|
||||
|
||||
@Test
|
||||
fun create() {
|
||||
ItemCreateParams.builder()
|
||||
.queueId("queue_id")
|
||||
.extendTraceRetention(true)
|
||||
.addItem(
|
||||
ItemCreateParams.Item.builder()
|
||||
.itemType(ItemCreateParams.Item.ItemType.RUN)
|
||||
.runId("run_id")
|
||||
.sessionId("session_id")
|
||||
.sourceProposedExampleId("source_proposed_example_id")
|
||||
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
|
||||
.threadId("thread_id")
|
||||
.build()
|
||||
)
|
||||
.build()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun pathParams() {
|
||||
val params = ItemCreateParams.builder().queueId("queue_id").build()
|
||||
|
||||
assertThat(params._pathParam(0)).isEqualTo("queue_id")
|
||||
// out-of-bound path param
|
||||
assertThat(params._pathParam(1)).isEqualTo("")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun queryParams() {
|
||||
val params =
|
||||
ItemCreateParams.builder()
|
||||
.queueId("queue_id")
|
||||
.extendTraceRetention(true)
|
||||
.addItem(
|
||||
ItemCreateParams.Item.builder()
|
||||
.itemType(ItemCreateParams.Item.ItemType.RUN)
|
||||
.runId("run_id")
|
||||
.sessionId("session_id")
|
||||
.sourceProposedExampleId("source_proposed_example_id")
|
||||
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
|
||||
.threadId("thread_id")
|
||||
.build()
|
||||
)
|
||||
.build()
|
||||
|
||||
val queryParams = params._queryParams()
|
||||
|
||||
assertThat(queryParams)
|
||||
.isEqualTo(QueryParams.builder().put("extend_trace_retention", "true").build())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun queryParamsWithoutOptionalFields() {
|
||||
val params = ItemCreateParams.builder().queueId("queue_id").build()
|
||||
|
||||
val queryParams = params._queryParams()
|
||||
|
||||
assertThat(queryParams).isEqualTo(QueryParams.builder().build())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun body() {
|
||||
val params =
|
||||
ItemCreateParams.builder()
|
||||
.queueId("queue_id")
|
||||
.extendTraceRetention(true)
|
||||
.addItem(
|
||||
ItemCreateParams.Item.builder()
|
||||
.itemType(ItemCreateParams.Item.ItemType.RUN)
|
||||
.runId("run_id")
|
||||
.sessionId("session_id")
|
||||
.sourceProposedExampleId("source_proposed_example_id")
|
||||
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
|
||||
.threadId("thread_id")
|
||||
.build()
|
||||
)
|
||||
.build()
|
||||
|
||||
val body = params._body()
|
||||
|
||||
assertThat(body.items().getOrNull())
|
||||
.containsExactly(
|
||||
ItemCreateParams.Item.builder()
|
||||
.itemType(ItemCreateParams.Item.ItemType.RUN)
|
||||
.runId("run_id")
|
||||
.sessionId("session_id")
|
||||
.sourceProposedExampleId("source_proposed_example_id")
|
||||
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
|
||||
.threadId("thread_id")
|
||||
.build()
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun bodyWithoutOptionalFields() {
|
||||
val params = ItemCreateParams.builder().queueId("queue_id").build()
|
||||
|
||||
val body = params._body()
|
||||
}
|
||||
}
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.models.annotationqueues.items
|
||||
|
||||
import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
|
||||
import com.langchain.smith.core.jsonMapper
|
||||
import kotlin.jvm.optionals.getOrNull
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
internal class ItemCreateResponseTest {
|
||||
|
||||
@Test
|
||||
fun create() {
|
||||
val itemCreateResponse =
|
||||
ItemCreateResponse.builder()
|
||||
.addItem(
|
||||
ItemCreateResponse.Item.builder()
|
||||
.id("id")
|
||||
.addedAt("added_at")
|
||||
.itemType(ItemCreateResponse.Item.ItemType.RUN)
|
||||
.lastReviewedTime("last_reviewed_time")
|
||||
.queueId("queue_id")
|
||||
.runId("run_id")
|
||||
.sessionId("session_id")
|
||||
.sourceProposedExampleId("source_proposed_example_id")
|
||||
.startTime("start_time")
|
||||
.threadId("thread_id")
|
||||
.build()
|
||||
)
|
||||
.build()
|
||||
|
||||
assertThat(itemCreateResponse.items().getOrNull())
|
||||
.containsExactly(
|
||||
ItemCreateResponse.Item.builder()
|
||||
.id("id")
|
||||
.addedAt("added_at")
|
||||
.itemType(ItemCreateResponse.Item.ItemType.RUN)
|
||||
.lastReviewedTime("last_reviewed_time")
|
||||
.queueId("queue_id")
|
||||
.runId("run_id")
|
||||
.sessionId("session_id")
|
||||
.sourceProposedExampleId("source_proposed_example_id")
|
||||
.startTime("start_time")
|
||||
.threadId("thread_id")
|
||||
.build()
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun roundtrip() {
|
||||
val jsonMapper = jsonMapper()
|
||||
val itemCreateResponse =
|
||||
ItemCreateResponse.builder()
|
||||
.addItem(
|
||||
ItemCreateResponse.Item.builder()
|
||||
.id("id")
|
||||
.addedAt("added_at")
|
||||
.itemType(ItemCreateResponse.Item.ItemType.RUN)
|
||||
.lastReviewedTime("last_reviewed_time")
|
||||
.queueId("queue_id")
|
||||
.runId("run_id")
|
||||
.sessionId("session_id")
|
||||
.sourceProposedExampleId("source_proposed_example_id")
|
||||
.startTime("start_time")
|
||||
.threadId("thread_id")
|
||||
.build()
|
||||
)
|
||||
.build()
|
||||
|
||||
val roundtrippedItemCreateResponse =
|
||||
jsonMapper.readValue(
|
||||
jsonMapper.writeValueAsString(itemCreateResponse),
|
||||
jacksonTypeRef<ItemCreateResponse>(),
|
||||
)
|
||||
|
||||
assertThat(roundtrippedItemCreateResponse).isEqualTo(itemCreateResponse)
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.models.annotationqueues.items
|
||||
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
internal class ItemCreateStatusParamsTest {
|
||||
|
||||
@Test
|
||||
fun create() {
|
||||
ItemCreateStatusParams.builder()
|
||||
.queueItemId("queue_item_id")
|
||||
.overrideAddedAt("override_added_at")
|
||||
.status(ItemCreateStatusParams.Status.VIEWED)
|
||||
.build()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun pathParams() {
|
||||
val params = ItemCreateStatusParams.builder().queueItemId("queue_item_id").build()
|
||||
|
||||
assertThat(params._pathParam(0)).isEqualTo("queue_item_id")
|
||||
// out-of-bound path param
|
||||
assertThat(params._pathParam(1)).isEqualTo("")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun body() {
|
||||
val params =
|
||||
ItemCreateStatusParams.builder()
|
||||
.queueItemId("queue_item_id")
|
||||
.overrideAddedAt("override_added_at")
|
||||
.status(ItemCreateStatusParams.Status.VIEWED)
|
||||
.build()
|
||||
|
||||
val body = params._body()
|
||||
|
||||
assertThat(body.overrideAddedAt()).contains("override_added_at")
|
||||
assertThat(body.status()).contains(ItemCreateStatusParams.Status.VIEWED)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun bodyWithoutOptionalFields() {
|
||||
val params = ItemCreateStatusParams.builder().queueItemId("queue_item_id").build()
|
||||
|
||||
val body = params._body()
|
||||
}
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.models.annotationqueues.items
|
||||
|
||||
import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
|
||||
import com.langchain.smith.core.jsonMapper
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
internal class ItemCreateStatusResponseTest {
|
||||
|
||||
@Test
|
||||
fun create() {
|
||||
val itemCreateStatusResponse =
|
||||
ItemCreateStatusResponse.builder()
|
||||
.isArchived(true)
|
||||
.overrideAddedAt("override_added_at")
|
||||
.queueItemId("queue_item_id")
|
||||
.status(ItemCreateStatusResponse.Status.VIEWED)
|
||||
.build()
|
||||
|
||||
assertThat(itemCreateStatusResponse.isArchived()).contains(true)
|
||||
assertThat(itemCreateStatusResponse.overrideAddedAt()).contains("override_added_at")
|
||||
assertThat(itemCreateStatusResponse.queueItemId()).contains("queue_item_id")
|
||||
assertThat(itemCreateStatusResponse.status())
|
||||
.contains(ItemCreateStatusResponse.Status.VIEWED)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun roundtrip() {
|
||||
val jsonMapper = jsonMapper()
|
||||
val itemCreateStatusResponse =
|
||||
ItemCreateStatusResponse.builder()
|
||||
.isArchived(true)
|
||||
.overrideAddedAt("override_added_at")
|
||||
.queueItemId("queue_item_id")
|
||||
.status(ItemCreateStatusResponse.Status.VIEWED)
|
||||
.build()
|
||||
|
||||
val roundtrippedItemCreateStatusResponse =
|
||||
jsonMapper.readValue(
|
||||
jsonMapper.writeValueAsString(itemCreateStatusResponse),
|
||||
jacksonTypeRef<ItemCreateStatusResponse>(),
|
||||
)
|
||||
|
||||
assertThat(roundtrippedItemCreateStatusResponse).isEqualTo(itemCreateStatusResponse)
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.models.annotationqueues.items
|
||||
|
||||
import kotlin.jvm.optionals.getOrNull
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
internal class ItemDeleteAllParamsTest {
|
||||
|
||||
@Test
|
||||
fun create() {
|
||||
ItemDeleteAllParams.builder().queueId("queue_id").addItemId("string").build()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun pathParams() {
|
||||
val params = ItemDeleteAllParams.builder().queueId("queue_id").build()
|
||||
|
||||
assertThat(params._pathParam(0)).isEqualTo("queue_id")
|
||||
// out-of-bound path param
|
||||
assertThat(params._pathParam(1)).isEqualTo("")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun body() {
|
||||
val params = ItemDeleteAllParams.builder().queueId("queue_id").addItemId("string").build()
|
||||
|
||||
val body = params._body()
|
||||
|
||||
assertThat(body.itemIds().getOrNull()).containsExactly("string")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun bodyWithoutOptionalFields() {
|
||||
val params = ItemDeleteAllParams.builder().queueId("queue_id").build()
|
||||
|
||||
val body = params._body()
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.models.annotationqueues.items
|
||||
|
||||
import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
|
||||
import com.langchain.smith.core.JsonValue
|
||||
import com.langchain.smith.core.jsonMapper
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
internal class ItemDeleteAllResponseTest {
|
||||
|
||||
@Test
|
||||
fun create() {
|
||||
val itemDeleteAllResponse =
|
||||
ItemDeleteAllResponse.builder()
|
||||
.putAdditionalProperty("foo", JsonValue.from("string"))
|
||||
.build()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun roundtrip() {
|
||||
val jsonMapper = jsonMapper()
|
||||
val itemDeleteAllResponse =
|
||||
ItemDeleteAllResponse.builder()
|
||||
.putAdditionalProperty("foo", JsonValue.from("string"))
|
||||
.build()
|
||||
|
||||
val roundtrippedItemDeleteAllResponse =
|
||||
jsonMapper.readValue(
|
||||
jsonMapper.writeValueAsString(itemDeleteAllResponse),
|
||||
jacksonTypeRef<ItemDeleteAllResponse>(),
|
||||
)
|
||||
|
||||
assertThat(roundtrippedItemDeleteAllResponse).isEqualTo(itemDeleteAllResponse)
|
||||
}
|
||||
}
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.models.annotationqueues.items
|
||||
|
||||
import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
|
||||
import com.langchain.smith.core.jsonMapper
|
||||
import kotlin.jvm.optionals.getOrNull
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
internal class ItemListPageResponseTest {
|
||||
|
||||
@Test
|
||||
fun create() {
|
||||
val itemListPageResponse =
|
||||
ItemListPageResponse.builder()
|
||||
.addItem(
|
||||
ItemListResponse.builder()
|
||||
.id("id")
|
||||
.addedAt("added_at")
|
||||
.addCompletedBy("string")
|
||||
.effectiveAddedAt("effective_added_at")
|
||||
.itemType(ItemListResponse.ItemType.RUN)
|
||||
.lastReviewedTime("last_reviewed_time")
|
||||
.queueId("queue_id")
|
||||
.addReservedBy("string")
|
||||
.runId("run_id")
|
||||
.sessionId("session_id")
|
||||
.sourceProposedExampleId("source_proposed_example_id")
|
||||
.startTime("start_time")
|
||||
.threadId("thread_id")
|
||||
.build()
|
||||
)
|
||||
.nextCursor("next_cursor")
|
||||
.previousCursor("previous_cursor")
|
||||
.build()
|
||||
|
||||
assertThat(itemListPageResponse.items().getOrNull())
|
||||
.containsExactly(
|
||||
ItemListResponse.builder()
|
||||
.id("id")
|
||||
.addedAt("added_at")
|
||||
.addCompletedBy("string")
|
||||
.effectiveAddedAt("effective_added_at")
|
||||
.itemType(ItemListResponse.ItemType.RUN)
|
||||
.lastReviewedTime("last_reviewed_time")
|
||||
.queueId("queue_id")
|
||||
.addReservedBy("string")
|
||||
.runId("run_id")
|
||||
.sessionId("session_id")
|
||||
.sourceProposedExampleId("source_proposed_example_id")
|
||||
.startTime("start_time")
|
||||
.threadId("thread_id")
|
||||
.build()
|
||||
)
|
||||
assertThat(itemListPageResponse.nextCursor()).contains("next_cursor")
|
||||
assertThat(itemListPageResponse.previousCursor()).contains("previous_cursor")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun roundtrip() {
|
||||
val jsonMapper = jsonMapper()
|
||||
val itemListPageResponse =
|
||||
ItemListPageResponse.builder()
|
||||
.addItem(
|
||||
ItemListResponse.builder()
|
||||
.id("id")
|
||||
.addedAt("added_at")
|
||||
.addCompletedBy("string")
|
||||
.effectiveAddedAt("effective_added_at")
|
||||
.itemType(ItemListResponse.ItemType.RUN)
|
||||
.lastReviewedTime("last_reviewed_time")
|
||||
.queueId("queue_id")
|
||||
.addReservedBy("string")
|
||||
.runId("run_id")
|
||||
.sessionId("session_id")
|
||||
.sourceProposedExampleId("source_proposed_example_id")
|
||||
.startTime("start_time")
|
||||
.threadId("thread_id")
|
||||
.build()
|
||||
)
|
||||
.nextCursor("next_cursor")
|
||||
.previousCursor("previous_cursor")
|
||||
.build()
|
||||
|
||||
val roundtrippedItemListPageResponse =
|
||||
jsonMapper.readValue(
|
||||
jsonMapper.writeValueAsString(itemListPageResponse),
|
||||
jacksonTypeRef<ItemListPageResponse>(),
|
||||
)
|
||||
|
||||
assertThat(roundtrippedItemListPageResponse).isEqualTo(itemListPageResponse)
|
||||
}
|
||||
}
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.models.annotationqueues.items
|
||||
|
||||
import com.langchain.smith.core.http.QueryParams
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
internal class ItemListParamsTest {
|
||||
|
||||
@Test
|
||||
fun create() {
|
||||
ItemListParams.builder()
|
||||
.queueId("queue_id")
|
||||
.status(ItemListParams.Status.NEEDS_MY_REVIEW)
|
||||
.cursor("cursor")
|
||||
.direction(ItemListParams.Direction.FORWARD)
|
||||
.itemType(ItemListParams.ItemType.RUN)
|
||||
.pageSize(0L)
|
||||
.build()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun pathParams() {
|
||||
val params =
|
||||
ItemListParams.builder()
|
||||
.queueId("queue_id")
|
||||
.status(ItemListParams.Status.NEEDS_MY_REVIEW)
|
||||
.build()
|
||||
|
||||
assertThat(params._pathParam(0)).isEqualTo("queue_id")
|
||||
// out-of-bound path param
|
||||
assertThat(params._pathParam(1)).isEqualTo("")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun queryParams() {
|
||||
val params =
|
||||
ItemListParams.builder()
|
||||
.queueId("queue_id")
|
||||
.status(ItemListParams.Status.NEEDS_MY_REVIEW)
|
||||
.cursor("cursor")
|
||||
.direction(ItemListParams.Direction.FORWARD)
|
||||
.itemType(ItemListParams.ItemType.RUN)
|
||||
.pageSize(0L)
|
||||
.build()
|
||||
|
||||
val queryParams = params._queryParams()
|
||||
|
||||
assertThat(queryParams)
|
||||
.isEqualTo(
|
||||
QueryParams.builder()
|
||||
.put("status", "needs_my_review")
|
||||
.put("cursor", "cursor")
|
||||
.put("direction", "forward")
|
||||
.put("item_type", "RUN")
|
||||
.put("page_size", "0")
|
||||
.build()
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun queryParamsWithoutOptionalFields() {
|
||||
val params =
|
||||
ItemListParams.builder()
|
||||
.queueId("queue_id")
|
||||
.status(ItemListParams.Status.NEEDS_MY_REVIEW)
|
||||
.build()
|
||||
|
||||
val queryParams = params._queryParams()
|
||||
|
||||
assertThat(queryParams)
|
||||
.isEqualTo(QueryParams.builder().put("status", "needs_my_review").build())
|
||||
}
|
||||
}
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.models.annotationqueues.items
|
||||
|
||||
import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
|
||||
import com.langchain.smith.core.jsonMapper
|
||||
import kotlin.jvm.optionals.getOrNull
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
internal class ItemListResponseTest {
|
||||
|
||||
@Test
|
||||
fun create() {
|
||||
val itemListResponse =
|
||||
ItemListResponse.builder()
|
||||
.id("id")
|
||||
.addedAt("added_at")
|
||||
.addCompletedBy("string")
|
||||
.effectiveAddedAt("effective_added_at")
|
||||
.itemType(ItemListResponse.ItemType.RUN)
|
||||
.lastReviewedTime("last_reviewed_time")
|
||||
.queueId("queue_id")
|
||||
.addReservedBy("string")
|
||||
.runId("run_id")
|
||||
.sessionId("session_id")
|
||||
.sourceProposedExampleId("source_proposed_example_id")
|
||||
.startTime("start_time")
|
||||
.threadId("thread_id")
|
||||
.build()
|
||||
|
||||
assertThat(itemListResponse.id()).contains("id")
|
||||
assertThat(itemListResponse.addedAt()).contains("added_at")
|
||||
assertThat(itemListResponse.completedBy().getOrNull()).containsExactly("string")
|
||||
assertThat(itemListResponse.effectiveAddedAt()).contains("effective_added_at")
|
||||
assertThat(itemListResponse.itemType()).contains(ItemListResponse.ItemType.RUN)
|
||||
assertThat(itemListResponse.lastReviewedTime()).contains("last_reviewed_time")
|
||||
assertThat(itemListResponse.queueId()).contains("queue_id")
|
||||
assertThat(itemListResponse.reservedBy().getOrNull()).containsExactly("string")
|
||||
assertThat(itemListResponse.runId()).contains("run_id")
|
||||
assertThat(itemListResponse.sessionId()).contains("session_id")
|
||||
assertThat(itemListResponse.sourceProposedExampleId())
|
||||
.contains("source_proposed_example_id")
|
||||
assertThat(itemListResponse.startTime()).contains("start_time")
|
||||
assertThat(itemListResponse.threadId()).contains("thread_id")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun roundtrip() {
|
||||
val jsonMapper = jsonMapper()
|
||||
val itemListResponse =
|
||||
ItemListResponse.builder()
|
||||
.id("id")
|
||||
.addedAt("added_at")
|
||||
.addCompletedBy("string")
|
||||
.effectiveAddedAt("effective_added_at")
|
||||
.itemType(ItemListResponse.ItemType.RUN)
|
||||
.lastReviewedTime("last_reviewed_time")
|
||||
.queueId("queue_id")
|
||||
.addReservedBy("string")
|
||||
.runId("run_id")
|
||||
.sessionId("session_id")
|
||||
.sourceProposedExampleId("source_proposed_example_id")
|
||||
.startTime("start_time")
|
||||
.threadId("thread_id")
|
||||
.build()
|
||||
|
||||
val roundtrippedItemListResponse =
|
||||
jsonMapper.readValue(
|
||||
jsonMapper.writeValueAsString(itemListResponse),
|
||||
jacksonTypeRef<ItemListResponse>(),
|
||||
)
|
||||
|
||||
assertThat(roundtrippedItemListResponse).isEqualTo(itemListResponse)
|
||||
}
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.models.annotationqueues.items
|
||||
|
||||
import com.langchain.smith.core.http.QueryParams
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
internal class ItemRetrieveCountParamsTest {
|
||||
|
||||
@Test
|
||||
fun create() {
|
||||
ItemRetrieveCountParams.builder()
|
||||
.queueId("queue_id")
|
||||
.status("status")
|
||||
.endTime("end_time")
|
||||
.startTime("start_time")
|
||||
.build()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun pathParams() {
|
||||
val params = ItemRetrieveCountParams.builder().queueId("queue_id").status("status").build()
|
||||
|
||||
assertThat(params._pathParam(0)).isEqualTo("queue_id")
|
||||
// out-of-bound path param
|
||||
assertThat(params._pathParam(1)).isEqualTo("")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun queryParams() {
|
||||
val params =
|
||||
ItemRetrieveCountParams.builder()
|
||||
.queueId("queue_id")
|
||||
.status("status")
|
||||
.endTime("end_time")
|
||||
.startTime("start_time")
|
||||
.build()
|
||||
|
||||
val queryParams = params._queryParams()
|
||||
|
||||
assertThat(queryParams)
|
||||
.isEqualTo(
|
||||
QueryParams.builder()
|
||||
.put("status", "status")
|
||||
.put("end_time", "end_time")
|
||||
.put("start_time", "start_time")
|
||||
.build()
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun queryParamsWithoutOptionalFields() {
|
||||
val params = ItemRetrieveCountParams.builder().queueId("queue_id").status("status").build()
|
||||
|
||||
val queryParams = params._queryParams()
|
||||
|
||||
assertThat(queryParams).isEqualTo(QueryParams.builder().put("status", "status").build())
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.models.annotationqueues.items
|
||||
|
||||
import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
|
||||
import com.langchain.smith.core.jsonMapper
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
internal class ItemRetrieveCountResponseTest {
|
||||
|
||||
@Test
|
||||
fun create() {
|
||||
val itemRetrieveCountResponse = ItemRetrieveCountResponse.builder().count(0L).build()
|
||||
|
||||
assertThat(itemRetrieveCountResponse.count()).contains(0L)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun roundtrip() {
|
||||
val jsonMapper = jsonMapper()
|
||||
val itemRetrieveCountResponse = ItemRetrieveCountResponse.builder().count(0L).build()
|
||||
|
||||
val roundtrippedItemRetrieveCountResponse =
|
||||
jsonMapper.readValue(
|
||||
jsonMapper.writeValueAsString(itemRetrieveCountResponse),
|
||||
jacksonTypeRef<ItemRetrieveCountResponse>(),
|
||||
)
|
||||
|
||||
assertThat(roundtrippedItemRetrieveCountResponse).isEqualTo(itemRetrieveCountResponse)
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.models.annotationqueues.items
|
||||
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
internal class ItemRetrievePlacementParamsTest {
|
||||
|
||||
@Test
|
||||
fun create() {
|
||||
ItemRetrievePlacementParams.builder().queueId("queue_id").itemId("item_id").build()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun pathParams() {
|
||||
val params =
|
||||
ItemRetrievePlacementParams.builder().queueId("queue_id").itemId("item_id").build()
|
||||
|
||||
assertThat(params._pathParam(0)).isEqualTo("queue_id")
|
||||
assertThat(params._pathParam(1)).isEqualTo("item_id")
|
||||
// out-of-bound path param
|
||||
assertThat(params._pathParam(2)).isEqualTo("")
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.models.annotationqueues.items
|
||||
|
||||
import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
|
||||
import com.langchain.smith.core.jsonMapper
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
internal class ItemRetrievePlacementResponseTest {
|
||||
|
||||
@Test
|
||||
fun create() {
|
||||
val itemRetrievePlacementResponse =
|
||||
ItemRetrievePlacementResponse.builder()
|
||||
.cursor("cursor")
|
||||
.itemType(ItemRetrievePlacementResponse.ItemType.RUN)
|
||||
.position(0L)
|
||||
.section(ItemRetrievePlacementResponse.Section.NEEDS_MY_REVIEW)
|
||||
.build()
|
||||
|
||||
assertThat(itemRetrievePlacementResponse.cursor()).contains("cursor")
|
||||
assertThat(itemRetrievePlacementResponse.itemType())
|
||||
.contains(ItemRetrievePlacementResponse.ItemType.RUN)
|
||||
assertThat(itemRetrievePlacementResponse.position()).contains(0L)
|
||||
assertThat(itemRetrievePlacementResponse.section())
|
||||
.contains(ItemRetrievePlacementResponse.Section.NEEDS_MY_REVIEW)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun roundtrip() {
|
||||
val jsonMapper = jsonMapper()
|
||||
val itemRetrievePlacementResponse =
|
||||
ItemRetrievePlacementResponse.builder()
|
||||
.cursor("cursor")
|
||||
.itemType(ItemRetrievePlacementResponse.ItemType.RUN)
|
||||
.position(0L)
|
||||
.section(ItemRetrievePlacementResponse.Section.NEEDS_MY_REVIEW)
|
||||
.build()
|
||||
|
||||
val roundtrippedItemRetrievePlacementResponse =
|
||||
jsonMapper.readValue(
|
||||
jsonMapper.writeValueAsString(itemRetrievePlacementResponse),
|
||||
jacksonTypeRef<ItemRetrievePlacementResponse>(),
|
||||
)
|
||||
|
||||
assertThat(roundtrippedItemRetrievePlacementResponse)
|
||||
.isEqualTo(itemRetrievePlacementResponse)
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.models.annotationqueues.items
|
||||
|
||||
import java.time.OffsetDateTime
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
internal class ItemUpdateParamsTest {
|
||||
|
||||
@Test
|
||||
fun create() {
|
||||
ItemUpdateParams.builder()
|
||||
.queueId("queue_id")
|
||||
.itemId("item_id")
|
||||
.addedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
|
||||
.lastReviewedTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
|
||||
.build()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun pathParams() {
|
||||
val params = ItemUpdateParams.builder().queueId("queue_id").itemId("item_id").build()
|
||||
|
||||
assertThat(params._pathParam(0)).isEqualTo("queue_id")
|
||||
assertThat(params._pathParam(1)).isEqualTo("item_id")
|
||||
// out-of-bound path param
|
||||
assertThat(params._pathParam(2)).isEqualTo("")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun body() {
|
||||
val params =
|
||||
ItemUpdateParams.builder()
|
||||
.queueId("queue_id")
|
||||
.itemId("item_id")
|
||||
.addedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
|
||||
.lastReviewedTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
|
||||
.build()
|
||||
|
||||
val body = params._body()
|
||||
|
||||
assertThat(body.addedAt()).contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
|
||||
assertThat(body.lastReviewedTime())
|
||||
.contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun bodyWithoutOptionalFields() {
|
||||
val params = ItemUpdateParams.builder().queueId("queue_id").itemId("item_id").build()
|
||||
|
||||
val body = params._body()
|
||||
}
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.models.annotationqueues.items
|
||||
|
||||
import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
|
||||
import com.langchain.smith.core.jsonMapper
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
internal class ItemUpdateResponseTest {
|
||||
|
||||
@Test
|
||||
fun create() {
|
||||
val itemUpdateResponse =
|
||||
ItemUpdateResponse.builder()
|
||||
.id("id")
|
||||
.addedAt("added_at")
|
||||
.itemType(ItemUpdateResponse.ItemType.RUN)
|
||||
.lastReviewedTime("last_reviewed_time")
|
||||
.queueId("queue_id")
|
||||
.runId("run_id")
|
||||
.sessionId("session_id")
|
||||
.sourceProposedExampleId("source_proposed_example_id")
|
||||
.startTime("start_time")
|
||||
.threadId("thread_id")
|
||||
.build()
|
||||
|
||||
assertThat(itemUpdateResponse.id()).contains("id")
|
||||
assertThat(itemUpdateResponse.addedAt()).contains("added_at")
|
||||
assertThat(itemUpdateResponse.itemType()).contains(ItemUpdateResponse.ItemType.RUN)
|
||||
assertThat(itemUpdateResponse.lastReviewedTime()).contains("last_reviewed_time")
|
||||
assertThat(itemUpdateResponse.queueId()).contains("queue_id")
|
||||
assertThat(itemUpdateResponse.runId()).contains("run_id")
|
||||
assertThat(itemUpdateResponse.sessionId()).contains("session_id")
|
||||
assertThat(itemUpdateResponse.sourceProposedExampleId())
|
||||
.contains("source_proposed_example_id")
|
||||
assertThat(itemUpdateResponse.startTime()).contains("start_time")
|
||||
assertThat(itemUpdateResponse.threadId()).contains("thread_id")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun roundtrip() {
|
||||
val jsonMapper = jsonMapper()
|
||||
val itemUpdateResponse =
|
||||
ItemUpdateResponse.builder()
|
||||
.id("id")
|
||||
.addedAt("added_at")
|
||||
.itemType(ItemUpdateResponse.ItemType.RUN)
|
||||
.lastReviewedTime("last_reviewed_time")
|
||||
.queueId("queue_id")
|
||||
.runId("run_id")
|
||||
.sessionId("session_id")
|
||||
.sourceProposedExampleId("source_proposed_example_id")
|
||||
.startTime("start_time")
|
||||
.threadId("thread_id")
|
||||
.build()
|
||||
|
||||
val roundtrippedItemUpdateResponse =
|
||||
jsonMapper.readValue(
|
||||
jsonMapper.writeValueAsString(itemUpdateResponse),
|
||||
jacksonTypeRef<ItemUpdateResponse>(),
|
||||
)
|
||||
|
||||
assertThat(roundtrippedItemUpdateResponse).isEqualTo(itemUpdateResponse)
|
||||
}
|
||||
}
|
||||
+181
@@ -0,0 +1,181 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.services.async.annotationqueues
|
||||
|
||||
import com.langchain.smith.client.okhttp.LangsmithOkHttpClientAsync
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemCreateParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemCreateStatusParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemDeleteAllParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemListParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemRetrieveCountParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemRetrievePlacementParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemUpdateParams
|
||||
import java.time.OffsetDateTime
|
||||
import org.junit.jupiter.api.Disabled
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
internal class ItemServiceAsyncTest {
|
||||
|
||||
@Disabled("Mock server tests are disabled")
|
||||
@Test
|
||||
fun create() {
|
||||
val client =
|
||||
LangsmithOkHttpClientAsync.builder()
|
||||
.apiKey("My API Key")
|
||||
.tenantId("My Tenant ID")
|
||||
.build()
|
||||
val itemServiceAsync = client.annotationQueues().items()
|
||||
|
||||
val itemFuture =
|
||||
itemServiceAsync.create(
|
||||
ItemCreateParams.builder()
|
||||
.queueId("queue_id")
|
||||
.extendTraceRetention(true)
|
||||
.addItem(
|
||||
ItemCreateParams.Item.builder()
|
||||
.itemType(ItemCreateParams.Item.ItemType.RUN)
|
||||
.runId("run_id")
|
||||
.sessionId("session_id")
|
||||
.sourceProposedExampleId("source_proposed_example_id")
|
||||
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
|
||||
.threadId("thread_id")
|
||||
.build()
|
||||
)
|
||||
.build()
|
||||
)
|
||||
|
||||
val item = itemFuture.get()
|
||||
item.validate()
|
||||
}
|
||||
|
||||
@Disabled("Mock server tests are disabled")
|
||||
@Test
|
||||
fun update() {
|
||||
val client =
|
||||
LangsmithOkHttpClientAsync.builder()
|
||||
.apiKey("My API Key")
|
||||
.tenantId("My Tenant ID")
|
||||
.build()
|
||||
val itemServiceAsync = client.annotationQueues().items()
|
||||
|
||||
val itemFuture =
|
||||
itemServiceAsync.update(
|
||||
ItemUpdateParams.builder()
|
||||
.queueId("queue_id")
|
||||
.itemId("item_id")
|
||||
.addedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
|
||||
.lastReviewedTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
|
||||
.build()
|
||||
)
|
||||
|
||||
val item = itemFuture.get()
|
||||
item.validate()
|
||||
}
|
||||
|
||||
@Disabled("Mock server tests are disabled")
|
||||
@Test
|
||||
fun list() {
|
||||
val client =
|
||||
LangsmithOkHttpClientAsync.builder()
|
||||
.apiKey("My API Key")
|
||||
.tenantId("My Tenant ID")
|
||||
.build()
|
||||
val itemServiceAsync = client.annotationQueues().items()
|
||||
|
||||
val pageFuture =
|
||||
itemServiceAsync.list(
|
||||
ItemListParams.builder()
|
||||
.queueId("queue_id")
|
||||
.status(ItemListParams.Status.NEEDS_MY_REVIEW)
|
||||
.build()
|
||||
)
|
||||
|
||||
val page = pageFuture.get()
|
||||
page.response().validate()
|
||||
}
|
||||
|
||||
@Disabled("Mock server tests are disabled")
|
||||
@Test
|
||||
fun createStatus() {
|
||||
val client =
|
||||
LangsmithOkHttpClientAsync.builder()
|
||||
.apiKey("My API Key")
|
||||
.tenantId("My Tenant ID")
|
||||
.build()
|
||||
val itemServiceAsync = client.annotationQueues().items()
|
||||
|
||||
val responseFuture =
|
||||
itemServiceAsync.createStatus(
|
||||
ItemCreateStatusParams.builder()
|
||||
.queueItemId("queue_item_id")
|
||||
.overrideAddedAt("override_added_at")
|
||||
.status(ItemCreateStatusParams.Status.VIEWED)
|
||||
.build()
|
||||
)
|
||||
|
||||
val response = responseFuture.get()
|
||||
response.validate()
|
||||
}
|
||||
|
||||
@Disabled("Mock server tests are disabled")
|
||||
@Test
|
||||
fun deleteAll() {
|
||||
val client =
|
||||
LangsmithOkHttpClientAsync.builder()
|
||||
.apiKey("My API Key")
|
||||
.tenantId("My Tenant ID")
|
||||
.build()
|
||||
val itemServiceAsync = client.annotationQueues().items()
|
||||
|
||||
val responseFuture =
|
||||
itemServiceAsync.deleteAll(
|
||||
ItemDeleteAllParams.builder().queueId("queue_id").addItemId("string").build()
|
||||
)
|
||||
|
||||
val response = responseFuture.get()
|
||||
response.validate()
|
||||
}
|
||||
|
||||
@Disabled("Mock server tests are disabled")
|
||||
@Test
|
||||
fun retrieveCount() {
|
||||
val client =
|
||||
LangsmithOkHttpClientAsync.builder()
|
||||
.apiKey("My API Key")
|
||||
.tenantId("My Tenant ID")
|
||||
.build()
|
||||
val itemServiceAsync = client.annotationQueues().items()
|
||||
|
||||
val responseFuture =
|
||||
itemServiceAsync.retrieveCount(
|
||||
ItemRetrieveCountParams.builder()
|
||||
.queueId("queue_id")
|
||||
.status("status")
|
||||
.endTime("end_time")
|
||||
.startTime("start_time")
|
||||
.build()
|
||||
)
|
||||
|
||||
val response = responseFuture.get()
|
||||
response.validate()
|
||||
}
|
||||
|
||||
@Disabled("Mock server tests are disabled")
|
||||
@Test
|
||||
fun retrievePlacement() {
|
||||
val client =
|
||||
LangsmithOkHttpClientAsync.builder()
|
||||
.apiKey("My API Key")
|
||||
.tenantId("My Tenant ID")
|
||||
.build()
|
||||
val itemServiceAsync = client.annotationQueues().items()
|
||||
|
||||
val responseFuture =
|
||||
itemServiceAsync.retrievePlacement(
|
||||
ItemRetrievePlacementParams.builder().queueId("queue_id").itemId("item_id").build()
|
||||
)
|
||||
|
||||
val response = responseFuture.get()
|
||||
response.validate()
|
||||
}
|
||||
}
|
||||
+153
@@ -0,0 +1,153 @@
|
||||
// File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
package com.langchain.smith.services.blocking.annotationqueues
|
||||
|
||||
import com.langchain.smith.client.okhttp.LangsmithOkHttpClient
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemCreateParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemCreateStatusParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemDeleteAllParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemListParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemRetrieveCountParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemRetrievePlacementParams
|
||||
import com.langchain.smith.models.annotationqueues.items.ItemUpdateParams
|
||||
import java.time.OffsetDateTime
|
||||
import org.junit.jupiter.api.Disabled
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
internal class ItemServiceTest {
|
||||
|
||||
@Disabled("Mock server tests are disabled")
|
||||
@Test
|
||||
fun create() {
|
||||
val client =
|
||||
LangsmithOkHttpClient.builder().apiKey("My API Key").tenantId("My Tenant ID").build()
|
||||
val itemService = client.annotationQueues().items()
|
||||
|
||||
val item =
|
||||
itemService.create(
|
||||
ItemCreateParams.builder()
|
||||
.queueId("queue_id")
|
||||
.extendTraceRetention(true)
|
||||
.addItem(
|
||||
ItemCreateParams.Item.builder()
|
||||
.itemType(ItemCreateParams.Item.ItemType.RUN)
|
||||
.runId("run_id")
|
||||
.sessionId("session_id")
|
||||
.sourceProposedExampleId("source_proposed_example_id")
|
||||
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
|
||||
.threadId("thread_id")
|
||||
.build()
|
||||
)
|
||||
.build()
|
||||
)
|
||||
|
||||
item.validate()
|
||||
}
|
||||
|
||||
@Disabled("Mock server tests are disabled")
|
||||
@Test
|
||||
fun update() {
|
||||
val client =
|
||||
LangsmithOkHttpClient.builder().apiKey("My API Key").tenantId("My Tenant ID").build()
|
||||
val itemService = client.annotationQueues().items()
|
||||
|
||||
val item =
|
||||
itemService.update(
|
||||
ItemUpdateParams.builder()
|
||||
.queueId("queue_id")
|
||||
.itemId("item_id")
|
||||
.addedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
|
||||
.lastReviewedTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
|
||||
.build()
|
||||
)
|
||||
|
||||
item.validate()
|
||||
}
|
||||
|
||||
@Disabled("Mock server tests are disabled")
|
||||
@Test
|
||||
fun list() {
|
||||
val client =
|
||||
LangsmithOkHttpClient.builder().apiKey("My API Key").tenantId("My Tenant ID").build()
|
||||
val itemService = client.annotationQueues().items()
|
||||
|
||||
val page =
|
||||
itemService.list(
|
||||
ItemListParams.builder()
|
||||
.queueId("queue_id")
|
||||
.status(ItemListParams.Status.NEEDS_MY_REVIEW)
|
||||
.build()
|
||||
)
|
||||
|
||||
page.response().validate()
|
||||
}
|
||||
|
||||
@Disabled("Mock server tests are disabled")
|
||||
@Test
|
||||
fun createStatus() {
|
||||
val client =
|
||||
LangsmithOkHttpClient.builder().apiKey("My API Key").tenantId("My Tenant ID").build()
|
||||
val itemService = client.annotationQueues().items()
|
||||
|
||||
val response =
|
||||
itemService.createStatus(
|
||||
ItemCreateStatusParams.builder()
|
||||
.queueItemId("queue_item_id")
|
||||
.overrideAddedAt("override_added_at")
|
||||
.status(ItemCreateStatusParams.Status.VIEWED)
|
||||
.build()
|
||||
)
|
||||
|
||||
response.validate()
|
||||
}
|
||||
|
||||
@Disabled("Mock server tests are disabled")
|
||||
@Test
|
||||
fun deleteAll() {
|
||||
val client =
|
||||
LangsmithOkHttpClient.builder().apiKey("My API Key").tenantId("My Tenant ID").build()
|
||||
val itemService = client.annotationQueues().items()
|
||||
|
||||
val response =
|
||||
itemService.deleteAll(
|
||||
ItemDeleteAllParams.builder().queueId("queue_id").addItemId("string").build()
|
||||
)
|
||||
|
||||
response.validate()
|
||||
}
|
||||
|
||||
@Disabled("Mock server tests are disabled")
|
||||
@Test
|
||||
fun retrieveCount() {
|
||||
val client =
|
||||
LangsmithOkHttpClient.builder().apiKey("My API Key").tenantId("My Tenant ID").build()
|
||||
val itemService = client.annotationQueues().items()
|
||||
|
||||
val response =
|
||||
itemService.retrieveCount(
|
||||
ItemRetrieveCountParams.builder()
|
||||
.queueId("queue_id")
|
||||
.status("status")
|
||||
.endTime("end_time")
|
||||
.startTime("start_time")
|
||||
.build()
|
||||
)
|
||||
|
||||
response.validate()
|
||||
}
|
||||
|
||||
@Disabled("Mock server tests are disabled")
|
||||
@Test
|
||||
fun retrievePlacement() {
|
||||
val client =
|
||||
LangsmithOkHttpClient.builder().apiKey("My API Key").tenantId("My Tenant ID").build()
|
||||
val itemService = client.annotationQueues().items()
|
||||
|
||||
val response =
|
||||
itemService.retrievePlacement(
|
||||
ItemRetrievePlacementParams.builder().queueId("queue_id").itemId("item_id").build()
|
||||
)
|
||||
|
||||
response.validate()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user