sesv1
import sesv1 "pocketone.dev/ext/contracts/mail/feedback/ses/v1"
Package sesv1 is the mail.feedback.ses/v1 contract: where Amazon SNS delivers SES bounce and complaint notifications for an app. Its provider checks each delivery and raises mail.feedback/v1 events.
A wire contract at /api/_c/mail.feedback.ses/v1. Its operation is public: deliveries are checked by their SNS signature.
Source: ext/contracts/mail/feedback/ses/v1.
Variables
var Contract = extkit.NewContract[Receiver]("mail.feedback.ses/v1", extkit.One).JS(extkit.JSHooks, nil).JSTypes(jsTypes)
Contract is mail.feedback.ses/v1.
var W = extkit.NewWire(Contract, "mail_feedback_ses", func(inner Receiver, g *extkit.Guard[Receiver]) Receiver {
return &guardReceiver{inner, g}
},
extkit.Op[Receiver]{
Name: "sns",
Desc: "Takes an Amazon SNS HTTPS delivery: a subscription confirmation (confirmed) or an SES bounce or complaint notification (raised as mail.feedback/v1 events). Point an SNS HTTPS subscription here.",
Method: "POST",
Path: "sns",
Access: "anyone",
RawIn: true,
Out: extkit.OutJSON,
Invoke: func(ctx context.Context, impl Receiver, a extkit.Auth, req extkit.OpRequest) (any, error) {
in := extkit.RawIn{Query: req.Query, Body: req.Body, ContentType: req.ContentType, Header: req.Header}
return impl.SNS(ctx, a, in)
},
},
)
W is mail.feedback.ses/v1's wire side: routes at /api/_c/mail.feedback.ses/v1/<op>, action hooks, MCP tools and the client.
Functions
OnSNS
func OnSNS(owner any, fn func(e *extkit.CallEvent, in *extkit.RawIn) error)
OnSNS binds fn to sns calls on owner (an app, or a host's scope for calls the host answers). Call e.Next() to continue; return an error to refuse. in is the call's input; changes reach the provider.
Types
Ack
type Ack struct {
Accepted int `json:"accepted"` // events raised
}
Ack is a receipt.
Client
type Client struct {
// contains filtered or unexported fields
}
Client is mail.feedback.ses/v1 over HTTP, for the CLI and other apps. It implements Receiver; the token it was made with is the credential, so the extkit.Auth argument is ignored.
NewClient
func NewClient(baseURL, token string, hc *http.Client) *Client
NewClient calls mail.feedback.ses/v1 on the app at baseURL with token (a PocketBase auth token or an API token).
Client.SNS
func (c *Client) SNS(ctx context.Context, _ extkit.Auth, in extkit.RawIn) (Ack, error)
Receiver
type Receiver interface {
// SNS takes an Amazon SNS HTTPS delivery: a subscription confirmation (confirmed) or an SES bounce or complaint
// notification (raised as mail.feedback/v1 events). Point an SNS HTTPS subscription here.
//
//op: POST sns access=anyone
SNS(ctx context.Context, a extkit.Auth, in extkit.RawIn) (Ack, error)
}
Receiver takes Amazon SNS deliveries of SES notifications.
Questions and comments
Comments are a GitHub Discussions thread; sign in with GitHub to post.