diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 0f2463a..141929c 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.24.0" + ".": "4.25.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 29ea7c7..06502c4 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 147 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-ca32540df5bca42c8113de4004e7751b74bb440e3d73267e7cbad84dd3c3e82a.yml -openapi_spec_hash: 5576c8cf8e5be1f250b5dd1eb6d30571 -config_hash: c6cefb51165221f01d442a42ac4a13b9 +configured_endpoints: 145 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-b4485f5c4897c26d52a46aeb39b8a22415bcd529b0ad326fd43a30d7fadf1376.yml +openapi_spec_hash: db619c8991994dc8016fc4327f6917a2 +config_hash: 3eb0070d128aef7a6da16173f7050177 diff --git a/CHANGELOG.md b/CHANGELOG.md index 4dd13d0..741e581 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 4.25.0 (2026-07-30) + +Full Changelog: [v4.24.0...v4.25.0](https://github.com/trycourier/courier-java/compare/v4.24.0...v4.25.0) + +### Features + +* spec: remove inbox message delete/restore endpoints for now (C-19268) ([#182](https://github.com/trycourier/courier-java/issues/182)) ([07e30e0](https://github.com/trycourier/courier-java/commit/07e30e0228b6de99301269f039ebba887c5dff47)) +* spec: reorder API reference sections to match the Studio nav ([#180](https://github.com/trycourier/courier-java/issues/180)) ([3fe56cc](https://github.com/trycourier/courier-java/commit/3fe56ccad1fcdce5235c1ef4e3c2613879384d59)) + ## 4.24.0 (2026-07-29) Full Changelog: [v4.23.0...v4.24.0](https://github.com/trycourier/courier-java/compare/v4.23.0...v4.24.0) diff --git a/build.gradle.kts b/build.gradle.kts index b4c977c..0e25458 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.courier" - version = "4.24.0" // x-release-please-version + version = "4.25.0" // x-release-please-version } subprojects { diff --git a/courier-java-core/src/main/kotlin/com/courier/client/CourierClient.kt b/courier-java-core/src/main/kotlin/com/courier/client/CourierClient.kt index f47f046..9505cef 100644 --- a/courier-java-core/src/main/kotlin/com/courier/client/CourierClient.kt +++ b/courier-java-core/src/main/kotlin/com/courier/client/CourierClient.kt @@ -11,7 +11,6 @@ import com.courier.services.blocking.BrandService import com.courier.services.blocking.BroadcastService import com.courier.services.blocking.DigestService import com.courier.services.blocking.InboundService -import com.courier.services.blocking.InboxService import com.courier.services.blocking.JourneyService import com.courier.services.blocking.ListService import com.courier.services.blocking.MessageService @@ -97,6 +96,10 @@ interface CourierClient { */ fun journeys(): JourneyService + /** + * Create a one-off send to a list or audience, author its content, then send it immediately or + * schedule it for later. + */ fun broadcasts(): BroadcastService /** Manage the logos, colors, and layout that give the templates you send a consistent look. */ @@ -113,8 +116,6 @@ interface CourierClient { */ fun lists(): ListService - fun inbox(): InboxService - /** * Look up the messages Courier has accepted, inspect their delivery history and rendered * output, and cancel, resend, or archive them. @@ -219,6 +220,10 @@ interface CourierClient { */ fun journeys(): JourneyService.WithRawResponse + /** + * Create a one-off send to a list or audience, author its content, then send it immediately + * or schedule it for later. + */ fun broadcasts(): BroadcastService.WithRawResponse /** @@ -237,8 +242,6 @@ interface CourierClient { */ fun lists(): ListService.WithRawResponse - fun inbox(): InboxService.WithRawResponse - /** * Look up the messages Courier has accepted, inspect their delivery history and rendered * output, and cancel, resend, or archive them. diff --git a/courier-java-core/src/main/kotlin/com/courier/client/CourierClientAsync.kt b/courier-java-core/src/main/kotlin/com/courier/client/CourierClientAsync.kt index b1fe4a0..835c15e 100644 --- a/courier-java-core/src/main/kotlin/com/courier/client/CourierClientAsync.kt +++ b/courier-java-core/src/main/kotlin/com/courier/client/CourierClientAsync.kt @@ -11,7 +11,6 @@ import com.courier.services.async.BrandServiceAsync import com.courier.services.async.BroadcastServiceAsync import com.courier.services.async.DigestServiceAsync import com.courier.services.async.InboundServiceAsync -import com.courier.services.async.InboxServiceAsync import com.courier.services.async.JourneyServiceAsync import com.courier.services.async.ListServiceAsync import com.courier.services.async.MessageServiceAsync @@ -97,6 +96,10 @@ interface CourierClientAsync { */ fun journeys(): JourneyServiceAsync + /** + * Create a one-off send to a list or audience, author its content, then send it immediately or + * schedule it for later. + */ fun broadcasts(): BroadcastServiceAsync /** Manage the logos, colors, and layout that give the templates you send a consistent look. */ @@ -113,8 +116,6 @@ interface CourierClientAsync { */ fun lists(): ListServiceAsync - fun inbox(): InboxServiceAsync - /** * Look up the messages Courier has accepted, inspect their delivery history and rendered * output, and cancel, resend, or archive them. @@ -223,6 +224,10 @@ interface CourierClientAsync { */ fun journeys(): JourneyServiceAsync.WithRawResponse + /** + * Create a one-off send to a list or audience, author its content, then send it immediately + * or schedule it for later. + */ fun broadcasts(): BroadcastServiceAsync.WithRawResponse /** @@ -241,8 +246,6 @@ interface CourierClientAsync { */ fun lists(): ListServiceAsync.WithRawResponse - fun inbox(): InboxServiceAsync.WithRawResponse - /** * Look up the messages Courier has accepted, inspect their delivery history and rendered * output, and cancel, resend, or archive them. diff --git a/courier-java-core/src/main/kotlin/com/courier/client/CourierClientAsyncImpl.kt b/courier-java-core/src/main/kotlin/com/courier/client/CourierClientAsyncImpl.kt index 8b34654..ed3d572 100644 --- a/courier-java-core/src/main/kotlin/com/courier/client/CourierClientAsyncImpl.kt +++ b/courier-java-core/src/main/kotlin/com/courier/client/CourierClientAsyncImpl.kt @@ -20,8 +20,6 @@ import com.courier.services.async.DigestServiceAsync import com.courier.services.async.DigestServiceAsyncImpl import com.courier.services.async.InboundServiceAsync import com.courier.services.async.InboundServiceAsyncImpl -import com.courier.services.async.InboxServiceAsync -import com.courier.services.async.InboxServiceAsyncImpl import com.courier.services.async.JourneyServiceAsync import com.courier.services.async.JourneyServiceAsyncImpl import com.courier.services.async.ListServiceAsync @@ -109,10 +107,6 @@ class CourierClientAsyncImpl(private val clientOptions: ClientOptions) : Courier private val lists: ListServiceAsync by lazy { ListServiceAsyncImpl(clientOptionsWithUserAgent) } - private val inbox: InboxServiceAsync by lazy { - InboxServiceAsyncImpl(clientOptionsWithUserAgent) - } - private val messages: MessageServiceAsync by lazy { MessageServiceAsyncImpl(clientOptionsWithUserAgent) } @@ -188,6 +182,10 @@ class CourierClientAsyncImpl(private val clientOptions: ClientOptions) : Courier */ override fun journeys(): JourneyServiceAsync = journeys + /** + * Create a one-off send to a list or audience, author its content, then send it immediately or + * schedule it for later. + */ override fun broadcasts(): BroadcastServiceAsync = broadcasts /** Manage the logos, colors, and layout that give the templates you send a consistent look. */ @@ -204,8 +202,6 @@ class CourierClientAsyncImpl(private val clientOptions: ClientOptions) : Courier */ override fun lists(): ListServiceAsync = lists - override fun inbox(): InboxServiceAsync = inbox - /** * Look up the messages Courier has accepted, inspect their delivery history and rendered * output, and cancel, resend, or archive them. @@ -304,10 +300,6 @@ class CourierClientAsyncImpl(private val clientOptions: ClientOptions) : Courier ListServiceAsyncImpl.WithRawResponseImpl(clientOptions) } - private val inbox: InboxServiceAsync.WithRawResponse by lazy { - InboxServiceAsyncImpl.WithRawResponseImpl(clientOptions) - } - private val messages: MessageServiceAsync.WithRawResponse by lazy { MessageServiceAsyncImpl.WithRawResponseImpl(clientOptions) } @@ -387,6 +379,10 @@ class CourierClientAsyncImpl(private val clientOptions: ClientOptions) : Courier */ override fun journeys(): JourneyServiceAsync.WithRawResponse = journeys + /** + * Create a one-off send to a list or audience, author its content, then send it immediately + * or schedule it for later. + */ override fun broadcasts(): BroadcastServiceAsync.WithRawResponse = broadcasts /** @@ -405,8 +401,6 @@ class CourierClientAsyncImpl(private val clientOptions: ClientOptions) : Courier */ override fun lists(): ListServiceAsync.WithRawResponse = lists - override fun inbox(): InboxServiceAsync.WithRawResponse = inbox - /** * Look up the messages Courier has accepted, inspect their delivery history and rendered * output, and cancel, resend, or archive them. diff --git a/courier-java-core/src/main/kotlin/com/courier/client/CourierClientImpl.kt b/courier-java-core/src/main/kotlin/com/courier/client/CourierClientImpl.kt index 1594a81..497c779 100644 --- a/courier-java-core/src/main/kotlin/com/courier/client/CourierClientImpl.kt +++ b/courier-java-core/src/main/kotlin/com/courier/client/CourierClientImpl.kt @@ -20,8 +20,6 @@ import com.courier.services.blocking.DigestService import com.courier.services.blocking.DigestServiceImpl import com.courier.services.blocking.InboundService import com.courier.services.blocking.InboundServiceImpl -import com.courier.services.blocking.InboxService -import com.courier.services.blocking.InboxServiceImpl import com.courier.services.blocking.JourneyService import com.courier.services.blocking.JourneyServiceImpl import com.courier.services.blocking.ListService @@ -101,8 +99,6 @@ class CourierClientImpl(private val clientOptions: ClientOptions) : CourierClien private val lists: ListService by lazy { ListServiceImpl(clientOptionsWithUserAgent) } - private val inbox: InboxService by lazy { InboxServiceImpl(clientOptionsWithUserAgent) } - private val messages: MessageService by lazy { MessageServiceImpl(clientOptionsWithUserAgent) } private val requests: RequestService by lazy { RequestServiceImpl(clientOptionsWithUserAgent) } @@ -170,6 +166,10 @@ class CourierClientImpl(private val clientOptions: ClientOptions) : CourierClien */ override fun journeys(): JourneyService = journeys + /** + * Create a one-off send to a list or audience, author its content, then send it immediately or + * schedule it for later. + */ override fun broadcasts(): BroadcastService = broadcasts /** Manage the logos, colors, and layout that give the templates you send a consistent look. */ @@ -186,8 +186,6 @@ class CourierClientImpl(private val clientOptions: ClientOptions) : CourierClien */ override fun lists(): ListService = lists - override fun inbox(): InboxService = inbox - /** * Look up the messages Courier has accepted, inspect their delivery history and rendered * output, and cancel, resend, or archive them. @@ -286,10 +284,6 @@ class CourierClientImpl(private val clientOptions: ClientOptions) : CourierClien ListServiceImpl.WithRawResponseImpl(clientOptions) } - private val inbox: InboxService.WithRawResponse by lazy { - InboxServiceImpl.WithRawResponseImpl(clientOptions) - } - private val messages: MessageService.WithRawResponse by lazy { MessageServiceImpl.WithRawResponseImpl(clientOptions) } @@ -369,6 +363,10 @@ class CourierClientImpl(private val clientOptions: ClientOptions) : CourierClien */ override fun journeys(): JourneyService.WithRawResponse = journeys + /** + * Create a one-off send to a list or audience, author its content, then send it immediately + * or schedule it for later. + */ override fun broadcasts(): BroadcastService.WithRawResponse = broadcasts /** @@ -387,8 +385,6 @@ class CourierClientImpl(private val clientOptions: ClientOptions) : CourierClien */ override fun lists(): ListService.WithRawResponse = lists - override fun inbox(): InboxService.WithRawResponse = inbox - /** * Look up the messages Courier has accepted, inspect their delivery history and rendered * output, and cancel, resend, or archive them. diff --git a/courier-java-core/src/main/kotlin/com/courier/models/inbox/messages/MessageDeleteParams.kt b/courier-java-core/src/main/kotlin/com/courier/models/inbox/messages/MessageDeleteParams.kt deleted file mode 100644 index 1f4c457..0000000 --- a/courier-java-core/src/main/kotlin/com/courier/models/inbox/messages/MessageDeleteParams.kt +++ /dev/null @@ -1,232 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.courier.models.inbox.messages - -import com.courier.core.JsonValue -import com.courier.core.Params -import com.courier.core.http.Headers -import com.courier.core.http.QueryParams -import com.courier.core.toImmutable -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** - * Delete a user's inbox message. The message is removed from every inbox read (it stops appearing - * in the recipient's Inbox); it can be restored. - */ -class MessageDeleteParams -private constructor( - private val messageId: String?, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, -) : Params { - - fun messageId(): Optional = Optional.ofNullable(messageId) - - /** Additional body properties to send with the request. */ - fun _additionalBodyProperties(): Map = additionalBodyProperties - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun none(): MessageDeleteParams = builder().build() - - /** Returns a mutable builder for constructing an instance of [MessageDeleteParams]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [MessageDeleteParams]. */ - class Builder internal constructor() { - - private var messageId: String? = null - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(messageDeleteParams: MessageDeleteParams) = apply { - messageId = messageDeleteParams.messageId - additionalHeaders = messageDeleteParams.additionalHeaders.toBuilder() - additionalQueryParams = messageDeleteParams.additionalQueryParams.toBuilder() - additionalBodyProperties = messageDeleteParams.additionalBodyProperties.toMutableMap() - } - - fun messageId(messageId: String?) = apply { this.messageId = messageId } - - /** Alias for calling [Builder.messageId] with `messageId.orElse(null)`. */ - fun messageId(messageId: Optional) = messageId(messageId.getOrNull()) - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } - - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) - } - - /** - * Returns an immutable instance of [MessageDeleteParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): MessageDeleteParams = - MessageDeleteParams( - messageId, - additionalHeaders.build(), - additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), - ) - } - - fun _body(): Optional> = - Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) - - fun _pathParam(index: Int): String = - when (index) { - 0 -> messageId ?: "" - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is MessageDeleteParams && - messageId == other.messageId && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams && - additionalBodyProperties == other.additionalBodyProperties - } - - override fun hashCode(): Int = - Objects.hash(messageId, additionalHeaders, additionalQueryParams, additionalBodyProperties) - - override fun toString() = - "MessageDeleteParams{messageId=$messageId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" -} diff --git a/courier-java-core/src/main/kotlin/com/courier/models/inbox/messages/MessageRestoreParams.kt b/courier-java-core/src/main/kotlin/com/courier/models/inbox/messages/MessageRestoreParams.kt deleted file mode 100644 index 4b2608d..0000000 --- a/courier-java-core/src/main/kotlin/com/courier/models/inbox/messages/MessageRestoreParams.kt +++ /dev/null @@ -1,219 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.courier.models.inbox.messages - -import com.courier.core.JsonValue -import com.courier.core.Params -import com.courier.core.checkRequired -import com.courier.core.http.Headers -import com.courier.core.http.QueryParams -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** Restore a previously deleted inbox message. */ -class MessageRestoreParams -private constructor( - private val messageId: String?, - private val body: JsonValue, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - fun messageId(): Optional = Optional.ofNullable(messageId) - - fun body(): JsonValue = body - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [MessageRestoreParams]. - * - * The following fields are required: - * ```java - * .body() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [MessageRestoreParams]. */ - class Builder internal constructor() { - - private var messageId: String? = null - private var body: JsonValue? = null - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(messageRestoreParams: MessageRestoreParams) = apply { - messageId = messageRestoreParams.messageId - body = messageRestoreParams.body - additionalHeaders = messageRestoreParams.additionalHeaders.toBuilder() - additionalQueryParams = messageRestoreParams.additionalQueryParams.toBuilder() - } - - fun messageId(messageId: String?) = apply { this.messageId = messageId } - - /** Alias for calling [Builder.messageId] with `messageId.orElse(null)`. */ - fun messageId(messageId: Optional) = messageId(messageId.getOrNull()) - - fun body(body: JsonValue) = apply { this.body = body } - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [MessageRestoreParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .body() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): MessageRestoreParams = - MessageRestoreParams( - messageId, - checkRequired("body", body), - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - fun _body(): JsonValue = body - - fun _pathParam(index: Int): String = - when (index) { - 0 -> messageId ?: "" - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is MessageRestoreParams && - messageId == other.messageId && - body == other.body && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = - Objects.hash(messageId, body, additionalHeaders, additionalQueryParams) - - override fun toString() = - "MessageRestoreParams{messageId=$messageId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/courier-java-core/src/main/kotlin/com/courier/services/async/BroadcastServiceAsync.kt b/courier-java-core/src/main/kotlin/com/courier/services/async/BroadcastServiceAsync.kt index 3f32205..62e2d77 100644 --- a/courier-java-core/src/main/kotlin/com/courier/services/async/BroadcastServiceAsync.kt +++ b/courier-java-core/src/main/kotlin/com/courier/services/async/BroadcastServiceAsync.kt @@ -24,6 +24,10 @@ import com.courier.models.notifications.NotificationContentMutationResponse import java.util.concurrent.CompletableFuture import java.util.function.Consumer +/** + * Create a one-off send to a list or audience, author its content, then send it immediately or + * schedule it for later. + */ interface BroadcastServiceAsync { /** diff --git a/courier-java-core/src/main/kotlin/com/courier/services/async/BroadcastServiceAsyncImpl.kt b/courier-java-core/src/main/kotlin/com/courier/services/async/BroadcastServiceAsyncImpl.kt index 0b58529..03f6b13 100644 --- a/courier-java-core/src/main/kotlin/com/courier/services/async/BroadcastServiceAsyncImpl.kt +++ b/courier-java-core/src/main/kotlin/com/courier/services/async/BroadcastServiceAsyncImpl.kt @@ -35,6 +35,10 @@ import java.util.concurrent.CompletableFuture import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull +/** + * Create a one-off send to a list or audience, author its content, then send it immediately or + * schedule it for later. + */ class BroadcastServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : BroadcastServiceAsync { diff --git a/courier-java-core/src/main/kotlin/com/courier/services/async/InboxServiceAsync.kt b/courier-java-core/src/main/kotlin/com/courier/services/async/InboxServiceAsync.kt deleted file mode 100644 index 2730595..0000000 --- a/courier-java-core/src/main/kotlin/com/courier/services/async/InboxServiceAsync.kt +++ /dev/null @@ -1,41 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.courier.services.async - -import com.courier.core.ClientOptions -import com.courier.services.async.inbox.MessageServiceAsync -import java.util.function.Consumer - -interface InboxServiceAsync { - - /** - * Returns a view of this service that provides access to raw HTTP responses for each method. - */ - fun withRawResponse(): WithRawResponse - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions(modifier: Consumer): InboxServiceAsync - - /** Manage the messages in a user's in-app inbox. */ - fun messages(): MessageServiceAsync - - /** A view of [InboxServiceAsync] that provides access to raw HTTP responses for each method. */ - interface WithRawResponse { - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions( - modifier: Consumer - ): InboxServiceAsync.WithRawResponse - - /** Manage the messages in a user's in-app inbox. */ - fun messages(): MessageServiceAsync.WithRawResponse - } -} diff --git a/courier-java-core/src/main/kotlin/com/courier/services/async/InboxServiceAsyncImpl.kt b/courier-java-core/src/main/kotlin/com/courier/services/async/InboxServiceAsyncImpl.kt deleted file mode 100644 index 0ad14fa..0000000 --- a/courier-java-core/src/main/kotlin/com/courier/services/async/InboxServiceAsyncImpl.kt +++ /dev/null @@ -1,44 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.courier.services.async - -import com.courier.core.ClientOptions -import com.courier.services.async.inbox.MessageServiceAsync -import com.courier.services.async.inbox.MessageServiceAsyncImpl -import java.util.function.Consumer - -class InboxServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : - InboxServiceAsync { - - private val withRawResponse: InboxServiceAsync.WithRawResponse by lazy { - WithRawResponseImpl(clientOptions) - } - - private val messages: MessageServiceAsync by lazy { MessageServiceAsyncImpl(clientOptions) } - - override fun withRawResponse(): InboxServiceAsync.WithRawResponse = withRawResponse - - override fun withOptions(modifier: Consumer): InboxServiceAsync = - InboxServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - - /** Manage the messages in a user's in-app inbox. */ - override fun messages(): MessageServiceAsync = messages - - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : - InboxServiceAsync.WithRawResponse { - - private val messages: MessageServiceAsync.WithRawResponse by lazy { - MessageServiceAsyncImpl.WithRawResponseImpl(clientOptions) - } - - override fun withOptions( - modifier: Consumer - ): InboxServiceAsync.WithRawResponse = - InboxServiceAsyncImpl.WithRawResponseImpl( - clientOptions.toBuilder().apply(modifier::accept).build() - ) - - /** Manage the messages in a user's in-app inbox. */ - override fun messages(): MessageServiceAsync.WithRawResponse = messages - } -} diff --git a/courier-java-core/src/main/kotlin/com/courier/services/async/inbox/MessageServiceAsync.kt b/courier-java-core/src/main/kotlin/com/courier/services/async/inbox/MessageServiceAsync.kt deleted file mode 100644 index 821d595..0000000 --- a/courier-java-core/src/main/kotlin/com/courier/services/async/inbox/MessageServiceAsync.kt +++ /dev/null @@ -1,164 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.courier.services.async.inbox - -import com.courier.core.ClientOptions -import com.courier.core.RequestOptions -import com.courier.core.http.HttpResponse -import com.courier.models.inbox.messages.MessageDeleteParams -import com.courier.models.inbox.messages.MessageRestoreParams -import java.util.concurrent.CompletableFuture -import java.util.function.Consumer - -/** Manage the messages in a user's in-app inbox. */ -interface MessageServiceAsync { - - /** - * Returns a view of this service that provides access to raw HTTP responses for each method. - */ - fun withRawResponse(): WithRawResponse - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions(modifier: Consumer): MessageServiceAsync - - /** - * Delete a user's inbox message. The message is removed from every inbox read (it stops - * appearing in the recipient's Inbox); it can be restored. - */ - fun delete(messageId: String): CompletableFuture = - delete(messageId, MessageDeleteParams.none()) - - /** @see delete */ - fun delete( - messageId: String, - params: MessageDeleteParams = MessageDeleteParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = - delete(params.toBuilder().messageId(messageId).build(), requestOptions) - - /** @see delete */ - fun delete( - messageId: String, - params: MessageDeleteParams = MessageDeleteParams.none(), - ): CompletableFuture = delete(messageId, params, RequestOptions.none()) - - /** @see delete */ - fun delete( - params: MessageDeleteParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see delete */ - fun delete(params: MessageDeleteParams): CompletableFuture = - delete(params, RequestOptions.none()) - - /** @see delete */ - fun delete(messageId: String, requestOptions: RequestOptions): CompletableFuture = - delete(messageId, MessageDeleteParams.none(), requestOptions) - - /** Restore a previously deleted inbox message. */ - fun restore(messageId: String, params: MessageRestoreParams): CompletableFuture = - restore(messageId, params, RequestOptions.none()) - - /** @see restore */ - fun restore( - messageId: String, - params: MessageRestoreParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = - restore(params.toBuilder().messageId(messageId).build(), requestOptions) - - /** @see restore */ - fun restore(params: MessageRestoreParams): CompletableFuture = - restore(params, RequestOptions.none()) - - /** @see restore */ - fun restore( - params: MessageRestoreParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** - * A view of [MessageServiceAsync] that provides access to raw HTTP responses for each method. - */ - interface WithRawResponse { - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions( - modifier: Consumer - ): MessageServiceAsync.WithRawResponse - - /** - * Returns a raw HTTP response for `delete /inbox/messages/{message_id}`, but is otherwise - * the same as [MessageServiceAsync.delete]. - */ - fun delete(messageId: String): CompletableFuture = - delete(messageId, MessageDeleteParams.none()) - - /** @see delete */ - fun delete( - messageId: String, - params: MessageDeleteParams = MessageDeleteParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = - delete(params.toBuilder().messageId(messageId).build(), requestOptions) - - /** @see delete */ - fun delete( - messageId: String, - params: MessageDeleteParams = MessageDeleteParams.none(), - ): CompletableFuture = delete(messageId, params, RequestOptions.none()) - - /** @see delete */ - fun delete( - params: MessageDeleteParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see delete */ - fun delete(params: MessageDeleteParams): CompletableFuture = - delete(params, RequestOptions.none()) - - /** @see delete */ - fun delete( - messageId: String, - requestOptions: RequestOptions, - ): CompletableFuture = - delete(messageId, MessageDeleteParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `put /inbox/messages/{message_id}/restore`, but is - * otherwise the same as [MessageServiceAsync.restore]. - */ - fun restore( - messageId: String, - params: MessageRestoreParams, - ): CompletableFuture = restore(messageId, params, RequestOptions.none()) - - /** @see restore */ - fun restore( - messageId: String, - params: MessageRestoreParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = - restore(params.toBuilder().messageId(messageId).build(), requestOptions) - - /** @see restore */ - fun restore(params: MessageRestoreParams): CompletableFuture = - restore(params, RequestOptions.none()) - - /** @see restore */ - fun restore( - params: MessageRestoreParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - } -} diff --git a/courier-java-core/src/main/kotlin/com/courier/services/async/inbox/MessageServiceAsyncImpl.kt b/courier-java-core/src/main/kotlin/com/courier/services/async/inbox/MessageServiceAsyncImpl.kt deleted file mode 100644 index e15a01a..0000000 --- a/courier-java-core/src/main/kotlin/com/courier/services/async/inbox/MessageServiceAsyncImpl.kt +++ /dev/null @@ -1,118 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.courier.services.async.inbox - -import com.courier.core.ClientOptions -import com.courier.core.RequestOptions -import com.courier.core.checkRequired -import com.courier.core.handlers.emptyHandler -import com.courier.core.handlers.errorBodyHandler -import com.courier.core.handlers.errorHandler -import com.courier.core.http.HttpMethod -import com.courier.core.http.HttpRequest -import com.courier.core.http.HttpResponse -import com.courier.core.http.HttpResponse.Handler -import com.courier.core.http.json -import com.courier.core.http.parseable -import com.courier.core.prepareAsync -import com.courier.models.inbox.messages.MessageDeleteParams -import com.courier.models.inbox.messages.MessageRestoreParams -import java.util.concurrent.CompletableFuture -import java.util.function.Consumer -import kotlin.jvm.optionals.getOrNull - -/** Manage the messages in a user's in-app inbox. */ -class MessageServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : - MessageServiceAsync { - - private val withRawResponse: MessageServiceAsync.WithRawResponse by lazy { - WithRawResponseImpl(clientOptions) - } - - override fun withRawResponse(): MessageServiceAsync.WithRawResponse = withRawResponse - - override fun withOptions(modifier: Consumer): MessageServiceAsync = - MessageServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - - override fun delete( - params: MessageDeleteParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // delete /inbox/messages/{message_id} - withRawResponse().delete(params, requestOptions).thenAccept {} - - override fun restore( - params: MessageRestoreParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // put /inbox/messages/{message_id}/restore - withRawResponse().restore(params, requestOptions).thenAccept {} - - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : - MessageServiceAsync.WithRawResponse { - - private val errorHandler: Handler = - errorHandler(errorBodyHandler(clientOptions.jsonMapper)) - - override fun withOptions( - modifier: Consumer - ): MessageServiceAsync.WithRawResponse = - MessageServiceAsyncImpl.WithRawResponseImpl( - clientOptions.toBuilder().apply(modifier::accept).build() - ) - - private val deleteHandler: Handler = emptyHandler() - - override fun delete( - params: MessageDeleteParams, - requestOptions: RequestOptions, - ): CompletableFuture { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("messageId", params.messageId().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.DELETE) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("inbox", "messages", params._pathParam(0)) - .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response.use { deleteHandler.handle(it) } - } - } - } - - private val restoreHandler: Handler = emptyHandler() - - override fun restore( - params: MessageRestoreParams, - requestOptions: RequestOptions, - ): CompletableFuture { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("messageId", params.messageId().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.PUT) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("inbox", "messages", params._pathParam(0), "restore") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response.use { restoreHandler.handle(it) } - } - } - } - } -} diff --git a/courier-java-core/src/main/kotlin/com/courier/services/blocking/BroadcastService.kt b/courier-java-core/src/main/kotlin/com/courier/services/blocking/BroadcastService.kt index 5473b72..7279d93 100644 --- a/courier-java-core/src/main/kotlin/com/courier/services/blocking/BroadcastService.kt +++ b/courier-java-core/src/main/kotlin/com/courier/services/blocking/BroadcastService.kt @@ -24,6 +24,10 @@ import com.courier.models.notifications.NotificationContentMutationResponse import com.google.errorprone.annotations.MustBeClosed import java.util.function.Consumer +/** + * Create a one-off send to a list or audience, author its content, then send it immediately or + * schedule it for later. + */ interface BroadcastService { /** diff --git a/courier-java-core/src/main/kotlin/com/courier/services/blocking/BroadcastServiceImpl.kt b/courier-java-core/src/main/kotlin/com/courier/services/blocking/BroadcastServiceImpl.kt index a083327..b5db366 100644 --- a/courier-java-core/src/main/kotlin/com/courier/services/blocking/BroadcastServiceImpl.kt +++ b/courier-java-core/src/main/kotlin/com/courier/services/blocking/BroadcastServiceImpl.kt @@ -34,6 +34,10 @@ import com.courier.models.notifications.NotificationContentMutationResponse import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull +/** + * Create a one-off send to a list or audience, author its content, then send it immediately or + * schedule it for later. + */ class BroadcastServiceImpl internal constructor(private val clientOptions: ClientOptions) : BroadcastService { diff --git a/courier-java-core/src/main/kotlin/com/courier/services/blocking/InboxService.kt b/courier-java-core/src/main/kotlin/com/courier/services/blocking/InboxService.kt deleted file mode 100644 index c83883b..0000000 --- a/courier-java-core/src/main/kotlin/com/courier/services/blocking/InboxService.kt +++ /dev/null @@ -1,39 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.courier.services.blocking - -import com.courier.core.ClientOptions -import com.courier.services.blocking.inbox.MessageService -import java.util.function.Consumer - -interface InboxService { - - /** - * Returns a view of this service that provides access to raw HTTP responses for each method. - */ - fun withRawResponse(): WithRawResponse - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions(modifier: Consumer): InboxService - - /** Manage the messages in a user's in-app inbox. */ - fun messages(): MessageService - - /** A view of [InboxService] that provides access to raw HTTP responses for each method. */ - interface WithRawResponse { - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions(modifier: Consumer): InboxService.WithRawResponse - - /** Manage the messages in a user's in-app inbox. */ - fun messages(): MessageService.WithRawResponse - } -} diff --git a/courier-java-core/src/main/kotlin/com/courier/services/blocking/InboxServiceImpl.kt b/courier-java-core/src/main/kotlin/com/courier/services/blocking/InboxServiceImpl.kt deleted file mode 100644 index 670ae13..0000000 --- a/courier-java-core/src/main/kotlin/com/courier/services/blocking/InboxServiceImpl.kt +++ /dev/null @@ -1,44 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.courier.services.blocking - -import com.courier.core.ClientOptions -import com.courier.services.blocking.inbox.MessageService -import com.courier.services.blocking.inbox.MessageServiceImpl -import java.util.function.Consumer - -class InboxServiceImpl internal constructor(private val clientOptions: ClientOptions) : - InboxService { - - private val withRawResponse: InboxService.WithRawResponse by lazy { - WithRawResponseImpl(clientOptions) - } - - private val messages: MessageService by lazy { MessageServiceImpl(clientOptions) } - - override fun withRawResponse(): InboxService.WithRawResponse = withRawResponse - - override fun withOptions(modifier: Consumer): InboxService = - InboxServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - - /** Manage the messages in a user's in-app inbox. */ - override fun messages(): MessageService = messages - - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : - InboxService.WithRawResponse { - - private val messages: MessageService.WithRawResponse by lazy { - MessageServiceImpl.WithRawResponseImpl(clientOptions) - } - - override fun withOptions( - modifier: Consumer - ): InboxService.WithRawResponse = - InboxServiceImpl.WithRawResponseImpl( - clientOptions.toBuilder().apply(modifier::accept).build() - ) - - /** Manage the messages in a user's in-app inbox. */ - override fun messages(): MessageService.WithRawResponse = messages - } -} diff --git a/courier-java-core/src/main/kotlin/com/courier/services/blocking/inbox/MessageService.kt b/courier-java-core/src/main/kotlin/com/courier/services/blocking/inbox/MessageService.kt deleted file mode 100644 index 607fd59..0000000 --- a/courier-java-core/src/main/kotlin/com/courier/services/blocking/inbox/MessageService.kt +++ /dev/null @@ -1,152 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.courier.services.blocking.inbox - -import com.courier.core.ClientOptions -import com.courier.core.RequestOptions -import com.courier.core.http.HttpResponse -import com.courier.models.inbox.messages.MessageDeleteParams -import com.courier.models.inbox.messages.MessageRestoreParams -import com.google.errorprone.annotations.MustBeClosed -import java.util.function.Consumer - -/** Manage the messages in a user's in-app inbox. */ -interface MessageService { - - /** - * Returns a view of this service that provides access to raw HTTP responses for each method. - */ - fun withRawResponse(): WithRawResponse - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions(modifier: Consumer): MessageService - - /** - * Delete a user's inbox message. The message is removed from every inbox read (it stops - * appearing in the recipient's Inbox); it can be restored. - */ - fun delete(messageId: String) = delete(messageId, MessageDeleteParams.none()) - - /** @see delete */ - fun delete( - messageId: String, - params: MessageDeleteParams = MessageDeleteParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ) = delete(params.toBuilder().messageId(messageId).build(), requestOptions) - - /** @see delete */ - fun delete(messageId: String, params: MessageDeleteParams = MessageDeleteParams.none()) = - delete(messageId, params, RequestOptions.none()) - - /** @see delete */ - fun delete(params: MessageDeleteParams, requestOptions: RequestOptions = RequestOptions.none()) - - /** @see delete */ - fun delete(params: MessageDeleteParams) = delete(params, RequestOptions.none()) - - /** @see delete */ - fun delete(messageId: String, requestOptions: RequestOptions) = - delete(messageId, MessageDeleteParams.none(), requestOptions) - - /** Restore a previously deleted inbox message. */ - fun restore(messageId: String, params: MessageRestoreParams) = - restore(messageId, params, RequestOptions.none()) - - /** @see restore */ - fun restore( - messageId: String, - params: MessageRestoreParams, - requestOptions: RequestOptions = RequestOptions.none(), - ) = restore(params.toBuilder().messageId(messageId).build(), requestOptions) - - /** @see restore */ - fun restore(params: MessageRestoreParams) = restore(params, RequestOptions.none()) - - /** @see restore */ - fun restore( - params: MessageRestoreParams, - requestOptions: RequestOptions = RequestOptions.none(), - ) - - /** A view of [MessageService] that provides access to raw HTTP responses for each method. */ - interface WithRawResponse { - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions(modifier: Consumer): MessageService.WithRawResponse - - /** - * Returns a raw HTTP response for `delete /inbox/messages/{message_id}`, but is otherwise - * the same as [MessageService.delete]. - */ - @MustBeClosed - fun delete(messageId: String): HttpResponse = delete(messageId, MessageDeleteParams.none()) - - /** @see delete */ - @MustBeClosed - fun delete( - messageId: String, - params: MessageDeleteParams = MessageDeleteParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponse = delete(params.toBuilder().messageId(messageId).build(), requestOptions) - - /** @see delete */ - @MustBeClosed - fun delete( - messageId: String, - params: MessageDeleteParams = MessageDeleteParams.none(), - ): HttpResponse = delete(messageId, params, RequestOptions.none()) - - /** @see delete */ - @MustBeClosed - fun delete( - params: MessageDeleteParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponse - - /** @see delete */ - @MustBeClosed - fun delete(params: MessageDeleteParams): HttpResponse = - delete(params, RequestOptions.none()) - - /** @see delete */ - @MustBeClosed - fun delete(messageId: String, requestOptions: RequestOptions): HttpResponse = - delete(messageId, MessageDeleteParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `put /inbox/messages/{message_id}/restore`, but is - * otherwise the same as [MessageService.restore]. - */ - @MustBeClosed - fun restore(messageId: String, params: MessageRestoreParams): HttpResponse = - restore(messageId, params, RequestOptions.none()) - - /** @see restore */ - @MustBeClosed - fun restore( - messageId: String, - params: MessageRestoreParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponse = restore(params.toBuilder().messageId(messageId).build(), requestOptions) - - /** @see restore */ - @MustBeClosed - fun restore(params: MessageRestoreParams): HttpResponse = - restore(params, RequestOptions.none()) - - /** @see restore */ - @MustBeClosed - fun restore( - params: MessageRestoreParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponse - } -} diff --git a/courier-java-core/src/main/kotlin/com/courier/services/blocking/inbox/MessageServiceImpl.kt b/courier-java-core/src/main/kotlin/com/courier/services/blocking/inbox/MessageServiceImpl.kt deleted file mode 100644 index 422d822..0000000 --- a/courier-java-core/src/main/kotlin/com/courier/services/blocking/inbox/MessageServiceImpl.kt +++ /dev/null @@ -1,107 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.courier.services.blocking.inbox - -import com.courier.core.ClientOptions -import com.courier.core.RequestOptions -import com.courier.core.checkRequired -import com.courier.core.handlers.emptyHandler -import com.courier.core.handlers.errorBodyHandler -import com.courier.core.handlers.errorHandler -import com.courier.core.http.HttpMethod -import com.courier.core.http.HttpRequest -import com.courier.core.http.HttpResponse -import com.courier.core.http.HttpResponse.Handler -import com.courier.core.http.json -import com.courier.core.http.parseable -import com.courier.core.prepare -import com.courier.models.inbox.messages.MessageDeleteParams -import com.courier.models.inbox.messages.MessageRestoreParams -import java.util.function.Consumer -import kotlin.jvm.optionals.getOrNull - -/** Manage the messages in a user's in-app inbox. */ -class MessageServiceImpl internal constructor(private val clientOptions: ClientOptions) : - MessageService { - - private val withRawResponse: MessageService.WithRawResponse by lazy { - WithRawResponseImpl(clientOptions) - } - - override fun withRawResponse(): MessageService.WithRawResponse = withRawResponse - - override fun withOptions(modifier: Consumer): MessageService = - MessageServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - - override fun delete(params: MessageDeleteParams, requestOptions: RequestOptions) { - // delete /inbox/messages/{message_id} - withRawResponse().delete(params, requestOptions) - } - - override fun restore(params: MessageRestoreParams, requestOptions: RequestOptions) { - // put /inbox/messages/{message_id}/restore - withRawResponse().restore(params, requestOptions) - } - - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : - MessageService.WithRawResponse { - - private val errorHandler: Handler = - errorHandler(errorBodyHandler(clientOptions.jsonMapper)) - - override fun withOptions( - modifier: Consumer - ): MessageService.WithRawResponse = - MessageServiceImpl.WithRawResponseImpl( - clientOptions.toBuilder().apply(modifier::accept).build() - ) - - private val deleteHandler: Handler = emptyHandler() - - override fun delete( - params: MessageDeleteParams, - requestOptions: RequestOptions, - ): HttpResponse { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("messageId", params.messageId().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.DELETE) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("inbox", "messages", params._pathParam(0)) - .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response.use { deleteHandler.handle(it) } - } - } - - private val restoreHandler: Handler = emptyHandler() - - override fun restore( - params: MessageRestoreParams, - requestOptions: RequestOptions, - ): HttpResponse { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("messageId", params.messageId().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.PUT) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("inbox", "messages", params._pathParam(0), "restore") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response.use { restoreHandler.handle(it) } - } - } - } -} diff --git a/courier-java-core/src/test/kotlin/com/courier/models/inbox/messages/MessageDeleteParamsTest.kt b/courier-java-core/src/test/kotlin/com/courier/models/inbox/messages/MessageDeleteParamsTest.kt deleted file mode 100644 index 7858a6a..0000000 --- a/courier-java-core/src/test/kotlin/com/courier/models/inbox/messages/MessageDeleteParamsTest.kt +++ /dev/null @@ -1,23 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.courier.models.inbox.messages - -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class MessageDeleteParamsTest { - - @Test - fun create() { - MessageDeleteParams.builder().messageId("message_id").build() - } - - @Test - fun pathParams() { - val params = MessageDeleteParams.builder().messageId("message_id").build() - - assertThat(params._pathParam(0)).isEqualTo("message_id") - // out-of-bound path param - assertThat(params._pathParam(1)).isEqualTo("") - } -} diff --git a/courier-java-core/src/test/kotlin/com/courier/models/inbox/messages/MessageRestoreParamsTest.kt b/courier-java-core/src/test/kotlin/com/courier/models/inbox/messages/MessageRestoreParamsTest.kt deleted file mode 100644 index 3dc903d..0000000 --- a/courier-java-core/src/test/kotlin/com/courier/models/inbox/messages/MessageRestoreParamsTest.kt +++ /dev/null @@ -1,44 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.courier.models.inbox.messages - -import com.courier.core.JsonValue -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class MessageRestoreParamsTest { - - @Test - fun create() { - MessageRestoreParams.builder() - .messageId("message_id") - .body(JsonValue.from(mapOf())) - .build() - } - - @Test - fun pathParams() { - val params = - MessageRestoreParams.builder() - .messageId("message_id") - .body(JsonValue.from(mapOf())) - .build() - - assertThat(params._pathParam(0)).isEqualTo("message_id") - // out-of-bound path param - assertThat(params._pathParam(1)).isEqualTo("") - } - - @Test - fun body() { - val params = - MessageRestoreParams.builder() - .messageId("message_id") - .body(JsonValue.from(mapOf())) - .build() - - val body = params._body() - - assertThat(body).isEqualTo(JsonValue.from(mapOf())) - } -} diff --git a/courier-java-core/src/test/kotlin/com/courier/services/async/inbox/MessageServiceAsyncTest.kt b/courier-java-core/src/test/kotlin/com/courier/services/async/inbox/MessageServiceAsyncTest.kt deleted file mode 100644 index 444389b..0000000 --- a/courier-java-core/src/test/kotlin/com/courier/services/async/inbox/MessageServiceAsyncTest.kt +++ /dev/null @@ -1,40 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.courier.services.async.inbox - -import com.courier.client.okhttp.CourierOkHttpClientAsync -import com.courier.core.JsonValue -import com.courier.models.inbox.messages.MessageRestoreParams -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.Test - -internal class MessageServiceAsyncTest { - - @Disabled("Mock server tests are disabled") - @Test - fun delete() { - val client = CourierOkHttpClientAsync.builder().apiKey("My API Key").build() - val messageServiceAsync = client.inbox().messages() - - val future = messageServiceAsync.delete("message_id") - - val response = future.get() - } - - @Disabled("Mock server tests are disabled") - @Test - fun restore() { - val client = CourierOkHttpClientAsync.builder().apiKey("My API Key").build() - val messageServiceAsync = client.inbox().messages() - - val future = - messageServiceAsync.restore( - MessageRestoreParams.builder() - .messageId("message_id") - .body(JsonValue.from(mapOf())) - .build() - ) - - val response = future.get() - } -} diff --git a/courier-java-core/src/test/kotlin/com/courier/services/blocking/inbox/MessageServiceTest.kt b/courier-java-core/src/test/kotlin/com/courier/services/blocking/inbox/MessageServiceTest.kt deleted file mode 100644 index a9fd08a..0000000 --- a/courier-java-core/src/test/kotlin/com/courier/services/blocking/inbox/MessageServiceTest.kt +++ /dev/null @@ -1,35 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.courier.services.blocking.inbox - -import com.courier.client.okhttp.CourierOkHttpClient -import com.courier.core.JsonValue -import com.courier.models.inbox.messages.MessageRestoreParams -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.Test - -internal class MessageServiceTest { - - @Disabled("Mock server tests are disabled") - @Test - fun delete() { - val client = CourierOkHttpClient.builder().apiKey("My API Key").build() - val messageService = client.inbox().messages() - - messageService.delete("message_id") - } - - @Disabled("Mock server tests are disabled") - @Test - fun restore() { - val client = CourierOkHttpClient.builder().apiKey("My API Key").build() - val messageService = client.inbox().messages() - - messageService.restore( - MessageRestoreParams.builder() - .messageId("message_id") - .body(JsonValue.from(mapOf())) - .build() - ) - } -} diff --git a/courier-java-proguard-test/src/test/kotlin/com/courier/proguard/ProGuardCompatibilityTest.kt b/courier-java-proguard-test/src/test/kotlin/com/courier/proguard/ProGuardCompatibilityTest.kt index 083e50c..a1fda09 100644 --- a/courier-java-proguard-test/src/test/kotlin/com/courier/proguard/ProGuardCompatibilityTest.kt +++ b/courier-java-proguard-test/src/test/kotlin/com/courier/proguard/ProGuardCompatibilityTest.kt @@ -62,7 +62,6 @@ internal class ProGuardCompatibilityTest { assertThat(client.digests()).isNotNull() assertThat(client.inbound()).isNotNull() assertThat(client.lists()).isNotNull() - assertThat(client.inbox()).isNotNull() assertThat(client.messages()).isNotNull() assertThat(client.requests()).isNotNull() assertThat(client.notifications()).isNotNull()