Documentation
¶
Overview ¶
Package api implements the imsgd HTTP API described by api/openapi.yaml.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
DB *db.DB
APIKeys []config.APIKey
Version string
MacOSVersion string
// Names resolves contact names; nil disables resolution.
Names present.NameResolver
// AttachmentRoots are directories attachment content may be served from.
// Defaults to ~/Library/Messages/Attachments and StickerCache (never the
// database files beside them).
AttachmentRoots []string
// Bus enables GET /api/v1/events; Store and Webhooks enable the webhook API.
Bus *events.Bus
Store *store.Store
Webhooks WebhookDispatcher
// Sender enables POST /api/v1/messages and GET /api/v1/sends/{id}.
Sender *send.Sender
// UploadMaxBytes limits a send request body (default 100 MiB).
UploadMaxBytes int64
// Converter enables format=jpeg/m4a on attachment content.
Converter *media.Converter
// Dims enables real image dimensions in attachment objects.
Dims *media.DimensionCache
// CORSOrigins lists browser origins allowed to call the API ("*" = any).
CORSOrigins []string
// SendsPerMinute limits POST /api/v1/messages per API key (default 60,
// burst 20). StreamsPerKey caps concurrent WebSockets per key (default 20).
SendsPerMinute int
StreamsPerKey int
}
Options configures a Server.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) SetAPIKeys ¶
SetAPIKeys replaces the accepted API keys without a restart.
type WebhookDispatcher ¶
type WebhookDispatcher interface {
Invalidate()
SendTest(ctx context.Context, w *store.Webhook) webhook.TestResult
}
WebhookDispatcher is the subset of *webhook.Dispatcher the API uses.