@@ -9,6 +9,7 @@ import com.increase.api.core.NoAutoDetect
99import com.increase.api.core.Params
1010import com.increase.api.core.http.Headers
1111import com.increase.api.core.http.QueryParams
12+ import com.increase.api.core.toImmutable
1213import com.increase.api.errors.IncreaseInvalidDataException
1314import java.time.OffsetDateTime
1415import java.time.format.DateTimeFormatter
@@ -54,7 +55,6 @@ private constructor(
5455 /* * Filter Accounts for those in a specific Program. */
5556 fun programId (): Optional <String > = Optional .ofNullable(programId)
5657
57- /* * Filter Accounts for those with the specified status. */
5858 fun status (): Optional <Status > = Optional .ofNullable(status)
5959
6060 fun _additionalHeaders (): Headers = additionalHeaders
@@ -76,7 +76,7 @@ private constructor(
7676 }
7777 this .limit?.let { queryParams.put(" limit" , listOf (it.toString())) }
7878 this .programId?.let { queryParams.put(" program_id" , listOf (it.toString())) }
79- this .status?.let { queryParams.put(" status" , listOf (it.toString()) ) }
79+ this .status?.forEachQueryParam { key, values -> queryParams.put(" status. $key " , values ) }
8080 queryParams.putAll(additionalQueryParams)
8181 return queryParams.build()
8282 }
@@ -183,10 +183,8 @@ private constructor(
183183 /* * Filter Accounts for those in a specific Program. */
184184 fun programId (programId : Optional <String >) = programId(programId.orElse(null ))
185185
186- /* * Filter Accounts for those with the specified status. */
187186 fun status (status : Status ? ) = apply { this .status = status }
188187
189- /* * Filter Accounts for those with the specified status. */
190188 fun status (status : Optional <Status >) = status(status.orElse(null ))
191189
192190 fun additionalHeaders (additionalHeaders : Headers ) = apply {
@@ -497,111 +495,235 @@ private constructor(
497495 " CreatedAt{after=$after , before=$before , onOrAfter=$onOrAfter , onOrBefore=$onOrBefore , additionalProperties=$additionalProperties }"
498496 }
499497
500- /* * Filter Accounts for those with the specified status. */
501- class Status @JsonCreator private constructor(private val value : JsonField < String >) : Enum {
498+ class Status
499+ private constructor (private val in_ : List < In > ? , private val additionalProperties : QueryParams ) {
502500
503501 /* *
504- * Returns this class instance's raw value.
505- *
506- * This is usually only useful if this instance was deserialized from data that doesn't
507- * match any known member, and you want to know that value. For example, if the SDK is on an
508- * older version than the API, then the API may respond with new members that the SDK is
509- * unaware of.
502+ * Filter Accounts for those with the specified status. For GET requests, this should be
503+ * encoded as a comma-delimited string, such as `?in=one,two,three`.
510504 */
511- @com.fasterxml.jackson.annotation. JsonValue fun _value (): JsonField < String > = value
505+ fun in_ (): Optional < List < In >> = Optional .ofNullable(in_)
512506
513- companion object {
507+ fun _additionalProperties (): QueryParams = additionalProperties
514508
515- /* * Closed Accounts on which no new activity can occur. */
516- @JvmField val CLOSED = of(" closed" )
509+ @JvmSynthetic
510+ internal fun forEachQueryParam (putParam : (String , List <String >) -> Unit ) {
511+ this .in_?.let { putParam(" in" , listOf (it.joinToString(separator = " ," ))) }
512+ additionalProperties.keys().forEach { putParam(it, additionalProperties.values(it)) }
513+ }
517514
518- /* * Open Accounts that are ready to use. */
519- @JvmField val OPEN = of(" open" )
515+ fun toBuilder () = Builder ().from(this )
520516
521- @JvmStatic fun of (value : String ) = Status (JsonField .of(value))
522- }
517+ companion object {
523518
524- /* * An enum containing [Status]'s known values. */
525- enum class Known {
526- /* * Closed Accounts on which no new activity can occur. */
527- CLOSED ,
528- /* * Open Accounts that are ready to use. */
529- OPEN ,
519+ @JvmStatic fun builder () = Builder ()
530520 }
531521
532- /* *
533- * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member.
534- *
535- * An instance of [Status] can contain an unknown value in a couple of cases:
536- * - It was deserialized from data that doesn't match any known member. For example, if the
537- * SDK is on an older version than the API, then the API may respond with new members that
538- * the SDK is unaware of.
539- * - It was constructed with an arbitrary value using the [of] method.
540- */
541- enum class Value {
542- /* * Closed Accounts on which no new activity can occur. */
543- CLOSED ,
544- /* * Open Accounts that are ready to use. */
545- OPEN ,
546- /* * An enum member indicating that [Status] was instantiated with an unknown value. */
547- _UNKNOWN ,
522+ /* * A builder for [Status]. */
523+ class Builder internal constructor() {
524+
525+ private var in_: MutableList <In >? = null
526+ private var additionalProperties: QueryParams .Builder = QueryParams .builder()
527+
528+ @JvmSynthetic
529+ internal fun from (status : Status ) = apply {
530+ in_ = status.in_?.toMutableList()
531+ additionalProperties = status.additionalProperties.toBuilder()
532+ }
533+
534+ /* *
535+ * Filter Accounts for those with the specified status. For GET requests, this should be
536+ * encoded as a comma-delimited string, such as `?in=one,two,three`.
537+ */
538+ fun in_ (in_ : List <In >? ) = apply { this .in_ = in_?.toMutableList() }
539+
540+ /* *
541+ * Filter Accounts for those with the specified status. For GET requests, this should be
542+ * encoded as a comma-delimited string, such as `?in=one,two,three`.
543+ */
544+ fun in_ (in_ : Optional <List <In >>) = in_(in_.orElse(null ))
545+
546+ /* *
547+ * Filter Accounts for those with the specified status. For GET requests, this should be
548+ * encoded as a comma-delimited string, such as `?in=one,two,three`.
549+ */
550+ fun addIn (in_ : In ) = apply {
551+ this .in_ = (this .in_ ? : mutableListOf ()).apply { add(in_) }
552+ }
553+
554+ fun additionalProperties (additionalProperties : QueryParams ) = apply {
555+ this .additionalProperties.clear()
556+ putAllAdditionalProperties(additionalProperties)
557+ }
558+
559+ fun additionalProperties (additionalProperties : Map <String , Iterable <String >>) = apply {
560+ this .additionalProperties.clear()
561+ putAllAdditionalProperties(additionalProperties)
562+ }
563+
564+ fun putAdditionalProperty (key : String , value : String ) = apply {
565+ additionalProperties.put(key, value)
566+ }
567+
568+ fun putAdditionalProperties (key : String , values : Iterable <String >) = apply {
569+ additionalProperties.put(key, values)
570+ }
571+
572+ fun putAllAdditionalProperties (additionalProperties : QueryParams ) = apply {
573+ this .additionalProperties.putAll(additionalProperties)
574+ }
575+
576+ fun putAllAdditionalProperties (additionalProperties : Map <String , Iterable <String >>) =
577+ apply {
578+ this .additionalProperties.putAll(additionalProperties)
579+ }
580+
581+ fun replaceAdditionalProperties (key : String , value : String ) = apply {
582+ additionalProperties.replace(key, value)
583+ }
584+
585+ fun replaceAdditionalProperties (key : String , values : Iterable <String >) = apply {
586+ additionalProperties.replace(key, values)
587+ }
588+
589+ fun replaceAllAdditionalProperties (additionalProperties : QueryParams ) = apply {
590+ this .additionalProperties.replaceAll(additionalProperties)
591+ }
592+
593+ fun replaceAllAdditionalProperties (
594+ additionalProperties : Map <String , Iterable <String >>
595+ ) = apply { this .additionalProperties.replaceAll(additionalProperties) }
596+
597+ fun removeAdditionalProperties (key : String ) = apply { additionalProperties.remove(key) }
598+
599+ fun removeAllAdditionalProperties (keys : Set <String >) = apply {
600+ additionalProperties.removeAll(keys)
601+ }
602+
603+ fun build (): Status = Status (in_?.toImmutable(), additionalProperties.build())
548604 }
549605
550- /* *
551- * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
552- * if the class was instantiated with an unknown value.
553- *
554- * Use the [known] method instead if you're certain the value is always known or if you want
555- * to throw for the unknown case.
556- */
557- fun value (): Value =
558- when (this ) {
559- CLOSED -> Value .CLOSED
560- OPEN -> Value .OPEN
561- else -> Value ._UNKNOWN
606+ class In @JsonCreator private constructor(private val value : JsonField <String >) : Enum {
607+
608+ /* *
609+ * Returns this class instance's raw value.
610+ *
611+ * This is usually only useful if this instance was deserialized from data that doesn't
612+ * match any known member, and you want to know that value. For example, if the SDK is
613+ * on an older version than the API, then the API may respond with new members that the
614+ * SDK is unaware of.
615+ */
616+ @com.fasterxml.jackson.annotation.JsonValue fun _value (): JsonField <String > = value
617+
618+ companion object {
619+
620+ /* * Closed Accounts on which no new activity can occur. */
621+ @JvmField val CLOSED = of(" closed" )
622+
623+ /* * Open Accounts that are ready to use. */
624+ @JvmField val OPEN = of(" open" )
625+
626+ @JvmStatic fun of (value : String ) = In (JsonField .of(value))
562627 }
563628
564- /* *
565- * Returns an enum member corresponding to this class instance's value.
566- *
567- * Use the [value] method instead if you're uncertain the value is always known and don't
568- * want to throw for the unknown case.
569- *
570- * @throws IncreaseInvalidDataException if this class instance's value is a not a known
571- * member.
572- */
573- fun known (): Known =
574- when (this ) {
575- CLOSED -> Known .CLOSED
576- OPEN -> Known .OPEN
577- else -> throw IncreaseInvalidDataException (" Unknown Status: $value " )
629+ /* * An enum containing [In]'s known values. */
630+ enum class Known {
631+ /* * Closed Accounts on which no new activity can occur. */
632+ CLOSED ,
633+ /* * Open Accounts that are ready to use. */
634+ OPEN ,
578635 }
579636
580- /* *
581- * Returns this class instance's primitive wire representation.
582- *
583- * This differs from the [toString] method because that method is primarily for debugging
584- * and generally doesn't throw.
585- *
586- * @throws IncreaseInvalidDataException if this class instance's value does not have the
587- * expected primitive type.
588- */
589- fun asString (): String =
590- _value ().asString().orElseThrow {
591- IncreaseInvalidDataException (" Value is not a String" )
637+ /* *
638+ * An enum containing [In]'s known values, as well as an [_UNKNOWN] member.
639+ *
640+ * An instance of [In] can contain an unknown value in a couple of cases:
641+ * - It was deserialized from data that doesn't match any known member. For example, if
642+ * the SDK is on an older version than the API, then the API may respond with new
643+ * members that the SDK is unaware of.
644+ * - It was constructed with an arbitrary value using the [of] method.
645+ */
646+ enum class Value {
647+ /* * Closed Accounts on which no new activity can occur. */
648+ CLOSED ,
649+ /* * Open Accounts that are ready to use. */
650+ OPEN ,
651+ /* * An enum member indicating that [In] was instantiated with an unknown value. */
652+ _UNKNOWN ,
592653 }
593654
655+ /* *
656+ * Returns an enum member corresponding to this class instance's value, or
657+ * [Value._UNKNOWN] if the class was instantiated with an unknown value.
658+ *
659+ * Use the [known] method instead if you're certain the value is always known or if you
660+ * want to throw for the unknown case.
661+ */
662+ fun value (): Value =
663+ when (this ) {
664+ CLOSED -> Value .CLOSED
665+ OPEN -> Value .OPEN
666+ else -> Value ._UNKNOWN
667+ }
668+
669+ /* *
670+ * Returns an enum member corresponding to this class instance's value.
671+ *
672+ * Use the [value] method instead if you're uncertain the value is always known and
673+ * don't want to throw for the unknown case.
674+ *
675+ * @throws IncreaseInvalidDataException if this class instance's value is a not a known
676+ * member.
677+ */
678+ fun known (): Known =
679+ when (this ) {
680+ CLOSED -> Known .CLOSED
681+ OPEN -> Known .OPEN
682+ else -> throw IncreaseInvalidDataException (" Unknown In: $value " )
683+ }
684+
685+ /* *
686+ * Returns this class instance's primitive wire representation.
687+ *
688+ * This differs from the [toString] method because that method is primarily for
689+ * debugging and generally doesn't throw.
690+ *
691+ * @throws IncreaseInvalidDataException if this class instance's value does not have the
692+ * expected primitive type.
693+ */
694+ fun asString (): String =
695+ _value ().asString().orElseThrow {
696+ IncreaseInvalidDataException (" Value is not a String" )
697+ }
698+
699+ override fun equals (other : Any? ): Boolean {
700+ if (this == = other) {
701+ return true
702+ }
703+
704+ return /* spotless:off */ other is In && value == other.value /* spotless:on */
705+ }
706+
707+ override fun hashCode () = value.hashCode()
708+
709+ override fun toString () = value.toString()
710+ }
711+
594712 override fun equals (other : Any? ): Boolean {
595713 if (this == = other) {
596714 return true
597715 }
598716
599- return /* spotless:off */ other is Status && value == other.value /* spotless:on */
717+ return /* spotless:off */ other is Status && in_ == other.in_ && additionalProperties == other.additionalProperties /* spotless:on */
600718 }
601719
602- override fun hashCode () = value.hashCode()
720+ /* spotless:off */
721+ private val hashCode: Int by lazy { Objects .hash(in_, additionalProperties) }
722+ /* spotless:on */
723+
724+ override fun hashCode (): Int = hashCode
603725
604- override fun toString () = value.toString()
726+ override fun toString () = " Status{in_= $in_ , additionalProperties= $additionalProperties } "
605727 }
606728
607729 override fun equals (other : Any? ): Boolean {
0 commit comments