@@ -18,6 +18,7 @@ import com.withorb.api.errors.OrbInvalidDataException
1818import java.time.OffsetDateTime
1919import java.util.Collections
2020import java.util.Objects
21+ import java.util.Optional
2122import kotlin.jvm.optionals.getOrNull
2223
2324/* *
@@ -33,6 +34,7 @@ private constructor(
3334 private val externalConnections: JsonField <List <ExternalConnection >>,
3435 private val metadata: JsonField <Metadata >,
3536 private val name: JsonField <String >,
37+ private val archivedAt: JsonField <OffsetDateTime >,
3638 private val additionalProperties: MutableMap <String , JsonValue >,
3739) {
3840
@@ -47,21 +49,31 @@ private constructor(
4749 externalConnections: JsonField <List <ExternalConnection >> = JsonMissing .of(),
4850 @JsonProperty(" metadata" ) @ExcludeMissing metadata: JsonField <Metadata > = JsonMissing .of(),
4951 @JsonProperty(" name" ) @ExcludeMissing name: JsonField <String > = JsonMissing .of(),
50- ) : this (id, createdAt, externalConnections, metadata, name, mutableMapOf ())
52+ @JsonProperty(" archived_at" )
53+ @ExcludeMissing
54+ archivedAt: JsonField <OffsetDateTime > = JsonMissing .of(),
55+ ) : this (id, createdAt, externalConnections, metadata, name, archivedAt, mutableMapOf ())
5156
5257 /* *
58+ * The Orb-assigned unique identifier for the item.
59+ *
5360 * @throws OrbInvalidDataException if the JSON field has an unexpected type or is unexpectedly
5461 * missing or null (e.g. if the server responded with an unexpected value).
5562 */
5663 fun id (): String = id.getRequired(" id" )
5764
5865 /* *
66+ * The time at which the item was created.
67+ *
5968 * @throws OrbInvalidDataException if the JSON field has an unexpected type or is unexpectedly
6069 * missing or null (e.g. if the server responded with an unexpected value).
6170 */
6271 fun createdAt (): OffsetDateTime = createdAt.getRequired(" created_at" )
6372
6473 /* *
74+ * A list of external connections for this item, used to sync with external invoicing and tax
75+ * systems.
76+ *
6577 * @throws OrbInvalidDataException if the JSON field has an unexpected type or is unexpectedly
6678 * missing or null (e.g. if the server responded with an unexpected value).
6779 */
@@ -79,11 +91,21 @@ private constructor(
7991 fun metadata (): Metadata = metadata.getRequired(" metadata" )
8092
8193 /* *
94+ * The name of the item.
95+ *
8296 * @throws OrbInvalidDataException if the JSON field has an unexpected type or is unexpectedly
8397 * missing or null (e.g. if the server responded with an unexpected value).
8498 */
8599 fun name (): String = name.getRequired(" name" )
86100
101+ /* *
102+ * The time at which the item was archived. If null, the item is not archived.
103+ *
104+ * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server
105+ * responded with an unexpected value).
106+ */
107+ fun archivedAt (): Optional <OffsetDateTime > = archivedAt.getOptional(" archived_at" )
108+
87109 /* *
88110 * Returns the raw JSON value of [id].
89111 *
@@ -124,6 +146,15 @@ private constructor(
124146 */
125147 @JsonProperty(" name" ) @ExcludeMissing fun _name (): JsonField <String > = name
126148
149+ /* *
150+ * Returns the raw JSON value of [archivedAt].
151+ *
152+ * Unlike [archivedAt], this method doesn't throw if the JSON field has an unexpected type.
153+ */
154+ @JsonProperty(" archived_at" )
155+ @ExcludeMissing
156+ fun _archivedAt (): JsonField <OffsetDateTime > = archivedAt
157+
127158 @JsonAnySetter
128159 private fun putAdditionalProperty (key : String , value : JsonValue ) {
129160 additionalProperties.put(key, value)
@@ -161,6 +192,7 @@ private constructor(
161192 private var externalConnections: JsonField <MutableList <ExternalConnection >>? = null
162193 private var metadata: JsonField <Metadata >? = null
163194 private var name: JsonField <String >? = null
195+ private var archivedAt: JsonField <OffsetDateTime > = JsonMissing .of()
164196 private var additionalProperties: MutableMap <String , JsonValue > = mutableMapOf ()
165197
166198 @JvmSynthetic
@@ -170,9 +202,11 @@ private constructor(
170202 externalConnections = item.externalConnections.map { it.toMutableList() }
171203 metadata = item.metadata
172204 name = item.name
205+ archivedAt = item.archivedAt
173206 additionalProperties = item.additionalProperties.toMutableMap()
174207 }
175208
209+ /* * The Orb-assigned unique identifier for the item. */
176210 fun id (id : String ) = id(JsonField .of(id))
177211
178212 /* *
@@ -183,6 +217,7 @@ private constructor(
183217 */
184218 fun id (id : JsonField <String >) = apply { this .id = id }
185219
220+ /* * The time at which the item was created. */
186221 fun createdAt (createdAt : OffsetDateTime ) = createdAt(JsonField .of(createdAt))
187222
188223 /* *
@@ -194,6 +229,10 @@ private constructor(
194229 */
195230 fun createdAt (createdAt : JsonField <OffsetDateTime >) = apply { this .createdAt = createdAt }
196231
232+ /* *
233+ * A list of external connections for this item, used to sync with external invoicing and
234+ * tax systems.
235+ */
197236 fun externalConnections (externalConnections : List <ExternalConnection >) =
198237 externalConnections(JsonField .of(externalConnections))
199238
@@ -236,6 +275,7 @@ private constructor(
236275 */
237276 fun metadata (metadata : JsonField <Metadata >) = apply { this .metadata = metadata }
238277
278+ /* * The name of the item. */
239279 fun name (name : String ) = name(JsonField .of(name))
240280
241281 /* *
@@ -246,6 +286,23 @@ private constructor(
246286 */
247287 fun name (name : JsonField <String >) = apply { this .name = name }
248288
289+ /* * The time at which the item was archived. If null, the item is not archived. */
290+ fun archivedAt (archivedAt : OffsetDateTime ? ) = archivedAt(JsonField .ofNullable(archivedAt))
291+
292+ /* * Alias for calling [Builder.archivedAt] with `archivedAt.orElse(null)`. */
293+ fun archivedAt (archivedAt : Optional <OffsetDateTime >) = archivedAt(archivedAt.getOrNull())
294+
295+ /* *
296+ * Sets [Builder.archivedAt] to an arbitrary JSON value.
297+ *
298+ * You should usually call [Builder.archivedAt] with a well-typed [OffsetDateTime] value
299+ * instead. This method is primarily for setting the field to an undocumented or not yet
300+ * supported value.
301+ */
302+ fun archivedAt (archivedAt : JsonField <OffsetDateTime >) = apply {
303+ this .archivedAt = archivedAt
304+ }
305+
249306 fun additionalProperties (additionalProperties : Map <String , JsonValue >) = apply {
250307 this .additionalProperties.clear()
251308 putAllAdditionalProperties(additionalProperties)
@@ -288,6 +345,7 @@ private constructor(
288345 checkRequired(" externalConnections" , externalConnections).map { it.toImmutable() },
289346 checkRequired(" metadata" , metadata),
290347 checkRequired(" name" , name),
348+ archivedAt,
291349 additionalProperties.toMutableMap(),
292350 )
293351 }
@@ -304,6 +362,7 @@ private constructor(
304362 externalConnections().forEach { it.validate() }
305363 metadata().validate()
306364 name()
365+ archivedAt()
307366 validated = true
308367 }
309368
@@ -326,8 +385,13 @@ private constructor(
326385 (if (createdAt.asKnown().isPresent) 1 else 0 ) +
327386 (externalConnections.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ? : 0 ) +
328387 (metadata.asKnown().getOrNull()?.validity() ? : 0 ) +
329- (if (name.asKnown().isPresent) 1 else 0 )
388+ (if (name.asKnown().isPresent) 1 else 0 ) +
389+ (if (archivedAt.asKnown().isPresent) 1 else 0 )
330390
391+ /* *
392+ * Represents a connection between an Item and an external system for invoicing or tax
393+ * calculation purposes.
394+ */
331395 class ExternalConnection
332396 @JsonCreator(mode = JsonCreator .Mode .DISABLED )
333397 private constructor (
@@ -347,13 +411,17 @@ private constructor(
347411 ) : this (externalConnectionName, externalEntityId, mutableMapOf ())
348412
349413 /* *
414+ * The name of the external system this item is connected to.
415+ *
350416 * @throws OrbInvalidDataException if the JSON field has an unexpected type or is
351417 * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
352418 */
353419 fun externalConnectionName (): ExternalConnectionName =
354420 externalConnectionName.getRequired(" external_connection_name" )
355421
356422 /* *
423+ * The identifier of this item in the external system.
424+ *
357425 * @throws OrbInvalidDataException if the JSON field has an unexpected type or is
358426 * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
359427 */
@@ -419,6 +487,7 @@ private constructor(
419487 additionalProperties = externalConnection.additionalProperties.toMutableMap()
420488 }
421489
490+ /* * The name of the external system this item is connected to. */
422491 fun externalConnectionName (externalConnectionName : ExternalConnectionName ) =
423492 externalConnectionName(JsonField .of(externalConnectionName))
424493
@@ -434,6 +503,7 @@ private constructor(
434503 this .externalConnectionName = externalConnectionName
435504 }
436505
506+ /* * The identifier of this item in the external system. */
437507 fun externalEntityId (externalEntityId : String ) =
438508 externalEntityId(JsonField .of(externalEntityId))
439509
@@ -519,6 +589,7 @@ private constructor(
519589 (externalConnectionName.asKnown().getOrNull()?.validity() ? : 0 ) +
520590 (if (externalEntityId.asKnown().isPresent) 1 else 0 )
521591
592+ /* * The name of the external system this item is connected to. */
522593 class ExternalConnectionName
523594 @JsonCreator
524595 private constructor (private val value: JsonField <String >) : Enum {
@@ -823,15 +894,24 @@ private constructor(
823894 externalConnections == other.externalConnections &&
824895 metadata == other.metadata &&
825896 name == other.name &&
897+ archivedAt == other.archivedAt &&
826898 additionalProperties == other.additionalProperties
827899 }
828900
829901 private val hashCode: Int by lazy {
830- Objects .hash(id, createdAt, externalConnections, metadata, name, additionalProperties)
902+ Objects .hash(
903+ id,
904+ createdAt,
905+ externalConnections,
906+ metadata,
907+ name,
908+ archivedAt,
909+ additionalProperties,
910+ )
831911 }
832912
833913 override fun hashCode (): Int = hashCode
834914
835915 override fun toString () =
836- " Item{id=$id , createdAt=$createdAt , externalConnections=$externalConnections , metadata=$metadata , name=$name , additionalProperties=$additionalProperties }"
916+ " Item{id=$id , createdAt=$createdAt , externalConnections=$externalConnections , metadata=$metadata , name=$name , archivedAt= $archivedAt , additionalProperties=$additionalProperties }"
837917}
0 commit comments