Documentation
¶
Overview ¶
Package memos implements the Memos adapter for the memo capability.
Index ¶
- Constants
- func Register(app string, svc Service) error
- type Adapter
- func (a *Adapter) Create(ctx context.Context, content, visibility string) (*capability.Memo, error)
- func (a *Adapter) Delete(ctx context.Context, name string) error
- func (a *Adapter) Get(ctx context.Context, name string) (*capability.Memo, error)
- func (a *Adapter) HealthCheck(ctx context.Context) (bool, error)
- func (a *Adapter) List(ctx context.Context, q *ListQuery) (*capability.ListResult[capability.Memo], error)
- func (a *Adapter) ListRawEvents(ctx context.Context, cursor string) ([]any, string, error)
- func (a *Adapter) Update(ctx context.Context, name string, data map[string]any) (*capability.Memo, error)
- type ListQuery
- type Service
- type Webhook
Constants ¶
const ( OpList = "list" OpGet = "get" OpCreate = "create" OpUpdate = "update" OpDelete = "delete" OpHealth = "health" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter implements Service using the Memos provider client.
func (*Adapter) HealthCheck ¶
HealthCheck reports whether the memo backend is reachable by querying the current user endpoint.
func (*Adapter) List ¶
func (a *Adapter) List(ctx context.Context, q *ListQuery) (*capability.ListResult[capability.Memo], error)
List returns a paginated list of memos.
func (*Adapter) ListRawEvents ¶
ListRawEvents lists memos as raw events for polling support.
type ListQuery ¶
type ListQuery = capability.MemoListQuery
ListQuery wraps pagination for listing memos.
type Service ¶
type Service interface {
List(ctx context.Context, q *ListQuery) (*capability.ListResult[capability.Memo], error)
Get(ctx context.Context, name string) (*capability.Memo, error)
Create(ctx context.Context, content, visibility string) (*capability.Memo, error)
Update(ctx context.Context, name string, data map[string]any) (*capability.Memo, error)
Delete(ctx context.Context, name string) error
HealthCheck(ctx context.Context) (bool, error)
ListRawEvents(ctx context.Context, cursor string) ([]any, string, error)
}
Service defines the memo capability contract.
func New ¶
func New() Service
New creates an Adapter using the default provider client (reads config from YAML). Returns nil when the provider is not configured.
func NewWithClient ¶
func NewWithClient(c client) Service
NewWithClient creates an Adapter with a specific client, useful for testing.
type Webhook ¶
type Webhook struct {
// contains filtered or unexported fields
}
Webhook implements capability.WebhookConverter for Memos. It validates a shared token (vendors.memos.webhook_token) from the URL query parameter. Memos can only attach credentials via the webhook URL, so configure the endpoint as /webhook/provider/memos/events?token=<token>.
func NewWebhook ¶
func NewWebhook() *Webhook
NewWebhook creates a Webhook that reads the webhook token from provider config lazily at verification time.
func (*Webhook) VerifySignature ¶
VerifySignature validates the webhook token from the query parameter. Memos passes the token as a URL query string parameter ?token=TOKEN. The eventsource webhook handler injects query params as X-Query-* headers. An empty webhook_token config rejects all deliveries (same as other providers).
func (*Webhook) WebhookPath ¶
WebhookPath returns the URL path segment for Memos webhooks. The full URL is /webhook/provider/memos/events?token=TOKEN.