Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.camelmailer</groupId>
<artifactId>camelmailer-java</artifactId>
<version>0.2.0</version>
<version>0.2.1</version>
<packaging>jar</packaging>

<name>camelmailer-java</name>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/camelmailer/http/ApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/com/camelmailer/inbound/RequeueResult.java
Original file line number Diff line number Diff line change
@@ -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) {}
3 changes: 1 addition & 2 deletions src/main/java/com/camelmailer/subscribers/Subscriber.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
23 changes: 0 additions & 23 deletions src/main/java/com/camelmailer/subscribers/SubscriberRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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}.
*
Expand All @@ -57,7 +46,6 @@ public String getStatus() {
public static final class Builder {

private String address;
private String name;
private String status;

private Builder() {}
Expand All @@ -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}.
*
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/camelmailer/subscribers/Subscribers.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public List<Subscriber> list(String permalink) {
/**
* Adds or updates one subscriber. Upserts by address, so calling it twice is safe.
*
* <p>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
Expand Down
13 changes: 9 additions & 4 deletions src/test/java/com/camelmailer/InboundLogsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}
}
Expand Down
10 changes: 8 additions & 2 deletions src/test/java/com/camelmailer/SubscribersLayoutsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Expand Down
Loading