From 936d0166e2782a095795d730623782f4768375c1 Mon Sep 17 00:00:00 2001 From: courier-codegen Date: Thu, 19 Nov 2026 18:03:27 +0000 Subject: [PATCH] feat(api): add POST /feedback for agent and tool feedback [C-22903] --- .stats.yml | 2 +- .../com/courier/client/CourierClient.kt | 13 + .../com/courier/client/CourierClientAsync.kt | 13 + .../courier/client/CourierClientAsyncImpl.kt | 22 + .../com/courier/client/CourierClientImpl.kt | 22 + .../models/feedback/FeedbackCreateParams.kt | 1350 +++++++++++++++++ .../models/feedback/FeedbackCreateResponse.kt | 184 +++ .../services/async/FeedbackServiceAsync.kt | 84 + .../async/FeedbackServiceAsyncImpl.kt | 90 ++ .../services/blocking/FeedbackService.kt | 80 + .../services/blocking/FeedbackServiceImpl.kt | 86 ++ .../feedback/FeedbackCreateParamsTest.kt | 85 ++ .../feedback/FeedbackCreateResponseTest.kt | 34 + .../async/FeedbackServiceAsyncTest.kt | 38 + .../services/blocking/FeedbackServiceTest.kt | 37 + .../proguard/ProGuardCompatibilityTest.kt | 1 + 16 files changed, 2140 insertions(+), 1 deletion(-) create mode 100644 courier-java-core/src/main/kotlin/com/courier/models/feedback/FeedbackCreateParams.kt create mode 100644 courier-java-core/src/main/kotlin/com/courier/models/feedback/FeedbackCreateResponse.kt create mode 100644 courier-java-core/src/main/kotlin/com/courier/services/async/FeedbackServiceAsync.kt create mode 100644 courier-java-core/src/main/kotlin/com/courier/services/async/FeedbackServiceAsyncImpl.kt create mode 100644 courier-java-core/src/main/kotlin/com/courier/services/blocking/FeedbackService.kt create mode 100644 courier-java-core/src/main/kotlin/com/courier/services/blocking/FeedbackServiceImpl.kt create mode 100644 courier-java-core/src/test/kotlin/com/courier/models/feedback/FeedbackCreateParamsTest.kt create mode 100644 courier-java-core/src/test/kotlin/com/courier/models/feedback/FeedbackCreateResponseTest.kt create mode 100644 courier-java-core/src/test/kotlin/com/courier/services/async/FeedbackServiceAsyncTest.kt create mode 100644 courier-java-core/src/test/kotlin/com/courier/services/blocking/FeedbackServiceTest.kt diff --git a/.stats.yml b/.stats.yml index 100a47a7..e8ac4eb6 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 168 +configured_endpoints: 169 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 c90d4f4e..dc7a7d9f 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,6 +11,7 @@ import com.courier.services.blocking.BrandService import com.courier.services.blocking.BroadcastService import com.courier.services.blocking.BulkService import com.courier.services.blocking.DigestService +import com.courier.services.blocking.FeedbackService import com.courier.services.blocking.InboundService import com.courier.services.blocking.JourneyService import com.courier.services.blocking.ListService @@ -117,6 +118,12 @@ interface CourierClient { fun digests(): DigestService + /** + * Report suspected bugs, confusing behavior and missing features in Courier, from an AI agent, + * a developer tool or by hand. + */ + fun feedback(): FeedbackService + /** Record an inbound event that triggers the journeys and automations mapped to it. */ fun inbound(): InboundService @@ -251,6 +258,12 @@ interface CourierClient { fun digests(): DigestService.WithRawResponse + /** + * Report suspected bugs, confusing behavior and missing features in Courier, from an AI + * agent, a developer tool or by hand. + */ + fun feedback(): FeedbackService.WithRawResponse + /** Record an inbound event that triggers the journeys and automations mapped to it. */ fun inbound(): InboundService.WithRawResponse 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 ad1eebab..18bc96fb 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,6 +11,7 @@ import com.courier.services.async.BrandServiceAsync import com.courier.services.async.BroadcastServiceAsync import com.courier.services.async.BulkServiceAsync import com.courier.services.async.DigestServiceAsync +import com.courier.services.async.FeedbackServiceAsync import com.courier.services.async.InboundServiceAsync import com.courier.services.async.JourneyServiceAsync import com.courier.services.async.ListServiceAsync @@ -117,6 +118,12 @@ interface CourierClientAsync { fun digests(): DigestServiceAsync + /** + * Report suspected bugs, confusing behavior and missing features in Courier, from an AI agent, + * a developer tool or by hand. + */ + fun feedback(): FeedbackServiceAsync + /** Record an inbound event that triggers the journeys and automations mapped to it. */ fun inbound(): InboundServiceAsync @@ -255,6 +262,12 @@ interface CourierClientAsync { fun digests(): DigestServiceAsync.WithRawResponse + /** + * Report suspected bugs, confusing behavior and missing features in Courier, from an AI + * agent, a developer tool or by hand. + */ + fun feedback(): FeedbackServiceAsync.WithRawResponse + /** Record an inbound event that triggers the journeys and automations mapped to it. */ fun inbound(): InboundServiceAsync.WithRawResponse 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 747eba33..a1f1a60b 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,6 +20,8 @@ import com.courier.services.async.BulkServiceAsync import com.courier.services.async.BulkServiceAsyncImpl import com.courier.services.async.DigestServiceAsync import com.courier.services.async.DigestServiceAsyncImpl +import com.courier.services.async.FeedbackServiceAsync +import com.courier.services.async.FeedbackServiceAsyncImpl import com.courier.services.async.InboundServiceAsync import com.courier.services.async.InboundServiceAsyncImpl import com.courier.services.async.JourneyServiceAsync @@ -111,6 +113,10 @@ class CourierClientAsyncImpl(private val clientOptions: ClientOptions) : Courier DigestServiceAsyncImpl(clientOptionsWithUserAgent) } + private val feedback: FeedbackServiceAsync by lazy { + FeedbackServiceAsyncImpl(clientOptionsWithUserAgent) + } + private val inbound: InboundServiceAsync by lazy { InboundServiceAsyncImpl(clientOptionsWithUserAgent) } @@ -211,6 +217,12 @@ class CourierClientAsyncImpl(private val clientOptions: ClientOptions) : Courier override fun digests(): DigestServiceAsync = digests + /** + * Report suspected bugs, confusing behavior and missing features in Courier, from an AI agent, + * a developer tool or by hand. + */ + override fun feedback(): FeedbackServiceAsync = feedback + /** Record an inbound event that triggers the journeys and automations mapped to it. */ override fun inbound(): InboundServiceAsync = inbound @@ -318,6 +330,10 @@ class CourierClientAsyncImpl(private val clientOptions: ClientOptions) : Courier DigestServiceAsyncImpl.WithRawResponseImpl(clientOptions) } + private val feedback: FeedbackServiceAsync.WithRawResponse by lazy { + FeedbackServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + private val inbound: InboundServiceAsync.WithRawResponse by lazy { InboundServiceAsyncImpl.WithRawResponseImpl(clientOptions) } @@ -426,6 +442,12 @@ class CourierClientAsyncImpl(private val clientOptions: ClientOptions) : Courier override fun digests(): DigestServiceAsync.WithRawResponse = digests + /** + * Report suspected bugs, confusing behavior and missing features in Courier, from an AI + * agent, a developer tool or by hand. + */ + override fun feedback(): FeedbackServiceAsync.WithRawResponse = feedback + /** Record an inbound event that triggers the journeys and automations mapped to it. */ override fun inbound(): InboundServiceAsync.WithRawResponse = inbound 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 cecbf259..7c9bba36 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,6 +20,8 @@ import com.courier.services.blocking.BulkService import com.courier.services.blocking.BulkServiceImpl import com.courier.services.blocking.DigestService import com.courier.services.blocking.DigestServiceImpl +import com.courier.services.blocking.FeedbackService +import com.courier.services.blocking.FeedbackServiceImpl import com.courier.services.blocking.InboundService import com.courier.services.blocking.InboundServiceImpl import com.courier.services.blocking.JourneyService @@ -103,6 +105,10 @@ class CourierClientImpl(private val clientOptions: ClientOptions) : CourierClien private val digests: DigestService by lazy { DigestServiceImpl(clientOptionsWithUserAgent) } + private val feedback: FeedbackService by lazy { + FeedbackServiceImpl(clientOptionsWithUserAgent) + } + private val inbound: InboundService by lazy { InboundServiceImpl(clientOptionsWithUserAgent) } private val lists: ListService by lazy { ListServiceImpl(clientOptionsWithUserAgent) } @@ -193,6 +199,12 @@ class CourierClientImpl(private val clientOptions: ClientOptions) : CourierClien override fun digests(): DigestService = digests + /** + * Report suspected bugs, confusing behavior and missing features in Courier, from an AI agent, + * a developer tool or by hand. + */ + override fun feedback(): FeedbackService = feedback + /** Record an inbound event that triggers the journeys and automations mapped to it. */ override fun inbound(): InboundService = inbound @@ -300,6 +312,10 @@ class CourierClientImpl(private val clientOptions: ClientOptions) : CourierClien DigestServiceImpl.WithRawResponseImpl(clientOptions) } + private val feedback: FeedbackService.WithRawResponse by lazy { + FeedbackServiceImpl.WithRawResponseImpl(clientOptions) + } + private val inbound: InboundService.WithRawResponse by lazy { InboundServiceImpl.WithRawResponseImpl(clientOptions) } @@ -408,6 +424,12 @@ class CourierClientImpl(private val clientOptions: ClientOptions) : CourierClien override fun digests(): DigestService.WithRawResponse = digests + /** + * Report suspected bugs, confusing behavior and missing features in Courier, from an AI + * agent, a developer tool or by hand. + */ + override fun feedback(): FeedbackService.WithRawResponse = feedback + /** Record an inbound event that triggers the journeys and automations mapped to it. */ override fun inbound(): InboundService.WithRawResponse = inbound diff --git a/courier-java-core/src/main/kotlin/com/courier/models/feedback/FeedbackCreateParams.kt b/courier-java-core/src/main/kotlin/com/courier/models/feedback/FeedbackCreateParams.kt new file mode 100644 index 00000000..75050934 --- /dev/null +++ b/courier-java-core/src/main/kotlin/com/courier/models/feedback/FeedbackCreateParams.kt @@ -0,0 +1,1350 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.courier.models.feedback + +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.Params +import com.courier.core.checkRequired +import com.courier.core.http.Headers +import com.courier.core.http.QueryParams +import com.courier.errors.CourierInvalidDataException +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * Reports a suspected bug, confusing behavior or a missing feature in Courier. It is built for AI + * agents and developer tools to call when Courier does something unexpected, and people can call it + * too. + * + * A report is not a support ticket. A `201` means Courier stored the report; it does not promise a + * reply or a fix. For help with your account, contact Courier support. + * + * Never include secrets, API keys or customer data such as recipient names, email addresses or + * message content. + * + * Requires an API key with no scope restrictions; a JWT or a scoped API key is refused. Each + * workspace can submit 200 reports per UTC day, and requests that fail validation count toward that + * limit. + */ +class FeedbackCreateParams +private constructor( + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** + * What kind of report this is: `possible_bug` for behavior that looks wrong, + * `confusing_behavior` for behavior that works but was hard to understand, `feature_request` + * for something Courier does not do yet, and `other`. + * + * @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 category(): Category = body.category() + + /** + * What happened, in enough detail for someone at Courier to follow it. + * + * @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 description(): String = body.description() + + /** + * Where you met the problem: the REST `api`, an `sdk`, the Courier `mcp` server, the Courier + * app `ui`, the `docs`, or `other`. + * + * @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 surface(): Surface = body.surface() + + /** + * A one-line summary of the report. + * + * @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 title(): String = body.title() + + /** + * What you expected to happen instead. + * + * @throws CourierInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun expectedBehavior(): Optional = body.expectedBehavior() + + /** + * The agent or tool that submitted the report, such as `Claude Code`. + * + * @throws CourierInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun harness(): Optional = body.harness() + + /** + * Where it happened, such as an endpoint (`POST /send`), an SDK method, an MCP tool name or a + * docs URL. + * + * @throws CourierInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun location(): Optional = body.location() + + /** + * The AI model that submitted the report, such as `claude-opus-5-5`. + * + * @throws CourierInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun model(): Optional = body.model() + + /** + * The request ID of an API call that shows the problem, if there is one. + * + * @throws CourierInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun requestId(): Optional = body.requestId() + + /** + * Returns the raw JSON value of [category]. + * + * Unlike [category], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _category(): JsonField = body._category() + + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _description(): JsonField = body._description() + + /** + * Returns the raw JSON value of [surface]. + * + * Unlike [surface], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _surface(): JsonField = body._surface() + + /** + * Returns the raw JSON value of [title]. + * + * Unlike [title], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _title(): JsonField = body._title() + + /** + * Returns the raw JSON value of [expectedBehavior]. + * + * Unlike [expectedBehavior], this method doesn't throw if the JSON field has an unexpected + * type. + */ + fun _expectedBehavior(): JsonField = body._expectedBehavior() + + /** + * Returns the raw JSON value of [harness]. + * + * Unlike [harness], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _harness(): JsonField = body._harness() + + /** + * Returns the raw JSON value of [location]. + * + * Unlike [location], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _location(): JsonField = body._location() + + /** + * Returns the raw JSON value of [model]. + * + * Unlike [model], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _model(): JsonField = body._model() + + /** + * Returns the raw JSON value of [requestId]. + * + * Unlike [requestId], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _requestId(): JsonField = body._requestId() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** 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 [FeedbackCreateParams]. + * + * The following fields are required: + * ```java + * .category() + * .description() + * .surface() + * .title() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [FeedbackCreateParams]. */ + class Builder internal constructor() { + + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(feedbackCreateParams: FeedbackCreateParams) = apply { + body = feedbackCreateParams.body.toBuilder() + additionalHeaders = feedbackCreateParams.additionalHeaders.toBuilder() + additionalQueryParams = feedbackCreateParams.additionalQueryParams.toBuilder() + } + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [category] + * - [description] + * - [surface] + * - [title] + * - [expectedBehavior] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + /** + * What kind of report this is: `possible_bug` for behavior that looks wrong, + * `confusing_behavior` for behavior that works but was hard to understand, + * `feature_request` for something Courier does not do yet, and `other`. + */ + fun category(category: Category) = apply { body.category(category) } + + /** + * Sets [Builder.category] to an arbitrary JSON value. + * + * You should usually call [Builder.category] with a well-typed [Category] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun category(category: JsonField) = apply { body.category(category) } + + /** What happened, in enough detail for someone at Courier to follow it. */ + fun description(description: String) = apply { body.description(description) } + + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun description(description: JsonField) = apply { body.description(description) } + + /** + * Where you met the problem: the REST `api`, an `sdk`, the Courier `mcp` server, the + * Courier app `ui`, the `docs`, or `other`. + */ + fun surface(surface: Surface) = apply { body.surface(surface) } + + /** + * Sets [Builder.surface] to an arbitrary JSON value. + * + * You should usually call [Builder.surface] with a well-typed [Surface] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun surface(surface: JsonField) = apply { body.surface(surface) } + + /** A one-line summary of the report. */ + fun title(title: String) = apply { body.title(title) } + + /** + * Sets [Builder.title] to an arbitrary JSON value. + * + * You should usually call [Builder.title] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun title(title: JsonField) = apply { body.title(title) } + + /** What you expected to happen instead. */ + fun expectedBehavior(expectedBehavior: String) = apply { + body.expectedBehavior(expectedBehavior) + } + + /** + * Sets [Builder.expectedBehavior] to an arbitrary JSON value. + * + * You should usually call [Builder.expectedBehavior] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun expectedBehavior(expectedBehavior: JsonField) = apply { + body.expectedBehavior(expectedBehavior) + } + + /** The agent or tool that submitted the report, such as `Claude Code`. */ + fun harness(harness: String) = apply { body.harness(harness) } + + /** + * Sets [Builder.harness] to an arbitrary JSON value. + * + * You should usually call [Builder.harness] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun harness(harness: JsonField) = apply { body.harness(harness) } + + /** + * Where it happened, such as an endpoint (`POST /send`), an SDK method, an MCP tool name or + * a docs URL. + */ + fun location(location: String) = apply { body.location(location) } + + /** + * Sets [Builder.location] to an arbitrary JSON value. + * + * You should usually call [Builder.location] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun location(location: JsonField) = apply { body.location(location) } + + /** The AI model that submitted the report, such as `claude-opus-5-5`. */ + fun model(model: String) = apply { body.model(model) } + + /** + * Sets [Builder.model] to an arbitrary JSON value. + * + * You should usually call [Builder.model] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun model(model: JsonField) = apply { body.model(model) } + + /** The request ID of an API call that shows the problem, if there is one. */ + fun requestId(requestId: String) = apply { body.requestId(requestId) } + + /** + * Sets [Builder.requestId] to an arbitrary JSON value. + * + * You should usually call [Builder.requestId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun requestId(requestId: JsonField) = apply { body.requestId(requestId) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + 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 [FeedbackCreateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .category() + * .description() + * .surface() + * .title() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): FeedbackCreateParams = + FeedbackCreateParams( + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + /** + * A report about Courier. Never include secrets, API keys or customer data. Unknown fields are + * ignored. Lengths are counted in UTF-16 code units, and a blank optional field is treated as + * omitted. + */ + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val category: JsonField, + private val description: JsonField, + private val surface: JsonField, + private val title: JsonField, + private val expectedBehavior: JsonField, + private val harness: JsonField, + private val location: JsonField, + private val model: JsonField, + private val requestId: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("category") + @ExcludeMissing + category: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("surface") @ExcludeMissing surface: JsonField = JsonMissing.of(), + @JsonProperty("title") @ExcludeMissing title: JsonField = JsonMissing.of(), + @JsonProperty("expected_behavior") + @ExcludeMissing + expectedBehavior: JsonField = JsonMissing.of(), + @JsonProperty("harness") @ExcludeMissing harness: JsonField = JsonMissing.of(), + @JsonProperty("location") + @ExcludeMissing + location: JsonField = JsonMissing.of(), + @JsonProperty("model") @ExcludeMissing model: JsonField = JsonMissing.of(), + @JsonProperty("request_id") + @ExcludeMissing + requestId: JsonField = JsonMissing.of(), + ) : this( + category, + description, + surface, + title, + expectedBehavior, + harness, + location, + model, + requestId, + mutableMapOf(), + ) + + /** + * What kind of report this is: `possible_bug` for behavior that looks wrong, + * `confusing_behavior` for behavior that works but was hard to understand, + * `feature_request` for something Courier does not do yet, and `other`. + * + * @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 category(): Category = category.getRequired("category") + + /** + * What happened, in enough detail for someone at Courier to follow it. + * + * @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 description(): String = description.getRequired("description") + + /** + * Where you met the problem: the REST `api`, an `sdk`, the Courier `mcp` server, the + * Courier app `ui`, the `docs`, or `other`. + * + * @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 surface(): Surface = surface.getRequired("surface") + + /** + * A one-line summary of the report. + * + * @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 title(): String = title.getRequired("title") + + /** + * What you expected to happen instead. + * + * @throws CourierInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun expectedBehavior(): Optional = expectedBehavior.getOptional("expected_behavior") + + /** + * The agent or tool that submitted the report, such as `Claude Code`. + * + * @throws CourierInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun harness(): Optional = harness.getOptional("harness") + + /** + * Where it happened, such as an endpoint (`POST /send`), an SDK method, an MCP tool name or + * a docs URL. + * + * @throws CourierInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun location(): Optional = location.getOptional("location") + + /** + * The AI model that submitted the report, such as `claude-opus-5-5`. + * + * @throws CourierInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun model(): Optional = model.getOptional("model") + + /** + * The request ID of an API call that shows the problem, if there is one. + * + * @throws CourierInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun requestId(): Optional = requestId.getOptional("request_id") + + /** + * Returns the raw JSON value of [category]. + * + * Unlike [category], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("category") @ExcludeMissing fun _category(): JsonField = category + + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description + + /** + * Returns the raw JSON value of [surface]. + * + * Unlike [surface], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("surface") @ExcludeMissing fun _surface(): JsonField = surface + + /** + * Returns the raw JSON value of [title]. + * + * Unlike [title], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("title") @ExcludeMissing fun _title(): JsonField = title + + /** + * Returns the raw JSON value of [expectedBehavior]. + * + * Unlike [expectedBehavior], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("expected_behavior") + @ExcludeMissing + fun _expectedBehavior(): JsonField = expectedBehavior + + /** + * Returns the raw JSON value of [harness]. + * + * Unlike [harness], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("harness") @ExcludeMissing fun _harness(): JsonField = harness + + /** + * Returns the raw JSON value of [location]. + * + * Unlike [location], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("location") @ExcludeMissing fun _location(): JsonField = location + + /** + * Returns the raw JSON value of [model]. + * + * Unlike [model], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("model") @ExcludeMissing fun _model(): JsonField = model + + /** + * Returns the raw JSON value of [requestId]. + * + * Unlike [requestId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("request_id") @ExcludeMissing fun _requestId(): JsonField = requestId + + @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 [Body]. + * + * The following fields are required: + * ```java + * .category() + * .description() + * .surface() + * .title() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var category: JsonField? = null + private var description: JsonField? = null + private var surface: JsonField? = null + private var title: JsonField? = null + private var expectedBehavior: JsonField = JsonMissing.of() + private var harness: JsonField = JsonMissing.of() + private var location: JsonField = JsonMissing.of() + private var model: JsonField = JsonMissing.of() + private var requestId: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + category = body.category + description = body.description + surface = body.surface + title = body.title + expectedBehavior = body.expectedBehavior + harness = body.harness + location = body.location + model = body.model + requestId = body.requestId + additionalProperties = body.additionalProperties.toMutableMap() + } + + /** + * What kind of report this is: `possible_bug` for behavior that looks wrong, + * `confusing_behavior` for behavior that works but was hard to understand, + * `feature_request` for something Courier does not do yet, and `other`. + */ + fun category(category: Category) = category(JsonField.of(category)) + + /** + * Sets [Builder.category] to an arbitrary JSON value. + * + * You should usually call [Builder.category] with a well-typed [Category] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun category(category: JsonField) = apply { this.category = category } + + /** What happened, in enough detail for someone at Courier to follow it. */ + fun description(description: String) = description(JsonField.of(description)) + + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun description(description: JsonField) = apply { + this.description = description + } + + /** + * Where you met the problem: the REST `api`, an `sdk`, the Courier `mcp` server, the + * Courier app `ui`, the `docs`, or `other`. + */ + fun surface(surface: Surface) = surface(JsonField.of(surface)) + + /** + * Sets [Builder.surface] to an arbitrary JSON value. + * + * You should usually call [Builder.surface] with a well-typed [Surface] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun surface(surface: JsonField) = apply { this.surface = surface } + + /** A one-line summary of the report. */ + fun title(title: String) = title(JsonField.of(title)) + + /** + * Sets [Builder.title] to an arbitrary JSON value. + * + * You should usually call [Builder.title] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun title(title: JsonField) = apply { this.title = title } + + /** What you expected to happen instead. */ + fun expectedBehavior(expectedBehavior: String) = + expectedBehavior(JsonField.of(expectedBehavior)) + + /** + * Sets [Builder.expectedBehavior] to an arbitrary JSON value. + * + * You should usually call [Builder.expectedBehavior] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun expectedBehavior(expectedBehavior: JsonField) = apply { + this.expectedBehavior = expectedBehavior + } + + /** The agent or tool that submitted the report, such as `Claude Code`. */ + fun harness(harness: String) = harness(JsonField.of(harness)) + + /** + * Sets [Builder.harness] to an arbitrary JSON value. + * + * You should usually call [Builder.harness] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun harness(harness: JsonField) = apply { this.harness = harness } + + /** + * Where it happened, such as an endpoint (`POST /send`), an SDK method, an MCP tool + * name or a docs URL. + */ + fun location(location: String) = location(JsonField.of(location)) + + /** + * Sets [Builder.location] to an arbitrary JSON value. + * + * You should usually call [Builder.location] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun location(location: JsonField) = apply { this.location = location } + + /** The AI model that submitted the report, such as `claude-opus-5-5`. */ + fun model(model: String) = model(JsonField.of(model)) + + /** + * Sets [Builder.model] to an arbitrary JSON value. + * + * You should usually call [Builder.model] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun model(model: JsonField) = apply { this.model = model } + + /** The request ID of an API call that shows the problem, if there is one. */ + fun requestId(requestId: String) = requestId(JsonField.of(requestId)) + + /** + * Sets [Builder.requestId] to an arbitrary JSON value. + * + * You should usually call [Builder.requestId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun requestId(requestId: JsonField) = apply { this.requestId = requestId } + + 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 [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .category() + * .description() + * .surface() + * .title() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Body = + Body( + checkRequired("category", category), + checkRequired("description", description), + checkRequired("surface", surface), + checkRequired("title", title), + expectedBehavior, + harness, + location, + model, + requestId, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CourierInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Body = apply { + if (validated) { + return@apply + } + + category().validate() + description() + surface().validate() + title() + expectedBehavior() + harness() + location() + model() + requestId() + 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 = + (category.asKnown().getOrNull()?.validity() ?: 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (surface.asKnown().getOrNull()?.validity() ?: 0) + + (if (title.asKnown().isPresent) 1 else 0) + + (if (expectedBehavior.asKnown().isPresent) 1 else 0) + + (if (harness.asKnown().isPresent) 1 else 0) + + (if (location.asKnown().isPresent) 1 else 0) + + (if (model.asKnown().isPresent) 1 else 0) + + (if (requestId.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + category == other.category && + description == other.description && + surface == other.surface && + title == other.title && + expectedBehavior == other.expectedBehavior && + harness == other.harness && + location == other.location && + model == other.model && + requestId == other.requestId && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + category, + description, + surface, + title, + expectedBehavior, + harness, + location, + model, + requestId, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{category=$category, description=$description, surface=$surface, title=$title, expectedBehavior=$expectedBehavior, harness=$harness, location=$location, model=$model, requestId=$requestId, additionalProperties=$additionalProperties}" + } + + /** + * What kind of report this is: `possible_bug` for behavior that looks wrong, + * `confusing_behavior` for behavior that works but was hard to understand, `feature_request` + * for something Courier does not do yet, and `other`. + */ + class Category @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 POSSIBLE_BUG = of("possible_bug") + + @JvmField val CONFUSING_BEHAVIOR = of("confusing_behavior") + + @JvmField val FEATURE_REQUEST = of("feature_request") + + @JvmField val OTHER = of("other") + + @JvmStatic fun of(value: String) = Category(JsonField.of(value)) + } + + /** An enum containing [Category]'s known values. */ + enum class Known { + POSSIBLE_BUG, + CONFUSING_BEHAVIOR, + FEATURE_REQUEST, + OTHER, + } + + /** + * An enum containing [Category]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Category] 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 { + POSSIBLE_BUG, + CONFUSING_BEHAVIOR, + FEATURE_REQUEST, + OTHER, + /** An enum member indicating that [Category] 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) { + POSSIBLE_BUG -> Value.POSSIBLE_BUG + CONFUSING_BEHAVIOR -> Value.CONFUSING_BEHAVIOR + FEATURE_REQUEST -> Value.FEATURE_REQUEST + OTHER -> Value.OTHER + 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) { + POSSIBLE_BUG -> Known.POSSIBLE_BUG + CONFUSING_BEHAVIOR -> Known.CONFUSING_BEHAVIOR + FEATURE_REQUEST -> Known.FEATURE_REQUEST + OTHER -> Known.OTHER + else -> throw CourierInvalidDataException("Unknown Category: $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 + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CourierInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Category = 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 Category && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** + * Where you met the problem: the REST `api`, an `sdk`, the Courier `mcp` server, the Courier + * app `ui`, the `docs`, or `other`. + */ + class Surface @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 API = of("api") + + @JvmField val SDK = of("sdk") + + @JvmField val MCP = of("mcp") + + @JvmField val UI = of("ui") + + @JvmField val DOCS = of("docs") + + @JvmField val OTHER = of("other") + + @JvmStatic fun of(value: String) = Surface(JsonField.of(value)) + } + + /** An enum containing [Surface]'s known values. */ + enum class Known { + API, + SDK, + MCP, + UI, + DOCS, + OTHER, + } + + /** + * An enum containing [Surface]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Surface] 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 { + API, + SDK, + MCP, + UI, + DOCS, + OTHER, + /** An enum member indicating that [Surface] 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) { + API -> Value.API + SDK -> Value.SDK + MCP -> Value.MCP + UI -> Value.UI + DOCS -> Value.DOCS + OTHER -> Value.OTHER + 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) { + API -> Known.API + SDK -> Known.SDK + MCP -> Known.MCP + UI -> Known.UI + DOCS -> Known.DOCS + OTHER -> Known.OTHER + else -> throw CourierInvalidDataException("Unknown Surface: $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 + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CourierInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Surface = 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 Surface && 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 FeedbackCreateParams && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = Objects.hash(body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "FeedbackCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/courier-java-core/src/main/kotlin/com/courier/models/feedback/FeedbackCreateResponse.kt b/courier-java-core/src/main/kotlin/com/courier/models/feedback/FeedbackCreateResponse.kt new file mode 100644 index 00000000..d6515c05 --- /dev/null +++ b/courier-java-core/src/main/kotlin/com/courier/models/feedback/FeedbackCreateResponse.kt @@ -0,0 +1,184 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.courier.models.feedback + +import com.courier.core.ExcludeMissing +import com.courier.core.JsonField +import com.courier.core.JsonMissing +import com.courier.core.JsonValue +import com.courier.core.checkRequired +import com.courier.errors.CourierInvalidDataException +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import java.util.Collections +import java.util.Objects + +class FeedbackCreateResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val feedbackId: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("feedback_id") + @ExcludeMissing + feedbackId: JsonField = JsonMissing.of() + ) : this(feedbackId, mutableMapOf()) + + /** + * The ID of the stored report, `fbk_` followed by a ULID. + * + * @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 feedbackId(): String = feedbackId.getRequired("feedback_id") + + /** + * Returns the raw JSON value of [feedbackId]. + * + * Unlike [feedbackId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("feedback_id") @ExcludeMissing fun _feedbackId(): JsonField = feedbackId + + @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 [FeedbackCreateResponse]. + * + * The following fields are required: + * ```java + * .feedbackId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [FeedbackCreateResponse]. */ + class Builder internal constructor() { + + private var feedbackId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(feedbackCreateResponse: FeedbackCreateResponse) = apply { + feedbackId = feedbackCreateResponse.feedbackId + additionalProperties = feedbackCreateResponse.additionalProperties.toMutableMap() + } + + /** The ID of the stored report, `fbk_` followed by a ULID. */ + fun feedbackId(feedbackId: String) = feedbackId(JsonField.of(feedbackId)) + + /** + * Sets [Builder.feedbackId] to an arbitrary JSON value. + * + * You should usually call [Builder.feedbackId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun feedbackId(feedbackId: JsonField) = apply { this.feedbackId = feedbackId } + + 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 [FeedbackCreateResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .feedbackId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): FeedbackCreateResponse = + FeedbackCreateResponse( + checkRequired("feedbackId", feedbackId), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws CourierInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): FeedbackCreateResponse = apply { + if (validated) { + return@apply + } + + feedbackId() + 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 (feedbackId.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is FeedbackCreateResponse && + feedbackId == other.feedbackId && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(feedbackId, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "FeedbackCreateResponse{feedbackId=$feedbackId, additionalProperties=$additionalProperties}" +} diff --git a/courier-java-core/src/main/kotlin/com/courier/services/async/FeedbackServiceAsync.kt b/courier-java-core/src/main/kotlin/com/courier/services/async/FeedbackServiceAsync.kt new file mode 100644 index 00000000..09003ff2 --- /dev/null +++ b/courier-java-core/src/main/kotlin/com/courier/services/async/FeedbackServiceAsync.kt @@ -0,0 +1,84 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.courier.services.async + +import com.courier.core.ClientOptions +import com.courier.core.RequestOptions +import com.courier.core.http.HttpResponseFor +import com.courier.models.feedback.FeedbackCreateParams +import com.courier.models.feedback.FeedbackCreateResponse +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer + +/** + * Report suspected bugs, confusing behavior and missing features in Courier, from an AI agent, a + * developer tool or by hand. + */ +interface FeedbackServiceAsync { + + /** + * 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): FeedbackServiceAsync + + /** + * Reports a suspected bug, confusing behavior or a missing feature in Courier. It is built for + * AI agents and developer tools to call when Courier does something unexpected, and people can + * call it too. + * + * A report is not a support ticket. A `201` means Courier stored the report; it does not + * promise a reply or a fix. For help with your account, contact Courier support. + * + * Never include secrets, API keys or customer data such as recipient names, email addresses or + * message content. + * + * Requires an API key with no scope restrictions; a JWT or a scoped API key is refused. Each + * workspace can submit 200 reports per UTC day, and requests that fail validation count toward + * that limit. + */ + fun create(params: FeedbackCreateParams): CompletableFuture = + create(params, RequestOptions.none()) + + /** @see create */ + fun create( + params: FeedbackCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** + * A view of [FeedbackServiceAsync] 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 + ): FeedbackServiceAsync.WithRawResponse + + /** + * Returns a raw HTTP response for `post /feedback`, but is otherwise the same as + * [FeedbackServiceAsync.create]. + */ + fun create( + params: FeedbackCreateParams + ): CompletableFuture> = + create(params, RequestOptions.none()) + + /** @see create */ + fun create( + params: FeedbackCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + } +} diff --git a/courier-java-core/src/main/kotlin/com/courier/services/async/FeedbackServiceAsyncImpl.kt b/courier-java-core/src/main/kotlin/com/courier/services/async/FeedbackServiceAsyncImpl.kt new file mode 100644 index 00000000..618da210 --- /dev/null +++ b/courier-java-core/src/main/kotlin/com/courier/services/async/FeedbackServiceAsyncImpl.kt @@ -0,0 +1,90 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.courier.services.async + +import com.courier.core.ClientOptions +import com.courier.core.RequestOptions +import com.courier.core.handlers.errorBodyHandler +import com.courier.core.handlers.errorHandler +import com.courier.core.handlers.jsonHandler +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.HttpResponseFor +import com.courier.core.http.json +import com.courier.core.http.parseable +import com.courier.core.prepareAsync +import com.courier.models.feedback.FeedbackCreateParams +import com.courier.models.feedback.FeedbackCreateResponse +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer + +/** + * Report suspected bugs, confusing behavior and missing features in Courier, from an AI agent, a + * developer tool or by hand. + */ +class FeedbackServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + FeedbackServiceAsync { + + private val withRawResponse: FeedbackServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): FeedbackServiceAsync.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): FeedbackServiceAsync = + FeedbackServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun create( + params: FeedbackCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // post /feedback + withRawResponse().create(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + FeedbackServiceAsync.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): FeedbackServiceAsync.WithRawResponse = + FeedbackServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun create( + params: FeedbackCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("feedback") + .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 { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + } +} diff --git a/courier-java-core/src/main/kotlin/com/courier/services/blocking/FeedbackService.kt b/courier-java-core/src/main/kotlin/com/courier/services/blocking/FeedbackService.kt new file mode 100644 index 00000000..25d3a150 --- /dev/null +++ b/courier-java-core/src/main/kotlin/com/courier/services/blocking/FeedbackService.kt @@ -0,0 +1,80 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.courier.services.blocking + +import com.courier.core.ClientOptions +import com.courier.core.RequestOptions +import com.courier.core.http.HttpResponseFor +import com.courier.models.feedback.FeedbackCreateParams +import com.courier.models.feedback.FeedbackCreateResponse +import com.google.errorprone.annotations.MustBeClosed +import java.util.function.Consumer + +/** + * Report suspected bugs, confusing behavior and missing features in Courier, from an AI agent, a + * developer tool or by hand. + */ +interface FeedbackService { + + /** + * 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): FeedbackService + + /** + * Reports a suspected bug, confusing behavior or a missing feature in Courier. It is built for + * AI agents and developer tools to call when Courier does something unexpected, and people can + * call it too. + * + * A report is not a support ticket. A `201` means Courier stored the report; it does not + * promise a reply or a fix. For help with your account, contact Courier support. + * + * Never include secrets, API keys or customer data such as recipient names, email addresses or + * message content. + * + * Requires an API key with no scope restrictions; a JWT or a scoped API key is refused. Each + * workspace can submit 200 reports per UTC day, and requests that fail validation count toward + * that limit. + */ + fun create(params: FeedbackCreateParams): FeedbackCreateResponse = + create(params, RequestOptions.none()) + + /** @see create */ + fun create( + params: FeedbackCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): FeedbackCreateResponse + + /** A view of [FeedbackService] 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): FeedbackService.WithRawResponse + + /** + * Returns a raw HTTP response for `post /feedback`, but is otherwise the same as + * [FeedbackService.create]. + */ + @MustBeClosed + fun create(params: FeedbackCreateParams): HttpResponseFor = + create(params, RequestOptions.none()) + + /** @see create */ + @MustBeClosed + fun create( + params: FeedbackCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + } +} diff --git a/courier-java-core/src/main/kotlin/com/courier/services/blocking/FeedbackServiceImpl.kt b/courier-java-core/src/main/kotlin/com/courier/services/blocking/FeedbackServiceImpl.kt new file mode 100644 index 00000000..73cf6c00 --- /dev/null +++ b/courier-java-core/src/main/kotlin/com/courier/services/blocking/FeedbackServiceImpl.kt @@ -0,0 +1,86 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.courier.services.blocking + +import com.courier.core.ClientOptions +import com.courier.core.RequestOptions +import com.courier.core.handlers.errorBodyHandler +import com.courier.core.handlers.errorHandler +import com.courier.core.handlers.jsonHandler +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.HttpResponseFor +import com.courier.core.http.json +import com.courier.core.http.parseable +import com.courier.core.prepare +import com.courier.models.feedback.FeedbackCreateParams +import com.courier.models.feedback.FeedbackCreateResponse +import java.util.function.Consumer + +/** + * Report suspected bugs, confusing behavior and missing features in Courier, from an AI agent, a + * developer tool or by hand. + */ +class FeedbackServiceImpl internal constructor(private val clientOptions: ClientOptions) : + FeedbackService { + + private val withRawResponse: FeedbackService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): FeedbackService.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): FeedbackService = + FeedbackServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun create( + params: FeedbackCreateParams, + requestOptions: RequestOptions, + ): FeedbackCreateResponse = + // post /feedback + withRawResponse().create(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + FeedbackService.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): FeedbackService.WithRawResponse = + FeedbackServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun create( + params: FeedbackCreateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("feedback") + .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 { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } +} diff --git a/courier-java-core/src/test/kotlin/com/courier/models/feedback/FeedbackCreateParamsTest.kt b/courier-java-core/src/test/kotlin/com/courier/models/feedback/FeedbackCreateParamsTest.kt new file mode 100644 index 00000000..bb90a4e1 --- /dev/null +++ b/courier-java-core/src/test/kotlin/com/courier/models/feedback/FeedbackCreateParamsTest.kt @@ -0,0 +1,85 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.courier.models.feedback + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class FeedbackCreateParamsTest { + + @Test + fun create() { + FeedbackCreateParams.builder() + .category(FeedbackCreateParams.Category.POSSIBLE_BUG) + .description( + "GET /lists/{list_id}/subscriptions returned items: [] with paging.more set to true, and following the cursor returned the remaining subscribers." + ) + .surface(FeedbackCreateParams.Surface.API) + .title("List subscriptions returns an empty page with a next cursor") + .expectedBehavior("Every page before the last one contains at least one item.") + .harness("Claude Code") + .location("GET /lists/{list_id}/subscriptions") + .model("claude-opus-5-5") + .requestId("1-67f340b1-58b7b231d9485ef0cda0a38b") + .build() + } + + @Test + fun body() { + val params = + FeedbackCreateParams.builder() + .category(FeedbackCreateParams.Category.POSSIBLE_BUG) + .description( + "GET /lists/{list_id}/subscriptions returned items: [] with paging.more set to true, and following the cursor returned the remaining subscribers." + ) + .surface(FeedbackCreateParams.Surface.API) + .title("List subscriptions returns an empty page with a next cursor") + .expectedBehavior("Every page before the last one contains at least one item.") + .harness("Claude Code") + .location("GET /lists/{list_id}/subscriptions") + .model("claude-opus-5-5") + .requestId("1-67f340b1-58b7b231d9485ef0cda0a38b") + .build() + + val body = params._body() + + assertThat(body.category()).isEqualTo(FeedbackCreateParams.Category.POSSIBLE_BUG) + assertThat(body.description()) + .isEqualTo( + "GET /lists/{list_id}/subscriptions returned items: [] with paging.more set to true, and following the cursor returned the remaining subscribers." + ) + assertThat(body.surface()).isEqualTo(FeedbackCreateParams.Surface.API) + assertThat(body.title()) + .isEqualTo("List subscriptions returns an empty page with a next cursor") + assertThat(body.expectedBehavior()) + .contains("Every page before the last one contains at least one item.") + assertThat(body.harness()).contains("Claude Code") + assertThat(body.location()).contains("GET /lists/{list_id}/subscriptions") + assertThat(body.model()).contains("claude-opus-5-5") + assertThat(body.requestId()).contains("1-67f340b1-58b7b231d9485ef0cda0a38b") + } + + @Test + fun bodyWithoutOptionalFields() { + val params = + FeedbackCreateParams.builder() + .category(FeedbackCreateParams.Category.POSSIBLE_BUG) + .description( + "GET /lists/{list_id}/subscriptions returned items: [] with paging.more set to true, and following the cursor returned the remaining subscribers." + ) + .surface(FeedbackCreateParams.Surface.API) + .title("List subscriptions returns an empty page with a next cursor") + .build() + + val body = params._body() + + assertThat(body.category()).isEqualTo(FeedbackCreateParams.Category.POSSIBLE_BUG) + assertThat(body.description()) + .isEqualTo( + "GET /lists/{list_id}/subscriptions returned items: [] with paging.more set to true, and following the cursor returned the remaining subscribers." + ) + assertThat(body.surface()).isEqualTo(FeedbackCreateParams.Surface.API) + assertThat(body.title()) + .isEqualTo("List subscriptions returns an empty page with a next cursor") + } +} diff --git a/courier-java-core/src/test/kotlin/com/courier/models/feedback/FeedbackCreateResponseTest.kt b/courier-java-core/src/test/kotlin/com/courier/models/feedback/FeedbackCreateResponseTest.kt new file mode 100644 index 00000000..56d04c2c --- /dev/null +++ b/courier-java-core/src/test/kotlin/com/courier/models/feedback/FeedbackCreateResponseTest.kt @@ -0,0 +1,34 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.courier.models.feedback + +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 FeedbackCreateResponseTest { + + @Test + fun create() { + val feedbackCreateResponse = + FeedbackCreateResponse.builder().feedbackId("feedback_id").build() + + assertThat(feedbackCreateResponse.feedbackId()).isEqualTo("feedback_id") + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val feedbackCreateResponse = + FeedbackCreateResponse.builder().feedbackId("feedback_id").build() + + val roundtrippedFeedbackCreateResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(feedbackCreateResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedFeedbackCreateResponse).isEqualTo(feedbackCreateResponse) + } +} diff --git a/courier-java-core/src/test/kotlin/com/courier/services/async/FeedbackServiceAsyncTest.kt b/courier-java-core/src/test/kotlin/com/courier/services/async/FeedbackServiceAsyncTest.kt new file mode 100644 index 00000000..7351f095 --- /dev/null +++ b/courier-java-core/src/test/kotlin/com/courier/services/async/FeedbackServiceAsyncTest.kt @@ -0,0 +1,38 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.courier.services.async + +import com.courier.client.okhttp.CourierOkHttpClientAsync +import com.courier.models.feedback.FeedbackCreateParams +import org.junit.jupiter.api.Disabled +import org.junit.jupiter.api.Test + +internal class FeedbackServiceAsyncTest { + + @Disabled("Mock server tests are disabled") + @Test + fun create() { + val client = CourierOkHttpClientAsync.builder().apiKey("My API Key").build() + val feedbackServiceAsync = client.feedback() + + val feedbackFuture = + feedbackServiceAsync.create( + FeedbackCreateParams.builder() + .category(FeedbackCreateParams.Category.POSSIBLE_BUG) + .description( + "GET /lists/{list_id}/subscriptions returned items: [] with paging.more set to true, and following the cursor returned the remaining subscribers." + ) + .surface(FeedbackCreateParams.Surface.API) + .title("List subscriptions returns an empty page with a next cursor") + .expectedBehavior("Every page before the last one contains at least one item.") + .harness("Claude Code") + .location("GET /lists/{list_id}/subscriptions") + .model("claude-opus-5-5") + .requestId("1-67f340b1-58b7b231d9485ef0cda0a38b") + .build() + ) + + val feedback = feedbackFuture.get() + feedback.validate() + } +} diff --git a/courier-java-core/src/test/kotlin/com/courier/services/blocking/FeedbackServiceTest.kt b/courier-java-core/src/test/kotlin/com/courier/services/blocking/FeedbackServiceTest.kt new file mode 100644 index 00000000..79062164 --- /dev/null +++ b/courier-java-core/src/test/kotlin/com/courier/services/blocking/FeedbackServiceTest.kt @@ -0,0 +1,37 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.courier.services.blocking + +import com.courier.client.okhttp.CourierOkHttpClient +import com.courier.models.feedback.FeedbackCreateParams +import org.junit.jupiter.api.Disabled +import org.junit.jupiter.api.Test + +internal class FeedbackServiceTest { + + @Disabled("Mock server tests are disabled") + @Test + fun create() { + val client = CourierOkHttpClient.builder().apiKey("My API Key").build() + val feedbackService = client.feedback() + + val feedback = + feedbackService.create( + FeedbackCreateParams.builder() + .category(FeedbackCreateParams.Category.POSSIBLE_BUG) + .description( + "GET /lists/{list_id}/subscriptions returned items: [] with paging.more set to true, and following the cursor returned the remaining subscribers." + ) + .surface(FeedbackCreateParams.Surface.API) + .title("List subscriptions returns an empty page with a next cursor") + .expectedBehavior("Every page before the last one contains at least one item.") + .harness("Claude Code") + .location("GET /lists/{list_id}/subscriptions") + .model("claude-opus-5-5") + .requestId("1-67f340b1-58b7b231d9485ef0cda0a38b") + .build() + ) + + feedback.validate() + } +} 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 3b10c4a0..e07ce8c5 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,6 +62,7 @@ internal class ProGuardCompatibilityTest { assertThat(client.bulk()).isNotNull() assertThat(client.brands()).isNotNull() assertThat(client.digests()).isNotNull() + assertThat(client.feedback()).isNotNull() assertThat(client.inbound()).isNotNull() assertThat(client.lists()).isNotNull() assertThat(client.messages()).isNotNull()