diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 03276cf..809fed1 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.12.0" + ".": "4.13.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 035a6ed..37cb440 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 103 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier%2Fcourier-d891c800ffe6b7eddce179c225367cedcb49dab758ebc03e352d945240918d96.yml -openapi_spec_hash: 852d55192b8d7ad96c1f85cd9070ef64 -config_hash: a730d0e598dc108e89c016802008c9b3 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier%2Fcourier-f0ac5c2fa86eabda773c549f5809d3e2d109e3e1d5a07f6fe1ace18355e4680a.yml +openapi_spec_hash: b25dc0b42dd9386ab4a025bb2143bde6 +config_hash: 6037e4a9909efb8b2edac2dcc907b84f diff --git a/CHANGELOG.md b/CHANGELOG.md index 27e4454..a6c2cb7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 4.13.0 (2026-04-13) + +Full Changelog: [v4.12.0...v4.13.0](https://github.com/trycourier/courier-java/compare/v4.12.0...v4.13.0) + +### Features + +* **api:** update notifications/routing_strategies return types, change providers update to PUT ([a83b773](https://github.com/trycourier/courier-java/commit/a83b7735114f5eb5fee33770b70d561f64ec1c64)) + + +### Chores + +* **internal:** regenerate SDK with no functional changes ([42f49e4](https://github.com/trycourier/courier-java/commit/42f49e4f9dba28b99404bfa2e00baf83d6cc2ce9)) + ## 4.12.0 (2026-04-08) Full Changelog: [v4.11.0...v4.12.0](https://github.com/trycourier/courier-java/compare/v4.11.0...v4.12.0) diff --git a/build.gradle.kts b/build.gradle.kts index 98c9ba1..fd41975 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.courier" - version = "4.12.0" // x-release-please-version + version = "4.13.0" // x-release-please-version } subprojects { diff --git a/buildSrc/src/main/kotlin/courier.publish.gradle.kts b/buildSrc/src/main/kotlin/courier.publish.gradle.kts index 50c167b..f1887fa 100644 --- a/buildSrc/src/main/kotlin/courier.publish.gradle.kts +++ b/buildSrc/src/main/kotlin/courier.publish.gradle.kts @@ -43,7 +43,7 @@ configure { pom { name.set("Courier") - description.set("An SDK library for Courier") + description.set("The Courier REST API.") url.set("https://www.courier.com/docs") licenses { diff --git a/courier-java-core/src/main/kotlin/com/courier/models/notifications/NotificationTemplateMutationResponse.kt b/courier-java-core/src/main/kotlin/com/courier/models/notifications/NotificationTemplateMutationResponse.kt deleted file mode 100644 index 89c0a04..0000000 --- a/courier-java-core/src/main/kotlin/com/courier/models/notifications/NotificationTemplateMutationResponse.kt +++ /dev/null @@ -1,503 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.courier.models.notifications - -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 - -/** Response returned by POST and PUT operations. */ -class NotificationTemplateMutationResponse -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val notification: JsonField, - private val state: JsonField, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("notification") - @ExcludeMissing - notification: JsonField = JsonMissing.of(), - @JsonProperty("state") @ExcludeMissing state: JsonField = JsonMissing.of(), - ) : this(notification, state, 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 notification(): Notification = notification.getRequired("notification") - - /** - * The template state after the operation. Always uppercase. - * - * @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 state(): State = state.getRequired("state") - - /** - * Returns the raw JSON value of [notification]. - * - * Unlike [notification], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("notification") - @ExcludeMissing - fun _notification(): JsonField = notification - - /** - * Returns the raw JSON value of [state]. - * - * Unlike [state], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("state") @ExcludeMissing fun _state(): JsonField = state - - @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 - * [NotificationTemplateMutationResponse]. - * - * The following fields are required: - * ```java - * .notification() - * .state() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [NotificationTemplateMutationResponse]. */ - class Builder internal constructor() { - - private var notification: JsonField? = null - private var state: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from( - notificationTemplateMutationResponse: NotificationTemplateMutationResponse - ) = apply { - notification = notificationTemplateMutationResponse.notification - state = notificationTemplateMutationResponse.state - additionalProperties = - notificationTemplateMutationResponse.additionalProperties.toMutableMap() - } - - fun notification(notification: Notification) = notification(JsonField.of(notification)) - - /** - * Sets [Builder.notification] to an arbitrary JSON value. - * - * You should usually call [Builder.notification] with a well-typed [Notification] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun notification(notification: JsonField) = apply { - this.notification = notification - } - - /** The template state after the operation. Always uppercase. */ - fun state(state: State) = state(JsonField.of(state)) - - /** - * Sets [Builder.state] to an arbitrary JSON value. - * - * You should usually call [Builder.state] with a well-typed [State] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun state(state: JsonField) = apply { this.state = state } - - 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 [NotificationTemplateMutationResponse]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .notification() - * .state() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): NotificationTemplateMutationResponse = - NotificationTemplateMutationResponse( - checkRequired("notification", notification), - checkRequired("state", state), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): NotificationTemplateMutationResponse = apply { - if (validated) { - return@apply - } - - notification().validate() - state().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 = - (notification.asKnown().getOrNull()?.validity() ?: 0) + - (state.asKnown().getOrNull()?.validity() ?: 0) - - class Notification - @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()) - - /** - * The ID of the created or updated template. - * - * @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 [Notification]. - * - * The following fields are required: - * ```java - * .id() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Notification]. */ - class Builder internal constructor() { - - private var id: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(notification: Notification) = apply { - id = notification.id - additionalProperties = notification.additionalProperties.toMutableMap() - } - - /** The ID of the created or updated template. */ - 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 [Notification]. - * - * 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(): Notification = - Notification(checkRequired("id", id), additionalProperties.toMutableMap()) - } - - private var validated: Boolean = false - - fun validate(): Notification = 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 Notification && - id == other.id && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(id, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = "Notification{id=$id, additionalProperties=$additionalProperties}" - } - - /** The template state after the operation. Always uppercase. */ - class State @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 DRAFT = of("DRAFT") - - @JvmField val PUBLISHED = of("PUBLISHED") - - @JvmStatic fun of(value: String) = State(JsonField.of(value)) - } - - /** An enum containing [State]'s known values. */ - enum class Known { - DRAFT, - PUBLISHED, - } - - /** - * An enum containing [State]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [State] 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 { - DRAFT, - PUBLISHED, - /** An enum member indicating that [State] 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) { - DRAFT -> Value.DRAFT - PUBLISHED -> Value.PUBLISHED - 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) { - DRAFT -> Known.DRAFT - PUBLISHED -> Known.PUBLISHED - else -> throw CourierInvalidDataException("Unknown State: $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(): State = 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 State && 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 NotificationTemplateMutationResponse && - notification == other.notification && - state == other.state && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(notification, state, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "NotificationTemplateMutationResponse{notification=$notification, state=$state, additionalProperties=$additionalProperties}" -} diff --git a/courier-java-core/src/main/kotlin/com/courier/models/providers/ProviderUpdateParams.kt b/courier-java-core/src/main/kotlin/com/courier/models/providers/ProviderUpdateParams.kt index d373d66..30103ea 100644 --- a/courier-java-core/src/main/kotlin/com/courier/models/providers/ProviderUpdateParams.kt +++ b/courier-java-core/src/main/kotlin/com/courier/models/providers/ProviderUpdateParams.kt @@ -22,9 +22,10 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** - * Update an existing provider configuration. The `provider` key is required. All other fields are - * optional — omitted fields are cleared from the stored configuration (this is a full replacement, - * not a partial merge). + * Replace an existing provider configuration. The `provider` key is required and determines which + * provider-specific settings schema is applied. All other fields are optional — omitted fields are + * cleared from the stored configuration (this is a full replacement, not a partial merge). Changing + * the provider type for an existing configuration is not supported. */ class ProviderUpdateParams private constructor( @@ -37,7 +38,8 @@ private constructor( fun id(): Optional = Optional.ofNullable(id) /** - * The provider key identifying the type. + * The provider key identifying the type. Required on every request because it selects the + * provider-specific settings schema for validation. * * @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). @@ -153,7 +155,10 @@ private constructor( */ fun body(body: Body) = apply { this.body = body.toBuilder() } - /** The provider key identifying the type. */ + /** + * The provider key identifying the type. Required on every request because it selects the + * provider-specific settings schema for validation. + */ fun provider(provider: String) = apply { body.provider(provider) } /** @@ -352,9 +357,11 @@ private constructor( override fun _queryParams(): QueryParams = additionalQueryParams /** - * Request body for updating an existing provider configuration. The `provider` key is required. - * All other fields are optional — omitted fields are cleared from the stored configuration - * (this is a full replacement, not a partial merge). + * Request body for replacing an existing provider configuration. The `provider` key is required + * because it determines which provider-specific settings schema is validated against. Changing + * the provider type for an existing configuration is not supported. All other fields are + * optional — omitted fields are cleared from the stored configuration (this is a full + * replacement, not a partial merge). */ class Body @JsonCreator(mode = JsonCreator.Mode.DISABLED) @@ -379,7 +386,8 @@ private constructor( ) : this(provider, alias, settings, title, mutableMapOf()) /** - * The provider key identifying the type. + * The provider key identifying the type. Required on every request because it selects the + * provider-specific settings schema for validation. * * @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). @@ -482,7 +490,10 @@ private constructor( additionalProperties = body.additionalProperties.toMutableMap() } - /** The provider key identifying the type. */ + /** + * The provider key identifying the type. Required on every request because it selects + * the provider-specific settings schema for validation. + */ fun provider(provider: String) = provider(JsonField.of(provider)) /** diff --git a/courier-java-core/src/main/kotlin/com/courier/models/routingstrategies/RoutingStrategyMutationResponse.kt b/courier-java-core/src/main/kotlin/com/courier/models/routingstrategies/RoutingStrategyMutationResponse.kt deleted file mode 100644 index 278eaab..0000000 --- a/courier-java-core/src/main/kotlin/com/courier/models/routingstrategies/RoutingStrategyMutationResponse.kt +++ /dev/null @@ -1,177 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.courier.models.routingstrategies - -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 - -/** Response returned by create and replace operations. */ -class RoutingStrategyMutationResponse -@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()) - - /** - * The routing strategy ID (rs_ prefix). - * - * @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 - * [RoutingStrategyMutationResponse]. - * - * The following fields are required: - * ```java - * .id() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [RoutingStrategyMutationResponse]. */ - class Builder internal constructor() { - - private var id: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(routingStrategyMutationResponse: RoutingStrategyMutationResponse) = - apply { - id = routingStrategyMutationResponse.id - additionalProperties = - routingStrategyMutationResponse.additionalProperties.toMutableMap() - } - - /** The routing strategy ID (rs_ prefix). */ - 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 [RoutingStrategyMutationResponse]. - * - * 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(): RoutingStrategyMutationResponse = - RoutingStrategyMutationResponse( - checkRequired("id", id), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): RoutingStrategyMutationResponse = 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 RoutingStrategyMutationResponse && - id == other.id && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(id, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "RoutingStrategyMutationResponse{id=$id, additionalProperties=$additionalProperties}" -} diff --git a/courier-java-core/src/main/kotlin/com/courier/services/async/NotificationServiceAsync.kt b/courier-java-core/src/main/kotlin/com/courier/services/async/NotificationServiceAsync.kt index d954aba..b005a4e 100644 --- a/courier-java-core/src/main/kotlin/com/courier/services/async/NotificationServiceAsync.kt +++ b/courier-java-core/src/main/kotlin/com/courier/services/async/NotificationServiceAsync.kt @@ -22,7 +22,6 @@ import com.courier.models.notifications.NotificationRetrieveContentResponse import com.courier.models.notifications.NotificationRetrieveParams import com.courier.models.notifications.NotificationTemplateCreateRequest import com.courier.models.notifications.NotificationTemplateGetResponse -import com.courier.models.notifications.NotificationTemplateMutationResponse import com.courier.models.notifications.NotificationTemplateVersionListResponse import com.courier.services.async.notifications.CheckServiceAsync import java.util.concurrent.CompletableFuture @@ -50,20 +49,19 @@ interface NotificationServiceAsync { */ fun create( params: NotificationCreateParams - ): CompletableFuture = - create(params, RequestOptions.none()) + ): CompletableFuture = create(params, RequestOptions.none()) /** @see create */ fun create( params: NotificationCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture + ): CompletableFuture /** @see create */ fun create( notificationTemplateCreateRequest: NotificationTemplateCreateRequest, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = + ): CompletableFuture = create( NotificationCreateParams.builder() .notificationTemplateCreateRequest(notificationTemplateCreateRequest) @@ -74,7 +72,7 @@ interface NotificationServiceAsync { /** @see create */ fun create( notificationTemplateCreateRequest: NotificationTemplateCreateRequest - ): CompletableFuture = + ): CompletableFuture = create(notificationTemplateCreateRequest, RequestOptions.none()) /** @@ -332,7 +330,7 @@ interface NotificationServiceAsync { fun replace( id: String, params: NotificationReplaceParams, - ): CompletableFuture = + ): CompletableFuture = replace(id, params, RequestOptions.none()) /** @see replace */ @@ -340,20 +338,19 @@ interface NotificationServiceAsync { id: String, params: NotificationReplaceParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = + ): CompletableFuture = replace(params.toBuilder().id(id).build(), requestOptions) /** @see replace */ fun replace( params: NotificationReplaceParams - ): CompletableFuture = - replace(params, RequestOptions.none()) + ): CompletableFuture = replace(params, RequestOptions.none()) /** @see replace */ fun replace( params: NotificationReplaceParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture + ): CompletableFuture /** * Retrieve the content of a notification template. The response shape depends on whether the @@ -420,20 +417,20 @@ interface NotificationServiceAsync { */ fun create( params: NotificationCreateParams - ): CompletableFuture> = + ): CompletableFuture> = create(params, RequestOptions.none()) /** @see create */ fun create( params: NotificationCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> + ): CompletableFuture> /** @see create */ fun create( notificationTemplateCreateRequest: NotificationTemplateCreateRequest, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = + ): CompletableFuture> = create( NotificationCreateParams.builder() .notificationTemplateCreateRequest(notificationTemplateCreateRequest) @@ -444,7 +441,7 @@ interface NotificationServiceAsync { /** @see create */ fun create( notificationTemplateCreateRequest: NotificationTemplateCreateRequest - ): CompletableFuture> = + ): CompletableFuture> = create(notificationTemplateCreateRequest, RequestOptions.none()) /** @@ -725,7 +722,7 @@ interface NotificationServiceAsync { fun replace( id: String, params: NotificationReplaceParams, - ): CompletableFuture> = + ): CompletableFuture> = replace(id, params, RequestOptions.none()) /** @see replace */ @@ -733,20 +730,20 @@ interface NotificationServiceAsync { id: String, params: NotificationReplaceParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = + ): CompletableFuture> = replace(params.toBuilder().id(id).build(), requestOptions) /** @see replace */ fun replace( params: NotificationReplaceParams - ): CompletableFuture> = + ): CompletableFuture> = replace(params, RequestOptions.none()) /** @see replace */ fun replace( params: NotificationReplaceParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> + ): CompletableFuture> /** * Returns a raw HTTP response for `get /notifications/{id}/content`, but is otherwise the diff --git a/courier-java-core/src/main/kotlin/com/courier/services/async/NotificationServiceAsyncImpl.kt b/courier-java-core/src/main/kotlin/com/courier/services/async/NotificationServiceAsyncImpl.kt index 83a4218..80b8664 100644 --- a/courier-java-core/src/main/kotlin/com/courier/services/async/NotificationServiceAsyncImpl.kt +++ b/courier-java-core/src/main/kotlin/com/courier/services/async/NotificationServiceAsyncImpl.kt @@ -32,7 +32,6 @@ import com.courier.models.notifications.NotificationRetrieveContentParams import com.courier.models.notifications.NotificationRetrieveContentResponse import com.courier.models.notifications.NotificationRetrieveParams import com.courier.models.notifications.NotificationTemplateGetResponse -import com.courier.models.notifications.NotificationTemplateMutationResponse import com.courier.models.notifications.NotificationTemplateVersionListResponse import com.courier.services.async.notifications.CheckServiceAsync import com.courier.services.async.notifications.CheckServiceAsyncImpl @@ -59,7 +58,7 @@ class NotificationServiceAsyncImpl internal constructor(private val clientOption override fun create( params: NotificationCreateParams, requestOptions: RequestOptions, - ): CompletableFuture = + ): CompletableFuture = // post /notifications withRawResponse().create(params, requestOptions).thenApply { it.parse() } @@ -122,7 +121,7 @@ class NotificationServiceAsyncImpl internal constructor(private val clientOption override fun replace( params: NotificationReplaceParams, requestOptions: RequestOptions, - ): CompletableFuture = + ): CompletableFuture = // put /notifications/{id} withRawResponse().replace(params, requestOptions).thenApply { it.parse() } @@ -152,13 +151,13 @@ class NotificationServiceAsyncImpl internal constructor(private val clientOption override fun checks(): CheckServiceAsync.WithRawResponse = checks - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) override fun create( params: NotificationCreateParams, requestOptions: RequestOptions, - ): CompletableFuture> { + ): CompletableFuture> { val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -445,13 +444,13 @@ class NotificationServiceAsyncImpl internal constructor(private val clientOption } } - private val replaceHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val replaceHandler: Handler = + jsonHandler(clientOptions.jsonMapper) override fun replace( params: NotificationReplaceParams, requestOptions: RequestOptions, - ): CompletableFuture> { + ): CompletableFuture> { // We check here instead of in the params builder because this can be specified // positionally or in the params class. checkRequired("id", params.id().getOrNull()) diff --git a/courier-java-core/src/main/kotlin/com/courier/services/async/ProviderServiceAsync.kt b/courier-java-core/src/main/kotlin/com/courier/services/async/ProviderServiceAsync.kt index 39b15c8..de00097 100644 --- a/courier-java-core/src/main/kotlin/com/courier/services/async/ProviderServiceAsync.kt +++ b/courier-java-core/src/main/kotlin/com/courier/services/async/ProviderServiceAsync.kt @@ -78,9 +78,10 @@ interface ProviderServiceAsync { retrieve(id, ProviderRetrieveParams.none(), requestOptions) /** - * Update an existing provider configuration. The `provider` key is required. All other fields - * are optional — omitted fields are cleared from the stored configuration (this is a full - * replacement, not a partial merge). + * Replace an existing provider configuration. The `provider` key is required and determines + * which provider-specific settings schema is applied. All other fields are optional — omitted + * fields are cleared from the stored configuration (this is a full replacement, not a partial + * merge). Changing the provider type for an existing configuration is not supported. */ fun update(id: String, params: ProviderUpdateParams): CompletableFuture = update(id, params, RequestOptions.none()) @@ -225,7 +226,7 @@ interface ProviderServiceAsync { retrieve(id, ProviderRetrieveParams.none(), requestOptions) /** - * Returns a raw HTTP response for `post /providers/{id}`, but is otherwise the same as + * Returns a raw HTTP response for `put /providers/{id}`, but is otherwise the same as * [ProviderServiceAsync.update]. */ fun update( diff --git a/courier-java-core/src/main/kotlin/com/courier/services/async/ProviderServiceAsyncImpl.kt b/courier-java-core/src/main/kotlin/com/courier/services/async/ProviderServiceAsyncImpl.kt index 805ef43..5e7646e 100644 --- a/courier-java-core/src/main/kotlin/com/courier/services/async/ProviderServiceAsyncImpl.kt +++ b/courier-java-core/src/main/kotlin/com/courier/services/async/ProviderServiceAsyncImpl.kt @@ -64,7 +64,7 @@ class ProviderServiceAsyncImpl internal constructor(private val clientOptions: C params: ProviderUpdateParams, requestOptions: RequestOptions, ): CompletableFuture = - // post /providers/{id} + // put /providers/{id} withRawResponse().update(params, requestOptions).thenApply { it.parse() } override fun list( @@ -176,7 +176,7 @@ class ProviderServiceAsyncImpl internal constructor(private val clientOptions: C checkRequired("id", params.id().getOrNull()) val request = HttpRequest.builder() - .method(HttpMethod.POST) + .method(HttpMethod.PUT) .baseUrl(clientOptions.baseUrl()) .addPathSegments("providers", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) diff --git a/courier-java-core/src/main/kotlin/com/courier/services/async/RoutingStrategyServiceAsync.kt b/courier-java-core/src/main/kotlin/com/courier/services/async/RoutingStrategyServiceAsync.kt index e748424..36c9f9c 100644 --- a/courier-java-core/src/main/kotlin/com/courier/services/async/RoutingStrategyServiceAsync.kt +++ b/courier-java-core/src/main/kotlin/com/courier/services/async/RoutingStrategyServiceAsync.kt @@ -14,7 +14,6 @@ import com.courier.models.routingstrategies.RoutingStrategyGetResponse import com.courier.models.routingstrategies.RoutingStrategyListNotificationsParams import com.courier.models.routingstrategies.RoutingStrategyListParams import com.courier.models.routingstrategies.RoutingStrategyListResponse -import com.courier.models.routingstrategies.RoutingStrategyMutationResponse import com.courier.models.routingstrategies.RoutingStrategyReplaceParams import com.courier.models.routingstrategies.RoutingStrategyRetrieveParams import java.util.concurrent.CompletableFuture @@ -38,21 +37,20 @@ interface RoutingStrategyServiceAsync { * Create a routing strategy. Requires a name and routing configuration at minimum. Channels and * providers default to empty if omitted. */ - fun create( - params: RoutingStrategyCreateParams - ): CompletableFuture = create(params, RequestOptions.none()) + fun create(params: RoutingStrategyCreateParams): CompletableFuture = + create(params, RequestOptions.none()) /** @see create */ fun create( params: RoutingStrategyCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture + ): CompletableFuture /** @see create */ fun create( routingStrategyCreateRequest: RoutingStrategyCreateRequest, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = + ): CompletableFuture = create( RoutingStrategyCreateParams.builder() .routingStrategyCreateRequest(routingStrategyCreateRequest) @@ -63,7 +61,7 @@ interface RoutingStrategyServiceAsync { /** @see create */ fun create( routingStrategyCreateRequest: RoutingStrategyCreateRequest - ): CompletableFuture = + ): CompletableFuture = create(routingStrategyCreateRequest, RequestOptions.none()) /** @@ -211,27 +209,26 @@ interface RoutingStrategyServiceAsync { fun replace( id: String, params: RoutingStrategyReplaceParams, - ): CompletableFuture = - replace(id, params, RequestOptions.none()) + ): CompletableFuture = replace(id, params, RequestOptions.none()) /** @see replace */ fun replace( id: String, params: RoutingStrategyReplaceParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = + ): CompletableFuture = replace(params.toBuilder().id(id).build(), requestOptions) /** @see replace */ fun replace( params: RoutingStrategyReplaceParams - ): CompletableFuture = replace(params, RequestOptions.none()) + ): CompletableFuture = replace(params, RequestOptions.none()) /** @see replace */ fun replace( params: RoutingStrategyReplaceParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture + ): CompletableFuture /** * A view of [RoutingStrategyServiceAsync] that provides access to raw HTTP responses for each @@ -254,20 +251,20 @@ interface RoutingStrategyServiceAsync { */ fun create( params: RoutingStrategyCreateParams - ): CompletableFuture> = + ): CompletableFuture> = create(params, RequestOptions.none()) /** @see create */ fun create( params: RoutingStrategyCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> + ): CompletableFuture> /** @see create */ fun create( routingStrategyCreateRequest: RoutingStrategyCreateRequest, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = + ): CompletableFuture> = create( RoutingStrategyCreateParams.builder() .routingStrategyCreateRequest(routingStrategyCreateRequest) @@ -278,7 +275,7 @@ interface RoutingStrategyServiceAsync { /** @see create */ fun create( routingStrategyCreateRequest: RoutingStrategyCreateRequest - ): CompletableFuture> = + ): CompletableFuture> = create(routingStrategyCreateRequest, RequestOptions.none()) /** @@ -434,7 +431,7 @@ interface RoutingStrategyServiceAsync { fun replace( id: String, params: RoutingStrategyReplaceParams, - ): CompletableFuture> = + ): CompletableFuture> = replace(id, params, RequestOptions.none()) /** @see replace */ @@ -442,19 +439,19 @@ interface RoutingStrategyServiceAsync { id: String, params: RoutingStrategyReplaceParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = + ): CompletableFuture> = replace(params.toBuilder().id(id).build(), requestOptions) /** @see replace */ fun replace( params: RoutingStrategyReplaceParams - ): CompletableFuture> = + ): CompletableFuture> = replace(params, RequestOptions.none()) /** @see replace */ fun replace( params: RoutingStrategyReplaceParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> + ): CompletableFuture> } } diff --git a/courier-java-core/src/main/kotlin/com/courier/services/async/RoutingStrategyServiceAsyncImpl.kt b/courier-java-core/src/main/kotlin/com/courier/services/async/RoutingStrategyServiceAsyncImpl.kt index aae996e..a805c99 100644 --- a/courier-java-core/src/main/kotlin/com/courier/services/async/RoutingStrategyServiceAsyncImpl.kt +++ b/courier-java-core/src/main/kotlin/com/courier/services/async/RoutingStrategyServiceAsyncImpl.kt @@ -24,7 +24,6 @@ import com.courier.models.routingstrategies.RoutingStrategyGetResponse import com.courier.models.routingstrategies.RoutingStrategyListNotificationsParams import com.courier.models.routingstrategies.RoutingStrategyListParams import com.courier.models.routingstrategies.RoutingStrategyListResponse -import com.courier.models.routingstrategies.RoutingStrategyMutationResponse import com.courier.models.routingstrategies.RoutingStrategyReplaceParams import com.courier.models.routingstrategies.RoutingStrategyRetrieveParams import java.util.concurrent.CompletableFuture @@ -48,7 +47,7 @@ internal constructor(private val clientOptions: ClientOptions) : RoutingStrategy override fun create( params: RoutingStrategyCreateParams, requestOptions: RequestOptions, - ): CompletableFuture = + ): CompletableFuture = // post /routing-strategies withRawResponse().create(params, requestOptions).thenApply { it.parse() } @@ -83,7 +82,7 @@ internal constructor(private val clientOptions: ClientOptions) : RoutingStrategy override fun replace( params: RoutingStrategyReplaceParams, requestOptions: RequestOptions, - ): CompletableFuture = + ): CompletableFuture = // put /routing-strategies/{id} withRawResponse().replace(params, requestOptions).thenApply { it.parse() } @@ -100,13 +99,13 @@ internal constructor(private val clientOptions: ClientOptions) : RoutingStrategy clientOptions.toBuilder().apply(modifier::accept).build() ) - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) override fun create( params: RoutingStrategyCreateParams, requestOptions: RequestOptions, - ): CompletableFuture> { + ): CompletableFuture> { val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -254,13 +253,13 @@ internal constructor(private val clientOptions: ClientOptions) : RoutingStrategy } } - private val replaceHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val replaceHandler: Handler = + jsonHandler(clientOptions.jsonMapper) override fun replace( params: RoutingStrategyReplaceParams, requestOptions: RequestOptions, - ): CompletableFuture> { + ): CompletableFuture> { // We check here instead of in the params builder because this can be specified // positionally or in the params class. checkRequired("id", params.id().getOrNull()) diff --git a/courier-java-core/src/main/kotlin/com/courier/services/blocking/NotificationService.kt b/courier-java-core/src/main/kotlin/com/courier/services/blocking/NotificationService.kt index cb90719..c909720 100644 --- a/courier-java-core/src/main/kotlin/com/courier/services/blocking/NotificationService.kt +++ b/courier-java-core/src/main/kotlin/com/courier/services/blocking/NotificationService.kt @@ -22,7 +22,6 @@ import com.courier.models.notifications.NotificationRetrieveContentResponse import com.courier.models.notifications.NotificationRetrieveParams import com.courier.models.notifications.NotificationTemplateCreateRequest import com.courier.models.notifications.NotificationTemplateGetResponse -import com.courier.models.notifications.NotificationTemplateMutationResponse import com.courier.models.notifications.NotificationTemplateVersionListResponse import com.courier.services.blocking.notifications.CheckService import com.google.errorprone.annotations.MustBeClosed @@ -48,20 +47,20 @@ interface NotificationService { * Create a notification template. Requires all fields in the notification object. Templates are * created in draft state by default. */ - fun create(params: NotificationCreateParams): NotificationTemplateMutationResponse = + fun create(params: NotificationCreateParams): NotificationTemplateGetResponse = create(params, RequestOptions.none()) /** @see create */ fun create( params: NotificationCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): NotificationTemplateMutationResponse + ): NotificationTemplateGetResponse /** @see create */ fun create( notificationTemplateCreateRequest: NotificationTemplateCreateRequest, requestOptions: RequestOptions = RequestOptions.none(), - ): NotificationTemplateMutationResponse = + ): NotificationTemplateGetResponse = create( NotificationCreateParams.builder() .notificationTemplateCreateRequest(notificationTemplateCreateRequest) @@ -72,7 +71,7 @@ interface NotificationService { /** @see create */ fun create( notificationTemplateCreateRequest: NotificationTemplateCreateRequest - ): NotificationTemplateMutationResponse = + ): NotificationTemplateGetResponse = create(notificationTemplateCreateRequest, RequestOptions.none()) /** @@ -302,28 +301,25 @@ interface NotificationService { ): NotificationContentMutationResponse /** Replace a notification template. All fields are required. */ - fun replace( - id: String, - params: NotificationReplaceParams, - ): NotificationTemplateMutationResponse = replace(id, params, RequestOptions.none()) + fun replace(id: String, params: NotificationReplaceParams): NotificationTemplateGetResponse = + replace(id, params, RequestOptions.none()) /** @see replace */ fun replace( id: String, params: NotificationReplaceParams, requestOptions: RequestOptions = RequestOptions.none(), - ): NotificationTemplateMutationResponse = - replace(params.toBuilder().id(id).build(), requestOptions) + ): NotificationTemplateGetResponse = replace(params.toBuilder().id(id).build(), requestOptions) /** @see replace */ - fun replace(params: NotificationReplaceParams): NotificationTemplateMutationResponse = + fun replace(params: NotificationReplaceParams): NotificationTemplateGetResponse = replace(params, RequestOptions.none()) /** @see replace */ fun replace( params: NotificationReplaceParams, requestOptions: RequestOptions = RequestOptions.none(), - ): NotificationTemplateMutationResponse + ): NotificationTemplateGetResponse /** * Retrieve the content of a notification template. The response shape depends on whether the @@ -388,22 +384,21 @@ interface NotificationService { @MustBeClosed fun create( params: NotificationCreateParams - ): HttpResponseFor = - create(params, RequestOptions.none()) + ): HttpResponseFor = create(params, RequestOptions.none()) /** @see create */ @MustBeClosed fun create( params: NotificationCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor + ): HttpResponseFor /** @see create */ @MustBeClosed fun create( notificationTemplateCreateRequest: NotificationTemplateCreateRequest, requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = + ): HttpResponseFor = create( NotificationCreateParams.builder() .notificationTemplateCreateRequest(notificationTemplateCreateRequest) @@ -415,7 +410,7 @@ interface NotificationService { @MustBeClosed fun create( notificationTemplateCreateRequest: NotificationTemplateCreateRequest - ): HttpResponseFor = + ): HttpResponseFor = create(notificationTemplateCreateRequest, RequestOptions.none()) /** @@ -725,7 +720,7 @@ interface NotificationService { fun replace( id: String, params: NotificationReplaceParams, - ): HttpResponseFor = + ): HttpResponseFor = replace(id, params, RequestOptions.none()) /** @see replace */ @@ -734,22 +729,21 @@ interface NotificationService { id: String, params: NotificationReplaceParams, requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = + ): HttpResponseFor = replace(params.toBuilder().id(id).build(), requestOptions) /** @see replace */ @MustBeClosed fun replace( params: NotificationReplaceParams - ): HttpResponseFor = - replace(params, RequestOptions.none()) + ): HttpResponseFor = replace(params, RequestOptions.none()) /** @see replace */ @MustBeClosed fun replace( params: NotificationReplaceParams, requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor + ): HttpResponseFor /** * Returns a raw HTTP response for `get /notifications/{id}/content`, but is otherwise the diff --git a/courier-java-core/src/main/kotlin/com/courier/services/blocking/NotificationServiceImpl.kt b/courier-java-core/src/main/kotlin/com/courier/services/blocking/NotificationServiceImpl.kt index 431b090..fa74685 100644 --- a/courier-java-core/src/main/kotlin/com/courier/services/blocking/NotificationServiceImpl.kt +++ b/courier-java-core/src/main/kotlin/com/courier/services/blocking/NotificationServiceImpl.kt @@ -32,7 +32,6 @@ import com.courier.models.notifications.NotificationRetrieveContentParams import com.courier.models.notifications.NotificationRetrieveContentResponse import com.courier.models.notifications.NotificationRetrieveParams import com.courier.models.notifications.NotificationTemplateGetResponse -import com.courier.models.notifications.NotificationTemplateMutationResponse import com.courier.models.notifications.NotificationTemplateVersionListResponse import com.courier.services.blocking.notifications.CheckService import com.courier.services.blocking.notifications.CheckServiceImpl @@ -58,7 +57,7 @@ class NotificationServiceImpl internal constructor(private val clientOptions: Cl override fun create( params: NotificationCreateParams, requestOptions: RequestOptions, - ): NotificationTemplateMutationResponse = + ): NotificationTemplateGetResponse = // post /notifications withRawResponse().create(params, requestOptions).parse() @@ -117,7 +116,7 @@ class NotificationServiceImpl internal constructor(private val clientOptions: Cl override fun replace( params: NotificationReplaceParams, requestOptions: RequestOptions, - ): NotificationTemplateMutationResponse = + ): NotificationTemplateGetResponse = // put /notifications/{id} withRawResponse().replace(params, requestOptions).parse() @@ -147,13 +146,13 @@ class NotificationServiceImpl internal constructor(private val clientOptions: Cl override fun checks(): CheckService.WithRawResponse = checks - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) override fun create( params: NotificationCreateParams, requestOptions: RequestOptions, - ): HttpResponseFor { + ): HttpResponseFor { val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -413,13 +412,13 @@ class NotificationServiceImpl internal constructor(private val clientOptions: Cl } } - private val replaceHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val replaceHandler: Handler = + jsonHandler(clientOptions.jsonMapper) override fun replace( params: NotificationReplaceParams, requestOptions: RequestOptions, - ): HttpResponseFor { + ): HttpResponseFor { // We check here instead of in the params builder because this can be specified // positionally or in the params class. checkRequired("id", params.id().getOrNull()) diff --git a/courier-java-core/src/main/kotlin/com/courier/services/blocking/ProviderService.kt b/courier-java-core/src/main/kotlin/com/courier/services/blocking/ProviderService.kt index 790a584..77bd49e 100644 --- a/courier-java-core/src/main/kotlin/com/courier/services/blocking/ProviderService.kt +++ b/courier-java-core/src/main/kotlin/com/courier/services/blocking/ProviderService.kt @@ -75,9 +75,10 @@ interface ProviderService { retrieve(id, ProviderRetrieveParams.none(), requestOptions) /** - * Update an existing provider configuration. The `provider` key is required. All other fields - * are optional — omitted fields are cleared from the stored configuration (this is a full - * replacement, not a partial merge). + * Replace an existing provider configuration. The `provider` key is required and determines + * which provider-specific settings schema is applied. All other fields are optional — omitted + * fields are cleared from the stored configuration (this is a full replacement, not a partial + * merge). Changing the provider type for an existing configuration is not supported. */ fun update(id: String, params: ProviderUpdateParams): Provider = update(id, params, RequestOptions.none()) @@ -213,7 +214,7 @@ interface ProviderService { retrieve(id, ProviderRetrieveParams.none(), requestOptions) /** - * Returns a raw HTTP response for `post /providers/{id}`, but is otherwise the same as + * Returns a raw HTTP response for `put /providers/{id}`, but is otherwise the same as * [ProviderService.update]. */ @MustBeClosed diff --git a/courier-java-core/src/main/kotlin/com/courier/services/blocking/ProviderServiceImpl.kt b/courier-java-core/src/main/kotlin/com/courier/services/blocking/ProviderServiceImpl.kt index dca6129..2022f3e 100644 --- a/courier-java-core/src/main/kotlin/com/courier/services/blocking/ProviderServiceImpl.kt +++ b/courier-java-core/src/main/kotlin/com/courier/services/blocking/ProviderServiceImpl.kt @@ -57,7 +57,7 @@ class ProviderServiceImpl internal constructor(private val clientOptions: Client withRawResponse().retrieve(params, requestOptions).parse() override fun update(params: ProviderUpdateParams, requestOptions: RequestOptions): Provider = - // post /providers/{id} + // put /providers/{id} withRawResponse().update(params, requestOptions).parse() override fun list( @@ -161,7 +161,7 @@ class ProviderServiceImpl internal constructor(private val clientOptions: Client checkRequired("id", params.id().getOrNull()) val request = HttpRequest.builder() - .method(HttpMethod.POST) + .method(HttpMethod.PUT) .baseUrl(clientOptions.baseUrl()) .addPathSegments("providers", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) diff --git a/courier-java-core/src/main/kotlin/com/courier/services/blocking/RoutingStrategyService.kt b/courier-java-core/src/main/kotlin/com/courier/services/blocking/RoutingStrategyService.kt index f5f8236..3890fbb 100644 --- a/courier-java-core/src/main/kotlin/com/courier/services/blocking/RoutingStrategyService.kt +++ b/courier-java-core/src/main/kotlin/com/courier/services/blocking/RoutingStrategyService.kt @@ -14,7 +14,6 @@ import com.courier.models.routingstrategies.RoutingStrategyGetResponse import com.courier.models.routingstrategies.RoutingStrategyListNotificationsParams import com.courier.models.routingstrategies.RoutingStrategyListParams import com.courier.models.routingstrategies.RoutingStrategyListResponse -import com.courier.models.routingstrategies.RoutingStrategyMutationResponse import com.courier.models.routingstrategies.RoutingStrategyReplaceParams import com.courier.models.routingstrategies.RoutingStrategyRetrieveParams import com.google.errorprone.annotations.MustBeClosed @@ -38,20 +37,20 @@ interface RoutingStrategyService { * Create a routing strategy. Requires a name and routing configuration at minimum. Channels and * providers default to empty if omitted. */ - fun create(params: RoutingStrategyCreateParams): RoutingStrategyMutationResponse = + fun create(params: RoutingStrategyCreateParams): RoutingStrategyGetResponse = create(params, RequestOptions.none()) /** @see create */ fun create( params: RoutingStrategyCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): RoutingStrategyMutationResponse + ): RoutingStrategyGetResponse /** @see create */ fun create( routingStrategyCreateRequest: RoutingStrategyCreateRequest, requestOptions: RequestOptions = RequestOptions.none(), - ): RoutingStrategyMutationResponse = + ): RoutingStrategyGetResponse = create( RoutingStrategyCreateParams.builder() .routingStrategyCreateRequest(routingStrategyCreateRequest) @@ -62,7 +61,7 @@ interface RoutingStrategyService { /** @see create */ fun create( routingStrategyCreateRequest: RoutingStrategyCreateRequest - ): RoutingStrategyMutationResponse = create(routingStrategyCreateRequest, RequestOptions.none()) + ): RoutingStrategyGetResponse = create(routingStrategyCreateRequest, RequestOptions.none()) /** * Retrieve a routing strategy by ID. Returns the full entity including routing content and @@ -196,7 +195,7 @@ interface RoutingStrategyService { * Replace a routing strategy. Full document replacement; the caller must send the complete * desired state. Missing optional fields are cleared. */ - fun replace(id: String, params: RoutingStrategyReplaceParams): RoutingStrategyMutationResponse = + fun replace(id: String, params: RoutingStrategyReplaceParams): RoutingStrategyGetResponse = replace(id, params, RequestOptions.none()) /** @see replace */ @@ -204,17 +203,17 @@ interface RoutingStrategyService { id: String, params: RoutingStrategyReplaceParams, requestOptions: RequestOptions = RequestOptions.none(), - ): RoutingStrategyMutationResponse = replace(params.toBuilder().id(id).build(), requestOptions) + ): RoutingStrategyGetResponse = replace(params.toBuilder().id(id).build(), requestOptions) /** @see replace */ - fun replace(params: RoutingStrategyReplaceParams): RoutingStrategyMutationResponse = + fun replace(params: RoutingStrategyReplaceParams): RoutingStrategyGetResponse = replace(params, RequestOptions.none()) /** @see replace */ fun replace( params: RoutingStrategyReplaceParams, requestOptions: RequestOptions = RequestOptions.none(), - ): RoutingStrategyMutationResponse + ): RoutingStrategyGetResponse /** * A view of [RoutingStrategyService] that provides access to raw HTTP responses for each @@ -238,21 +237,21 @@ interface RoutingStrategyService { @MustBeClosed fun create( params: RoutingStrategyCreateParams - ): HttpResponseFor = create(params, RequestOptions.none()) + ): HttpResponseFor = create(params, RequestOptions.none()) /** @see create */ @MustBeClosed fun create( params: RoutingStrategyCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor + ): HttpResponseFor /** @see create */ @MustBeClosed fun create( routingStrategyCreateRequest: RoutingStrategyCreateRequest, requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = + ): HttpResponseFor = create( RoutingStrategyCreateParams.builder() .routingStrategyCreateRequest(routingStrategyCreateRequest) @@ -264,7 +263,7 @@ interface RoutingStrategyService { @MustBeClosed fun create( routingStrategyCreateRequest: RoutingStrategyCreateRequest - ): HttpResponseFor = + ): HttpResponseFor = create(routingStrategyCreateRequest, RequestOptions.none()) /** @@ -434,8 +433,7 @@ interface RoutingStrategyService { fun replace( id: String, params: RoutingStrategyReplaceParams, - ): HttpResponseFor = - replace(id, params, RequestOptions.none()) + ): HttpResponseFor = replace(id, params, RequestOptions.none()) /** @see replace */ @MustBeClosed @@ -443,20 +441,20 @@ interface RoutingStrategyService { id: String, params: RoutingStrategyReplaceParams, requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = + ): HttpResponseFor = replace(params.toBuilder().id(id).build(), requestOptions) /** @see replace */ @MustBeClosed fun replace( params: RoutingStrategyReplaceParams - ): HttpResponseFor = replace(params, RequestOptions.none()) + ): HttpResponseFor = replace(params, RequestOptions.none()) /** @see replace */ @MustBeClosed fun replace( params: RoutingStrategyReplaceParams, requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor + ): HttpResponseFor } } diff --git a/courier-java-core/src/main/kotlin/com/courier/services/blocking/RoutingStrategyServiceImpl.kt b/courier-java-core/src/main/kotlin/com/courier/services/blocking/RoutingStrategyServiceImpl.kt index 6fc9efd..f8dc5a3 100644 --- a/courier-java-core/src/main/kotlin/com/courier/services/blocking/RoutingStrategyServiceImpl.kt +++ b/courier-java-core/src/main/kotlin/com/courier/services/blocking/RoutingStrategyServiceImpl.kt @@ -24,7 +24,6 @@ import com.courier.models.routingstrategies.RoutingStrategyGetResponse import com.courier.models.routingstrategies.RoutingStrategyListNotificationsParams import com.courier.models.routingstrategies.RoutingStrategyListParams import com.courier.models.routingstrategies.RoutingStrategyListResponse -import com.courier.models.routingstrategies.RoutingStrategyMutationResponse import com.courier.models.routingstrategies.RoutingStrategyReplaceParams import com.courier.models.routingstrategies.RoutingStrategyRetrieveParams import java.util.function.Consumer @@ -45,7 +44,7 @@ class RoutingStrategyServiceImpl internal constructor(private val clientOptions: override fun create( params: RoutingStrategyCreateParams, requestOptions: RequestOptions, - ): RoutingStrategyMutationResponse = + ): RoutingStrategyGetResponse = // post /routing-strategies withRawResponse().create(params, requestOptions).parse() @@ -78,7 +77,7 @@ class RoutingStrategyServiceImpl internal constructor(private val clientOptions: override fun replace( params: RoutingStrategyReplaceParams, requestOptions: RequestOptions, - ): RoutingStrategyMutationResponse = + ): RoutingStrategyGetResponse = // put /routing-strategies/{id} withRawResponse().replace(params, requestOptions).parse() @@ -95,13 +94,13 @@ class RoutingStrategyServiceImpl internal constructor(private val clientOptions: clientOptions.toBuilder().apply(modifier::accept).build() ) - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) override fun create( params: RoutingStrategyCreateParams, requestOptions: RequestOptions, - ): HttpResponseFor { + ): HttpResponseFor { val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -234,13 +233,13 @@ class RoutingStrategyServiceImpl internal constructor(private val clientOptions: } } - private val replaceHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val replaceHandler: Handler = + jsonHandler(clientOptions.jsonMapper) override fun replace( params: RoutingStrategyReplaceParams, requestOptions: RequestOptions, - ): HttpResponseFor { + ): HttpResponseFor { // We check here instead of in the params builder because this can be specified // positionally or in the params class. checkRequired("id", params.id().getOrNull()) diff --git a/courier-java-core/src/test/kotlin/com/courier/models/notifications/NotificationTemplateMutationResponseTest.kt b/courier-java-core/src/test/kotlin/com/courier/models/notifications/NotificationTemplateMutationResponseTest.kt deleted file mode 100644 index 69470bc..0000000 --- a/courier-java-core/src/test/kotlin/com/courier/models/notifications/NotificationTemplateMutationResponseTest.kt +++ /dev/null @@ -1,48 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.courier.models.notifications - -import com.courier.core.jsonMapper -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class NotificationTemplateMutationResponseTest { - - @Test - fun create() { - val notificationTemplateMutationResponse = - NotificationTemplateMutationResponse.builder() - .notification( - NotificationTemplateMutationResponse.Notification.builder().id("id").build() - ) - .state(NotificationTemplateMutationResponse.State.DRAFT) - .build() - - assertThat(notificationTemplateMutationResponse.notification()) - .isEqualTo(NotificationTemplateMutationResponse.Notification.builder().id("id").build()) - assertThat(notificationTemplateMutationResponse.state()) - .isEqualTo(NotificationTemplateMutationResponse.State.DRAFT) - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val notificationTemplateMutationResponse = - NotificationTemplateMutationResponse.builder() - .notification( - NotificationTemplateMutationResponse.Notification.builder().id("id").build() - ) - .state(NotificationTemplateMutationResponse.State.DRAFT) - .build() - - val roundtrippedNotificationTemplateMutationResponse = - jsonMapper.readValue( - jsonMapper.writeValueAsString(notificationTemplateMutationResponse), - jacksonTypeRef(), - ) - - assertThat(roundtrippedNotificationTemplateMutationResponse) - .isEqualTo(notificationTemplateMutationResponse) - } -} diff --git a/courier-java-core/src/test/kotlin/com/courier/models/routingstrategies/RoutingStrategyMutationResponseTest.kt b/courier-java-core/src/test/kotlin/com/courier/models/routingstrategies/RoutingStrategyMutationResponseTest.kt deleted file mode 100644 index d02f1d8..0000000 --- a/courier-java-core/src/test/kotlin/com/courier/models/routingstrategies/RoutingStrategyMutationResponseTest.kt +++ /dev/null @@ -1,35 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.courier.models.routingstrategies - -import com.courier.core.jsonMapper -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class RoutingStrategyMutationResponseTest { - - @Test - fun create() { - val routingStrategyMutationResponse = - RoutingStrategyMutationResponse.builder().id("id").build() - - assertThat(routingStrategyMutationResponse.id()).isEqualTo("id") - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val routingStrategyMutationResponse = - RoutingStrategyMutationResponse.builder().id("id").build() - - val roundtrippedRoutingStrategyMutationResponse = - jsonMapper.readValue( - jsonMapper.writeValueAsString(routingStrategyMutationResponse), - jacksonTypeRef(), - ) - - assertThat(roundtrippedRoutingStrategyMutationResponse) - .isEqualTo(routingStrategyMutationResponse) - } -} diff --git a/courier-java-core/src/test/kotlin/com/courier/services/async/NotificationServiceAsyncTest.kt b/courier-java-core/src/test/kotlin/com/courier/services/async/NotificationServiceAsyncTest.kt index 0e1ecb3..3babf67 100644 --- a/courier-java-core/src/test/kotlin/com/courier/services/async/NotificationServiceAsyncTest.kt +++ b/courier-java-core/src/test/kotlin/com/courier/services/async/NotificationServiceAsyncTest.kt @@ -34,7 +34,7 @@ internal class NotificationServiceAsyncTest { val client = CourierOkHttpClientAsync.builder().apiKey("My API Key").build() val notificationServiceAsync = client.notifications() - val notificationTemplateMutationResponseFuture = + val notificationTemplateGetResponseFuture = notificationServiceAsync.create( NotificationTemplateCreateRequest.builder() .notification( @@ -71,8 +71,8 @@ internal class NotificationServiceAsyncTest { .build() ) - val notificationTemplateMutationResponse = notificationTemplateMutationResponseFuture.get() - notificationTemplateMutationResponse.validate() + val notificationTemplateGetResponse = notificationTemplateGetResponseFuture.get() + notificationTemplateGetResponse.validate() } @Disabled("Mock server tests are disabled") @@ -261,7 +261,7 @@ internal class NotificationServiceAsyncTest { val client = CourierOkHttpClientAsync.builder().apiKey("My API Key").build() val notificationServiceAsync = client.notifications() - val notificationTemplateMutationResponseFuture = + val notificationTemplateGetResponseFuture = notificationServiceAsync.replace( NotificationReplaceParams.builder() .id("id") @@ -302,8 +302,8 @@ internal class NotificationServiceAsyncTest { .build() ) - val notificationTemplateMutationResponse = notificationTemplateMutationResponseFuture.get() - notificationTemplateMutationResponse.validate() + val notificationTemplateGetResponse = notificationTemplateGetResponseFuture.get() + notificationTemplateGetResponse.validate() } @Disabled("Mock server tests are disabled") diff --git a/courier-java-core/src/test/kotlin/com/courier/services/async/RoutingStrategyServiceAsyncTest.kt b/courier-java-core/src/test/kotlin/com/courier/services/async/RoutingStrategyServiceAsyncTest.kt index 48292a0..0543782 100644 --- a/courier-java-core/src/test/kotlin/com/courier/services/async/RoutingStrategyServiceAsyncTest.kt +++ b/courier-java-core/src/test/kotlin/com/courier/services/async/RoutingStrategyServiceAsyncTest.kt @@ -23,7 +23,7 @@ internal class RoutingStrategyServiceAsyncTest { val client = CourierOkHttpClientAsync.builder().apiKey("My API Key").build() val routingStrategyServiceAsync = client.routingStrategies() - val routingStrategyMutationResponseFuture = + val routingStrategyGetResponseFuture = routingStrategyServiceAsync.create( RoutingStrategyCreateRequest.builder() .name("Email via SendGrid") @@ -92,8 +92,8 @@ internal class RoutingStrategyServiceAsyncTest { .build() ) - val routingStrategyMutationResponse = routingStrategyMutationResponseFuture.get() - routingStrategyMutationResponse.validate() + val routingStrategyGetResponse = routingStrategyGetResponseFuture.get() + routingStrategyGetResponse.validate() } @Disabled("Mock server tests are disabled") @@ -159,7 +159,7 @@ internal class RoutingStrategyServiceAsyncTest { val client = CourierOkHttpClientAsync.builder().apiKey("My API Key").build() val routingStrategyServiceAsync = client.routingStrategies() - val routingStrategyMutationResponseFuture = + val routingStrategyGetResponseFuture = routingStrategyServiceAsync.replace( RoutingStrategyReplaceParams.builder() .id("id") @@ -232,7 +232,7 @@ internal class RoutingStrategyServiceAsyncTest { .build() ) - val routingStrategyMutationResponse = routingStrategyMutationResponseFuture.get() - routingStrategyMutationResponse.validate() + val routingStrategyGetResponse = routingStrategyGetResponseFuture.get() + routingStrategyGetResponse.validate() } } diff --git a/courier-java-core/src/test/kotlin/com/courier/services/blocking/NotificationServiceTest.kt b/courier-java-core/src/test/kotlin/com/courier/services/blocking/NotificationServiceTest.kt index cfb81eb..223982c 100644 --- a/courier-java-core/src/test/kotlin/com/courier/services/blocking/NotificationServiceTest.kt +++ b/courier-java-core/src/test/kotlin/com/courier/services/blocking/NotificationServiceTest.kt @@ -34,7 +34,7 @@ internal class NotificationServiceTest { val client = CourierOkHttpClient.builder().apiKey("My API Key").build() val notificationService = client.notifications() - val notificationTemplateMutationResponse = + val notificationTemplateGetResponse = notificationService.create( NotificationTemplateCreateRequest.builder() .notification( @@ -71,7 +71,7 @@ internal class NotificationServiceTest { .build() ) - notificationTemplateMutationResponse.validate() + notificationTemplateGetResponse.validate() } @Disabled("Mock server tests are disabled") @@ -246,7 +246,7 @@ internal class NotificationServiceTest { val client = CourierOkHttpClient.builder().apiKey("My API Key").build() val notificationService = client.notifications() - val notificationTemplateMutationResponse = + val notificationTemplateGetResponse = notificationService.replace( NotificationReplaceParams.builder() .id("id") @@ -287,7 +287,7 @@ internal class NotificationServiceTest { .build() ) - notificationTemplateMutationResponse.validate() + notificationTemplateGetResponse.validate() } @Disabled("Mock server tests are disabled") diff --git a/courier-java-core/src/test/kotlin/com/courier/services/blocking/RoutingStrategyServiceTest.kt b/courier-java-core/src/test/kotlin/com/courier/services/blocking/RoutingStrategyServiceTest.kt index 5e69e5a..f15b222 100644 --- a/courier-java-core/src/test/kotlin/com/courier/services/blocking/RoutingStrategyServiceTest.kt +++ b/courier-java-core/src/test/kotlin/com/courier/services/blocking/RoutingStrategyServiceTest.kt @@ -23,7 +23,7 @@ internal class RoutingStrategyServiceTest { val client = CourierOkHttpClient.builder().apiKey("My API Key").build() val routingStrategyService = client.routingStrategies() - val routingStrategyMutationResponse = + val routingStrategyGetResponse = routingStrategyService.create( RoutingStrategyCreateRequest.builder() .name("Email via SendGrid") @@ -92,7 +92,7 @@ internal class RoutingStrategyServiceTest { .build() ) - routingStrategyMutationResponse.validate() + routingStrategyGetResponse.validate() } @Disabled("Mock server tests are disabled") @@ -153,7 +153,7 @@ internal class RoutingStrategyServiceTest { val client = CourierOkHttpClient.builder().apiKey("My API Key").build() val routingStrategyService = client.routingStrategies() - val routingStrategyMutationResponse = + val routingStrategyGetResponse = routingStrategyService.replace( RoutingStrategyReplaceParams.builder() .id("id") @@ -226,6 +226,6 @@ internal class RoutingStrategyServiceTest { .build() ) - routingStrategyMutationResponse.validate() + routingStrategyGetResponse.validate() } }