diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 934f2cc0..3d5f4e35 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "4.4.0"
+ ".": "4.5.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 4b96b1ea..1c575735 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 77
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier%2Fcourier-9859cb664d1a9de0323c857e96cf41d0a5ac5c5903c501059f36bf62553b1583.yml
-openapi_spec_hash: d29149d60504eba35c63f583ce4bf0bc
-config_hash: 3ec521d062b05b81c22bc1a25bfe3d02
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier%2Fcourier-fab4ee8a24b719456f38d4a6050f4e40158db57937a1d55035be9325df494941.yml
+openapi_spec_hash: be1371c71559511c79a4285238b7131c
+config_hash: 54d2059f36ceee17804ef6c2800affd2
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 45abdcee..6bd51a46 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,13 @@
# Changelog
+## 4.5.0 (2025-12-22)
+
+Full Changelog: [v4.4.0...v4.5.0](https://github.com/trycourier/courier-java/compare/v4.4.0...v4.5.0)
+
+### Features
+
+* **api:** add audience/list/slack/msTeams/pagerduty/webhook recipients, restructure to union ([46de0d2](https://github.com/trycourier/courier-java/commit/46de0d2d85f59c4d1d220dc3e3028c7e6760c769))
+
## 4.4.0 (2025-12-16)
Full Changelog: [v4.3.0...v4.4.0](https://github.com/trycourier/courier-java/compare/v4.3.0...v4.4.0)
diff --git a/README.md b/README.md
index 8674e8ae..5ac7a1f8 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/com.courier/courier-java/4.4.0)
-[](https://javadoc.io/doc/com.courier/courier-java/4.4.0)
+[](https://central.sonatype.com/artifact/com.courier/courier-java/4.5.0)
+[](https://javadoc.io/doc/com.courier/courier-java/4.5.0)
@@ -13,7 +13,7 @@ It is generated with [Stainless](https://www.stainless.com/).
-The REST API documentation can be found on [www.courier.com](https://www.courier.com/docs). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.courier/courier-java/4.4.0).
+The REST API documentation can be found on [www.courier.com](https://www.courier.com/docs). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.courier/courier-java/4.5.0).
@@ -24,7 +24,7 @@ The REST API documentation can be found on [www.courier.com](https://www.courier
### Gradle
```kotlin
-implementation("com.courier:courier-java:4.4.0")
+implementation("com.courier:courier-java:4.5.0")
```
### Maven
@@ -33,7 +33,7 @@ implementation("com.courier:courier-java:4.4.0")
com.courier
courier-java
- 4.4.0
+ 4.5.0
```
diff --git a/build.gradle.kts b/build.gradle.kts
index 63460547..39beae8b 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ repositories {
allprojects {
group = "com.courier"
- version = "4.4.0" // x-release-please-version
+ version = "4.5.0" // x-release-please-version
}
subprojects {
diff --git a/courier-java-core/src/main/kotlin/com/courier/models/AirshipProfile.kt b/courier-java-core/src/main/kotlin/com/courier/models/AirshipProfile.kt
new file mode 100644
index 00000000..73b3ae8f
--- /dev/null
+++ b/courier-java-core/src/main/kotlin/com/courier/models/AirshipProfile.kt
@@ -0,0 +1,234 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.courier.models
+
+import com.courier.core.ExcludeMissing
+import com.courier.core.JsonField
+import com.courier.core.JsonMissing
+import com.courier.core.JsonValue
+import com.courier.core.checkKnown
+import com.courier.core.checkRequired
+import com.courier.core.toImmutable
+import com.courier.errors.CourierInvalidDataException
+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 java.util.Collections
+import java.util.Objects
+import kotlin.jvm.optionals.getOrNull
+
+class AirshipProfile
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val audience: JsonField,
+ private val deviceTypes: JsonField>,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("audience")
+ @ExcludeMissing
+ audience: JsonField = JsonMissing.of(),
+ @JsonProperty("device_types")
+ @ExcludeMissing
+ deviceTypes: JsonField> = JsonMissing.of(),
+ ) : this(audience, deviceTypes, mutableMapOf())
+
+ /**
+ * @throws CourierInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun audience(): AirshipProfileAudience = audience.getRequired("audience")
+
+ /**
+ * @throws CourierInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun deviceTypes(): List = deviceTypes.getRequired("device_types")
+
+ /**
+ * Returns the raw JSON value of [audience].
+ *
+ * Unlike [audience], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("audience")
+ @ExcludeMissing
+ fun _audience(): JsonField = audience
+
+ /**
+ * Returns the raw JSON value of [deviceTypes].
+ *
+ * Unlike [deviceTypes], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("device_types")
+ @ExcludeMissing
+ fun _deviceTypes(): JsonField> = deviceTypes
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [AirshipProfile].
+ *
+ * The following fields are required:
+ * ```java
+ * .audience()
+ * .deviceTypes()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [AirshipProfile]. */
+ class Builder internal constructor() {
+
+ private var audience: JsonField? = null
+ private var deviceTypes: JsonField>? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(airshipProfile: AirshipProfile) = apply {
+ audience = airshipProfile.audience
+ deviceTypes = airshipProfile.deviceTypes.map { it.toMutableList() }
+ additionalProperties = airshipProfile.additionalProperties.toMutableMap()
+ }
+
+ fun audience(audience: AirshipProfileAudience) = audience(JsonField.of(audience))
+
+ /**
+ * Sets [Builder.audience] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.audience] with a well-typed [AirshipProfileAudience]
+ * value instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun audience(audience: JsonField) = apply {
+ this.audience = audience
+ }
+
+ fun deviceTypes(deviceTypes: List) = deviceTypes(JsonField.of(deviceTypes))
+
+ /**
+ * Sets [Builder.deviceTypes] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.deviceTypes] with a well-typed `List` value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun deviceTypes(deviceTypes: JsonField>) = apply {
+ this.deviceTypes = deviceTypes.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [String] to [deviceTypes].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addDeviceType(deviceType: String) = apply {
+ deviceTypes =
+ (deviceTypes ?: JsonField.of(mutableListOf())).also {
+ checkKnown("deviceTypes", it).add(deviceType)
+ }
+ }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [AirshipProfile].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .audience()
+ * .deviceTypes()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): AirshipProfile =
+ AirshipProfile(
+ checkRequired("audience", audience),
+ checkRequired("deviceTypes", deviceTypes).map { it.toImmutable() },
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): AirshipProfile = apply {
+ if (validated) {
+ return@apply
+ }
+
+ audience().validate()
+ deviceTypes()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: CourierInvalidDataException) {
+ 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 =
+ (audience.asKnown().getOrNull()?.validity() ?: 0) +
+ (deviceTypes.asKnown().getOrNull()?.size ?: 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is AirshipProfile &&
+ audience == other.audience &&
+ deviceTypes == other.deviceTypes &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(audience, deviceTypes, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "AirshipProfile{audience=$audience, deviceTypes=$deviceTypes, additionalProperties=$additionalProperties}"
+}
diff --git a/courier-java-core/src/main/kotlin/com/courier/models/AirshipProfileAudience.kt b/courier-java-core/src/main/kotlin/com/courier/models/AirshipProfileAudience.kt
new file mode 100644
index 00000000..3221dd9b
--- /dev/null
+++ b/courier-java-core/src/main/kotlin/com/courier/models/AirshipProfileAudience.kt
@@ -0,0 +1,171 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.courier.models
+
+import com.courier.core.ExcludeMissing
+import com.courier.core.JsonField
+import com.courier.core.JsonMissing
+import com.courier.core.JsonValue
+import com.courier.core.checkRequired
+import com.courier.errors.CourierInvalidDataException
+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 java.util.Collections
+import java.util.Objects
+
+class AirshipProfileAudience
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val namedUser: JsonField,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("named_user") @ExcludeMissing namedUser: JsonField = JsonMissing.of()
+ ) : this(namedUser, mutableMapOf())
+
+ /**
+ * @throws CourierInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun namedUser(): String = namedUser.getRequired("named_user")
+
+ /**
+ * Returns the raw JSON value of [namedUser].
+ *
+ * Unlike [namedUser], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("named_user") @ExcludeMissing fun _namedUser(): JsonField = namedUser
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [AirshipProfileAudience].
+ *
+ * The following fields are required:
+ * ```java
+ * .namedUser()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [AirshipProfileAudience]. */
+ class Builder internal constructor() {
+
+ private var namedUser: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(airshipProfileAudience: AirshipProfileAudience) = apply {
+ namedUser = airshipProfileAudience.namedUser
+ additionalProperties = airshipProfileAudience.additionalProperties.toMutableMap()
+ }
+
+ fun namedUser(namedUser: String) = namedUser(JsonField.of(namedUser))
+
+ /**
+ * Sets [Builder.namedUser] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.namedUser] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun namedUser(namedUser: JsonField) = apply { this.namedUser = namedUser }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [AirshipProfileAudience].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .namedUser()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): AirshipProfileAudience =
+ AirshipProfileAudience(
+ checkRequired("namedUser", namedUser),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): AirshipProfileAudience = apply {
+ if (validated) {
+ return@apply
+ }
+
+ namedUser()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: CourierInvalidDataException) {
+ 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 (namedUser.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is AirshipProfileAudience &&
+ namedUser == other.namedUser &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(namedUser, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "AirshipProfileAudience{namedUser=$namedUser, additionalProperties=$additionalProperties}"
+}
diff --git a/courier-java-core/src/main/kotlin/com/courier/models/AudienceFilter.kt b/courier-java-core/src/main/kotlin/com/courier/models/AudienceFilter.kt
new file mode 100644
index 00000000..d49d13b5
--- /dev/null
+++ b/courier-java-core/src/main/kotlin/com/courier/models/AudienceFilter.kt
@@ -0,0 +1,483 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.courier.models
+
+import com.courier.core.Enum
+import com.courier.core.ExcludeMissing
+import com.courier.core.JsonField
+import com.courier.core.JsonMissing
+import com.courier.core.JsonValue
+import com.courier.core.checkRequired
+import com.courier.errors.CourierInvalidDataException
+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 java.util.Collections
+import java.util.Objects
+import kotlin.jvm.optionals.getOrNull
+
+class AudienceFilter
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val operator: JsonField,
+ private val path: JsonField,
+ private val value: JsonField,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("operator") @ExcludeMissing operator: JsonField = JsonMissing.of(),
+ @JsonProperty("path") @ExcludeMissing path: JsonField = JsonMissing.of(),
+ @JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(),
+ ) : this(operator, path, value, mutableMapOf())
+
+ /**
+ * Send to users only if they are member of the account
+ *
+ * @throws CourierInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun operator(): Operator = operator.getRequired("operator")
+
+ /**
+ * @throws CourierInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun path(): Path = path.getRequired("path")
+
+ /**
+ * @throws CourierInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun value(): String = value.getRequired("value")
+
+ /**
+ * Returns the raw JSON value of [operator].
+ *
+ * Unlike [operator], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("operator") @ExcludeMissing fun _operator(): JsonField = operator
+
+ /**
+ * Returns the raw JSON value of [path].
+ *
+ * Unlike [path], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("path") @ExcludeMissing fun _path(): JsonField = path
+
+ /**
+ * Returns the raw JSON value of [value].
+ *
+ * Unlike [value], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [AudienceFilter].
+ *
+ * The following fields are required:
+ * ```java
+ * .operator()
+ * .path()
+ * .value()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [AudienceFilter]. */
+ class Builder internal constructor() {
+
+ private var operator: JsonField? = null
+ private var path: JsonField? = null
+ private var value: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(audienceFilter: AudienceFilter) = apply {
+ operator = audienceFilter.operator
+ path = audienceFilter.path
+ value = audienceFilter.value
+ additionalProperties = audienceFilter.additionalProperties.toMutableMap()
+ }
+
+ /** Send to users only if they are member of the account */
+ fun operator(operator: Operator) = operator(JsonField.of(operator))
+
+ /**
+ * Sets [Builder.operator] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.operator] with a well-typed [Operator] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun operator(operator: JsonField) = apply { this.operator = operator }
+
+ fun path(path: Path) = path(JsonField.of(path))
+
+ /**
+ * Sets [Builder.path] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.path] with a well-typed [Path] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun path(path: JsonField) = apply { this.path = path }
+
+ fun value(value: String) = value(JsonField.of(value))
+
+ /**
+ * Sets [Builder.value] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.value] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun value(value: JsonField) = apply { this.value = value }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [AudienceFilter].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .operator()
+ * .path()
+ * .value()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): AudienceFilter =
+ AudienceFilter(
+ checkRequired("operator", operator),
+ checkRequired("path", path),
+ checkRequired("value", value),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): AudienceFilter = apply {
+ if (validated) {
+ return@apply
+ }
+
+ operator().validate()
+ path().validate()
+ value()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: CourierInvalidDataException) {
+ 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 =
+ (operator.asKnown().getOrNull()?.validity() ?: 0) +
+ (path.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (value.asKnown().isPresent) 1 else 0)
+
+ /** Send to users only if they are member of the account */
+ class Operator @JsonCreator private constructor(private val value: JsonField) : 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 = value
+
+ companion object {
+
+ @JvmField val MEMBER_OF = of("MEMBER_OF")
+
+ @JvmStatic fun of(value: String) = Operator(JsonField.of(value))
+ }
+
+ /** An enum containing [Operator]'s known values. */
+ enum class Known {
+ MEMBER_OF
+ }
+
+ /**
+ * An enum containing [Operator]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Operator] 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 {
+ MEMBER_OF,
+ /** An enum member indicating that [Operator] 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) {
+ MEMBER_OF -> Value.MEMBER_OF
+ 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 CourierInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
+ fun known(): Known =
+ when (this) {
+ MEMBER_OF -> Known.MEMBER_OF
+ else -> throw CourierInvalidDataException("Unknown Operator: $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 CourierInvalidDataException if this class instance's value does not have the
+ * expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow { CourierInvalidDataException("Value is not a String") }
+
+ private var validated: Boolean = false
+
+ fun validate(): Operator = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: CourierInvalidDataException) {
+ 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 Operator && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
+ class Path @JsonCreator private constructor(private val value: JsonField) : 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 = value
+
+ companion object {
+
+ @JvmField val ACCOUNT_ID = of("account_id")
+
+ @JvmStatic fun of(value: String) = Path(JsonField.of(value))
+ }
+
+ /** An enum containing [Path]'s known values. */
+ enum class Known {
+ ACCOUNT_ID
+ }
+
+ /**
+ * An enum containing [Path]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Path] 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 {
+ ACCOUNT_ID,
+ /** An enum member indicating that [Path] 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) {
+ ACCOUNT_ID -> Value.ACCOUNT_ID
+ 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 CourierInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
+ fun known(): Known =
+ when (this) {
+ ACCOUNT_ID -> Known.ACCOUNT_ID
+ else -> throw CourierInvalidDataException("Unknown Path: $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 CourierInvalidDataException if this class instance's value does not have the
+ * expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow { CourierInvalidDataException("Value is not a String") }
+
+ private var validated: Boolean = false
+
+ fun validate(): Path = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: CourierInvalidDataException) {
+ 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 Path && 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 AudienceFilter &&
+ operator == other.operator &&
+ path == other.path &&
+ value == other.value &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(operator, path, value, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "AudienceFilter{operator=$operator, path=$path, value=$value, additionalProperties=$additionalProperties}"
+}
diff --git a/courier-java-core/src/main/kotlin/com/courier/models/AudienceRecipient.kt b/courier-java-core/src/main/kotlin/com/courier/models/AudienceRecipient.kt
new file mode 100644
index 00000000..47a50fb1
--- /dev/null
+++ b/courier-java-core/src/main/kotlin/com/courier/models/AudienceRecipient.kt
@@ -0,0 +1,375 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.courier.models
+
+import com.courier.core.ExcludeMissing
+import com.courier.core.JsonField
+import com.courier.core.JsonMissing
+import com.courier.core.JsonValue
+import com.courier.core.checkKnown
+import com.courier.core.checkRequired
+import com.courier.core.toImmutable
+import com.courier.errors.CourierInvalidDataException
+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 java.util.Collections
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** Send to all users in an audience */
+class AudienceRecipient
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val audienceId: JsonField,
+ private val data: JsonField,
+ private val filters: JsonField>,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("audience_id")
+ @ExcludeMissing
+ audienceId: JsonField = JsonMissing.of(),
+ @JsonProperty("data") @ExcludeMissing data: JsonField = JsonMissing.of(),
+ @JsonProperty("filters")
+ @ExcludeMissing
+ filters: JsonField> = JsonMissing.of(),
+ ) : this(audienceId, data, filters, mutableMapOf())
+
+ /**
+ * A unique identifier associated with an Audience. A message will be sent to each user in the
+ * audience.
+ *
+ * @throws CourierInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun audienceId(): String = audienceId.getRequired("audience_id")
+
+ /**
+ * @throws CourierInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun data(): Optional = data.getOptional("data")
+
+ /**
+ * @throws CourierInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun filters(): Optional> = filters.getOptional("filters")
+
+ /**
+ * Returns the raw JSON value of [audienceId].
+ *
+ * Unlike [audienceId], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("audience_id") @ExcludeMissing fun _audienceId(): JsonField = audienceId
+
+ /**
+ * Returns the raw JSON value of [data].
+ *
+ * Unlike [data], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data
+
+ /**
+ * Returns the raw JSON value of [filters].
+ *
+ * Unlike [filters], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("filters")
+ @ExcludeMissing
+ fun _filters(): JsonField> = filters
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [AudienceRecipient].
+ *
+ * The following fields are required:
+ * ```java
+ * .audienceId()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [AudienceRecipient]. */
+ class Builder internal constructor() {
+
+ private var audienceId: JsonField? = null
+ private var data: JsonField = JsonMissing.of()
+ private var filters: JsonField>? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(audienceRecipient: AudienceRecipient) = apply {
+ audienceId = audienceRecipient.audienceId
+ data = audienceRecipient.data
+ filters = audienceRecipient.filters.map { it.toMutableList() }
+ additionalProperties = audienceRecipient.additionalProperties.toMutableMap()
+ }
+
+ /**
+ * A unique identifier associated with an Audience. A message will be sent to each user in
+ * the audience.
+ */
+ fun audienceId(audienceId: String) = audienceId(JsonField.of(audienceId))
+
+ /**
+ * Sets [Builder.audienceId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.audienceId] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun audienceId(audienceId: JsonField) = apply { this.audienceId = audienceId }
+
+ fun data(data: Data?) = data(JsonField.ofNullable(data))
+
+ /** Alias for calling [Builder.data] with `data.orElse(null)`. */
+ fun data(data: Optional) = data(data.getOrNull())
+
+ /**
+ * Sets [Builder.data] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.data] with a well-typed [Data] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun data(data: JsonField) = apply { this.data = data }
+
+ fun filters(filters: List?) = filters(JsonField.ofNullable(filters))
+
+ /** Alias for calling [Builder.filters] with `filters.orElse(null)`. */
+ fun filters(filters: Optional>) = filters(filters.getOrNull())
+
+ /**
+ * Sets [Builder.filters] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.filters] with a well-typed `List` value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun filters(filters: JsonField>) = apply {
+ this.filters = filters.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [AudienceFilter] to [filters].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addFilter(filter: AudienceFilter) = apply {
+ filters =
+ (filters ?: JsonField.of(mutableListOf())).also {
+ checkKnown("filters", it).add(filter)
+ }
+ }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [AudienceRecipient].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .audienceId()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): AudienceRecipient =
+ AudienceRecipient(
+ checkRequired("audienceId", audienceId),
+ data,
+ (filters ?: JsonMissing.of()).map { it.toImmutable() },
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): AudienceRecipient = apply {
+ if (validated) {
+ return@apply
+ }
+
+ audienceId()
+ data().ifPresent { it.validate() }
+ filters().ifPresent { it.forEach { it.validate() } }
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: CourierInvalidDataException) {
+ 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 (audienceId.asKnown().isPresent) 1 else 0) +
+ (data.asKnown().getOrNull()?.validity() ?: 0) +
+ (filters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
+
+ class Data
+ @JsonCreator
+ private constructor(
+ @com.fasterxml.jackson.annotation.JsonValue
+ private val additionalProperties: Map
+ ) {
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map = additionalProperties
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /** Returns a mutable builder for constructing an instance of [Data]. */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Data]. */
+ class Builder internal constructor() {
+
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(data: Data) = apply {
+ additionalProperties = data.additionalProperties.toMutableMap()
+ }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [Data].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): Data = Data(additionalProperties.toImmutable())
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Data = apply {
+ if (validated) {
+ return@apply
+ }
+
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: CourierInvalidDataException) {
+ 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 Data && additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() = "Data{additionalProperties=$additionalProperties}"
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is AudienceRecipient &&
+ audienceId == other.audienceId &&
+ data == other.data &&
+ filters == other.filters &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(audienceId, data, filters, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "AudienceRecipient{audienceId=$audienceId, data=$data, filters=$filters, additionalProperties=$additionalProperties}"
+}
diff --git a/courier-java-core/src/main/kotlin/com/courier/models/Discord.kt b/courier-java-core/src/main/kotlin/com/courier/models/Discord.kt
new file mode 100644
index 00000000..a188cb33
--- /dev/null
+++ b/courier-java-core/src/main/kotlin/com/courier/models/Discord.kt
@@ -0,0 +1,194 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.courier.models
+
+import com.courier.core.BaseDeserializer
+import com.courier.core.BaseSerializer
+import com.courier.core.JsonValue
+import com.courier.core.allMaxBy
+import com.courier.core.getOrThrow
+import com.courier.errors.CourierInvalidDataException
+import com.fasterxml.jackson.core.JsonGenerator
+import com.fasterxml.jackson.core.ObjectCodec
+import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.SerializerProvider
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize
+import com.fasterxml.jackson.databind.annotation.JsonSerialize
+import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
+import java.util.Objects
+import java.util.Optional
+
+@JsonDeserialize(using = Discord.Deserializer::class)
+@JsonSerialize(using = Discord.Serializer::class)
+class Discord
+private constructor(
+ private val sendToChannel: SendToChannel? = null,
+ private val sendDirectMessage: SendDirectMessage? = null,
+ private val _json: JsonValue? = null,
+) {
+
+ fun sendToChannel(): Optional = Optional.ofNullable(sendToChannel)
+
+ fun sendDirectMessage(): Optional = Optional.ofNullable(sendDirectMessage)
+
+ fun isSendToChannel(): Boolean = sendToChannel != null
+
+ fun isSendDirectMessage(): Boolean = sendDirectMessage != null
+
+ fun asSendToChannel(): SendToChannel = sendToChannel.getOrThrow("sendToChannel")
+
+ fun asSendDirectMessage(): SendDirectMessage = sendDirectMessage.getOrThrow("sendDirectMessage")
+
+ fun _json(): Optional = Optional.ofNullable(_json)
+
+ fun accept(visitor: Visitor): T =
+ when {
+ sendToChannel != null -> visitor.visitSendToChannel(sendToChannel)
+ sendDirectMessage != null -> visitor.visitSendDirectMessage(sendDirectMessage)
+ else -> visitor.unknown(_json)
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Discord = apply {
+ if (validated) {
+ return@apply
+ }
+
+ accept(
+ object : Visitor {
+ override fun visitSendToChannel(sendToChannel: SendToChannel) {
+ sendToChannel.validate()
+ }
+
+ override fun visitSendDirectMessage(sendDirectMessage: SendDirectMessage) {
+ sendDirectMessage.validate()
+ }
+ }
+ )
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: CourierInvalidDataException) {
+ 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 =
+ accept(
+ object : Visitor {
+ override fun visitSendToChannel(sendToChannel: SendToChannel) =
+ sendToChannel.validity()
+
+ override fun visitSendDirectMessage(sendDirectMessage: SendDirectMessage) =
+ sendDirectMessage.validity()
+
+ override fun unknown(json: JsonValue?) = 0
+ }
+ )
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Discord &&
+ sendToChannel == other.sendToChannel &&
+ sendDirectMessage == other.sendDirectMessage
+ }
+
+ override fun hashCode(): Int = Objects.hash(sendToChannel, sendDirectMessage)
+
+ override fun toString(): String =
+ when {
+ sendToChannel != null -> "Discord{sendToChannel=$sendToChannel}"
+ sendDirectMessage != null -> "Discord{sendDirectMessage=$sendDirectMessage}"
+ _json != null -> "Discord{_unknown=$_json}"
+ else -> throw IllegalStateException("Invalid Discord")
+ }
+
+ companion object {
+
+ @JvmStatic
+ fun ofSendToChannel(sendToChannel: SendToChannel) = Discord(sendToChannel = sendToChannel)
+
+ @JvmStatic
+ fun ofSendDirectMessage(sendDirectMessage: SendDirectMessage) =
+ Discord(sendDirectMessage = sendDirectMessage)
+ }
+
+ /** An interface that defines how to map each variant of [Discord] to a value of type [T]. */
+ interface Visitor {
+
+ fun visitSendToChannel(sendToChannel: SendToChannel): T
+
+ fun visitSendDirectMessage(sendDirectMessage: SendDirectMessage): T
+
+ /**
+ * Maps an unknown variant of [Discord] to a value of type [T].
+ *
+ * An instance of [Discord] can contain an unknown variant if it was deserialized from data
+ * that doesn't match any known variant. For example, if the SDK is on an older version than
+ * the API, then the API may respond with new variants that the SDK is unaware of.
+ *
+ * @throws CourierInvalidDataException in the default implementation.
+ */
+ fun unknown(json: JsonValue?): T {
+ throw CourierInvalidDataException("Unknown Discord: $json")
+ }
+ }
+
+ internal class Deserializer : BaseDeserializer(Discord::class) {
+
+ override fun ObjectCodec.deserialize(node: JsonNode): Discord {
+ val json = JsonValue.fromJsonNode(node)
+
+ val bestMatches =
+ sequenceOf(
+ tryDeserialize(node, jacksonTypeRef())?.let {
+ Discord(sendToChannel = it, _json = json)
+ },
+ tryDeserialize(node, jacksonTypeRef())?.let {
+ Discord(sendDirectMessage = it, _json = json)
+ },
+ )
+ .filterNotNull()
+ .allMaxBy { it.validity() }
+ .toList()
+ return when (bestMatches.size) {
+ // This can happen if what we're deserializing is completely incompatible with all
+ // the possible variants (e.g. deserializing from boolean).
+ 0 -> Discord(_json = json)
+ 1 -> bestMatches.single()
+ // If there's more than one match with the highest validity, then use the first
+ // completely valid match, or simply the first match if none are completely valid.
+ else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first()
+ }
+ }
+ }
+
+ internal class Serializer : BaseSerializer(Discord::class) {
+
+ override fun serialize(
+ value: Discord,
+ generator: JsonGenerator,
+ provider: SerializerProvider,
+ ) {
+ when {
+ value.sendToChannel != null -> generator.writeObject(value.sendToChannel)
+ value.sendDirectMessage != null -> generator.writeObject(value.sendDirectMessage)
+ value._json != null -> generator.writeObject(value._json)
+ else -> throw IllegalStateException("Invalid Discord")
+ }
+ }
+ }
+}
diff --git a/courier-java-core/src/main/kotlin/com/courier/models/Expo.kt b/courier-java-core/src/main/kotlin/com/courier/models/Expo.kt
new file mode 100644
index 00000000..ddbb6749
--- /dev/null
+++ b/courier-java-core/src/main/kotlin/com/courier/models/Expo.kt
@@ -0,0 +1,189 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.courier.models
+
+import com.courier.core.BaseDeserializer
+import com.courier.core.BaseSerializer
+import com.courier.core.JsonValue
+import com.courier.core.allMaxBy
+import com.courier.core.getOrThrow
+import com.courier.errors.CourierInvalidDataException
+import com.fasterxml.jackson.core.JsonGenerator
+import com.fasterxml.jackson.core.ObjectCodec
+import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.SerializerProvider
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize
+import com.fasterxml.jackson.databind.annotation.JsonSerialize
+import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
+import java.util.Objects
+import java.util.Optional
+
+@JsonDeserialize(using = Expo.Deserializer::class)
+@JsonSerialize(using = Expo.Serializer::class)
+class Expo
+private constructor(
+ private val token: Token? = null,
+ private val multipleTokens: MultipleTokens? = null,
+ private val _json: JsonValue? = null,
+) {
+
+ fun token(): Optional = Optional.ofNullable(token)
+
+ fun multipleTokens(): Optional = Optional.ofNullable(multipleTokens)
+
+ fun isToken(): Boolean = token != null
+
+ fun isMultipleTokens(): Boolean = multipleTokens != null
+
+ fun asToken(): Token = token.getOrThrow("token")
+
+ fun asMultipleTokens(): MultipleTokens = multipleTokens.getOrThrow("multipleTokens")
+
+ fun _json(): Optional = Optional.ofNullable(_json)
+
+ fun accept(visitor: Visitor): T =
+ when {
+ token != null -> visitor.visitToken(token)
+ multipleTokens != null -> visitor.visitMultipleTokens(multipleTokens)
+ else -> visitor.unknown(_json)
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Expo = apply {
+ if (validated) {
+ return@apply
+ }
+
+ accept(
+ object : Visitor {
+ override fun visitToken(token: Token) {
+ token.validate()
+ }
+
+ override fun visitMultipleTokens(multipleTokens: MultipleTokens) {
+ multipleTokens.validate()
+ }
+ }
+ )
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: CourierInvalidDataException) {
+ 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 =
+ accept(
+ object : Visitor {
+ override fun visitToken(token: Token) = token.validity()
+
+ override fun visitMultipleTokens(multipleTokens: MultipleTokens) =
+ multipleTokens.validity()
+
+ override fun unknown(json: JsonValue?) = 0
+ }
+ )
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Expo && token == other.token && multipleTokens == other.multipleTokens
+ }
+
+ override fun hashCode(): Int = Objects.hash(token, multipleTokens)
+
+ override fun toString(): String =
+ when {
+ token != null -> "Expo{token=$token}"
+ multipleTokens != null -> "Expo{multipleTokens=$multipleTokens}"
+ _json != null -> "Expo{_unknown=$_json}"
+ else -> throw IllegalStateException("Invalid Expo")
+ }
+
+ companion object {
+
+ @JvmStatic fun ofToken(token: Token) = Expo(token = token)
+
+ @JvmStatic
+ fun ofMultipleTokens(multipleTokens: MultipleTokens) = Expo(multipleTokens = multipleTokens)
+ }
+
+ /** An interface that defines how to map each variant of [Expo] to a value of type [T]. */
+ interface Visitor {
+
+ fun visitToken(token: Token): T
+
+ fun visitMultipleTokens(multipleTokens: MultipleTokens): T
+
+ /**
+ * Maps an unknown variant of [Expo] to a value of type [T].
+ *
+ * An instance of [Expo] can contain an unknown variant if it was deserialized from data
+ * that doesn't match any known variant. For example, if the SDK is on an older version than
+ * the API, then the API may respond with new variants that the SDK is unaware of.
+ *
+ * @throws CourierInvalidDataException in the default implementation.
+ */
+ fun unknown(json: JsonValue?): T {
+ throw CourierInvalidDataException("Unknown Expo: $json")
+ }
+ }
+
+ internal class Deserializer : BaseDeserializer(Expo::class) {
+
+ override fun ObjectCodec.deserialize(node: JsonNode): Expo {
+ val json = JsonValue.fromJsonNode(node)
+
+ val bestMatches =
+ sequenceOf(
+ tryDeserialize(node, jacksonTypeRef())?.let {
+ Expo(token = it, _json = json)
+ },
+ tryDeserialize(node, jacksonTypeRef())?.let {
+ Expo(multipleTokens = it, _json = json)
+ },
+ )
+ .filterNotNull()
+ .allMaxBy { it.validity() }
+ .toList()
+ return when (bestMatches.size) {
+ // This can happen if what we're deserializing is completely incompatible with all
+ // the possible variants (e.g. deserializing from boolean).
+ 0 -> Expo(_json = json)
+ 1 -> bestMatches.single()
+ // If there's more than one match with the highest validity, then use the first
+ // completely valid match, or simply the first match if none are completely valid.
+ else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first()
+ }
+ }
+ }
+
+ internal class Serializer : BaseSerializer(Expo::class) {
+
+ override fun serialize(
+ value: Expo,
+ generator: JsonGenerator,
+ provider: SerializerProvider,
+ ) {
+ when {
+ value.token != null -> generator.writeObject(value.token)
+ value.multipleTokens != null -> generator.writeObject(value.multipleTokens)
+ value._json != null -> generator.writeObject(value._json)
+ else -> throw IllegalStateException("Invalid Expo")
+ }
+ }
+ }
+}
diff --git a/courier-java-core/src/main/kotlin/com/courier/models/Intercom.kt b/courier-java-core/src/main/kotlin/com/courier/models/Intercom.kt
new file mode 100644
index 00000000..23f38111
--- /dev/null
+++ b/courier-java-core/src/main/kotlin/com/courier/models/Intercom.kt
@@ -0,0 +1,206 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.courier.models
+
+import com.courier.core.ExcludeMissing
+import com.courier.core.JsonField
+import com.courier.core.JsonMissing
+import com.courier.core.JsonValue
+import com.courier.core.checkRequired
+import com.courier.errors.CourierInvalidDataException
+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 java.util.Collections
+import java.util.Objects
+import kotlin.jvm.optionals.getOrNull
+
+class Intercom
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val from: JsonField,
+ private val to: JsonField,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("from") @ExcludeMissing from: JsonField = JsonMissing.of(),
+ @JsonProperty("to") @ExcludeMissing to: JsonField = JsonMissing.of(),
+ ) : this(from, to, mutableMapOf())
+
+ /**
+ * @throws CourierInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun from(): String = from.getRequired("from")
+
+ /**
+ * @throws CourierInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun to(): IntercomRecipient = to.getRequired("to")
+
+ /**
+ * Returns the raw JSON value of [from].
+ *
+ * Unlike [from], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("from") @ExcludeMissing fun _from(): JsonField = from
+
+ /**
+ * Returns the raw JSON value of [to].
+ *
+ * Unlike [to], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("to") @ExcludeMissing fun _to(): JsonField = to
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [Intercom].
+ *
+ * The following fields are required:
+ * ```java
+ * .from()
+ * .to()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Intercom]. */
+ class Builder internal constructor() {
+
+ private var from: JsonField? = null
+ private var to: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(intercom: Intercom) = apply {
+ from = intercom.from
+ to = intercom.to
+ additionalProperties = intercom.additionalProperties.toMutableMap()
+ }
+
+ fun from(from: String) = from(JsonField.of(from))
+
+ /**
+ * Sets [Builder.from] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.from] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun from(from: JsonField) = apply { this.from = from }
+
+ fun to(to: IntercomRecipient) = to(JsonField.of(to))
+
+ /**
+ * Sets [Builder.to] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.to] with a well-typed [IntercomRecipient] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun to(to: JsonField) = apply { this.to = to }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [Intercom].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .from()
+ * .to()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): Intercom =
+ Intercom(
+ checkRequired("from", from),
+ checkRequired("to", to),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Intercom = apply {
+ if (validated) {
+ return@apply
+ }
+
+ from()
+ to().validate()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: CourierInvalidDataException) {
+ 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 (from.asKnown().isPresent) 1 else 0) + (to.asKnown().getOrNull()?.validity() ?: 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Intercom &&
+ from == other.from &&
+ to == other.to &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(from, to, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Intercom{from=$from, to=$to, additionalProperties=$additionalProperties}"
+}
diff --git a/courier-java-core/src/main/kotlin/com/courier/models/IntercomRecipient.kt b/courier-java-core/src/main/kotlin/com/courier/models/IntercomRecipient.kt
new file mode 100644
index 00000000..a37cccf7
--- /dev/null
+++ b/courier-java-core/src/main/kotlin/com/courier/models/IntercomRecipient.kt
@@ -0,0 +1,167 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.courier.models
+
+import com.courier.core.ExcludeMissing
+import com.courier.core.JsonField
+import com.courier.core.JsonMissing
+import com.courier.core.JsonValue
+import com.courier.core.checkRequired
+import com.courier.errors.CourierInvalidDataException
+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 java.util.Collections
+import java.util.Objects
+
+class IntercomRecipient
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val id: JsonField,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of()
+ ) : this(id, mutableMapOf())
+
+ /**
+ * @throws CourierInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun id(): String = id.getRequired("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 = id
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [IntercomRecipient].
+ *
+ * The following fields are required:
+ * ```java
+ * .id()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [IntercomRecipient]. */
+ class Builder internal constructor() {
+
+ private var id: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(intercomRecipient: IntercomRecipient) = apply {
+ id = intercomRecipient.id
+ additionalProperties = intercomRecipient.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) = apply { this.id = id }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [IntercomRecipient].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .id()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): IntercomRecipient =
+ IntercomRecipient(checkRequired("id", id), additionalProperties.toMutableMap())
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): IntercomRecipient = apply {
+ if (validated) {
+ return@apply
+ }
+
+ id()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: CourierInvalidDataException) {
+ 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)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is IntercomRecipient &&
+ id == other.id &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(id, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "IntercomRecipient{id=$id, additionalProperties=$additionalProperties}"
+}
diff --git a/courier-java-core/src/main/kotlin/com/courier/models/ListFilter.kt b/courier-java-core/src/main/kotlin/com/courier/models/ListFilter.kt
new file mode 100644
index 00000000..eff3d18e
--- /dev/null
+++ b/courier-java-core/src/main/kotlin/com/courier/models/ListFilter.kt
@@ -0,0 +1,483 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.courier.models
+
+import com.courier.core.Enum
+import com.courier.core.ExcludeMissing
+import com.courier.core.JsonField
+import com.courier.core.JsonMissing
+import com.courier.core.JsonValue
+import com.courier.core.checkRequired
+import com.courier.errors.CourierInvalidDataException
+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 java.util.Collections
+import java.util.Objects
+import kotlin.jvm.optionals.getOrNull
+
+class ListFilter
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val operator: JsonField,
+ private val path: JsonField,
+ private val value: JsonField,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("operator") @ExcludeMissing operator: JsonField = JsonMissing.of(),
+ @JsonProperty("path") @ExcludeMissing path: JsonField = JsonMissing.of(),
+ @JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(),
+ ) : this(operator, path, value, mutableMapOf())
+
+ /**
+ * Send to users only if they are member of the account
+ *
+ * @throws CourierInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun operator(): Operator = operator.getRequired("operator")
+
+ /**
+ * @throws CourierInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun path(): Path = path.getRequired("path")
+
+ /**
+ * @throws CourierInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun value(): String = value.getRequired("value")
+
+ /**
+ * Returns the raw JSON value of [operator].
+ *
+ * Unlike [operator], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("operator") @ExcludeMissing fun _operator(): JsonField = operator
+
+ /**
+ * Returns the raw JSON value of [path].
+ *
+ * Unlike [path], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("path") @ExcludeMissing fun _path(): JsonField = path
+
+ /**
+ * Returns the raw JSON value of [value].
+ *
+ * Unlike [value], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [ListFilter].
+ *
+ * The following fields are required:
+ * ```java
+ * .operator()
+ * .path()
+ * .value()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [ListFilter]. */
+ class Builder internal constructor() {
+
+ private var operator: JsonField? = null
+ private var path: JsonField? = null
+ private var value: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(listFilter: ListFilter) = apply {
+ operator = listFilter.operator
+ path = listFilter.path
+ value = listFilter.value
+ additionalProperties = listFilter.additionalProperties.toMutableMap()
+ }
+
+ /** Send to users only if they are member of the account */
+ fun operator(operator: Operator) = operator(JsonField.of(operator))
+
+ /**
+ * Sets [Builder.operator] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.operator] with a well-typed [Operator] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun operator(operator: JsonField) = apply { this.operator = operator }
+
+ fun path(path: Path) = path(JsonField.of(path))
+
+ /**
+ * Sets [Builder.path] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.path] with a well-typed [Path] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun path(path: JsonField) = apply { this.path = path }
+
+ fun value(value: String) = value(JsonField.of(value))
+
+ /**
+ * Sets [Builder.value] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.value] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun value(value: JsonField) = apply { this.value = value }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [ListFilter].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .operator()
+ * .path()
+ * .value()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): ListFilter =
+ ListFilter(
+ checkRequired("operator", operator),
+ checkRequired("path", path),
+ checkRequired("value", value),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): ListFilter = apply {
+ if (validated) {
+ return@apply
+ }
+
+ operator().validate()
+ path().validate()
+ value()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: CourierInvalidDataException) {
+ 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 =
+ (operator.asKnown().getOrNull()?.validity() ?: 0) +
+ (path.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (value.asKnown().isPresent) 1 else 0)
+
+ /** Send to users only if they are member of the account */
+ class Operator @JsonCreator private constructor(private val value: JsonField) : 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 = value
+
+ companion object {
+
+ @JvmField val MEMBER_OF = of("MEMBER_OF")
+
+ @JvmStatic fun of(value: String) = Operator(JsonField.of(value))
+ }
+
+ /** An enum containing [Operator]'s known values. */
+ enum class Known {
+ MEMBER_OF
+ }
+
+ /**
+ * An enum containing [Operator]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Operator] 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 {
+ MEMBER_OF,
+ /** An enum member indicating that [Operator] 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) {
+ MEMBER_OF -> Value.MEMBER_OF
+ 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 CourierInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
+ fun known(): Known =
+ when (this) {
+ MEMBER_OF -> Known.MEMBER_OF
+ else -> throw CourierInvalidDataException("Unknown Operator: $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 CourierInvalidDataException if this class instance's value does not have the
+ * expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow { CourierInvalidDataException("Value is not a String") }
+
+ private var validated: Boolean = false
+
+ fun validate(): Operator = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: CourierInvalidDataException) {
+ 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 Operator && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
+ class Path @JsonCreator private constructor(private val value: JsonField) : 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 = value
+
+ companion object {
+
+ @JvmField val ACCOUNT_ID = of("account_id")
+
+ @JvmStatic fun of(value: String) = Path(JsonField.of(value))
+ }
+
+ /** An enum containing [Path]'s known values. */
+ enum class Known {
+ ACCOUNT_ID
+ }
+
+ /**
+ * An enum containing [Path]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Path] 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 {
+ ACCOUNT_ID,
+ /** An enum member indicating that [Path] 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) {
+ ACCOUNT_ID -> Value.ACCOUNT_ID
+ 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 CourierInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
+ fun known(): Known =
+ when (this) {
+ ACCOUNT_ID -> Known.ACCOUNT_ID
+ else -> throw CourierInvalidDataException("Unknown Path: $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 CourierInvalidDataException if this class instance's value does not have the
+ * expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow { CourierInvalidDataException("Value is not a String") }
+
+ private var validated: Boolean = false
+
+ fun validate(): Path = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: CourierInvalidDataException) {
+ 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 Path && 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 ListFilter &&
+ operator == other.operator &&
+ path == other.path &&
+ value == other.value &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(operator, path, value, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "ListFilter{operator=$operator, path=$path, value=$value, additionalProperties=$additionalProperties}"
+}
diff --git a/courier-java-core/src/main/kotlin/com/courier/models/ListPatternRecipient.kt b/courier-java-core/src/main/kotlin/com/courier/models/ListPatternRecipient.kt
new file mode 100644
index 00000000..1feecfbb
--- /dev/null
+++ b/courier-java-core/src/main/kotlin/com/courier/models/ListPatternRecipient.kt
@@ -0,0 +1,298 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.courier.models
+
+import com.courier.core.ExcludeMissing
+import com.courier.core.JsonField
+import com.courier.core.JsonMissing
+import com.courier.core.JsonValue
+import com.courier.core.toImmutable
+import com.courier.errors.CourierInvalidDataException
+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 java.util.Collections
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** Send to users in lists matching a pattern */
+class ListPatternRecipient
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val data: JsonField,
+ private val listPattern: JsonField,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("data") @ExcludeMissing data: JsonField = JsonMissing.of(),
+ @JsonProperty("list_pattern")
+ @ExcludeMissing
+ listPattern: JsonField = JsonMissing.of(),
+ ) : this(data, listPattern, mutableMapOf())
+
+ /**
+ * @throws CourierInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun data(): Optional = data.getOptional("data")
+
+ /**
+ * @throws CourierInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun listPattern(): Optional = listPattern.getOptional("list_pattern")
+
+ /**
+ * Returns the raw JSON value of [data].
+ *
+ * Unlike [data], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data
+
+ /**
+ * Returns the raw JSON value of [listPattern].
+ *
+ * Unlike [listPattern], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("list_pattern")
+ @ExcludeMissing
+ fun _listPattern(): JsonField = listPattern
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /** Returns a mutable builder for constructing an instance of [ListPatternRecipient]. */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [ListPatternRecipient]. */
+ class Builder internal constructor() {
+
+ private var data: JsonField = JsonMissing.of()
+ private var listPattern: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(listPatternRecipient: ListPatternRecipient) = apply {
+ data = listPatternRecipient.data
+ listPattern = listPatternRecipient.listPattern
+ additionalProperties = listPatternRecipient.additionalProperties.toMutableMap()
+ }
+
+ fun data(data: Data?) = data(JsonField.ofNullable(data))
+
+ /** Alias for calling [Builder.data] with `data.orElse(null)`. */
+ fun data(data: Optional) = data(data.getOrNull())
+
+ /**
+ * Sets [Builder.data] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.data] with a well-typed [Data] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun data(data: JsonField) = apply { this.data = data }
+
+ fun listPattern(listPattern: String?) = listPattern(JsonField.ofNullable(listPattern))
+
+ /** Alias for calling [Builder.listPattern] with `listPattern.orElse(null)`. */
+ fun listPattern(listPattern: Optional) = listPattern(listPattern.getOrNull())
+
+ /**
+ * Sets [Builder.listPattern] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.listPattern] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun listPattern(listPattern: JsonField) = apply { this.listPattern = listPattern }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [ListPatternRecipient].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): ListPatternRecipient =
+ ListPatternRecipient(data, listPattern, additionalProperties.toMutableMap())
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): ListPatternRecipient = apply {
+ if (validated) {
+ return@apply
+ }
+
+ data().ifPresent { it.validate() }
+ listPattern()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: CourierInvalidDataException) {
+ 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 =
+ (data.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (listPattern.asKnown().isPresent) 1 else 0)
+
+ class Data
+ @JsonCreator
+ private constructor(
+ @com.fasterxml.jackson.annotation.JsonValue
+ private val additionalProperties: Map
+ ) {
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map = additionalProperties
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /** Returns a mutable builder for constructing an instance of [Data]. */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Data]. */
+ class Builder internal constructor() {
+
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(data: Data) = apply {
+ additionalProperties = data.additionalProperties.toMutableMap()
+ }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [Data].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): Data = Data(additionalProperties.toImmutable())
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Data = apply {
+ if (validated) {
+ return@apply
+ }
+
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: CourierInvalidDataException) {
+ 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 Data && additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() = "Data{additionalProperties=$additionalProperties}"
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is ListPatternRecipient &&
+ data == other.data &&
+ listPattern == other.listPattern &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(data, listPattern, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "ListPatternRecipient{data=$data, listPattern=$listPattern, additionalProperties=$additionalProperties}"
+}
diff --git a/courier-java-core/src/main/kotlin/com/courier/models/ListRecipient.kt b/courier-java-core/src/main/kotlin/com/courier/models/ListRecipient.kt
new file mode 100644
index 00000000..240e85ca
--- /dev/null
+++ b/courier-java-core/src/main/kotlin/com/courier/models/ListRecipient.kt
@@ -0,0 +1,349 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.courier.models
+
+import com.courier.core.ExcludeMissing
+import com.courier.core.JsonField
+import com.courier.core.JsonMissing
+import com.courier.core.JsonValue
+import com.courier.core.checkKnown
+import com.courier.core.toImmutable
+import com.courier.errors.CourierInvalidDataException
+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 java.util.Collections
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** Send to all users in a specific list */
+class ListRecipient
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val data: JsonField,
+ private val filters: JsonField>,
+ private val listId: JsonField,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("data") @ExcludeMissing data: JsonField = JsonMissing.of(),
+ @JsonProperty("filters")
+ @ExcludeMissing
+ filters: JsonField> = JsonMissing.of(),
+ @JsonProperty("list_id") @ExcludeMissing listId: JsonField = JsonMissing.of(),
+ ) : this(data, filters, listId, mutableMapOf())
+
+ /**
+ * @throws CourierInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun data(): Optional = data.getOptional("data")
+
+ /**
+ * @throws CourierInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun filters(): Optional> = filters.getOptional("filters")
+
+ /**
+ * @throws CourierInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun listId(): Optional = listId.getOptional("list_id")
+
+ /**
+ * Returns the raw JSON value of [data].
+ *
+ * Unlike [data], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data
+
+ /**
+ * Returns the raw JSON value of [filters].
+ *
+ * Unlike [filters], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("filters") @ExcludeMissing fun _filters(): JsonField> = filters
+
+ /**
+ * Returns the raw JSON value of [listId].
+ *
+ * Unlike [listId], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("list_id") @ExcludeMissing fun _listId(): JsonField = listId
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /** Returns a mutable builder for constructing an instance of [ListRecipient]. */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [ListRecipient]. */
+ class Builder internal constructor() {
+
+ private var data: JsonField = JsonMissing.of()
+ private var filters: JsonField>? = null
+ private var listId: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(listRecipient: ListRecipient) = apply {
+ data = listRecipient.data
+ filters = listRecipient.filters.map { it.toMutableList() }
+ listId = listRecipient.listId
+ additionalProperties = listRecipient.additionalProperties.toMutableMap()
+ }
+
+ fun data(data: Data?) = data(JsonField.ofNullable(data))
+
+ /** Alias for calling [Builder.data] with `data.orElse(null)`. */
+ fun data(data: Optional) = data(data.getOrNull())
+
+ /**
+ * Sets [Builder.data] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.data] with a well-typed [Data] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun data(data: JsonField) = apply { this.data = data }
+
+ fun filters(filters: List?) = filters(JsonField.ofNullable(filters))
+
+ /** Alias for calling [Builder.filters] with `filters.orElse(null)`. */
+ fun filters(filters: Optional>) = filters(filters.getOrNull())
+
+ /**
+ * Sets [Builder.filters] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.filters] with a well-typed `List` value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun filters(filters: JsonField>) = apply {
+ this.filters = filters.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [ListFilter] to [filters].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addFilter(filter: ListFilter) = apply {
+ filters =
+ (filters ?: JsonField.of(mutableListOf())).also {
+ checkKnown("filters", it).add(filter)
+ }
+ }
+
+ fun listId(listId: String?) = listId(JsonField.ofNullable(listId))
+
+ /** Alias for calling [Builder.listId] with `listId.orElse(null)`. */
+ fun listId(listId: Optional) = listId(listId.getOrNull())
+
+ /**
+ * Sets [Builder.listId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.listId] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun listId(listId: JsonField) = apply { this.listId = listId }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [ListRecipient].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): ListRecipient =
+ ListRecipient(
+ data,
+ (filters ?: JsonMissing.of()).map { it.toImmutable() },
+ listId,
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): ListRecipient = apply {
+ if (validated) {
+ return@apply
+ }
+
+ data().ifPresent { it.validate() }
+ filters().ifPresent { it.forEach { it.validate() } }
+ listId()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: CourierInvalidDataException) {
+ 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 =
+ (data.asKnown().getOrNull()?.validity() ?: 0) +
+ (filters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
+ (if (listId.asKnown().isPresent) 1 else 0)
+
+ class Data
+ @JsonCreator
+ private constructor(
+ @com.fasterxml.jackson.annotation.JsonValue
+ private val additionalProperties: Map
+ ) {
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map = additionalProperties
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /** Returns a mutable builder for constructing an instance of [Data]. */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Data]. */
+ class Builder internal constructor() {
+
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(data: Data) = apply {
+ additionalProperties = data.additionalProperties.toMutableMap()
+ }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [Data].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): Data = Data(additionalProperties.toImmutable())
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Data = apply {
+ if (validated) {
+ return@apply
+ }
+
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: CourierInvalidDataException) {
+ 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 Data && additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() = "Data{additionalProperties=$additionalProperties}"
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is ListRecipient &&
+ data == other.data &&
+ filters == other.filters &&
+ listId == other.listId &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(data, filters, listId, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "ListRecipient{data=$data, filters=$filters, listId=$listId, additionalProperties=$additionalProperties}"
+}
diff --git a/courier-java-core/src/main/kotlin/com/courier/models/MsTeams.kt b/courier-java-core/src/main/kotlin/com/courier/models/MsTeams.kt
new file mode 100644
index 00000000..9ad592ab
--- /dev/null
+++ b/courier-java-core/src/main/kotlin/com/courier/models/MsTeams.kt
@@ -0,0 +1,314 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.courier.models
+
+import com.courier.core.BaseDeserializer
+import com.courier.core.BaseSerializer
+import com.courier.core.JsonValue
+import com.courier.core.allMaxBy
+import com.courier.core.getOrThrow
+import com.courier.errors.CourierInvalidDataException
+import com.fasterxml.jackson.core.JsonGenerator
+import com.fasterxml.jackson.core.ObjectCodec
+import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.SerializerProvider
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize
+import com.fasterxml.jackson.databind.annotation.JsonSerialize
+import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
+import java.util.Objects
+import java.util.Optional
+
+@JsonDeserialize(using = MsTeams.Deserializer::class)
+@JsonSerialize(using = MsTeams.Serializer::class)
+class MsTeams
+private constructor(
+ private val sendToMsTeamsUserId: SendToMsTeamsUserId? = null,
+ private val sendToMsTeamsEmail: SendToMsTeamsEmail? = null,
+ private val sendToMsTeamsChannelId: SendToMsTeamsChannelId? = null,
+ private val sendToMsTeamsConversationId: SendToMsTeamsConversationId? = null,
+ private val sendToMsTeamsChannelName: SendToMsTeamsChannelName? = null,
+ private val _json: JsonValue? = null,
+) {
+
+ fun sendToMsTeamsUserId(): Optional =
+ Optional.ofNullable(sendToMsTeamsUserId)
+
+ fun sendToMsTeamsEmail(): Optional = Optional.ofNullable(sendToMsTeamsEmail)
+
+ fun sendToMsTeamsChannelId(): Optional =
+ Optional.ofNullable(sendToMsTeamsChannelId)
+
+ fun sendToMsTeamsConversationId(): Optional =
+ Optional.ofNullable(sendToMsTeamsConversationId)
+
+ fun sendToMsTeamsChannelName(): Optional =
+ Optional.ofNullable(sendToMsTeamsChannelName)
+
+ fun isSendToMsTeamsUserId(): Boolean = sendToMsTeamsUserId != null
+
+ fun isSendToMsTeamsEmail(): Boolean = sendToMsTeamsEmail != null
+
+ fun isSendToMsTeamsChannelId(): Boolean = sendToMsTeamsChannelId != null
+
+ fun isSendToMsTeamsConversationId(): Boolean = sendToMsTeamsConversationId != null
+
+ fun isSendToMsTeamsChannelName(): Boolean = sendToMsTeamsChannelName != null
+
+ fun asSendToMsTeamsUserId(): SendToMsTeamsUserId =
+ sendToMsTeamsUserId.getOrThrow("sendToMsTeamsUserId")
+
+ fun asSendToMsTeamsEmail(): SendToMsTeamsEmail =
+ sendToMsTeamsEmail.getOrThrow("sendToMsTeamsEmail")
+
+ fun asSendToMsTeamsChannelId(): SendToMsTeamsChannelId =
+ sendToMsTeamsChannelId.getOrThrow("sendToMsTeamsChannelId")
+
+ fun asSendToMsTeamsConversationId(): SendToMsTeamsConversationId =
+ sendToMsTeamsConversationId.getOrThrow("sendToMsTeamsConversationId")
+
+ fun asSendToMsTeamsChannelName(): SendToMsTeamsChannelName =
+ sendToMsTeamsChannelName.getOrThrow("sendToMsTeamsChannelName")
+
+ fun _json(): Optional = Optional.ofNullable(_json)
+
+ fun accept(visitor: Visitor): T =
+ when {
+ sendToMsTeamsUserId != null -> visitor.visitSendToMsTeamsUserId(sendToMsTeamsUserId)
+ sendToMsTeamsEmail != null -> visitor.visitSendToMsTeamsEmail(sendToMsTeamsEmail)
+ sendToMsTeamsChannelId != null ->
+ visitor.visitSendToMsTeamsChannelId(sendToMsTeamsChannelId)
+ sendToMsTeamsConversationId != null ->
+ visitor.visitSendToMsTeamsConversationId(sendToMsTeamsConversationId)
+ sendToMsTeamsChannelName != null ->
+ visitor.visitSendToMsTeamsChannelName(sendToMsTeamsChannelName)
+ else -> visitor.unknown(_json)
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): MsTeams = apply {
+ if (validated) {
+ return@apply
+ }
+
+ accept(
+ object : Visitor {
+ override fun visitSendToMsTeamsUserId(sendToMsTeamsUserId: SendToMsTeamsUserId) {
+ sendToMsTeamsUserId.validate()
+ }
+
+ override fun visitSendToMsTeamsEmail(sendToMsTeamsEmail: SendToMsTeamsEmail) {
+ sendToMsTeamsEmail.validate()
+ }
+
+ override fun visitSendToMsTeamsChannelId(
+ sendToMsTeamsChannelId: SendToMsTeamsChannelId
+ ) {
+ sendToMsTeamsChannelId.validate()
+ }
+
+ override fun visitSendToMsTeamsConversationId(
+ sendToMsTeamsConversationId: SendToMsTeamsConversationId
+ ) {
+ sendToMsTeamsConversationId.validate()
+ }
+
+ override fun visitSendToMsTeamsChannelName(
+ sendToMsTeamsChannelName: SendToMsTeamsChannelName
+ ) {
+ sendToMsTeamsChannelName.validate()
+ }
+ }
+ )
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: CourierInvalidDataException) {
+ 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 =
+ accept(
+ object : Visitor {
+ override fun visitSendToMsTeamsUserId(sendToMsTeamsUserId: SendToMsTeamsUserId) =
+ sendToMsTeamsUserId.validity()
+
+ override fun visitSendToMsTeamsEmail(sendToMsTeamsEmail: SendToMsTeamsEmail) =
+ sendToMsTeamsEmail.validity()
+
+ override fun visitSendToMsTeamsChannelId(
+ sendToMsTeamsChannelId: SendToMsTeamsChannelId
+ ) = sendToMsTeamsChannelId.validity()
+
+ override fun visitSendToMsTeamsConversationId(
+ sendToMsTeamsConversationId: SendToMsTeamsConversationId
+ ) = sendToMsTeamsConversationId.validity()
+
+ override fun visitSendToMsTeamsChannelName(
+ sendToMsTeamsChannelName: SendToMsTeamsChannelName
+ ) = sendToMsTeamsChannelName.validity()
+
+ override fun unknown(json: JsonValue?) = 0
+ }
+ )
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is MsTeams &&
+ sendToMsTeamsUserId == other.sendToMsTeamsUserId &&
+ sendToMsTeamsEmail == other.sendToMsTeamsEmail &&
+ sendToMsTeamsChannelId == other.sendToMsTeamsChannelId &&
+ sendToMsTeamsConversationId == other.sendToMsTeamsConversationId &&
+ sendToMsTeamsChannelName == other.sendToMsTeamsChannelName
+ }
+
+ override fun hashCode(): Int =
+ Objects.hash(
+ sendToMsTeamsUserId,
+ sendToMsTeamsEmail,
+ sendToMsTeamsChannelId,
+ sendToMsTeamsConversationId,
+ sendToMsTeamsChannelName,
+ )
+
+ override fun toString(): String =
+ when {
+ sendToMsTeamsUserId != null -> "MsTeams{sendToMsTeamsUserId=$sendToMsTeamsUserId}"
+ sendToMsTeamsEmail != null -> "MsTeams{sendToMsTeamsEmail=$sendToMsTeamsEmail}"
+ sendToMsTeamsChannelId != null ->
+ "MsTeams{sendToMsTeamsChannelId=$sendToMsTeamsChannelId}"
+ sendToMsTeamsConversationId != null ->
+ "MsTeams{sendToMsTeamsConversationId=$sendToMsTeamsConversationId}"
+ sendToMsTeamsChannelName != null ->
+ "MsTeams{sendToMsTeamsChannelName=$sendToMsTeamsChannelName}"
+ _json != null -> "MsTeams{_unknown=$_json}"
+ else -> throw IllegalStateException("Invalid MsTeams")
+ }
+
+ companion object {
+
+ @JvmStatic
+ fun ofSendToMsTeamsUserId(sendToMsTeamsUserId: SendToMsTeamsUserId) =
+ MsTeams(sendToMsTeamsUserId = sendToMsTeamsUserId)
+
+ @JvmStatic
+ fun ofSendToMsTeamsEmail(sendToMsTeamsEmail: SendToMsTeamsEmail) =
+ MsTeams(sendToMsTeamsEmail = sendToMsTeamsEmail)
+
+ @JvmStatic
+ fun ofSendToMsTeamsChannelId(sendToMsTeamsChannelId: SendToMsTeamsChannelId) =
+ MsTeams(sendToMsTeamsChannelId = sendToMsTeamsChannelId)
+
+ @JvmStatic
+ fun ofSendToMsTeamsConversationId(
+ sendToMsTeamsConversationId: SendToMsTeamsConversationId
+ ) = MsTeams(sendToMsTeamsConversationId = sendToMsTeamsConversationId)
+
+ @JvmStatic
+ fun ofSendToMsTeamsChannelName(sendToMsTeamsChannelName: SendToMsTeamsChannelName) =
+ MsTeams(sendToMsTeamsChannelName = sendToMsTeamsChannelName)
+ }
+
+ /** An interface that defines how to map each variant of [MsTeams] to a value of type [T]. */
+ interface Visitor {
+
+ fun visitSendToMsTeamsUserId(sendToMsTeamsUserId: SendToMsTeamsUserId): T
+
+ fun visitSendToMsTeamsEmail(sendToMsTeamsEmail: SendToMsTeamsEmail): T
+
+ fun visitSendToMsTeamsChannelId(sendToMsTeamsChannelId: SendToMsTeamsChannelId): T
+
+ fun visitSendToMsTeamsConversationId(
+ sendToMsTeamsConversationId: SendToMsTeamsConversationId
+ ): T
+
+ fun visitSendToMsTeamsChannelName(sendToMsTeamsChannelName: SendToMsTeamsChannelName): T
+
+ /**
+ * Maps an unknown variant of [MsTeams] to a value of type [T].
+ *
+ * An instance of [MsTeams] can contain an unknown variant if it was deserialized from data
+ * that doesn't match any known variant. For example, if the SDK is on an older version than
+ * the API, then the API may respond with new variants that the SDK is unaware of.
+ *
+ * @throws CourierInvalidDataException in the default implementation.
+ */
+ fun unknown(json: JsonValue?): T {
+ throw CourierInvalidDataException("Unknown MsTeams: $json")
+ }
+ }
+
+ internal class Deserializer : BaseDeserializer(MsTeams::class) {
+
+ override fun ObjectCodec.deserialize(node: JsonNode): MsTeams {
+ val json = JsonValue.fromJsonNode(node)
+
+ val bestMatches =
+ sequenceOf(
+ tryDeserialize(node, jacksonTypeRef())?.let {
+ MsTeams(sendToMsTeamsUserId = it, _json = json)
+ },
+ tryDeserialize(node, jacksonTypeRef())?.let {
+ MsTeams(sendToMsTeamsEmail = it, _json = json)
+ },
+ tryDeserialize(node, jacksonTypeRef())?.let {
+ MsTeams(sendToMsTeamsChannelId = it, _json = json)
+ },
+ tryDeserialize(node, jacksonTypeRef())?.let {
+ MsTeams(sendToMsTeamsConversationId = it, _json = json)
+ },
+ tryDeserialize(node, jacksonTypeRef())?.let {
+ MsTeams(sendToMsTeamsChannelName = it, _json = json)
+ },
+ )
+ .filterNotNull()
+ .allMaxBy { it.validity() }
+ .toList()
+ return when (bestMatches.size) {
+ // This can happen if what we're deserializing is completely incompatible with all
+ // the possible variants (e.g. deserializing from boolean).
+ 0 -> MsTeams(_json = json)
+ 1 -> bestMatches.single()
+ // If there's more than one match with the highest validity, then use the first
+ // completely valid match, or simply the first match if none are completely valid.
+ else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first()
+ }
+ }
+ }
+
+ internal class Serializer : BaseSerializer(MsTeams::class) {
+
+ override fun serialize(
+ value: MsTeams,
+ generator: JsonGenerator,
+ provider: SerializerProvider,
+ ) {
+ when {
+ value.sendToMsTeamsUserId != null ->
+ generator.writeObject(value.sendToMsTeamsUserId)
+ value.sendToMsTeamsEmail != null -> generator.writeObject(value.sendToMsTeamsEmail)
+ value.sendToMsTeamsChannelId != null ->
+ generator.writeObject(value.sendToMsTeamsChannelId)
+ value.sendToMsTeamsConversationId != null ->
+ generator.writeObject(value.sendToMsTeamsConversationId)
+ value.sendToMsTeamsChannelName != null ->
+ generator.writeObject(value.sendToMsTeamsChannelName)
+ value._json != null -> generator.writeObject(value._json)
+ else -> throw IllegalStateException("Invalid MsTeams")
+ }
+ }
+ }
+}
diff --git a/courier-java-core/src/main/kotlin/com/courier/models/MsTeamsBaseProperties.kt b/courier-java-core/src/main/kotlin/com/courier/models/MsTeamsBaseProperties.kt
new file mode 100644
index 00000000..ff1e3117
--- /dev/null
+++ b/courier-java-core/src/main/kotlin/com/courier/models/MsTeamsBaseProperties.kt
@@ -0,0 +1,208 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.courier.models
+
+import com.courier.core.ExcludeMissing
+import com.courier.core.JsonField
+import com.courier.core.JsonMissing
+import com.courier.core.JsonValue
+import com.courier.core.checkRequired
+import com.courier.errors.CourierInvalidDataException
+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 java.util.Collections
+import java.util.Objects
+
+class MsTeamsBaseProperties
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val serviceUrl: JsonField,
+ private val tenantId: JsonField,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("service_url")
+ @ExcludeMissing
+ serviceUrl: JsonField = JsonMissing.of(),
+ @JsonProperty("tenant_id") @ExcludeMissing tenantId: JsonField = JsonMissing.of(),
+ ) : this(serviceUrl, tenantId, mutableMapOf())
+
+ /**
+ * @throws CourierInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun serviceUrl(): String = serviceUrl.getRequired("service_url")
+
+ /**
+ * @throws CourierInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun tenantId(): String = tenantId.getRequired("tenant_id")
+
+ /**
+ * Returns the raw JSON value of [serviceUrl].
+ *
+ * Unlike [serviceUrl], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("service_url") @ExcludeMissing fun _serviceUrl(): JsonField = serviceUrl
+
+ /**
+ * Returns the raw JSON value of [tenantId].
+ *
+ * Unlike [tenantId], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("tenant_id") @ExcludeMissing fun _tenantId(): JsonField = tenantId
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [MsTeamsBaseProperties].
+ *
+ * The following fields are required:
+ * ```java
+ * .serviceUrl()
+ * .tenantId()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [MsTeamsBaseProperties]. */
+ class Builder internal constructor() {
+
+ private var serviceUrl: JsonField? = null
+ private var tenantId: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(msTeamsBaseProperties: MsTeamsBaseProperties) = apply {
+ serviceUrl = msTeamsBaseProperties.serviceUrl
+ tenantId = msTeamsBaseProperties.tenantId
+ additionalProperties = msTeamsBaseProperties.additionalProperties.toMutableMap()
+ }
+
+ fun serviceUrl(serviceUrl: String) = serviceUrl(JsonField.of(serviceUrl))
+
+ /**
+ * Sets [Builder.serviceUrl] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.serviceUrl] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun serviceUrl(serviceUrl: JsonField