|
| 1 | +# Changelog |
| 2 | + |
| 3 | +All notable changes to this project will be documented in this file. |
| 4 | + |
| 5 | +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), |
| 6 | +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). |
| 7 | + |
| 8 | +## [1.0.0] - 2025-10-31 |
| 9 | + |
| 10 | +### Overview |
| 11 | + |
| 12 | +This major release introduces breaking changes to the Contacts API and deprecates the Audiences API in favor of Segments. **If you only use the SDK for sending emails or the Audiences API, you can upgrade to v1.0.0 without any code changes.** The breaking changes are limited to the Contacts API only. |
| 13 | + |
| 14 | +### ⚠️ BREAKING CHANGES |
| 15 | + |
| 16 | +#### Contacts API Changes |
| 17 | + |
| 18 | +- ⚠️ **Change `Contacts.create` to accept hash parameter with optional `audience_id`** - Previously required `audience_id` in params, now it's optional. Supports global contacts. |
| 19 | +- ⚠️ **Change `Contacts.get` from `get(audience_id, id)` to `get(params)`** - Now accepts a hash with optional `audience_id` and required `id` or `email`. Raises `ArgumentError: "Missing \`id\` or \`email\` field"` when neither is provided. |
| 20 | +- ⚠️ **Change `Contacts.list` from `list(audience_id, params = {})` to `list(params = {})`** - Now accepts a hash with optional `audience_id` and pagination params |
| 21 | +- ⚠️ **Change `Contacts.remove` from `remove(audience_id, contact_id)` to `remove(params)`** - Now accepts a hash with optional `audience_id` and required `id` or `email`. Raises `ArgumentError: "Missing \`id\` or \`email\` field"` when neither is provided. |
| 22 | +- ⚠️ **Change `Contacts.update` error message** - Error changed from `"id or email is required"` to `"Missing \`id\` or \`email\` field"` to match Node.js SDK format |
| 23 | +- ⚠️ **Change `Contacts.update` to accept optional `audience_id`** - Previously required `audience_id` in params, now it's optional |
| 24 | + |
| 25 | +**Before (v0.x):** |
| 26 | + |
| 27 | +```ruby |
| 28 | +# Methods used positional arguments and required audience_id |
| 29 | +Resend::Contacts.create(audience_id: "aud_123", email: "user@example.com", first_name: "John") |
| 30 | +contact = Resend::Contacts.get("aud_123", "contact_123") |
| 31 | +contacts = Resend::Contacts.list("aud_123") |
| 32 | +contacts = Resend::Contacts.list("aud_123", limit: 10) |
| 33 | +Resend::Contacts.update(audience_id: "aud_123", id: "contact_123", first_name: "Jane") |
| 34 | +Resend::Contacts.remove("aud_123", "contact_123") |
| 35 | +``` |
| 36 | + |
| 37 | +**After (v1.0.0):** |
| 38 | + |
| 39 | +```ruby |
| 40 | +# Methods use hash parameters and support optional audience_id |
| 41 | +# Global contacts (no audience_id) |
| 42 | +Resend::Contacts.create(email: "user@example.com", first_name: "John") |
| 43 | +contact = Resend::Contacts.get(id: "contact_123") |
| 44 | +contact = Resend::Contacts.get(email: "user@example.com") |
| 45 | +contacts = Resend::Contacts.list |
| 46 | +contacts = Resend::Contacts.list(limit: 10) |
| 47 | +Resend::Contacts.update(id: "contact_123", first_name: "Jane") |
| 48 | +Resend::Contacts.remove(id: "contact_123") |
| 49 | + |
| 50 | +# Audience-scoped contacts (with audience_id) |
| 51 | +Resend::Contacts.create(audience_id: "aud_123", email: "user@example.com", first_name: "John") |
| 52 | +contact = Resend::Contacts.get(audience_id: "aud_123", id: "contact_123") |
| 53 | +contacts = Resend::Contacts.list(audience_id: "aud_123", limit: 10) |
| 54 | +Resend::Contacts.update(audience_id: "aud_123", id: "contact_123", first_name: "Jane") |
| 55 | +Resend::Contacts.remove(audience_id: "aud_123", id: "contact_123") |
| 56 | +``` |
| 57 | + |
| 58 | +#### Audiences API Deprecated |
| 59 | + |
| 60 | +- ⚠️ **Deprecate `Resend::Audiences` in favor of `Resend::Segments`** - The Audiences module has been replaced with Segments. A backward-compatible alias `Audiences = Segments` has been added, so existing code will continue to work. |
| 61 | + |
| 62 | +**Migration (Recommended):** |
| 63 | + |
| 64 | +Update your code to use `Segments` instead of `Audiences`: |
| 65 | + |
| 66 | +```ruby |
| 67 | +# Before (still works but deprecated) |
| 68 | +Resend::Audiences.create(name: "My Audience") |
| 69 | +Resend::Audiences.get("audience_123") |
| 70 | +Resend::Audiences.list |
| 71 | +Resend::Audiences.remove("audience_123") |
| 72 | + |
| 73 | +# After (recommended) |
| 74 | +Resend::Segments.create(name: "My Segment") |
| 75 | +Resend::Segments.get("segment_123") |
| 76 | +Resend::Segments.list |
| 77 | +Resend::Segments.remove("segment_123") |
| 78 | +``` |
| 79 | + |
| 80 | +**Note:** The `Audiences` alias is deprecated and may be removed in a future major version. Please migrate to `Segments`. |
| 81 | + |
| 82 | +### Added |
| 83 | + |
| 84 | +#### New API Modules |
| 85 | + |
| 86 | +- Add `Resend::Templates` API for managing email templates |
| 87 | + - `Templates.create` - Create a new template |
| 88 | + - `Templates.get` - Retrieve a template by ID |
| 89 | + - `Templates.update` - Update an existing template |
| 90 | + - `Templates.publish` - Publish a template |
| 91 | + - `Templates.duplicate` - Duplicate an existing template |
| 92 | + - `Templates.list` - List all templates with pagination |
| 93 | + - `Templates.remove` - Delete a template |
| 94 | +- Add `Resend::Topics` API for managing topics |
| 95 | + - `Topics.create` - Create a new topic |
| 96 | + - `Topics.get` - Retrieve a topic by ID |
| 97 | + - `Topics.update` - Update a topic |
| 98 | + - `Topics.list` - List all topics with pagination |
| 99 | + - `Topics.remove` - Delete a topic |
| 100 | +- Add `Resend::Segments` API for managing segments (replacement for Audiences) |
| 101 | + - `Segments.create` - Create a new segment |
| 102 | + - `Segments.get` - Retrieve a segment by ID |
| 103 | + - `Segments.list` - List all segments |
| 104 | + - `Segments.remove` - Delete a segment |
| 105 | +- Add `Resend::ContactProperties` API for managing custom contact properties |
| 106 | + - `ContactProperties.update` - Update contact properties (validates and raises `ArgumentError: "Missing \`id\` field"` when id is not provided) |
| 107 | + - `ContactProperties.get` - Retrieve contact properties by ID |
| 108 | +- Add `Resend::Contacts::Segments` API for managing contact-segment relationships |
| 109 | + - `Contacts::Segments.list` - List all segments for a contact |
| 110 | + - `Contacts::Segments.add` - Add a contact to a segment |
| 111 | + - `Contacts::Segments.remove` - Remove a contact from a segment |
| 112 | +- Add `Resend::Contacts::Topics` API for managing contact topic subscriptions |
| 113 | + - `Contacts::Topics.list` - List topic subscriptions for a contact |
| 114 | + - `Contacts::Topics.update` - Update topic subscriptions (opt-in/opt-out) for a contact |
| 115 | + |
| 116 | +#### Contacts API Enhancements |
| 117 | + |
| 118 | +- Add support for `email` parameter in `Contacts.get` and `Contacts.remove` methods (can now use email instead of ID) |
| 119 | +- Add `audience_id` support in Contacts API methods for scoped operations |
| 120 | +- Add support for global contacts (contacts not scoped to a specific audience/segment) |
| 121 | +- Add validation error messages matching Node.js SDK format with backticks around field names |
| 122 | + |
| 123 | +#### Broadcasts API Updates |
| 124 | + |
| 125 | +- Add deprecation warnings for `audience_id` in `Broadcasts.create` and `Broadcasts.update` (use `segment_id` instead) |
| 126 | + |
| 127 | +### Removed |
| 128 | + |
| 129 | +- Remove deprecated `send_email` method from `Resend::Emails` module (use `Resend::Emails.send` instead) |
| 130 | + |
| 131 | +[1.0.0]: https://github.com/resend/resend-ruby/compare/v0.26.0...v1.0.0 |
0 commit comments