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
3 changes: 3 additions & 0 deletions lib/lettermint/generated.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1178,6 +1178,7 @@ defmodule Lettermint.Models.RouteData do
route_type: :unset,
is_default: :unset,
inbound_address: :unset,
inbound_route_domain: :unset,
inbound_mx_hostname: :unset,
inbound_domain: :unset,
inbound_domain_verified_at: :unset,
Expand All @@ -1200,6 +1201,7 @@ defmodule Lettermint.Models.RouteData do
route_type: String.t() | nil | :unset,
is_default: boolean() | nil | :unset,
inbound_address: String.t() | nil | :unset,
inbound_route_domain: String.t() | nil | :unset,
inbound_mx_hostname: String.t() | nil | :unset,
inbound_domain: String.t() | nil | :unset,
inbound_domain_verified_at: String.t() | nil | :unset,
Expand All @@ -1223,6 +1225,7 @@ defmodule Lettermint.Models.RouteData do
{"route_type", :route_type, :string},
{"is_default", :is_default, :boolean},
{"inbound_address", :inbound_address, :string},
{"inbound_route_domain", :inbound_route_domain, :string},
{"inbound_mx_hostname", :inbound_mx_hostname, :string},
{"inbound_domain", :inbound_domain, :string},
{"inbound_domain_verified_at", :inbound_domain_verified_at, :string},
Expand Down
198 changes: 7 additions & 191 deletions specs/api-source-verification.json

Large diffs are not rendered by default.

99 changes: 90 additions & 9 deletions test/fixtures/api-source.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"events": [],
"enabled": true,
"include_machine_events": true,
"delivery_mode_filter": "live",
"secret": "fixture-value",
"last_called_at": "2026-09-07T12:00:00+00:00",
"created_at": "2026-09-07T12:00:00+00:00",
Expand All @@ -27,6 +28,7 @@
"events": [],
"enabled": true,
"include_machine_events": true,
"delivery_mode_filter": "live",
"last_called_at": "2026-09-07T12:00:00+00:00",
"created_at": "2026-09-07T12:00:00+00:00",
"updated_at": "2026-09-07T12:00:00+00:00"
Expand All @@ -41,6 +43,7 @@
"url": "fixture-value",
"events": [],
"enabled": true,
"delivery_mode_filter": "live",
"last_called_at": "2026-09-07T12:00:00+00:00",
"created_at": "2026-09-07T12:00:00+00:00",
"updated_at": "2026-09-07T12:00:00+00:00"
Expand All @@ -53,6 +56,7 @@
"source_project_id": "fixture-value",
"source_route_id": "fixture-value",
"status": "pending",
"sandbox": true,
"attempt_number": 1,
"http_status_code": 1,
"duration_ms": 1,
Expand All @@ -71,6 +75,7 @@
"source_project_id": "fixture-value",
"source_route_id": "fixture-value",
"status": "pending",
"sandbox": true,
"attempt_number": 1,
"http_status_code": 1,
"duration_ms": 1,
Expand Down Expand Up @@ -115,6 +120,8 @@
"id": "fixture-value",
"type": "inbound",
"status": "scheduled",
"delivery_mode": "live",
"sandbox_result": "delivered",
"status_changed_at": "2026-09-07T12:00:00+00:00",
"scheduled_at": "2026-09-07T12:00:00+00:00",
"tag": "fixture-value",
Expand All @@ -133,12 +140,15 @@
},
"MessageRecipientData": {
"email": "fixture-value",
"name": "fixture-value"
"name": "fixture-value",
"sandbox_result": null
},
"MessageListData": {
"id": "fixture-value",
"type": "inbound",
"status": "scheduled",
"delivery_mode": "live",
"sandbox_result": "delivered",
"scheduled_at": "2026-09-07T12:00:00+00:00",
"from_email": "fixture-value",
"from_name": "fixture-value",
Expand Down Expand Up @@ -172,9 +182,26 @@
"messages_inbound": 1,
"deliverability": 1.25
},
"ProjectCreatedData": {
"data": {
"id": "fixture-value",
"name": "fixture-value",
"delivery_mode": "live",
"smtp_enabled": true,
"redact_email_content": true,
"default_route_id": "fixture-value",
"token_generated_at": "2026-09-07T12:00:00+00:00",
"token_last_used_at": "2026-09-07T12:00:00+00:00",
"token_last_used_ip": "fixture-value",
"created_at": "fixture-value",
"updated_at": "fixture-value"
},
"message": "fixture-value"
},
"ProjectListData": {
"id": "fixture-value",
"name": "fixture-value",
"delivery_mode": "live",
"smtp_enabled": true,
"routes_count": 1,
"domains_count": 1,
Expand All @@ -190,6 +217,7 @@
"ProjectData": {
"id": "fixture-value",
"name": "fixture-value",
"delivery_mode": "live",
"smtp_enabled": true,
"redact_email_content": true,
"default_route_id": "fixture-value",
Expand Down Expand Up @@ -354,6 +382,11 @@
"machine_clicked": null
},
"daily": []
},
"AnalyticsResponseData": {
"data": [],
"meta": [],
"pagination": []
}
},
"enums": {
Expand All @@ -366,6 +399,10 @@
"admin",
"member"
],
"DeliveryMode": [
"live",
"sandbox"
],
"DkimMode": [
"legacy_txt",
"managed_cname"
Expand Down Expand Up @@ -466,7 +503,6 @@
"custom_role_requires_pro"
],
"RbacPermission": [
"analytics:read",
"team:manage",
"billing:manage",
"security:manage",
Expand Down Expand Up @@ -501,6 +537,7 @@
"webhooks:delete",
"webhooks:rotate_secret",
"stats:read",
"analytics:read",
"messages:read",
"messages:read_content",
"messages:send",
Expand All @@ -518,6 +555,19 @@
"broadcast",
"inbound"
],
"SandboxResult": [
"delivered",
"hard_bounced",
"soft_bounced",
"deferred",
"failed",
"suppressed",
"spam_complaint",
"auto_replied",
"opened",
"clicked",
"unsubscribed"
],
"SuppressionAppliesTo": [
"all",
"broadcast"
Expand Down Expand Up @@ -546,6 +596,11 @@
"opportunistic",
"enforced"
],
"WebhookDeliveryModeFilter": [
"live",
"sandbox",
"both"
],
"WebhookDeliveryStatus": [
"pending",
"success",
Expand Down Expand Up @@ -584,12 +639,6 @@
]
},
"routes": [
{ "method": "POST", "path": "/analytics" },
{ "method": "GET", "path": "/projects/{projectId}/report-forwarding" },
{ "method": "PUT", "path": "/projects/{projectId}/report-forwarding" },
{ "method": "DELETE", "path": "/projects/{projectId}/report-forwarding" },
{ "method": "POST", "path": "/projects/{projectId}/report-forwarding/verify" },
{ "method": "POST", "path": "/projects/{projectId}/report-forwarding/resend-code" },
{
"method": "POST",
"path": "/send/batch"
Expand Down Expand Up @@ -670,6 +719,26 @@
"method": "PUT",
"path": "/domains/{domainId}/projects"
},
{
"method": "GET",
"path": "/projects/{projectId}/report-forwarding"
},
{
"method": "PUT",
"path": "/projects/{projectId}/report-forwarding"
},
{
"method": "DELETE",
"path": "/projects/{projectId}/report-forwarding"
},
{
"method": "POST",
"path": "/projects/{projectId}/report-forwarding/verify"
},
{
"method": "POST",
"path": "/projects/{projectId}/report-forwarding/resend-code"
},
{
"method": "GET",
"path": "/projects"
Expand Down Expand Up @@ -794,6 +863,10 @@
"method": "DELETE",
"path": "/suppressions/{suppressionId}"
},
{
"method": "POST",
"path": "/analytics"
},
{
"method": "GET",
"path": "/stats"
Expand All @@ -806,6 +879,8 @@
"id": "fixture-value",
"type": "inbound",
"status": "scheduled",
"delivery_mode": "live",
"sandbox_result": "delivered",
"scheduled_at": "2026-09-07T12:00:00+00:00",
"from_email": "fixture-value",
"from_name": "fixture-value",
Expand Down Expand Up @@ -868,6 +943,7 @@
{
"id": "fixture-value",
"name": "fixture-value",
"delivery_mode": "live",
"smtp_enabled": true,
"routes_count": 1,
"domains_count": 1,
Expand Down Expand Up @@ -942,6 +1018,7 @@
"url": "fixture-value",
"events": [],
"enabled": true,
"delivery_mode_filter": "live",
"last_called_at": "2026-09-07T12:00:00+00:00",
"created_at": "2026-09-07T12:00:00+00:00",
"updated_at": "2026-09-07T12:00:00+00:00"
Expand All @@ -964,6 +1041,7 @@
"source_project_id": "fixture-value",
"source_route_id": "fixture-value",
"status": "pending",
"sandbox": true,
"attempt_number": 1,
"http_status_code": 1,
"duration_ms": 1,
Expand Down Expand Up @@ -1031,7 +1109,8 @@
},
"webhook_signature": {
"signature": "t=1788782400,v1=ad71837b0bfd7c1c78a5cbe0ad9fbddb3c7acea75ac7ca3b966e66a76fc127c2",
"body": "{\"url\":\"https://example.com/path\",\"name\":\"Café\"}"
"body": "{\"url\":\"https://example.com/path\",\"name\":\"Café\"}",
"timestamp": 1788782400
},
"request_rules": {
"single": [
Expand All @@ -1047,6 +1126,7 @@
"reply_to.*",
"subject",
"scheduled_at",
"sandbox_result",
"headers",
"headers.*",
"metadata",
Expand Down Expand Up @@ -1083,6 +1163,7 @@
"*.reply_to.*",
"*.subject",
"*.scheduled_at",
"*.sandbox_result",
"*.headers",
"*.headers.*",
"*.metadata",
Expand Down
15 changes: 15 additions & 0 deletions test/route_contract_test.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
defmodule Lettermint.RouteContractTest do
use ExUnit.Case, async: true
alias Lettermint.Model
alias Lettermint.Models.RouteData

test "the inbound route domain is optional and nullable" do
for domain <- ["incoming.example.com", nil] do
route = Model.from_map(RouteData, %{"inbound_route_domain" => domain})
assert route.inbound_route_domain == domain
assert route.extra == %{}
end

assert Model.from_map(RouteData, %{}).inbound_route_domain == :unset
end
end
Loading
Loading