mailset 0.7.0

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.
data/sig/mailset.rbs ADDED
@@ -0,0 +1,516 @@
1
+ # The mailset gem's hand-written half. sig/mailset/generated.rbs is the rest:
2
+ # every model, enum and union, and every group's methods.
3
+ module Mailset
4
+ VERSION: String
5
+ COMMAND_PATH: String
6
+ ERROR_DOCS: String
7
+ SUPPORT: String
8
+ ERROR_CODES: Array[String]
9
+ COMMANDS: Hash[String, CommandInfo]
10
+
11
+ # Leaves an optional input that may be null out of a call, where nil sends null.
12
+ OMIT: Object
13
+ type omit = Object
14
+
15
+ # For a call alone: `org:` (the org it is about), `approval:` (a passkey
16
+ # approval's id) and `timeout:` (seconds per try).
17
+ type request_options = Hash[Symbol, String | Numeric | nil]
18
+
19
+ # An address: `ana@example.com`, `Ana <ana@example.com>`, or its name and email.
20
+ type address = String | Hash[Symbol | String, String?]
21
+ type addresses = address | Array[address]
22
+
23
+ # A file to send: its name, its type, and its bytes.
24
+ type attachment = Hash[Symbol, untyped]
25
+
26
+ # A moment for deliver_by: a Time, or a time from now such as "10m".
27
+ type deadline = ::Time | String | untyped
28
+
29
+ class CommandInfo < ::Struct[untyped]
30
+ attr_accessor id: String
31
+ attr_accessor path: Array[Symbol]
32
+ attr_accessor grant: Symbol?
33
+ attr_accessor credentials: Array[Symbol]
34
+ attr_accessor passkey: bool
35
+ attr_accessor hand_written: bool
36
+ end
37
+
38
+ class HttpRequest < ::Struct[untyped]
39
+ attr_accessor verb: String
40
+ attr_accessor url: String
41
+ attr_accessor headers: Hash[String, String]
42
+ attr_accessor body: String?
43
+ attr_accessor timeout: Numeric
44
+ end
45
+
46
+ class HttpResponse < ::Struct[untyped]
47
+ attr_accessor status: Integer
48
+ attr_accessor headers: Hash[String, String | Array[String]]
49
+ attr_accessor body: String
50
+ end
51
+
52
+ interface _HttpAdapter
53
+ def call: (HttpRequest request) -> HttpResponse
54
+ end
55
+
56
+ interface _Clock
57
+ def call: () -> (::Time | Integer)
58
+ end
59
+
60
+ interface _OnApproval
61
+ def call: (Approval approval) -> untyped
62
+ end
63
+
64
+ def self.build_message: (
65
+ from: address,
66
+ to: addresses,
67
+ subject: String,
68
+ text: String,
69
+ ?cc: addresses?,
70
+ ?bcc: addresses?,
71
+ ?reply_to: addresses?,
72
+ ?html: String?,
73
+ ?attachments: Array[attachment]?,
74
+ ?headers: Hash[String | Symbol, String]?,
75
+ ?idempotency_key: String?,
76
+ ?date: ::Time
77
+ ) -> BuiltMessage
78
+
79
+ class Model
80
+ class Field < ::Struct[untyped]
81
+ attr_accessor name: Symbol
82
+ attr_accessor wire: String
83
+ attr_accessor type: untyped
84
+ attr_accessor required: bool
85
+ attr_accessor default: untyped
86
+ end
87
+
88
+ NO_DEFAULT: Object
89
+
90
+ def self.fields: () -> Hash[Symbol, Field]
91
+ def self.wire_fields: () -> Hash[String, Field]
92
+ def self.from_json: (untyped value) -> untyped
93
+ def self.dump_input: (Hash[untyped, untyped] hash) -> Hash[String, untyped]
94
+ def self.fits?: (Hash[String, untyped] hash, strict: bool) -> bool
95
+
96
+ def initialize: (**untyped values) -> void
97
+ def to_h: () -> Hash[String, untyped]
98
+ def []: (Symbol | String name) -> untyped
99
+ def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
100
+ def to_json: (*untyped) -> String
101
+ def as_json: (*untyped) -> Hash[String, untyped]
102
+ def ==: (untyped other) -> bool
103
+ def eql?: (untyped other) -> bool
104
+ def hash: () -> Integer
105
+ def inspect: () -> String
106
+ def to_s: () -> String
107
+
108
+ private
109
+
110
+ def self.field: (Symbol name, String wire, untyped type, ?required: bool, ?default: untyped) -> void
111
+ end
112
+
113
+ module Union
114
+ def from_json: (untyped value) -> untyped
115
+ end
116
+
117
+ module Types
118
+ def self.parse: (untyped type, untyped value) -> untyped
119
+ def self.dump: (untyped type, untyped value) -> untyped
120
+ def self.plain: (untyped value) -> untyped
121
+ def self.ms: (untyped value) -> Integer
122
+ def self.time?: (untyped value) -> bool
123
+ end
124
+
125
+ module Base64url
126
+ def self.strict_encode: (String bytes) -> String
127
+ def self.strict_decode: (String text) -> String?
128
+ def self.encode: (String bytes) -> String
129
+ def self.decode: (String text) -> String?
130
+ end
131
+
132
+ class Error < ::StandardError
133
+ FAMILIES: Hash[String, singleton(Error)]
134
+
135
+ attr_reader code: String
136
+ attr_reader status: Integer?
137
+ attr_reader refusal: String?
138
+ attr_reader retry_at: Integer?
139
+ attr_reader issues: Array[ErrorIssue]
140
+ attr_reader purpose: StepUpPurpose?
141
+ attr_reader command: String?
142
+ attr_reader needs: String?
143
+ attr_reader docs: String
144
+ attr_reader help: String
145
+
146
+ def self.default_code: () -> String
147
+ def self.of: (String code, String message, ?status: Integer?, **untyped) -> Error
148
+ def self.from_body: (untyped body, ?status: Integer?, ?command: String?) -> Error?
149
+
150
+ def initialize: (
151
+ ?String? message,
152
+ ?code: String,
153
+ ?status: Integer?,
154
+ ?refusal: String?,
155
+ ?retry_at: Integer?,
156
+ ?issues: Array[ErrorIssue],
157
+ ?purpose: StepUpPurpose?,
158
+ ?command: String?,
159
+ ?needs: String?
160
+ ) -> void
161
+ def to_h: () -> Hash[String, untyped]
162
+ def timed_out?: () -> bool
163
+ end
164
+
165
+ class AuthenticationError < Error
166
+ end
167
+
168
+ class PermissionError < Error
169
+ end
170
+
171
+ class InvalidRequestError < Error
172
+ end
173
+
174
+ class NotFoundError < Error
175
+ end
176
+
177
+ class ConflictError < Error
178
+ end
179
+
180
+ class RateLimitError < Error
181
+ end
182
+
183
+ class PasskeyRequiredError < Error
184
+ end
185
+
186
+ class ExpiredError < Error
187
+ end
188
+
189
+ class ConnectionError < Error
190
+ end
191
+
192
+ class TimeoutError < ConnectionError
193
+ end
194
+
195
+ class ServerError < Error
196
+ end
197
+
198
+ class Credential
199
+ KEY_PREFIX: String
200
+ TOKEN_PREFIX: String
201
+
202
+ attr_reader kind: :key | :token
203
+ attr_reader api: String?
204
+
205
+ def self.find: (?key: String?, ?token: String?, ?env: untyped) -> Credential
206
+ def self.parse: (String text) -> Credential?
207
+ def authorization: () -> String
208
+ def variable: () -> String
209
+ def sign: (String message) -> String
210
+ def proof: (String method, String path, String body, Integer now_ms) -> Hash[String, String]
211
+ end
212
+
213
+ class Transport
214
+ DEFAULT_API: String
215
+ UPGRADE: String
216
+
217
+ def self.warn_upgrade: () -> void
218
+ def self.reset_upgrade_notice!: () -> void
219
+ def self.client_header: () -> String
220
+
221
+ attr_reader credential: Credential
222
+ attr_reader base_url: String
223
+ attr_reader org: String?
224
+ attr_reader timeout: Numeric
225
+ attr_reader max_retries: Integer
226
+ attr_reader client_header: String
227
+
228
+ def initialize: (
229
+ Credential credential,
230
+ ?base_url: String?,
231
+ ?org: String?,
232
+ ?timeout: Numeric,
233
+ ?max_retries: Integer,
234
+ ?http: _HttpAdapter?,
235
+ ?now: _Clock?,
236
+ ?on_approval: _OnApproval?,
237
+ ?env: untyped
238
+ ) -> void
239
+ def now_ms: () -> Integer
240
+ def approvals: () -> Approvals
241
+ def command: (String id, untyped input, ?org: String?, ?approval: String?, ?timeout: Numeric?) -> untyped
242
+ def raw: (String method, String path, untyped body, ?command: String?, ?timeout: Numeric?) -> untyped
243
+ def pause: (Numeric seconds) -> void
244
+
245
+ class NetHttp
246
+ include _HttpAdapter
247
+ end
248
+ end
249
+
250
+ module Resources
251
+ module Calls
252
+ OPTIONS: Array[Symbol]
253
+ end
254
+
255
+ class Base
256
+ include Calls
257
+
258
+ def initialize: (Transport transport) -> void
259
+ end
260
+
261
+ class Delivery < Base
262
+ def search: (
263
+ ?id: String?,
264
+ ?message_id: String?,
265
+ ?recipient: String?,
266
+ ?sender: String?,
267
+ ?status: (DeliveryStatus::value | String)?,
268
+ ?since: (::Time | ::Date | Integer | String)?,
269
+ ?until: (::Time | ::Date | Integer | String)?,
270
+ ?limit: Integer?,
271
+ ?cursor: String?,
272
+ ?request_options: request_options
273
+ ) -> DeliveryPage
274
+ end
275
+
276
+ class Campaigns < Base
277
+ MAX_MESSAGES: Integer
278
+
279
+ def submit: (
280
+ domain: String,
281
+ messages: Array[Hash[Symbol | String, untyped]],
282
+ ?request_options: request_options
283
+ ) -> CampaignSubmitted
284
+ end
285
+
286
+ class Sending < Base
287
+ def submit: (
288
+ domain: String,
289
+ ref: String,
290
+ ?recipients: Array[String]?,
291
+ ?raw: String?,
292
+ ?from: address?,
293
+ ?to: addresses?,
294
+ ?cc: addresses?,
295
+ ?bcc: addresses?,
296
+ ?reply_to: addresses?,
297
+ ?subject: String?,
298
+ ?text: String?,
299
+ ?html: String?,
300
+ ?attachments: Array[attachment]?,
301
+ ?headers: Hash[String | Symbol, String]?,
302
+ ?request_options: request_options
303
+ ) -> SendingSubmitted
304
+ end
305
+ end
306
+
307
+ class Client
308
+ include Resources::Calls
309
+ include Resources::Root
310
+
311
+ MAX_SUBMIT_MESSAGES: Integer
312
+ MAX_SUBMIT_BYTES: Integer
313
+
314
+ def initialize: (
315
+ ?key: String?,
316
+ ?token: String?,
317
+ ?base_url: String?,
318
+ ?org: String?,
319
+ ?timeout: Numeric,
320
+ ?max_retries: Integer,
321
+ ?on_approval: _OnApproval?,
322
+ ?http: _HttpAdapter?,
323
+ ?now: _Clock?
324
+ ) -> void
325
+
326
+ def base_url: () -> String
327
+ def org: () -> String?
328
+ def credential_kind: () -> (:key | :token)
329
+
330
+ def send_email: (
331
+ from: address,
332
+ to: addresses,
333
+ subject: String,
334
+ text: String,
335
+ ?cc: addresses?,
336
+ ?bcc: addresses?,
337
+ ?reply_to: addresses?,
338
+ ?html: String?,
339
+ ?attachments: Array[attachment]?,
340
+ ?headers: Hash[String | Symbol, String]?,
341
+ ?mode: ("transactional" | "promotional" | Symbol)?,
342
+ ?keep_copy: bool,
343
+ ?deliver_by: deadline?,
344
+ ?idempotency_key: String?
345
+ ) -> Sent
346
+
347
+ def send_emails: (Array[Hash[Symbol | String, untyped]] messages) -> Array[Sent | NotSent]
348
+ def key: () -> KeyApi
349
+ def webhooks: () -> singleton(Webhooks)
350
+ def approvals: () -> Approvals
351
+ def request: (String command, ?Hash[untyped, untyped] input, ?org: String?, ?approval: String?, ?timeout: Numeric?) -> untyped
352
+ end
353
+
354
+ class Sent < Model
355
+ attr_reader ok: true
356
+ attr_reader id: String
357
+ attr_reader message_id: String
358
+ attr_reader status: ReceiptState::value | String
359
+ attr_reader state: ReceiptState::value | String
360
+ attr_reader sends_at: Integer?
361
+ attr_reader reason: String?
362
+ attr_reader skipped: Array[SkippedRecipient]?
363
+
364
+ def ok?: () -> true
365
+ end
366
+
367
+ class NotSent
368
+ attr_reader message_id: String?
369
+ attr_reader error: Error
370
+
371
+ def initialize: (String? message_id, Error error) -> void
372
+ def ok: () -> false
373
+ def ok?: () -> false
374
+ def to_h: () -> Hash[String, untyped]
375
+ def to_json: (*untyped) -> String
376
+ def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
377
+ end
378
+
379
+ class KeyApi
380
+ def initialize: (Transport transport) -> void
381
+ def check: () -> KeyStatus
382
+ end
383
+
384
+ class Approval < Model
385
+ attr_reader id: String
386
+ attr_reader url: String
387
+ attr_reader expires_at: Integer
388
+ attr_reader purpose: StepUpPurpose
389
+ end
390
+
391
+ class Approvals
392
+ def initialize: (Transport transport) -> void
393
+ def request: (StepUpPurpose | Hash[Symbol | String, untyped] purpose) -> Approval
394
+ def wait: (Approval | String approval, ?timeout: Numeric, ?every: Numeric) -> String
395
+ end
396
+
397
+ class DeliveryLine < Model
398
+ attr_reader id: String
399
+ attr_reader at: Integer
400
+ attr_reader sender: String?
401
+ attr_reader recipient: String
402
+ attr_reader status: DeliveryStatus::value | String
403
+ attr_reader reason: String?
404
+ attr_reader message: String?
405
+ attr_reader message_id: String?
406
+ attr_reader client: DeliveryClient?
407
+ end
408
+
409
+ class DeliveryPage < Model
410
+ attr_reader lines: Array[DeliveryLine]
411
+ attr_reader next: String?
412
+ end
413
+
414
+ class BuiltMessage
415
+ attr_reader raw: String
416
+ attr_reader message_id: String
417
+
418
+ def initialize: (String raw, String message_id) -> void
419
+ def base64: () -> String
420
+ end
421
+
422
+ module Mime
423
+ FIELDS: Array[Symbol]
424
+ MAX_MESSAGE_BYTES: Integer
425
+ end
426
+
427
+ module Webhooks
428
+ TYPES: Array[String]
429
+ TOLERANCE: Integer
430
+ CLASSES: Hash[String, singleton(Event)]
431
+
432
+ def self.verify: (
433
+ body: String | _Reader,
434
+ secret: String,
435
+ ?headers: untyped,
436
+ ?signature: String?,
437
+ ?tolerance: Numeric,
438
+ ?now: ::Time
439
+ ) -> Array[Event]
440
+
441
+ interface _Reader
442
+ def read: () -> String
443
+ end
444
+
445
+ class Event
446
+ attr_reader type: String
447
+ attr_reader id: String
448
+ attr_reader at: Integer
449
+
450
+ def self.from_json: (Hash[String, untyped] hash) -> Event
451
+ def initialize: (Hash[String, untyped] fields) -> void
452
+ def time: () -> ::Time
453
+ def []: (Symbol | String name) -> untyped
454
+ def to_h: () -> Hash[String, untyped]
455
+ def to_json: (*untyped) -> String
456
+ def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
457
+ end
458
+
459
+ class MessageEvent < Event
460
+ def message: () -> String
461
+ def message_id: () -> String
462
+ def recipient: () -> String
463
+ def app: () -> String
464
+ def duplicate_of: () -> String?
465
+ end
466
+
467
+ class QueuedEvent < MessageEvent
468
+ def sends_at: () -> Integer
469
+ def reason: () -> String
470
+ end
471
+
472
+ class SentEvent < MessageEvent
473
+ end
474
+
475
+ class DeliveredEvent < MessageEvent
476
+ end
477
+
478
+ class Bounce
479
+ attr_reader kind: String
480
+ def class: () -> String
481
+ attr_reader reason: String
482
+
483
+ def initialize: (untyped fields) -> void
484
+ def hard?: () -> bool
485
+ def to_h: () -> Hash[String, untyped]
486
+ end
487
+
488
+ class BouncedEvent < MessageEvent
489
+ def bounce: () -> Bounce
490
+ end
491
+
492
+ class ComplainedEvent < MessageEvent
493
+ end
494
+
495
+ class FailedEvent < MessageEvent
496
+ def reason: () -> String
497
+ end
498
+
499
+ class ExpiredEvent < MessageEvent
500
+ def reason: () -> String
501
+ end
502
+
503
+ class UnsubscribedEvent < Event
504
+ def recipient: () -> String
505
+ def app: () -> String?
506
+ def message: () -> String?
507
+ def message_id: () -> String?
508
+ end
509
+
510
+ class TestEvent < Event
511
+ end
512
+
513
+ class UnknownEvent < Event
514
+ end
515
+ end
516
+ end
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mailset
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.7.0
5
+ platform: ruby
6
+ authors:
7
+ - Intenseloop
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2026-12-01 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: 'Mailset for a Ruby server: send_email builds and sends a whole message
14
+ from a mailbox your app was granted, Mailset::Webhooks verifies your hook, and every
15
+ public command of the Mailset API is a typed method. Standard library only.'
16
+ email:
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - LICENSE
22
+ - README.md
23
+ - lib/mailset.rb
24
+ - lib/mailset/approvals.rb
25
+ - lib/mailset/base64url.rb
26
+ - lib/mailset/campaigns.rb
27
+ - lib/mailset/client.rb
28
+ - lib/mailset/credential.rb
29
+ - lib/mailset/delivery.rb
30
+ - lib/mailset/errors.rb
31
+ - lib/mailset/generated/commands.rb
32
+ - lib/mailset/generated/resources.rb
33
+ - lib/mailset/generated/types.rb
34
+ - lib/mailset/mime.rb
35
+ - lib/mailset/model.rb
36
+ - lib/mailset/resources.rb
37
+ - lib/mailset/transport.rb
38
+ - lib/mailset/version.rb
39
+ - lib/mailset/webhooks.rb
40
+ - sig/mailset.rbs
41
+ - sig/mailset/generated.rbs
42
+ homepage: https://mailset.app
43
+ licenses:
44
+ - Nonstandard
45
+ metadata:
46
+ homepage_uri: https://mailset.app
47
+ documentation_uri: https://mailset.app/docs/sdk
48
+ bug_tracker_uri: https://mailset.app/support
49
+ rubygems_mfa_required: 'true'
50
+ post_install_message:
51
+ rdoc_options: []
52
+ require_paths:
53
+ - lib
54
+ required_ruby_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: '3.0'
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ requirements: []
65
+ rubygems_version: 3.5.16
66
+ signing_key:
67
+ specification_version: 4
68
+ summary: 'Mailset''s official Ruby SDK: send mail, check your key, read the delivery
69
+ log, verify webhooks, and run every public command.'
70
+ test_files: []