mailkite 0.17.0 → 0.19.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mailkite.rb +120 -1
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b15ee263fe07ec0ace5a924dfbf72ea4af0315ec1d3e680c6de957fbabc9f802
4
- data.tar.gz: 736c9345872755f6d696347f39131e103f4a1bb0a6620fa0ef0066061090751d
3
+ metadata.gz: aa6c0fe1916c302b913ce3ec7d39ca3b9e78633791fdfaf0d372306bc71bc134
4
+ data.tar.gz: 7795b6f4b60abcaadd6de5167a1326c1b0c5e5d8eb510ab4aeb141220c499459
5
5
  SHA512:
6
- metadata.gz: 7f6115ce30631c431bb1f4f7eb009f21418930108ad237c318cc33ff753edb0751a1fdb8ff424f8d4f06d2340a7657e5bc3570295d71cca9907e62ed578964c8
7
- data.tar.gz: 9bc55eac84d0f2f62ebc8630e14bba0a9a095ec083c1010ee8c111fcc842d3b6d1620f6bdeb6aaaec385c63a3b8c354ddae15ded8581ab71af6eb8cb0078b1e7
6
+ metadata.gz: 836d902177a964a2094203c597a857222cef22f6f6d51eefd0ab5ddff1baecd636c5a4fb310aa1c658f84e128c2f9e99ef52b1f963f4d3d5f8d6c825f8f46b92
7
+ data.tar.gz: 438ec7af44244d1cffd79b609dddffcc11cbe9655dc3796a690ac7997d10fe8fc5c229a073dbbcb34cae2ec17640f367ed1659196d4fb3d0ded23e43f2a70015
data/lib/mailkite.rb CHANGED
@@ -15,7 +15,7 @@ require "base64"
15
15
  require "cgi"
16
16
 
17
17
  module Mailkite
18
- VERSION = "0.17.0"
18
+ VERSION = "0.19.0"
19
19
  DEFAULT_BASE_URL = "https://api.mailkite.dev"
20
20
  # Reject webhook events older than this (ms) to block replays. Pass 0 to disable.
21
21
  DEFAULT_TOLERANCE_MS = 5 * 60 * 1000
@@ -491,6 +491,125 @@ module Mailkite
491
491
  request("POST", "/api/broadcasts/#{id}/send", body)
492
492
  end
493
493
 
494
+ # --- Account ----------------------------------------------------------
495
+ # Create a MailKite account from just an email — no password. +body+ is a
496
+ # hash with "email" (required) and optional "channel", "ref" and
497
+ # "referrer". Returns the new account's API key immediately; a
498
+ # verification link is emailed, and SENDING stays blocked until the
499
+ # address is verified (poll me()). An existing email returns 409
500
+ # account_exists with no credentials. PUBLIC — no API key required.
501
+ def register(body)
502
+ request("POST", "/api/v1/provision", body)
503
+ end
504
+
505
+ # The account behind this credential: email, whether it is verified
506
+ # (sending is blocked until it is), and plan. Use to poll verification
507
+ # state after register().
508
+ def me
509
+ request("GET", "/v1/me")
510
+ end
511
+
512
+ # Get the account's unrestricted API key (mk_live_…). Read-or-create: the
513
+ # first call mints it.
514
+ def getApiKey
515
+ request("GET", "/api/keys")
516
+ end
517
+
518
+ # Rotate the account API key: the old key stops working immediately and a
519
+ # fresh one is returned. The plaintext is only shown here.
520
+ def rotateApiKey
521
+ request("POST", "/api/keys/rotate")
522
+ end
523
+
524
+ # List the account's domain-scoped API keys. A scoped key can send and
525
+ # manage only its one domain — hand one to each site or CI job so a leak
526
+ # burns only that surface.
527
+ def listScopedKeys
528
+ request("GET", "/api/keys/scoped")
529
+ end
530
+
531
+ # Create a key scoped to one domain. +body+ is a hash with "domainId"
532
+ # (required) and optional "name". Ideal for per-site installs (e.g. a
533
+ # WordPress plugin) — the site never holds the account master key.
534
+ def createScopedKey(body)
535
+ request("POST", "/api/keys/scoped", body)
536
+ end
537
+
538
+ # Revoke a domain-scoped key. Takes effect immediately.
539
+ def deleteScopedKey(id)
540
+ request("DELETE", "/api/keys/scoped/#{id}")
541
+ end
542
+
543
+ # List the account's app passwords. Each one opens a mailbox over IMAP
544
+ # and/or the mailbox API, scoped to a domain and an address pattern
545
+ # within it.
546
+ def listAppPasswords
547
+ request("GET", "/api/app-passwords")
548
+ end
549
+
550
+ # Create an app password for one domain and address pattern. +body+ is a
551
+ # hash with "domain" (required) plus optional "address" (default "*"),
552
+ # "protocols" (default ["imap"]) and "label". The secret is returned once
553
+ # and never again.
554
+ def createAppPassword(body)
555
+ request("POST", "/api/app-passwords", body)
556
+ end
557
+
558
+ # Revoke an app password. Takes effect immediately — any IMAP session or
559
+ # API call using it stops authenticating.
560
+ def deleteAppPassword(id)
561
+ request("DELETE", "/api/app-passwords/#{id}")
562
+ end
563
+
564
+ # List a mailbox's messages, newest first. Authenticated with an app
565
+ # password granting "api" — this is how an agent reads its own inbox
566
+ # without an IMAP client. +params+ may carry :limit and :before.
567
+ def listMailboxMessages(address, params = {})
568
+ q = URI.encode_www_form({ "address" => address }.merge(params))
569
+ request("GET", "/api/mailbox/messages?#{q}")
570
+ end
571
+
572
+ # Fetch one message's raw RFC822 bytes from a mailbox. Same app password
573
+ # auth as the list.
574
+ def getMailboxMessageRaw(uid, address)
575
+ q = URI.encode_www_form("address" => address)
576
+ request("GET", "/api/mailbox/messages/#{uid}/raw?#{q}")
577
+ end
578
+
579
+ # Replace a message's IMAP flags (e.g. mark it "Seen"). Flags set here are
580
+ # the same ones an IMAP client sees.
581
+ def setMailboxMessageFlags(uid, address, flags)
582
+ q = URI.encode_www_form("address" => address)
583
+ request("POST", "/api/mailbox/messages/#{uid}/flags?#{q}", { "flags" => flags })
584
+ end
585
+
586
+ # Current billing-period usage: emails used vs the plan's included bucket
587
+ # (null = unlimited), AI actions, and the overage state that gates
588
+ # sending. Powers quota meters in dashboards and integrations.
589
+ def getUsage
590
+ request("GET", "/api/billing/usage")
591
+ end
592
+
593
+ # --- Suppressions -----------------------------------------------------
594
+ # List suppressed addresses (unsubscribes, hard bounces, spam complaints,
595
+ # manual). Sends to a suppressed address are dropped before delivery.
596
+ def listSuppressions
597
+ request("GET", "/api/contacts/suppressions")
598
+ end
599
+
600
+ # Suppress an address so this account never sends to it again. +body+ is
601
+ # a hash with "email" (required) and optional "reason" (defaults to
602
+ # manual) and "note".
603
+ def addSuppression(body)
604
+ request("POST", "/api/contacts/suppressions", body)
605
+ end
606
+
607
+ # Remove an address from the suppression list. Removing an unsuppressed
608
+ # address is a no-op success.
609
+ def removeSuppression(email)
610
+ request("DELETE", "/api/contacts/suppressions/#{CGI.escape(email)}")
611
+ end
612
+
494
613
  # --- Docs -----------------------------------------------------------
495
614
  # Semantic search over the MailKite docs. PUBLIC — no auth required.
496
615
  # Returns { "query" => ..., "matches" => [...] }.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailkite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.0
4
+ version: 0.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - MailKite
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-08-01 00:00:00.000000000 Z
11
+ date: 2026-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mail