Skip to content
Merged
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
18 changes: 18 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ jobs:
build:
timeout-minutes: 15
name: build
permissions:
contents: read
id-token: write
runs-on: ${{ github.repository == 'stainless-sdks/courier-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork

Expand All @@ -61,6 +64,21 @@ jobs:
- name: Build SDK
run: ./scripts/build

- name: Get GitHub OIDC Token
if: github.repository == 'stainless-sdks/courier-java'
id: github-oidc
uses: actions/github-script@v6
with:
script: core.setOutput('github_token', await core.getIDToken());

- name: Build and upload Maven artifacts
if: github.repository == 'stainless-sdks/courier-java'
env:
URL: https://pkg.stainless.com/s
AUTH: ${{ steps.github-oidc.outputs.github_token }}
SHA: ${{ github.sha }}
PROJECT: courier-java
run: ./scripts/upload-artifacts
test:
timeout-minutes: 15
name: test
Expand Down
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.7.0"
".": "4.7.1"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 78
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier%2Fcourier-b79e0eb1ab06f4076c48fa519e2b2ad792a0c483a5d017e43c938ca4c4be6988.yml
openapi_spec_hash: cb3cc2c1145503e5737a880326857aa4
config_hash: ff903e824043dc81aca51a0ce21896d6
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier%2Fcourier-e3e54d99e2a73fd87519270f2685131050d342e86a4e96130247b854deae5c20.yml
openapi_spec_hash: 897a3fbee24f24d021d6af0df480220c
config_hash: 66a5c28bb74d78454456d9ce7d1c0a0c
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## 4.7.1 (2026-01-14)

Full Changelog: [v4.7.0...v4.7.1](https://github.com/trycourier/courier-java/compare/v4.7.0...v4.7.1)

### Chores

* **internal:** regenerate SDK with no functional changes ([227578d](https://github.com/trycourier/courier-java/commit/227578dc96d7114cd01e4cac20567f46008364ec))
* **internal:** regenerate SDK with no functional changes ([49599e7](https://github.com/trycourier/courier-java/commit/49599e729b1ed313141734486e484ca4b88cd8d9))
* **internal:** support uploading Maven repo artifacts to stainless package server ([4a21584](https://github.com/trycourier/courier-java/commit/4a21584ee2daff5c18cf9ca259cce3a9920005ba))

## 4.7.0 (2026-01-12)

Full Changelog: [v4.6.0...v4.7.0](https://github.com/trycourier/courier-java/compare/v4.6.0...v4.7.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.7.0)
[![javadoc](https://javadoc.io/badge2/com.courier/courier-java/4.7.0/javadoc.svg)](https://javadoc.io/doc/com.courier/courier-java/4.7.0)
[![Maven Central](https://img.shields.io/maven-central/v/com.courier/courier-java)](https://central.sonatype.com/artifact/com.courier/courier-java/4.7.1)
[![javadoc](https://javadoc.io/badge2/com.courier/courier-java/4.7.1/javadoc.svg)](https://javadoc.io/doc/com.courier/courier-java/4.7.1)

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

<!-- 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.7.0")
implementation("com.courier:courier-java:4.7.1")
```

### Maven
Expand All @@ -33,7 +33,7 @@ implementation("com.courier:courier-java:4.7.0")
<dependency>
<groupId>com.courier</groupId>
<artifactId>courier-java</artifactId>
<version>4.7.0</version>
<version>4.7.1</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.7.0" // x-release-please-version
version = "4.7.1" // x-release-please-version
}

subprojects {
Expand Down
17 changes: 15 additions & 2 deletions buildSrc/src/main/kotlin/courier.publish.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ plugins {
id("com.vanniktech.maven.publish")
}

publishing {
repositories {
if (project.hasProperty("publishLocal")) {
maven {
name = "LocalFileSystem"
url = uri("${rootProject.layout.buildDirectory.get()}/local-maven-repo")
}
}
}
}

repositories {
gradlePluginPortal()
mavenCentral()
Expand All @@ -17,8 +28,10 @@ extra["signingInMemoryKeyId"] = System.getenv("GPG_SIGNING_KEY_ID")
extra["signingInMemoryKeyPassword"] = System.getenv("GPG_SIGNING_PASSWORD")

configure<MavenPublishBaseExtension> {
signAllPublications()
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
if (!project.hasProperty("publishLocal")) {
signAllPublications()
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
}

coordinates(project.group.toString(), project.name, project.version.toString())
configure(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
// 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

/** Filter configuration for audience membership containing an array of filter rules */
class AudienceFilterConfig
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val filters: JsonField<List<FilterConfig>>,
private val additionalProperties: MutableMap<String, JsonValue>,
) {

@JsonCreator
private constructor(
@JsonProperty("filters")
@ExcludeMissing
filters: JsonField<List<FilterConfig>> = JsonMissing.of()
) : this(filters, mutableMapOf())

/**
* Array of filter rules (single conditions or nested groups)
*
* @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 filters(): List<FilterConfig> = filters.getRequired("filters")

/**
* 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<List<FilterConfig>> = filters

@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 [AudienceFilterConfig].
*
* The following fields are required:
* ```java
* .filters()
* ```
*/
@JvmStatic fun builder() = Builder()
}

/** A builder for [AudienceFilterConfig]. */
class Builder internal constructor() {

private var filters: JsonField<MutableList<FilterConfig>>? = null
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

@JvmSynthetic
internal fun from(audienceFilterConfig: AudienceFilterConfig) = apply {
filters = audienceFilterConfig.filters.map { it.toMutableList() }
additionalProperties = audienceFilterConfig.additionalProperties.toMutableMap()
}

/** Array of filter rules (single conditions or nested groups) */
fun filters(filters: List<FilterConfig>) = filters(JsonField.of(filters))

/**
* Sets [Builder.filters] to an arbitrary JSON value.
*
* You should usually call [Builder.filters] with a well-typed `List<FilterConfig>` value
* instead. This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun filters(filters: JsonField<List<FilterConfig>>) = apply {
this.filters = filters.map { it.toMutableList() }
}

/**
* Adds a single [FilterConfig] to [filters].
*
* @throws IllegalStateException if the field was previously set to a non-list.
*/
fun addFilter(filter: FilterConfig) = apply {
filters =
(filters ?: JsonField.of(mutableListOf())).also {
checkKnown("filters", it).add(filter)
}
}

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 [AudienceFilterConfig].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
* The following fields are required:
* ```java
* .filters()
* ```
*
* @throws IllegalStateException if any required field is unset.
*/
fun build(): AudienceFilterConfig =
AudienceFilterConfig(
checkRequired("filters", filters).map { it.toImmutable() },
additionalProperties.toMutableMap(),
)
}

private var validated: Boolean = false

fun validate(): AudienceFilterConfig = apply {
if (validated) {
return@apply
}

filters().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 =
(filters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return other is AudienceFilterConfig &&
filters == other.filters &&
additionalProperties == other.additionalProperties
}

private val hashCode: Int by lazy { Objects.hash(filters, additionalProperties) }

override fun hashCode(): Int = hashCode

override fun toString() =
"AudienceFilterConfig{filters=$filters, additionalProperties=$additionalProperties}"
}
Loading