From 752c82893c31bda5247ce9b569ca9b20683b6f68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20D=C3=B6hler?= Date: Mon, 14 Sep 2026 12:07:11 +0200 Subject: [PATCH] fix: three response fields that did not match the API inbound retry and bypass read "queued". The endpoint answers with "requeued", so both returned false and no error, whatever actually happened. They now read the right key and also expose the "message" the response carries. The subscriber types carried a "name". The create endpoint takes an address and a status; a name is silently dropped, so the field promised something the API does not store. All three were found by calling the endpoints against a live instance; the stub fixtures asserted the shapes this SDK had invented. --- CHANGELOG.md | 14 ++++++++++- README.md | 6 ++--- pom.xml | 2 +- .../java/com/camelmailer/http/ApiClient.java | 2 +- .../camelmailer/inbound/RequeueResult.java | 8 +++++-- .../camelmailer/subscribers/Subscriber.java | 3 +-- .../subscribers/SubscriberRequest.java | 23 ------------------- .../camelmailer/subscribers/Subscribers.java | 2 ++ .../java/com/camelmailer/InboundLogsTest.java | 13 +++++++---- .../camelmailer/SubscribersLayoutsTest.java | 10 ++++++-- 10 files changed, 44 insertions(+), 39 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 234fed8..8c3687d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.2.1] - 2026-09-14 + +### Fixed + +- `inbound` retry and bypass read `queued`. The endpoint answers with + `requeued`, so both returned false and no error whatever happened. They + also expose the `message` the response carries. +- The subscriber types carried a `name`. The endpoint takes an address and a + status; a name was silently dropped, so the field promised something the + API does not store. + ## [0.2.0] - 2026-09-14 ### Added @@ -43,6 +54,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `dmarc()`: `summary`, `reports`, `report`. - Typed, unchecked `CamelMailerException` with stable API error `code` and HTTP `statusCode`. -[Unreleased]: https://github.com/camelmailer/camelmailer-java/compare/v0.2.0...HEAD +[Unreleased]: https://github.com/camelmailer/camelmailer-java/compare/v0.2.1...HEAD +[0.2.1]: https://github.com/camelmailer/camelmailer-java/releases/tag/v0.2.1 [0.2.0]: https://github.com/camelmailer/camelmailer-java/releases/tag/v0.2.0 [0.1.0]: https://github.com/camelmailer/camelmailer-java/releases/tag/v0.1.0 diff --git a/README.md b/README.md index eb44528..910ddd5 100644 --- a/README.md +++ b/README.md @@ -178,7 +178,7 @@ list is the audience. ```java client.subscribers().list("newsletter"); client.subscribers().add("newsletter", - SubscriberRequest.builder().address("ada@example.com").name("Ada").build()); + SubscriberRequest.builder().address("ada@example.com").build()); client.subscribers().importAddresses("newsletter", List.of("ada@example.com", "grace@example.com")); client.subscribers().complaint("newsletter", "ada@example.com"); // suppress + unsubscribe @@ -209,8 +209,8 @@ client.layouts().delete("default"); InboundList held = client.inbound().list( ListInboundOptions.builder().status("held").build()); client.inbound().get(55); -client.inbound().retry(55); // back on the delivery queue -client.inbound().bypass(55); // release past the hold +client.inbound().retry(55).requeued(); // back on the delivery queue +client.inbound().bypass(55).requeued(); // release past the hold ``` ### Logs diff --git a/pom.xml b/pom.xml index ecca6a7..d4b3147 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.camelmailer camelmailer-java - 0.2.0 + 0.2.1 jar camelmailer-java diff --git a/src/main/java/com/camelmailer/http/ApiClient.java b/src/main/java/com/camelmailer/http/ApiClient.java index b6d59fd..bcc9d8e 100644 --- a/src/main/java/com/camelmailer/http/ApiClient.java +++ b/src/main/java/com/camelmailer/http/ApiClient.java @@ -28,7 +28,7 @@ public final class ApiClient { /** SDK version, sent in the User-Agent header. Keep in sync with the POM. */ - public static final String VERSION = "0.2.0"; + public static final String VERSION = "0.2.1"; private static final ObjectMapper MAPPER = new ObjectMapper() diff --git a/src/main/java/com/camelmailer/inbound/RequeueResult.java b/src/main/java/com/camelmailer/inbound/RequeueResult.java index 2f24adb..29dbdf9 100644 --- a/src/main/java/com/camelmailer/inbound/RequeueResult.java +++ b/src/main/java/com/camelmailer/inbound/RequeueResult.java @@ -1,8 +1,12 @@ package com.camelmailer.inbound; +import com.camelmailer.emails.Email; + /** * What a retry or bypass did. * - * @param queued whether the message went back on the delivery queue + * @param requeued whether the message went back on the delivery queue; the API names this field + * {@code requeued} + * @param message the message as it now stands */ -public record RequeueResult(boolean queued) {} +public record RequeueResult(boolean requeued, Email message) {} diff --git a/src/main/java/com/camelmailer/subscribers/Subscriber.java b/src/main/java/com/camelmailer/subscribers/Subscriber.java index cd7bab0..7b79970 100644 --- a/src/main/java/com/camelmailer/subscribers/Subscriber.java +++ b/src/main/java/com/camelmailer/subscribers/Subscriber.java @@ -5,8 +5,7 @@ * * @param id numeric subscriber id * @param address the email address - * @param name optional display name * @param status {@code subscribed} or {@code unsubscribed} * @param createdAt when the subscription row was created */ -public record Subscriber(long id, String address, String name, String status, String createdAt) {} +public record Subscriber(long id, String address, String status, String createdAt) {} diff --git a/src/main/java/com/camelmailer/subscribers/SubscriberRequest.java b/src/main/java/com/camelmailer/subscribers/SubscriberRequest.java index d1175f6..f6c7e58 100644 --- a/src/main/java/com/camelmailer/subscribers/SubscriberRequest.java +++ b/src/main/java/com/camelmailer/subscribers/SubscriberRequest.java @@ -8,12 +8,10 @@ public final class SubscriberRequest { private final String address; - private final String name; private final String status; private SubscriberRequest(Builder builder) { this.address = builder.address; - this.name = builder.name; this.status = builder.status; } @@ -35,15 +33,6 @@ public String getAddress() { return address; } - /** - * Returns the display name. - * - * @return the display name, or {@code null} when unset - */ - public String getName() { - return name; - } - /** * Returns {@code subscribed} (default) or {@code unsubscribed}. * @@ -57,7 +46,6 @@ public String getStatus() { public static final class Builder { private String address; - private String name; private String status; private Builder() {} @@ -73,17 +61,6 @@ public Builder address(String address) { return this; } - /** - * Sets the display name. - * - * @param name the display name - * @return this builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - /** * Sets {@code subscribed} (default) or {@code unsubscribed}. * diff --git a/src/main/java/com/camelmailer/subscribers/Subscribers.java b/src/main/java/com/camelmailer/subscribers/Subscribers.java index a38773d..2c3ffe2 100644 --- a/src/main/java/com/camelmailer/subscribers/Subscribers.java +++ b/src/main/java/com/camelmailer/subscribers/Subscribers.java @@ -40,6 +40,8 @@ public List list(String permalink) { /** * Adds or updates one subscriber. Upserts by address, so calling it twice is safe. * + *

The endpoint takes an address and a status; there is no name field. + * * @param permalink the stream permalink * @param request the subscriber fields * @return the stored subscriber diff --git a/src/test/java/com/camelmailer/InboundLogsTest.java b/src/test/java/com/camelmailer/InboundLogsTest.java index d4de5e7..385fa84 100644 --- a/src/test/java/com/camelmailer/InboundLogsTest.java +++ b/src/test/java/com/camelmailer/InboundLogsTest.java @@ -5,6 +5,7 @@ import com.camelmailer.inbound.InboundList; import com.camelmailer.inbound.ListInboundOptions; +import com.camelmailer.inbound.RequeueResult; import com.camelmailer.logs.LogList; import com.camelmailer.logs.TagCount; import java.util.List; @@ -37,12 +38,16 @@ void inboundListReadsTheInboundKey() { @Test void inboundRetryAndBypass() { try (MockServer server = new MockServer()) { - server.enqueueData("{\"queued\":true}"); - assertTrue(server.client().inbound().retry(55).queued()); + // The endpoint answers with "requeued", and carries the message. + String body = "{\"requeued\":true,\"message\":{\"id\":55,\"status\":\"Pending\"}}"; + server.enqueueData(body); + RequeueResult retried = server.client().inbound().retry(55); + assertTrue(retried.requeued()); + assertEquals(55L, retried.message().id()); assertEquals("/api/v2/server/inbound/55/retry", server.takeRequest().path()); - server.enqueueData("{\"queued\":true}"); - assertTrue(server.client().inbound().bypass(55).queued()); + server.enqueueData(body); + assertTrue(server.client().inbound().bypass(55).requeued()); assertEquals("/api/v2/server/inbound/55/bypass", server.takeRequest().path()); } } diff --git a/src/test/java/com/camelmailer/SubscribersLayoutsTest.java b/src/test/java/com/camelmailer/SubscribersLayoutsTest.java index c62129e..b9d34e0 100644 --- a/src/test/java/com/camelmailer/SubscribersLayoutsTest.java +++ b/src/test/java/com/camelmailer/SubscribersLayoutsTest.java @@ -41,9 +41,15 @@ void subscribersAddUpsertsByAddress() { .subscribers() .add( "product-news", - SubscriberRequest.builder().address("ada@example.com").name("Ada").build()); + SubscriberRequest.builder() + .address("ada@example.com") + .status("subscribed") + .build()); - assertTrue(server.takeRequest().body().contains("\"address\":\"ada@example.com\"")); + // The endpoint takes an address and a status; there is no name field. + String body = server.takeRequest().body(); + assertTrue(body.contains("\"address\":\"ada@example.com\"")); + assertTrue(body.contains("\"status\":\"subscribed\"")); assertEquals("ada@example.com", subscriber.address()); } }