Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "4.4.0"
".": "4.5.0"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

<!-- x-release-please-start-version -->

[![Maven Central](https://img.shields.io/maven-central/v/com.courier/courier-java)](https://central.sonatype.com/artifact/com.courier/courier-java/4.4.0)
[![javadoc](https://javadoc.io/badge2/com.courier/courier-java/4.4.0/javadoc.svg)](https://javadoc.io/doc/com.courier/courier-java/4.4.0)
[![Maven Central](https://img.shields.io/maven-central/v/com.courier/courier-java)](https://central.sonatype.com/artifact/com.courier/courier-java/4.5.0)
[![javadoc](https://javadoc.io/badge2/com.courier/courier-java/4.5.0/javadoc.svg)](https://javadoc.io/doc/com.courier/courier-java/4.5.0)

<!-- x-release-please-end -->

Expand All @@ -13,7 +13,7 @@ It is generated with [Stainless](https://www.stainless.com/).

<!-- x-release-please-start-version -->

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).

<!-- x-release-please-end -->

Expand All @@ -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
Expand All @@ -33,7 +33,7 @@ implementation("com.courier:courier-java:4.4.0")
<dependency>
<groupId>com.courier</groupId>
<artifactId>courier-java</artifactId>
<version>4.4.0</version>
<version>4.5.0</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
234 changes: 234 additions & 0 deletions courier-java-core/src/main/kotlin/com/courier/models/AirshipProfile.kt
Original file line number Diff line number Diff line change
@@ -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<AirshipProfileAudience>,
private val deviceTypes: JsonField<List<String>>,
private val additionalProperties: MutableMap<String, JsonValue>,
) {

@JsonCreator
private constructor(
@JsonProperty("audience")
@ExcludeMissing
audience: JsonField<AirshipProfileAudience> = JsonMissing.of(),
@JsonProperty("device_types")
@ExcludeMissing
deviceTypes: JsonField<List<String>> = 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<String> = 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<AirshipProfileAudience> = 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<List<String>> = deviceTypes

@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
additionalProperties.put(key, value)
}

@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> =
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<AirshipProfileAudience>? = null
private var deviceTypes: JsonField<MutableList<String>>? = null
private var additionalProperties: MutableMap<String, JsonValue> = 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<AirshipProfileAudience>) = apply {
this.audience = audience
}

fun deviceTypes(deviceTypes: List<String>) = deviceTypes(JsonField.of(deviceTypes))

/**
* Sets [Builder.deviceTypes] to an arbitrary JSON value.
*
* You should usually call [Builder.deviceTypes] with a well-typed `List<String>` value
* instead. This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun deviceTypes(deviceTypes: JsonField<List<String>>) = 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<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}

fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}

fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}

fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }

fun removeAllAdditionalProperties(keys: Set<String>) = 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}"
}
Loading
Loading