@@ -21,7 +21,7 @@ import java.util.Objects
2121import java.util.Optional
2222import kotlin.jvm.optionals.getOrNull
2323
24- /* * Update a conversation's metadata with the given ID. */
24+ /* * Update a conversation */
2525class ConversationUpdateParams
2626private constructor (
2727 private val conversationId: String? ,
@@ -35,13 +35,15 @@ private constructor(
3535 /* *
3636 * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing
3737 * additional information about the object in a structured format, and querying for objects via
38- * API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are
39- * strings with a maximum length of 512 characters.
38+ * API or the dashboard.
4039 *
41- * @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
42- * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
40+ * Keys are strings with a maximum length of 64 characters. Values are strings with a maximum
41+ * length of 512 characters.
42+ *
43+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
44+ * server responded with an unexpected value).
4345 */
44- fun metadata (): Metadata = body.metadata()
46+ fun metadata (): Optional < Metadata > = body.metadata()
4547
4648 /* *
4749 * Returns the raw JSON value of [metadata].
@@ -107,10 +109,15 @@ private constructor(
107109 /* *
108110 * Set of 16 key-value pairs that can be attached to an object. This can be useful for
109111 * storing additional information about the object in a structured format, and querying for
110- * objects via API or the dashboard. Keys are strings with a maximum length of 64
111- * characters. Values are strings with a maximum length of 512 characters.
112+ * objects via API or the dashboard.
113+ *
114+ * Keys are strings with a maximum length of 64 characters. Values are strings with a
115+ * maximum length of 512 characters.
112116 */
113- fun metadata (metadata : Metadata ) = apply { body.metadata(metadata) }
117+ fun metadata (metadata : Metadata ? ) = apply { body.metadata(metadata) }
118+
119+ /* * Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */
120+ fun metadata (metadata : Optional <Metadata >) = metadata(metadata.getOrNull())
114121
115122 /* *
116123 * Sets [Builder.metadata] to an arbitrary JSON value.
@@ -287,13 +294,15 @@ private constructor(
287294 /* *
288295 * Set of 16 key-value pairs that can be attached to an object. This can be useful for
289296 * storing additional information about the object in a structured format, and querying for
290- * objects via API or the dashboard. Keys are strings with a maximum length of 64
291- * characters. Values are strings with a maximum length of 512 characters.
297+ * objects via API or the dashboard.
298+ *
299+ * Keys are strings with a maximum length of 64 characters. Values are strings with a
300+ * maximum length of 512 characters.
292301 *
293- * @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
294- * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
302+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
303+ * server responded with an unexpected value).
295304 */
296- fun metadata (): Metadata = metadata.getRequired (" metadata" )
305+ fun metadata (): Optional < Metadata > = metadata.getOptional (" metadata" )
297306
298307 /* *
299308 * Returns the raw JSON value of [metadata].
@@ -342,10 +351,15 @@ private constructor(
342351 /* *
343352 * Set of 16 key-value pairs that can be attached to an object. This can be useful for
344353 * storing additional information about the object in a structured format, and querying
345- * for objects via API or the dashboard. Keys are strings with a maximum length of 64
346- * characters. Values are strings with a maximum length of 512 characters.
354+ * for objects via API or the dashboard.
355+ *
356+ * Keys are strings with a maximum length of 64 characters. Values are strings with a
357+ * maximum length of 512 characters.
347358 */
348- fun metadata (metadata : Metadata ) = metadata(JsonField .of(metadata))
359+ fun metadata (metadata : Metadata ? ) = metadata(JsonField .ofNullable(metadata))
360+
361+ /* * Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */
362+ fun metadata (metadata : Optional <Metadata >) = metadata(metadata.getOrNull())
349363
350364 /* *
351365 * Sets [Builder.metadata] to an arbitrary JSON value.
@@ -398,7 +412,7 @@ private constructor(
398412 return @apply
399413 }
400414
401- metadata().validate()
415+ metadata().ifPresent { it. validate() }
402416 validated = true
403417 }
404418
@@ -440,8 +454,10 @@ private constructor(
440454 /* *
441455 * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing
442456 * additional information about the object in a structured format, and querying for objects via
443- * API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are
444- * strings with a maximum length of 512 characters.
457+ * API or the dashboard.
458+ *
459+ * Keys are strings with a maximum length of 64 characters. Values are strings with a maximum
460+ * length of 512 characters.
445461 */
446462 class Metadata
447463 @JsonCreator
0 commit comments