@@ -13,7 +13,6 @@ import app.knock.api.core.http.Headers
1313import app.knock.api.core.http.QueryParams
1414import app.knock.api.core.toImmutable
1515import app.knock.api.errors.KnockInvalidDataException
16- import app.knock.api.models.users.InlineIdentifyUserRequest
1716import com.fasterxml.jackson.annotation.JsonAnyGetter
1817import com.fasterxml.jackson.annotation.JsonAnySetter
1918import com.fasterxml.jackson.annotation.JsonCreator
@@ -448,28 +447,22 @@ private constructor(
448447 /* * An audience member. */
449448 class Member
450449 private constructor (
451- private val user: JsonField <InlineIdentifyUserRequest >,
450+ private val user: JsonField <User >,
452451 private val tenant: JsonField <String >,
453452 private val additionalProperties: MutableMap <String , JsonValue >,
454453 ) {
455454
456455 @JsonCreator
457456 private constructor (
458- @JsonProperty(" user" )
459- @ExcludeMissing
460- user: JsonField <InlineIdentifyUserRequest > = JsonMissing .of(),
457+ @JsonProperty(" user" ) @ExcludeMissing user: JsonField <User > = JsonMissing .of(),
461458 @JsonProperty(" tenant" ) @ExcludeMissing tenant: JsonField <String > = JsonMissing .of(),
462459 ) : this (user, tenant, mutableMapOf ())
463460
464461 /* *
465- * A set of parameters to inline-identify a user with. Inline identifying the user will
466- * ensure that the user is available before the request is executed in Knock. It will
467- * perform an upsert for the user you're supplying, replacing any properties specified.
468- *
469462 * @throws KnockInvalidDataException if the JSON field has an unexpected type or is
470463 * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
471464 */
472- fun user (): InlineIdentifyUserRequest = user.getRequired(" user" )
465+ fun user (): User = user.getRequired(" user" )
473466
474467 /* *
475468 * The unique identifier for the tenant.
@@ -484,9 +477,7 @@ private constructor(
484477 *
485478 * Unlike [user], this method doesn't throw if the JSON field has an unexpected type.
486479 */
487- @JsonProperty(" user" )
488- @ExcludeMissing
489- fun _user (): JsonField <InlineIdentifyUserRequest > = user
480+ @JsonProperty(" user" ) @ExcludeMissing fun _user (): JsonField <User > = user
490481
491482 /* *
492483 * Returns the raw JSON value of [tenant].
@@ -523,7 +514,7 @@ private constructor(
523514 /* * A builder for [Member]. */
524515 class Builder internal constructor() {
525516
526- private var user: JsonField <InlineIdentifyUserRequest >? = null
517+ private var user: JsonField <User >? = null
527518 private var tenant: JsonField <String > = JsonMissing .of()
528519 private var additionalProperties: MutableMap <String , JsonValue > = mutableMapOf ()
529520
@@ -534,21 +525,16 @@ private constructor(
534525 additionalProperties = member.additionalProperties.toMutableMap()
535526 }
536527
537- /* *
538- * A set of parameters to inline-identify a user with. Inline identifying the user will
539- * ensure that the user is available before the request is executed in Knock. It will
540- * perform an upsert for the user you're supplying, replacing any properties specified.
541- */
542- fun user (user : InlineIdentifyUserRequest ) = user(JsonField .of(user))
528+ fun user (user : User ) = user(JsonField .of(user))
543529
544530 /* *
545531 * Sets [Builder.user] to an arbitrary JSON value.
546532 *
547- * You should usually call [Builder.user] with a well-typed [InlineIdentifyUserRequest]
548- * value instead. This method is primarily for setting the field to an undocumented or
549- * not yet supported value.
533+ * You should usually call [Builder.user] with a well-typed [User] value instead. This
534+ * method is primarily for setting the field to an undocumented or not yet supported
535+ * value.
550536 */
551- fun user (user : JsonField <InlineIdentifyUserRequest >) = apply { this .user = user }
537+ fun user (user : JsonField <User >) = apply { this .user = user }
552538
553539 /* * The unique identifier for the tenant. */
554540 fun tenant (tenant : String? ) = tenant(JsonField .ofNullable(tenant))
@@ -631,6 +617,148 @@ private constructor(
631617 (user.asKnown().getOrNull()?.validity() ? : 0 ) +
632618 (if (tenant.asKnown().isPresent) 1 else 0 )
633619
620+ class User
621+ private constructor (
622+ private val id: JsonField <String >,
623+ private val additionalProperties: MutableMap <String , JsonValue >,
624+ ) {
625+
626+ @JsonCreator
627+ private constructor (
628+ @JsonProperty(" id" ) @ExcludeMissing id: JsonField <String > = JsonMissing .of()
629+ ) : this (id, mutableMapOf ())
630+
631+ /* *
632+ * The ID for the user that you set when identifying them in Knock.
633+ *
634+ * @throws KnockInvalidDataException if the JSON field has an unexpected type (e.g. if
635+ * the server responded with an unexpected value).
636+ */
637+ fun id (): Optional <String > = id.getOptional(" id" )
638+
639+ /* *
640+ * Returns the raw JSON value of [id].
641+ *
642+ * Unlike [id], this method doesn't throw if the JSON field has an unexpected type.
643+ */
644+ @JsonProperty(" id" ) @ExcludeMissing fun _id (): JsonField <String > = id
645+
646+ @JsonAnySetter
647+ private fun putAdditionalProperty (key : String , value : JsonValue ) {
648+ additionalProperties.put(key, value)
649+ }
650+
651+ @JsonAnyGetter
652+ @ExcludeMissing
653+ fun _additionalProperties (): Map <String , JsonValue > =
654+ Collections .unmodifiableMap(additionalProperties)
655+
656+ fun toBuilder () = Builder ().from(this )
657+
658+ companion object {
659+
660+ /* * Returns a mutable builder for constructing an instance of [User]. */
661+ @JvmStatic fun builder () = Builder ()
662+ }
663+
664+ /* * A builder for [User]. */
665+ class Builder internal constructor() {
666+
667+ private var id: JsonField <String > = JsonMissing .of()
668+ private var additionalProperties: MutableMap <String , JsonValue > = mutableMapOf ()
669+
670+ @JvmSynthetic
671+ internal fun from (user : User ) = apply {
672+ id = user.id
673+ additionalProperties = user.additionalProperties.toMutableMap()
674+ }
675+
676+ /* * The ID for the user that you set when identifying them in Knock. */
677+ fun id (id : String ) = id(JsonField .of(id))
678+
679+ /* *
680+ * Sets [Builder.id] to an arbitrary JSON value.
681+ *
682+ * You should usually call [Builder.id] with a well-typed [String] value instead.
683+ * This method is primarily for setting the field to an undocumented or not yet
684+ * supported value.
685+ */
686+ fun id (id : JsonField <String >) = apply { this .id = id }
687+
688+ fun additionalProperties (additionalProperties : Map <String , JsonValue >) = apply {
689+ this .additionalProperties.clear()
690+ putAllAdditionalProperties(additionalProperties)
691+ }
692+
693+ fun putAdditionalProperty (key : String , value : JsonValue ) = apply {
694+ additionalProperties.put(key, value)
695+ }
696+
697+ fun putAllAdditionalProperties (additionalProperties : Map <String , JsonValue >) =
698+ apply {
699+ this .additionalProperties.putAll(additionalProperties)
700+ }
701+
702+ fun removeAdditionalProperty (key : String ) = apply {
703+ additionalProperties.remove(key)
704+ }
705+
706+ fun removeAllAdditionalProperties (keys : Set <String >) = apply {
707+ keys.forEach(::removeAdditionalProperty)
708+ }
709+
710+ /* *
711+ * Returns an immutable instance of [User].
712+ *
713+ * Further updates to this [Builder] will not mutate the returned instance.
714+ */
715+ fun build (): User = User (id, additionalProperties.toMutableMap())
716+ }
717+
718+ private var validated: Boolean = false
719+
720+ fun validate (): User = apply {
721+ if (validated) {
722+ return @apply
723+ }
724+
725+ id()
726+ validated = true
727+ }
728+
729+ fun isValid (): Boolean =
730+ try {
731+ validate()
732+ true
733+ } catch (e: KnockInvalidDataException ) {
734+ false
735+ }
736+
737+ /* *
738+ * Returns a score indicating how many valid values are contained in this object
739+ * recursively.
740+ *
741+ * Used for best match union deserialization.
742+ */
743+ @JvmSynthetic internal fun validity (): Int = (if (id.asKnown().isPresent) 1 else 0 )
744+
745+ override fun equals (other : Any? ): Boolean {
746+ if (this == = other) {
747+ return true
748+ }
749+
750+ return /* spotless:off */ other is User && id == other.id && additionalProperties == other.additionalProperties /* spotless:on */
751+ }
752+
753+ /* spotless:off */
754+ private val hashCode: Int by lazy { Objects .hash(id, additionalProperties) }
755+ /* spotless:on */
756+
757+ override fun hashCode (): Int = hashCode
758+
759+ override fun toString () = " User{id=$id , additionalProperties=$additionalProperties }"
760+ }
761+
634762 override fun equals (other : Any? ): Boolean {
635763 if (this == = other) {
636764 return true
0 commit comments