Skip to content

feat: add messages resend - #63

Merged
bjarn merged 3 commits into
mainfrom
feat/messages-resend
Oct 18, 2026
Merged

bjarn merged 3 commits into
mainfrom
feat/messages-resend

Conversation

@bjarn

@bjarn bjarn commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

What changed

Non-breaking for SDK users; suggested bump: minor (3.1.0 → 3.2.0).

  • Regenerated co.lettermint.types from the latest API spec.
  • New messages().resend(messageId[, ResendMessageRequest[, SendOptions]]). It sends the stored content of a sent message again, as a new message with its own ID. Leave out the recipients (or pass null) to resend to every original recipient. When no body is given, the SDK sends no request body. Like reschedule and cancel, it uses the team token if one is configured and otherwise the sending token. It accepts an Idempotency-Key through SendOptions, the same way as messages().process().
  • An HTTP 410 (content no longer retained) is raised as the generic ApiException. 401/403/404/409/422/429 map to the existing exception subclasses.
  • README: documents resend in the Team API method table and the token section, and adds a short "Resending" section.

Note: MessageData is a generated response record and gains an optional, nullable resentFromMessageId component. Its canonical constructor therefore takes one more argument. That only affects code that calls new MessageData(...) directly, for example in test fixtures. Reading responses, the accessors and MessageData.builder() are unchanged, and JSON without the field still parses.

API changes in the regenerated types

Change Details
messages.resend endpoint POST /messages/{messageId}/resend → Operations.RESEND_MESSAGE. Optional ResendMessageRequest { recipients } body (1-150 unique emails), optional Idempotency-Key header. 202 → PendingSendMailResponse. Errors: 401, 403, 404, 409, 410, 422, 429, 500. At most 5 resends in 24 hours.
resent_from_message_id New MessageData.resentFromMessageId(), optional and nullable: the ID of the message this one resent, or null when the field is absent or null (the message is not a resend).
Batch item type POST /send/batch items are now SendBatchMailItem (every SendMailRequest field plus an optional idempotencyKey, 1-255 characters, unique within a batch). settings reuses SendMailRequestSettings.
Batch 409 Can now also be an ApiError ({"error":{"code","message","details"}}, for example IDEMPOTENCY_CONFLICT).
Headers Every generated file header now points to the new spec revision.

Usage

PendingSendMailResponse resent = lettermint.messages().resend(messageId);

lettermint.messages().resend(messageId,
    new ResendMessageRequest(List.of("jane@example.com")),
    SendOptions.idempotencyKey("resend-" + messageId + "-jane"));

MessageData copy = lettermint.messages().retrieve(resent.messageId());
System.out.println(copy.resentFromMessageId()); // messageId

Checks

  • ./gradlew generateTypes with the SDK generator, then ./gradlew checkGeneratedTypes: up to date, 205 files (including the follow-up that documents resent_from_message_id as optional).
  • ./gradlew clean build (JDK 24, with the generator): BUILD SUCCESSFUL, 89 tests passed. This includes the surface-coverage test, which now reaches POST /messages/{messageId}/resend.
  • ./gradlew clean build (JDK 17, without the generator, as in CI): BUILD SUCCESSFUL. The generated headers of 205 files were checked.
  • CI build-output checks: Automatic-Module-Name: co.lettermint is in the manifest, and okhttp is not bundled.
  • Public API diff (javap -public) against main: 67 lines added, and 1 removed (the old MessageData canonical constructor noted above).

Not run locally

  • JDK 21 and 25 and Windows from the CI matrix. Only JDK 17 and 24 on macOS were run.

Suggested release tag

v3.2.0

🤖 Generated with Claude Code

bjarn and others added 2 commits October 18, 2026 17:08
- Add the POST /messages/{messageId}/resend operation with the
  ResendMessageRequest body; it returns a PendingSendMailResponse.
- MessageData gains resent_from_message_id.
- POST /send/batch items are now SendBatchMailItem: the send request
  fields plus an optional per-email idempotency_key.
- A batch 409 can now also be an ApiError.

Co-Authored-By: Claude <noreply@anthropic.com>
Add messages().resend(messageId[, ResendMessageRequest[, SendOptions]]),
which sends a sent message again as a new message with its own ID. Leave
out the recipients to resend to every original recipient. Like
reschedule and cancel, it uses the team token if configured, otherwise
the sending token, and it accepts an Idempotency-Key through SendOptions.

Co-Authored-By: Claude <noreply@anthropic.com>
The field stays nullable and is now documented as optional: it is null when the API leaves it out.

Co-Authored-By: Claude <noreply@anthropic.com>
@bjarn
bjarn added this pull request to stack #65 October 18, 2026 17:20
@bjarn
bjarn merged commit ca41b84 into main Oct 18, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants