nextmail 0.0.1 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b9a95ef0efdad1840601c1e9b93d29a8835ce66ece247254f797d5d69d5a0fe2
4
- data.tar.gz: 90eb6c5cb4bf078a7e1b5906142b5a177eac61daaf5ebc2826778c6ac1f30a3b
3
+ metadata.gz: bb3b572836d9f9d4e43b372c25a2706cd49825313601f132ef6eb0ca414e13c5
4
+ data.tar.gz: 3323950f7ed612e31f13f36802c7309228c22d79b82e3abc69dab78b68e29fd0
5
5
  SHA512:
6
- metadata.gz: 9c3125ed20b91ac82fedac71f7b1144f3c802c9257ae896e26863b9b3c54a228aa21f9f99086fba6a7815e193fbff59a7b265e6450285ece3eda405b8aabdce0
7
- data.tar.gz: b2cad49d82ab24d0b83b63a23978f55162ff0de442aeec62d0af09daff29d731bd2e2d92c7171456e5d16475b3a0e6e042fc002d8f979da6cbfcf9b96fb84a10
6
+ metadata.gz: 244a38f542a4e20e7192638d3d7cddad830617c7b31267c7019a35558a103e09d6f063bd69d091ff8a685c7d949cef01a81576d931cc4ed38e8c6f7ce91787ad
7
+ data.tar.gz: 860beb519e29aeee5accafd683d20887284a24ba7dee7e093efde0d3d413badee501d2cd35837eaa33a196fc05f231377fbfdb86209ef99ad1fab49eb57d0020
data/README.md CHANGED
@@ -81,6 +81,18 @@ end
81
81
 
82
82
  Every paginated resource has `list` for one page (`Nextmail::Page` with `items`, `has_more?` and `next_cursor`), `list_all` for every page at once as an Array, and `iterate`, which yields each item to a block, or without one returns an Enumerator that fetches the next page only when it gets there, so `first(10)` stops early. `addresses.list_all` is the exception and returns the whole address book.
83
83
 
84
+ ### Following the mailbox
85
+ ```ruby
86
+ client.live_events.stream(types: ["message.received"]) do |event|
87
+ next if event[:type] == "reset"
88
+
89
+ thread = client.threads.get(event[:data][:threadId])
90
+ puts thread[:id]
91
+ end
92
+ ```
93
+
94
+ `live_events.stream` yields each change to the mailbox as it happens, a message received or sent, a conversation changed or deleted, a delivery that moved on, and runs until the block breaks or raises. It reconnects by itself and resumes where it left off, and when it cannot it yields a `reset` first, so list again what you keep in sync. Each stream holds a connection of its own, so give it a thread of its own when the program has other work to do. To wait for one message instead, such as a sign-in code, `threads.wait_for_email(from: "github.com", timeout: 60)` holds the request open until it arrives.
95
+
84
96
  ### Errors
85
97
  ```ruby
86
98
  template = "order-shipped"
@@ -126,6 +138,20 @@ page = temp_mail.list_messages(inbox[:id], inbox_token: inbox[:token])
126
138
 
127
139
  `create` needs no credential and is the only call that returns the inbox token, so keep it.
128
140
 
141
+ ### Signing a person up
142
+ ```ruby
143
+ signups = Nextmail.create_signups
144
+
145
+ sign_up = signups.create(email: "ada@example.com", agent: "Claude Code")
146
+
147
+ print "The code sent to #{sign_up[:sentTo]}: "
148
+ account = signups.verify(sign_up[:id], $stdin.gets.strip)
149
+
150
+ client = Nextmail::Client.new(api_key: account[:apiKey][:token])
151
+ ```
152
+
153
+ An agent with no key starts a sign-up for a person's address, asks them for the six-digit code emailed to them, and gets back an API key for the new account. `account[:apiKey][:token]` is shown only in that answer, so store it.
154
+
129
155
  ### OAuth access tokens
130
156
  An app a person connected to Nextmail with OAuth, such as a command line tool or an agent, holds an access token rather than an API key. Pass it as `access_token:`, either the token itself or anything that responds to `call` and returns it:
131
157
 
@@ -176,7 +202,7 @@ client.raw.request("/something-new", method: :post, body: {name: "Invoices"})
176
202
 
177
203
  The path must begin with a single `/`, and a path whose finished URL leaves the base URL's origin raises before a request is sent, so the credential never reaches another host.
178
204
 
179
- `adapter:` swaps the HTTP layer for anything that responds to `call(request)` and returns `Nextmail::HttpResponse`, which is how a test drives the client without a network.
205
+ `adapter:` swaps the HTTP layer for anything that responds to `call(request)` and returns `Nextmail::HttpResponse`, which is how a test drives the client without a network. To stream, it also responds to `stream(request, idle_timeout:)` and yields one `Nextmail::HttpStream` whose `body` gives the chunks as they arrive. Without it, `live_events.stream` and `client.raw.stream` get the body whole, once the server ends it.
180
206
 
181
207
  When a newer version is on RubyGems the client says so once on a TTY. `NEXTMAIL_DISABLE_UPDATE_NOTICE=1` or `disable_update_notice: true` turns that off.
182
208
 
@@ -28,6 +28,8 @@ module Nextmail
28
28
  ACCOUNT_USERNAME = "/account/username"
29
29
  ACCOUNT_USERNAME_AVAILABILITY = "/account/username/availability"
30
30
  ADDRESSES = "/addresses"
31
+ ADDRESS_BOOKS = "/contacts/address-books"
32
+ ADDRESS_BOOK_MEMBER = "/contacts/address-books/:id/members/:memberId"
31
33
  ANALYTICS_MAILBOX = "/analytics/mailbox"
32
34
  ANALYTICS_SENDING = "/analytics/sending"
33
35
  APP_HOST = "/app-host"
@@ -101,6 +103,9 @@ module Nextmail
101
103
  BROADCAST_RESEND = "/broadcasts/:id/resend"
102
104
  BROADCAST_SEND = "/broadcasts/:id/send"
103
105
  BROADCAST_STATS = "/broadcasts/:id/stats"
106
+ CALENDAR_CALENDAR = "/calendar/calendars/:id"
107
+ CALENDAR_CALENDARS = "/calendar/calendars"
108
+ CALENDAR_CALENDAR_MEMBER = "/calendar/calendars/:id/members/:memberId"
104
109
  CALENDAR_EVENT = "/calendar/events/:id"
105
110
  CALENDAR_EVENTS = "/calendar/events"
106
111
  CALENDAR_EVENT_CANCEL = "/calendar/events/:id/cancel"
@@ -116,9 +121,14 @@ module Nextmail
116
121
  CALENDAR_IMPORT = "/calendar/imports/:id"
117
122
  CALENDAR_IMPORTS = "/calendar/imports"
118
123
  CALENDAR_IMPORT_UNDO = "/calendar/imports/:id/undo"
124
+ CALENDAR_LOGIN = "/calendar/logins/:id"
125
+ CALENDAR_LOGINS = "/calendar/logins"
126
+ CALENDAR_LOGIN_PROFILE_LINK = "/calendar/logins/profile-link"
119
127
  CALENDAR_SUBSCRIPTION = "/calendar/subscriptions/:id"
120
128
  CALENDAR_SUBSCRIPTIONS = "/calendar/subscriptions"
121
129
  CALENDAR_SUBSCRIPTION_REFRESH = "/calendar/subscriptions/:id/refresh"
130
+ CALENDAR_TODO = "/calendar/todos/:id"
131
+ CALENDAR_TODOS = "/calendar/todos"
122
132
  CHAT = "/chats/:id"
123
133
  CHATS = "/chats"
124
134
  CHAT_MESSAGES = "/chats/:id/messages"
@@ -198,6 +208,7 @@ module Nextmail
198
208
  EMAILS_CHECK = "/emails/check"
199
209
  EMAILS_COMPOSE = "/emails/compose"
200
210
  EMAILS_EVENTS = "/emails/events"
211
+ EMAILS_RAW = "/emails/raw"
201
212
  EMAILS_REWRITE = "/emails/rewrite"
202
213
  EMAILS_SUBJECT = "/emails/subject"
203
214
  EMAILS_TRANSLATE = "/emails/translate"
@@ -283,6 +294,7 @@ module Nextmail
283
294
  LABEL_COLORS = "/labels/colors"
284
295
  LABEL_TEST = "/labels/:id/test"
285
296
  LANGUAGES = "/languages"
297
+ LIVE_EVENTS = "/live-events"
286
298
  MAILBOX_EXPORT = "/exports/:id"
287
299
  MAILBOX_EXPORTS = "/exports"
288
300
  MAILBOX_EXPORTS_PREVIEW = "/exports/preview"
@@ -296,6 +308,11 @@ module Nextmail
296
308
  MEMBER_INVITATION = "/members/invitations/:invitationId"
297
309
  MEMBER_INVITATIONS = "/members/invitations"
298
310
  MEMBER_INVITATION_RESEND = "/members/invitations/:invitationId/resend"
311
+ NOTIFICATIONS = "/notifications"
312
+ NOTIFICATIONS_CLEAR = "/notifications/clear"
313
+ NOTIFICATIONS_READ = "/notifications/read"
314
+ NOTIFICATIONS_READ_ALL = "/notifications/read-all"
315
+ NOTIFICATIONS_UNREAD_COUNT = "/notifications/unread-count"
299
316
  OUT_OF_OFFICE = "/out-of-office"
300
317
  PING = "/ping"
301
318
  PROVIDER_IMPORT = "/provider-imports/:id"
@@ -328,9 +345,15 @@ module Nextmail
328
345
  SENDING_STREAMS = "/sending/streams"
329
346
  SENDING_STREAM_RESUME = "/sending/streams/:stream/resume"
330
347
  SETTINGS = "/settings"
348
+ SHARED_ITEM = "/shared/:token"
349
+ SHARED_ITEM_COPY = "/shared/:token/copy"
350
+ SHARE_LINK = "/share-links/:kind/:itemId"
351
+ SHARE_LINKS = "/share-links"
331
352
  SIGNATURE = "/signatures/:id"
332
353
  SIGNATURES = "/signatures"
333
354
  SIGNATURE_COPY = "/signatures/:id/copy"
355
+ SIGNUPS = "/signups"
356
+ SIGNUP_VERIFY = "/signups/:id/verify"
334
357
  SUBSCRIBE_FORM = "/subscribe/:formId"
335
358
  SUBSCRIPTIONS = "/subscriptions"
336
359
  SUBSCRIPTIONS_BATCH_KEEP = "/subscriptions/batch-keep"
@@ -385,7 +408,9 @@ module Nextmail
385
408
  THREAD = "/threads/:id"
386
409
  THREADS = "/threads"
387
410
  THREADS_COUNTS = "/threads/counts"
411
+ THREADS_WAIT = "/threads/wait"
388
412
  THREAD_ASSIGNEE = "/threads/:id/assignee"
413
+ THREAD_AUTOMATIONS = "/threads/:id/automations"
389
414
  THREAD_COMMENT = "/threads/:id/comments/:commentId"
390
415
  THREAD_COMMENTS = "/threads/:id/comments"
391
416
  THREAD_DELIVERY = "/threads/:id/delivery"
@@ -417,13 +442,17 @@ module Nextmail
417
442
  TOOLS_BIMI = "/tools/bimi"
418
443
  TOOLS_COST = "/tools/cost"
419
444
  TOOLS_DELIVERABILITY = "/tools/deliverability"
445
+ TOOLS_DKIM = "/tools/dkim"
420
446
  TOOLS_DMARC = "/tools/dmarc"
447
+ TOOLS_MX = "/tools/mx"
448
+ TOOLS_SPF = "/tools/spf"
421
449
  TOOLS_VERIFICATION_CODE = "/tools/verification-code"
422
450
  TRACKED = "/tracking/:id"
423
451
  TRACKED_CLICKS = "/tracking/:id/clicks"
424
452
  TRACKED_OPENS = "/tracking/:id/opens"
425
453
  TRACKING = "/tracking"
426
454
  TRACKING_STATS = "/tracking/stats"
455
+ TRAFFIC = "/traffic"
427
456
  WEBHOOK = "/webhooks/:id"
428
457
  WEBHOOKS = "/webhooks"
429
458
  WEBHOOKS_ACTIVITY = "/webhooks/activity"
@@ -8,6 +8,7 @@ module Nextmail
8
8
  keys: Resources::Keys,
9
9
  addresses: Resources::Addresses,
10
10
  languages: Resources::Languages,
11
+ live_events: Resources::LiveEvents,
11
12
  emails: Resources::Emails,
12
13
  templates: Resources::Templates,
13
14
  tracking: Resources::Tracking,
@@ -21,6 +22,8 @@ module Nextmail
21
22
  forms: Resources::Forms,
22
23
  automations: Resources::Automations,
23
24
  events: Resources::Events,
25
+ share_links: Resources::ShareLinks,
26
+ shared: Resources::Shared,
24
27
  broadcasts: Resources::Broadcasts,
25
28
  domains: Resources::Domains,
26
29
  app_host: Resources::AppHost,
@@ -35,10 +38,12 @@ module Nextmail
35
38
  roles: Resources::Roles,
36
39
  members: Resources::Members,
37
40
  suppressions: Resources::Suppressions,
41
+ traffic: Resources::Traffic,
38
42
  sending: Resources::Sending,
39
43
  files: Resources::Files,
40
44
  knowledge: Resources::Knowledge,
41
45
  temp_mail: Resources::TempMail,
46
+ signups: Resources::Signups,
42
47
  exports: Resources::Exports,
43
48
  chats: Resources::Chats,
44
49
  encryption: Resources::Encryption,
@@ -50,6 +55,7 @@ module Nextmail
50
55
  dns_connections: Resources::DnsConnections,
51
56
  workspaces: Resources::Workspaces,
52
57
  account: Resources::Account,
58
+ notifications: Resources::Notifications,
53
59
  signatures: Resources::Signatures,
54
60
  tasks: Resources::Tasks,
55
61
  bookings: Resources::Bookings,
@@ -32,7 +32,13 @@ module Nextmail
32
32
  SEND_FAILED: "send-failed"
33
33
  }.freeze
34
34
 
35
- ADDRESS_FORWARD_STATUSES = {LIVE: "live", PENDING: "pending", REFUSED: "refused", PAUSED: "paused"}.freeze
35
+ ADDRESS_FORWARD_STATUSES = {
36
+ LIVE: "live",
37
+ PENDING: "pending",
38
+ REFUSED: "refused",
39
+ PAUSED: "paused",
40
+ BOUNCED: "bounced"
41
+ }.freeze
36
42
 
37
43
  ADDRESS_GROUP_POSTING_POLICIES = {ANYONE: "anyone", MEMBERS: "members", WORKSPACE: "workspace"}.freeze
38
44
 
@@ -66,7 +72,8 @@ module Nextmail
66
72
  WEBHOOK_DISABLED: "webhook_disabled",
67
73
  REWRITE_DOMAIN_REMOVED: "rewrite_domain_removed",
68
74
  FORWARD_PENDING: "forward_pending",
69
- FORWARD_REFUSED: "forward_refused"
75
+ FORWARD_REFUSED: "forward_refused",
76
+ FORWARD_BOUNCED: "forward_bounced"
70
77
  }.freeze
71
78
 
72
79
  ADDRESS_ROUTE_TEST_STEPS = {
@@ -232,6 +239,8 @@ module Nextmail
232
239
  REPLY: "reply"
233
240
  }.freeze
234
241
 
242
+ AUTOMATION_THREAD_ROLES = {STARTED: "started", SENT: "sent"}.freeze
243
+
235
244
  AUTOMATION_TRIGGER_KINDS = {
236
245
  AUDIENCE_JOINED: "audience_joined",
237
246
  FORM_SUBMITTED: "form_submitted",
@@ -396,6 +405,8 @@ module Nextmail
396
405
 
397
406
  CALENDAR_FEED_MODES = {FULL: "full", BUSY: "busy"}.freeze
398
407
 
408
+ CALENDAR_KINDS = {EVENTS: "events", TODOS: "todos"}.freeze
409
+
399
410
  CALENDAR_REMINDER_ACTIONS = {DISPLAY: "DISPLAY", EMAIL: "EMAIL", AUDIO: "AUDIO"}.freeze
400
411
 
401
412
  CALENDAR_RESPONSES = {ACCEPTED: "ACCEPTED", DECLINED: "DECLINED", TENTATIVE: "TENTATIVE"}.freeze
@@ -439,6 +450,10 @@ module Nextmail
439
450
  FAILED: "failed"
440
451
  }.freeze
441
452
 
453
+ COLLECTION_ACCESS_LEVELS = {READ: "read", WRITE: "write"}.freeze
454
+
455
+ COLLECTION_RIGHTS = {OWNER: "owner", WRITE: "write", READ: "read"}.freeze
456
+
442
457
  CONNECTED_APP_KINDS = {APP: "app", CLI: "cli"}.freeze
443
458
 
444
459
  CONNECTED_APP_STATUSES = {
@@ -517,6 +532,36 @@ module Nextmail
517
532
 
518
533
  DIRECTORY_PERSON_STATES = {MEMBER: "member", INVITED: "invited", WAITING: "waiting", INACTIVE: "inactive"}.freeze
519
534
 
535
+ DKIM_FINDING_CODES = {
536
+ LOOKUP_FAILED: "lookup-failed",
537
+ NOT_FOUND: "not-found",
538
+ NONE_FOUND: "none-found",
539
+ NOT_DKIM: "not-dkim",
540
+ ALIASED: "aliased",
541
+ MULTIPLE_RECORDS: "multiple-records",
542
+ VERSION_INVALID: "version-invalid",
543
+ VERSION_NOT_FIRST: "version-not-first",
544
+ DUPLICATE_TAG: "duplicate-tag",
545
+ MALFORMED_TAG: "malformed-tag",
546
+ MISSING_KEY: "missing-key",
547
+ INVALID_KEY: "invalid-key",
548
+ REVOKED: "revoked",
549
+ WEAK_KEY: "weak-key",
550
+ SHORT_KEY: "short-key",
551
+ STRONG_KEY: "strong-key",
552
+ LONG_KEY: "long-key",
553
+ ED25519_KEY: "ed25519-key",
554
+ UNKNOWN_KEY_TYPE: "unknown-key-type",
555
+ SHA1_ONLY: "sha1-only",
556
+ SHA1_ALLOWED: "sha1-allowed",
557
+ UNKNOWN_HASH: "unknown-hash",
558
+ TESTING_MODE: "testing-mode",
559
+ STRICT_MODE: "strict-mode",
560
+ SERVICE_MISMATCH: "service-mismatch",
561
+ OBSOLETE_GRANULARITY: "obsolete-granularity",
562
+ UNKNOWN_TAG: "unknown-tag"
563
+ }.freeze
564
+
520
565
  DNS_CONNECTION_STATUSES = {ACTIVE: "active", NEEDS_REAUTH: "needs-reauth", REVOKED: "revoked", ERROR: "error"}.freeze
521
566
 
522
567
  DNS_PROVISION_STATES = {
@@ -1095,6 +1140,26 @@ module Nextmail
1095
1140
  {code: "tpi", label: "Tok Pisin", native: "Tok Pisin", flag: "🇵🇬", rtl: false}.freeze
1096
1141
  ].freeze
1097
1142
 
1143
+ LIVE_EVENT_TYPES = {
1144
+ MESSAGE_RECEIVED: "message.received",
1145
+ MESSAGE_SENT: "message.sent",
1146
+ THREAD_CHANGED: "thread.changed",
1147
+ THREAD_DELETED: "thread.deleted",
1148
+ MESSAGE_STATUS_CHANGED: "message.status_changed"
1149
+ }.freeze
1150
+
1151
+ LIVE_RESET_REASONS = {EXPIRED: "expired", UNKNOWN: "unknown"}.freeze
1152
+
1153
+ LIVE_SEND_STATUSES = {
1154
+ DELIVERED: "delivered",
1155
+ DELIVERY_DELAYED: "delivery_delayed",
1156
+ BOUNCED: "bounced",
1157
+ COMPLAINED: "complained",
1158
+ FAILED: "failed",
1159
+ SUPPRESSED: "suppressed",
1160
+ CANCELLED: "cancelled"
1161
+ }.freeze
1162
+
1098
1163
  LOGIN_BACKGROUND_KINDS = {PRESET: "preset", COLOR: "color", IMAGE: "image"}.freeze
1099
1164
 
1100
1165
  LOGIN_BACKGROUND_PRESETS = {
@@ -1147,6 +1212,7 @@ module Nextmail
1147
1212
  ICLOUD: "icloud",
1148
1213
  FASTMAIL: "fastmail",
1149
1214
  ZOHO: "zoho",
1215
+ OPENEMAIL: "openemail",
1150
1216
  OTHER: "other"
1151
1217
  }.freeze
1152
1218
 
@@ -1169,6 +1235,7 @@ module Nextmail
1169
1235
  PROTON: "proton",
1170
1236
  ZOHO: "zoho",
1171
1237
  FASTMAIL: "fastmail",
1238
+ OPENEMAIL: "openemail",
1172
1239
  RESEND: "resend",
1173
1240
  SENDGRID: "sendgrid",
1174
1241
  MAILGUN: "mailgun",
@@ -1188,6 +1255,40 @@ module Nextmail
1188
1255
  SMIME_SIGNED: "smime-signed"
1189
1256
  }.freeze
1190
1257
 
1258
+ MX_ADDRESS_FAMILIES = {IPV4: "ipv4", IPV6: "ipv6"}.freeze
1259
+
1260
+ MX_FINDING_CODES = {
1261
+ LOOKUP_FAILED: "lookup-failed",
1262
+ DOMAIN_MISSING: "domain-missing",
1263
+ NO_MAIL: "no-mail",
1264
+ IMPLICIT_MX: "implicit-mx",
1265
+ NULL_MX: "null-mx",
1266
+ NULL_MX_MIXED: "null-mx-mixed",
1267
+ ADDRESS_TARGET: "address-target",
1268
+ ALIAS_TARGET: "alias-target",
1269
+ HOST_UNRESOLVED: "host-unresolved",
1270
+ RESERVED_ADDRESS: "reserved-address",
1271
+ NO_REVERSE_DNS: "no-reverse-dns",
1272
+ DUPLICATE_HOST: "duplicate-host",
1273
+ SINGLE_HOST: "single-host",
1274
+ BACKUP_HOSTS: "backup-hosts",
1275
+ LOAD_BALANCED: "load-balanced",
1276
+ ALL_RESOLVE: "all-resolve",
1277
+ IPV6_READY: "ipv6-ready",
1278
+ NO_IPV6: "no-ipv6",
1279
+ PROVIDER: "provider"
1280
+ }.freeze
1281
+
1282
+ NOTIFICATION_INVITATION_STATUSES = {
1283
+ OPEN: "open",
1284
+ ACCEPTED: "accepted",
1285
+ DECLINED: "declined",
1286
+ WITHDRAWN: "withdrawn",
1287
+ EXPIRED: "expired"
1288
+ }.freeze
1289
+
1290
+ NOTIFICATION_KINDS = {WORKSPACE_INVITATION: "workspace-invitation"}.freeze
1291
+
1191
1292
  PAGE_LIMITS = {MAX_LIMIT: 100, DEFAULT_LIMIT: 25}.freeze
1192
1293
 
1193
1294
  PAID_PLAN_IDS = {STARTER: "starter", BUSINESS: "business", ENTERPRISE: "enterprise"}.freeze
@@ -1242,6 +1343,10 @@ module Nextmail
1242
1343
 
1243
1344
  RAW_MESSAGE_SOURCES = {ORIGINAL: "original", REBUILT: "rebuilt"}.freeze
1244
1345
 
1346
+ RECORD_CHECK_SEVERITIES = {ERROR: "error", WARNING: "warning", NOTICE: "notice", PASS: "pass"}.freeze
1347
+
1348
+ RECORD_CHECK_STATUSES = {PASS: "pass", WARN: "warn", FAIL: "fail", MISSING: "missing"}.freeze
1349
+
1245
1350
  REPLY_SUGGESTION_STATES = {READY: "ready", PENDING: "pending", NONE: "none"}.freeze
1246
1351
 
1247
1352
  REWRITE_ACTIONS = {
@@ -1327,6 +1432,8 @@ module Nextmail
1327
1432
  TWO_FACTOR_REQUIREMENT_CHANGED: "two-factor-requirement-changed",
1328
1433
  ADDRESS_PASSWORD_SET: "address-password-set",
1329
1434
  ADDRESS_PASSWORD_REMOVED: "address-password-removed",
1435
+ CALENDAR_LOGIN_CREATED: "calendar-login-created",
1436
+ CALENDAR_LOGIN_REVOKED: "calendar-login-revoked",
1330
1437
  DIRECTORY_SYNC_CONNECTED: "directory-sync-connected",
1331
1438
  DIRECTORY_SYNC_DISCONNECTED: "directory-sync-disconnected",
1332
1439
  DIRECTORY_SYNC_TOKEN_ROTATED: "directory-sync-token-rotated",
@@ -1335,7 +1442,11 @@ module Nextmail
1335
1442
  CONNECTOR_DISCONNECTED: "connector-disconnected",
1336
1443
  CONNECTOR_CHANGED: "connector-changed",
1337
1444
  OWNERSHIP_OFFERED: "ownership-offered",
1338
- OWNERSHIP_TRANSFERRED: "ownership-transferred"
1445
+ OWNERSHIP_TRANSFERRED: "ownership-transferred",
1446
+ ADDRESS_ACCESS_GRANTED: "address-access-granted",
1447
+ ADDRESS_ACCESS_REVOKED: "address-access-revoked",
1448
+ DOMAIN_ACCESS_GRANTED: "domain-access-granted",
1449
+ DOMAIN_ACCESS_REVOKED: "domain-access-revoked"
1339
1450
  }.freeze
1340
1451
 
1341
1452
  SECURITY_EVENT_SCOPES = {ACCOUNT: "account", WORKSPACE: "workspace"}.freeze
@@ -1407,6 +1518,61 @@ module Nextmail
1407
1518
 
1408
1519
  SETTINGS_WEEK_STARTS = {MONDAY: "monday", SUNDAY: "sunday"}.freeze
1409
1520
 
1521
+ SHARE_KINDS = {TEMPLATE: "template", FORM: "form", AUTOMATION: "automation"}.freeze
1522
+
1523
+ SPF_FINDING_CODES = {
1524
+ LOOKUP_FAILED: "lookup-failed",
1525
+ DOMAIN_MISSING: "domain-missing",
1526
+ NO_RECORD: "no-record",
1527
+ NEAR_MISS: "near-miss",
1528
+ ONE_RECORD: "one-record",
1529
+ MULTIPLE_RECORDS: "multiple-records",
1530
+ VALID_SYNTAX: "valid-syntax",
1531
+ INVALID_TERM: "invalid-term",
1532
+ UNKNOWN_MECHANISM: "unknown-mechanism",
1533
+ INVALID_ADDRESS: "invalid-address",
1534
+ INVALID_DOMAIN: "invalid-domain",
1535
+ LOOKUPS_WITHIN_LIMIT: "lookups-within-limit",
1536
+ NEAR_LOOKUP_LIMIT: "near-lookup-limit",
1537
+ TOO_MANY_LOOKUPS: "too-many-lookups",
1538
+ TOO_MANY_VOID_LOOKUPS: "too-many-void-lookups",
1539
+ VOID_LOOKUP: "void-lookup",
1540
+ INCLUDE_MISSING: "include-missing",
1541
+ INCLUDE_MULTIPLE: "include-multiple",
1542
+ INCLUDE_LOOP: "include-loop",
1543
+ INCLUDE_LOOKUP_FAILED: "include-lookup-failed",
1544
+ TOO_MANY_MX_HOSTS: "too-many-mx-hosts",
1545
+ PASS_ALL: "pass-all",
1546
+ NEUTRAL_ALL: "neutral-all",
1547
+ SOFTFAIL_ALL: "softfail-all",
1548
+ FAIL_ALL: "fail-all",
1549
+ NO_ALL: "no-all",
1550
+ TERMS_AFTER_ALL: "terms-after-all",
1551
+ REDIRECT_IGNORED: "redirect-ignored",
1552
+ DUPLICATE_MODIFIER: "duplicate-modifier",
1553
+ PTR_USED: "ptr-used",
1554
+ MACROS_USED: "macros-used",
1555
+ UNKNOWN_MODIFIER: "unknown-modifier",
1556
+ BROAD_RANGE: "broad-range",
1557
+ LONG_RECORD: "long-record",
1558
+ LONG_STRING: "long-string",
1559
+ ANALYSIS_TRUNCATED: "analysis-truncated"
1560
+ }.freeze
1561
+
1562
+ SPF_NODE_ERRORS = {
1563
+ MISSING: "missing",
1564
+ MULTIPLE: "multiple",
1565
+ LOOP: "loop",
1566
+ LOOKUP_FAILED: "lookup-failed",
1567
+ SKIPPED: "skipped"
1568
+ }.freeze
1569
+
1570
+ SPF_QUALIFIERS = {PASS: "+", FAIL: "-", SOFT_FAIL: "~", NEUTRAL: "?"}.freeze
1571
+
1572
+ SPF_REFERENCE_KINDS = {INCLUDE: "include", REDIRECT: "redirect"}.freeze
1573
+
1574
+ SPF_TERM_KINDS = {MECHANISM: "mechanism", MODIFIER: "modifier", UNKNOWN: "unknown"}.freeze
1575
+
1410
1576
  STEP_UP_ERROR_CODES = {
1411
1577
  STEP_UP_REQUIRED: "step_up_required",
1412
1578
  STEP_UP_NOT_APPLICABLE: "step_up_not_applicable",
@@ -1494,6 +1660,22 @@ module Nextmail
1494
1660
 
1495
1661
  TASK_TRIGGER_KINDS = {SCHEDULE: "schedule", MAIL: "mail", MANUAL: "manual"}.freeze
1496
1662
 
1663
+ TEMPLATE_CATEGORIES = {
1664
+ ACCOUNT: "account",
1665
+ COMMERCE: "commerce",
1666
+ NOTIFY: "notify",
1667
+ MARKETING: "marketing",
1668
+ EVENTS: "events",
1669
+ HOSPITALITY: "hospitality",
1670
+ HEALTH: "health",
1671
+ EDUCATION: "education",
1672
+ REAL_ESTATE: "real-estate",
1673
+ NONPROFIT: "nonprofit",
1674
+ TRAVEL: "travel",
1675
+ RECRUITING: "recruiting",
1676
+ COMMUNITY: "community"
1677
+ }.freeze
1678
+
1497
1679
  TEMPLATE_IMAGE_TYPES = {
1498
1680
  PNG: "image/png",
1499
1681
  JPEG: "image/jpeg",
@@ -1502,6 +1684,15 @@ module Nextmail
1502
1684
  SVG: "image/svg+xml"
1503
1685
  }.freeze
1504
1686
 
1687
+ TEMPLATE_STYLES = {
1688
+ MINIMAL: "minimal",
1689
+ MODERN: "modern",
1690
+ BOLD: "bold",
1691
+ CLASSIC: "classic",
1692
+ DARK: "dark",
1693
+ SOFT: "soft"
1694
+ }.freeze
1695
+
1505
1696
  THREAD_NOTE_COLORS = {
1506
1697
  DEFAULT: "default",
1507
1698
  RED: "red",
@@ -1517,6 +1708,45 @@ module Nextmail
1517
1708
 
1518
1709
  THREAD_SUMMARY_STATES = {READY: "ready", PENDING: "pending", FAILED: "failed", NONE: "none"}.freeze
1519
1710
 
1711
+ TODO_STATES = {OPEN: "open", DONE: "done", ALL: "all"}.freeze
1712
+
1713
+ TODO_STATUSES = {
1714
+ NEEDS_ACTION: "NEEDS-ACTION",
1715
+ IN_PROCESS: "IN-PROCESS",
1716
+ COMPLETED: "COMPLETED",
1717
+ CANCELLED: "CANCELLED"
1718
+ }.freeze
1719
+
1720
+ TRAFFIC_DIRECTIONS = {INBOUND: "inbound", OUTBOUND: "outbound"}.freeze
1721
+
1722
+ TRAFFIC_OUTCOMES = {
1723
+ DELIVERED: "delivered",
1724
+ DEFERRED: "deferred",
1725
+ BOUNCED: "bounced",
1726
+ SUPPRESSED: "suppressed",
1727
+ COMPLAINED: "complained",
1728
+ REJECTED: "rejected",
1729
+ FAILED: "failed",
1730
+ FORWARDED: "forwarded",
1731
+ FILED: "filed",
1732
+ SPAM: "spam",
1733
+ ROUTED: "routed",
1734
+ REFUSED: "refused",
1735
+ DROPPED: "dropped",
1736
+ REPORT: "report"
1737
+ }.freeze
1738
+
1739
+ TRAFFIC_REASONS = {
1740
+ UNKNOWN_RECIPIENT: "unknown_recipient",
1741
+ ADDRESS_LIMITS: "address_limits",
1742
+ BLOCKED_SENDER: "blocked_sender",
1743
+ RULE: "rule",
1744
+ GROUP_POLICY: "group_policy",
1745
+ UNREADABLE: "unreadable",
1746
+ TOO_LARGE: "too_large",
1747
+ REPORT_REFUSED: "report_refused"
1748
+ }.freeze
1749
+
1520
1750
  UNSUBSCRIBE_METHODS = {ONE_CLICK: "one-click", EMAIL: "email", LINK: "link"}.freeze
1521
1751
 
1522
1752
  UNSUBSCRIBE_SOURCES = {
@@ -1563,6 +1793,8 @@ module Nextmail
1563
1793
  DOMAIN_VERIFIED: "domain.verified",
1564
1794
  DOMAIN_SENDING_CHANGED: "domain.sending_changed",
1565
1795
  DOMAIN_DELETED: "domain.deleted",
1796
+ DOMAIN_ACCESS_GRANTED: "domain.access_granted",
1797
+ DOMAIN_ACCESS_REVOKED: "domain.access_revoked",
1566
1798
  SUPPRESSION_ADDED: "suppression.added",
1567
1799
  SUPPRESSION_REMOVED: "suppression.removed",
1568
1800
  FILE_UPLOADED: "file.uploaded",
@@ -1596,7 +1828,9 @@ module Nextmail
1596
1828
  BROADCAST_SENT: "broadcast.sent",
1597
1829
  BROADCAST_FAILED: "broadcast.failed",
1598
1830
  BROADCAST_CANCELLED: "broadcast.cancelled",
1599
- ADDRESS_EXPIRED: "address.expired"
1831
+ ADDRESS_EXPIRED: "address.expired",
1832
+ ADDRESS_ACCESS_GRANTED: "address.access_granted",
1833
+ ADDRESS_ACCESS_REVOKED: "address.access_revoked"
1600
1834
  }.freeze
1601
1835
 
1602
1836
  WEBHOOK_REPLAY_ERROR_CODES = {
@@ -24,6 +24,8 @@ module Nextmail
24
24
  IPV4_DECIMAL_PART = /\A(?:0|[1-9]\d*)\z/
25
25
  IPV4_OCTAL_PART = /\A0[0-7]+\z/
26
26
  IPV4_HEX_PART = /\A0x[0-9a-f]*\z/i
27
+ EVENT_STREAM_LINE_END = /[\r\n]/
28
+ EVENT_STREAM_RETRY_VALUE = /\A\d+\z/
27
29
 
28
30
  CONTENT_TYPES_BY_EXTENSION = {
29
31
  ".png" => "image/png",
@@ -91,6 +93,7 @@ module Nextmail
91
93
  RAW_BODY_SHAPE: "Pass the bytes as a String, an IO or a Pathname.",
92
94
  HEADER_SHAPE: "A header name must be a token and a header value must not contain a line break.",
93
95
  TIMEOUT_SHAPE: "Pass timeout: as a number of seconds, or 0 for no timeout.",
96
+ RAW_MESSAGE_SHAPE: "A raw message must be base64 text, or its bytes as a binary String or an IO",
94
97
  ATTACHMENT_CONTENT_SHAPE: "An attachment's content must be base64 text, or the raw bytes as a binary String " \
95
98
  "(File.binread), an IO or a Pathname, which are encoded for you.",
96
99
  CROP_SHAPE: "Pass crop: as a Hash of four numbers, :x, :y, :width and :height, each a fraction of the image " \
@@ -98,6 +101,13 @@ module Nextmail
98
101
  SEGMENT_ENCODING: "An id must be valid UTF-8 text.",
99
102
  TIMED_OUT: "Request timed out after %<seconds>ss.",
100
103
  UNREACHABLE: "Could not reach %<base_url>s: %<reason>s",
104
+ STREAM_IDLE: "The stream sent nothing for %<seconds>ss.",
105
+ STREAM_BROKEN: "The stream from %<base_url>s broke off: %<reason>s",
106
+ STREAM_BLOCK_TOO_LARGE: "The event stream sent more than %<limit>s bytes without ending an event.",
107
+ STREAM_BLOCK_REQUIRED: "Pass a block: the stream stays open while the block runs and closes when it returns.",
108
+ NOT_AN_EVENT_STREAM: "The API answered %<status>s with %<media_type>s where an event stream was expected.",
109
+ NO_CONTENT_TYPE: "no content type",
110
+ WAIT_TIMEOUT_SHAPE: "Pass timeout: as a whole number of seconds from 0 to 60, how long the API waits for a message.",
101
111
  NOT_JSON: "The API answered %<status>s with a body that is not JSON.",
102
112
  UNRECOGNISED_BODY: "The API responded %<status>s with a body this client did not recognise.",
103
113
  WEBHOOK_MISSING_HEADER: "Missing the X-Webhook-Signature header.",