Documentation
¶
Overview ¶
Package sdk provides the public Go SDK for Kumbuka plugins.
Index ¶
- Constants
- func Icon(name string, size int) (string, error)
- func Log(message string) error
- func PermissionFor(method string) (string, bool)
- func RegisterAdminAction(id string, run func() error)
- func RegisterContentChange(id string, changed func(ContentChangeContext) error)
- func RegisterExporter(id string, export func(ExportContext) (ExportFile, error))
- func RegisterLocalizedMacro[T any](id string, parse func(string) (T, bool), ...)
- func RegisterMacro[T any](id string, parse func(string) (T, bool), render func(T) (Result, error))
- func RegisterModule(id string, handler Handler)
- func RegisterWidget(id string, render func(WidgetContext) (Result, error))
- func RegisterWidgetWithCommands(id string, render func(WidgetContext) (Result, error), ...)
- func RenderPolicyEnabled(features map[string]bool, name string) bool
- func RenderPolicyFeature(name string) string
- func ValidPermission(permission string) bool
- func ValidRenderPolicy(name string) bool
- func ValidSyntax(name string) bool
- func ValidWidgetSurface(surface string) bool
- func ValidWidgetWidth(width string) bool
- type Attachment
- type AttachmentClient
- type AttachmentRead
- type CapabilityRequest
- type CapabilityResponse
- type Client
- func (c Client) Attachments() AttachmentClient
- func (c Client) Drafts() DraftClient
- func (c Client) HTTP() HTTPClient
- func (c Client) Icon(name string, size int) (string, error)
- func (c Client) Log(message string) error
- func (c Client) Notifications() NotificationClient
- func (c Client) Pages() PageClient
- func (c Client) Resources() ResourceClient
- func (c Client) Settings() Values
- func (c Client) Storage() Values
- func (c Client) Users() UserClient
- type ContentChangeContext
- type DraftClient
- type ExportContext
- type ExportFile
- type HTTPClient
- type HTTPRequest
- type HTTPResponse
- type Handler
- type IconRequest
- type LocalizedMacro
- type Localizer
- type LogMessage
- type NavigationNode
- type Notification
- type NotificationClient
- type NotificationInput
- type Page
- type PageClient
- func (p PageClient) Content(slug string) (PageContent, error)
- func (p PageClient) Favorites(limit int) ([]Page, error)
- func (p PageClient) Get(slug string) (Page, error)
- func (p PageClient) Links(slug string) (PageLinks, error)
- func (p PageClient) Navigation() ([]NavigationNode, error)
- func (p PageClient) Popular(limit int) ([]Page, error)
- func (p PageClient) Recent(limit int) ([]Page, error)
- func (p PageClient) RecentEdited(limit int) ([]RecentEdit, error)
- func (p PageClient) RecentViewed(limit int) ([]Page, error)
- func (p PageClient) Revisions(query RevisionQuery) (RevisionHistory, error)
- func (p PageClient) Search(query PageQuery) ([]Page, error)
- func (p PageClient) UpdateContent(update PageContentUpdate) (PageContent, error)
- type PageContent
- type PageContentUpdate
- type PageDraft
- type PageLink
- type PageLinks
- type PageListQuery
- type PageQuery
- type PageRef
- type Part
- type PluginResourceListRequest
- type PluginResourceRecord
- type PluginResourceRequest
- type Property
- type RecentEdit
- type RenderPart
- type RenderRequest
- type RenderResult
- type Request
- type ResourceClient
- type Result
- type Revision
- type RevisionHistory
- type RevisionQuery
- type StorageValue
- type StoredValue
- type Translations
- type Transport
- type User
- type UserClient
- type UserMention
- type UserQuery
- type Values
- type WidgetAction
- type WidgetCommandContext
- type WidgetCommandResult
- type WidgetContext
Constants ¶
const ( // PermissionUsersRead allows plugin-safe Kumbuka user-directory lookups. PermissionUsersRead = "users:read" // PermissionNotificationsSend allows attributed in-app notification creation during mutations. PermissionNotificationsSend = "notifications:send" )
const DefaultLocale = "en"
const Version = api.Version
Version is the Kumbuka plugin API version supported by this SDK.
Variables ¶
This section is empty.
Functions ¶
func PermissionFor ¶
PermissionFor returns the manifest permission required for a host capability.
func RegisterAdminAction ¶ added in v0.10.0
RegisterAdminAction registers one explicit administrator-triggered plugin operation.
func RegisterContentChange ¶ added in v0.17.0
func RegisterContentChange(id string, changed func(ContentChangeContext) error)
RegisterContentChange registers a handler for committed page Markdown changes.
func RegisterExporter ¶ added in v0.6.0
func RegisterExporter(id string, export func(ExportContext) (ExportFile, error))
RegisterExporter registers one page exporter for a manifest exporter module.
func RegisterLocalizedMacro ¶ added in v0.20.0
func RegisterLocalizedMacro[T any](id string, parse func(string) (T, bool), render func(LocalizedMacro[T]) (Result, error))
RegisterLocalizedMacro registers a macro whose renderer receives the request locale.
func RegisterMacro ¶
RegisterMacro hides the parse/render transport and invocation serialization.
func RegisterModule ¶
RegisterModule registers a handler for a manifest module. Call during init.
func RegisterWidget ¶ added in v0.4.0
func RegisterWidget(id string, render func(WidgetContext) (Result, error))
RegisterWidget registers a widget renderer for one manifest widget module.
func RegisterWidgetWithCommands ¶ added in v0.6.0
func RegisterWidgetWithCommands( id string, render func(WidgetContext) (Result, error), command func(WidgetCommandContext) (WidgetCommandResult, error), )
RegisterWidgetWithCommands registers a widget renderer plus host-mediated command handler.
func RenderPolicyEnabled ¶ added in v0.3.0
RenderPolicyEnabled reports whether one render-policy marker is active for a request.
func RenderPolicyFeature ¶ added in v0.3.0
RenderPolicyFeature returns the request feature key for one render-policy marker.
func ValidPermission ¶
ValidPermission reports whether permission is part of the public API contract.
func ValidRenderPolicy ¶
ValidRenderPolicy reports whether name is a valid public render-policy marker.
func ValidSyntax ¶
ValidSyntax reports whether name identifies a supported declarative Markdown grammar.
func ValidWidgetSurface ¶ added in v0.4.0
ValidWidgetSurface reports whether surface is a supported widget placement.
func ValidWidgetWidth ¶ added in v0.5.0
ValidWidgetWidth reports whether width is a supported host layout hint.
Types ¶
type Attachment ¶
type Attachment = api.Attachment
Attachment contains authorized attachment bytes and metadata.
type AttachmentClient ¶
type AttachmentClient struct {
// contains filtered or unexported fields
}
AttachmentClient reads attachments authorized by the current request scope.
func Attachments ¶
func Attachments() AttachmentClient
Attachments returns the host attachment capability.
func (AttachmentClient) Read ¶
func (a AttachmentClient) Read(request AttachmentRead) (Attachment, error)
Read requests a bounded attachment byte range.
type AttachmentRead ¶
type AttachmentRead = api.AttachmentRead
AttachmentRead requests a bounded attachment range.
type CapabilityRequest ¶
type CapabilityRequest = api.CapabilityRequest
CapabilityRequest is the low-level host capability request envelope.
type CapabilityResponse ¶
type CapabilityResponse = api.CapabilityResponse
CapabilityResponse is the low-level host capability response envelope.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides typed capabilities bound to one transport.
func (Client) Attachments ¶
func (c Client) Attachments() AttachmentClient
Attachments returns attachment operations on this client.
func (Client) Drafts ¶ added in v0.5.0
func (c Client) Drafts() DraftClient
Drafts returns private draft operations on this client.
func (Client) HTTP ¶ added in v0.7.0
func (c Client) HTTP() HTTPClient
HTTP returns outbound HTTP operations on this client.
func (Client) Notifications ¶ added in v0.16.0
func (c Client) Notifications() NotificationClient
Notifications returns in-app notification operations on this client.
func (Client) Pages ¶
func (c Client) Pages() PageClient
Pages returns page operations on this client.
func (Client) Resources ¶ added in v0.7.0
func (c Client) Resources() ResourceClient
Resources returns structured settings declared by the calling plugin.
func (Client) Users ¶ added in v0.16.0
func (c Client) Users() UserClient
Users returns user-directory operations on this client.
type ContentChangeContext ¶ added in v0.17.0
type ContentChangeContext = api.ContentChangeContext
ContentChangeContext describes one committed canonical Markdown change.
type DraftClient ¶ added in v0.5.0
type DraftClient struct {
// contains filtered or unexported fields
}
DraftClient provides access to the current viewer's private draft metadata.
func Drafts ¶ added in v0.5.0
func Drafts() DraftClient
Drafts returns private draft metadata for the current viewer.
type ExportContext ¶ added in v0.6.0
type ExportContext = api.ExportContext
ExportContext describes one authorized page export invocation.
type ExportFile ¶ added in v0.6.0
type ExportFile = api.ExportFile
ExportFile is one bounded file returned by an exporter plugin.
type HTTPClient ¶ added in v0.7.0
type HTTPClient struct {
// contains filtered or unexported fields
}
HTTPClient performs bounded outbound HTTP through Kumbuka's host network policy.
func HTTP ¶ added in v0.7.0
func HTTP() HTTPClient
HTTP returns the bounded outbound HTTP client provided by Kumbuka.
func (HTTPClient) Do ¶ added in v0.7.0
func (h HTTPClient) Do(request HTTPRequest) (HTTPResponse, error)
Do performs one bounded HTTP request through the Kumbuka host.
type HTTPRequest ¶ added in v0.7.0
type HTTPRequest = api.HTTPRequest
HTTPRequest describes one bounded outbound HTTP request.
type HTTPResponse ¶ added in v0.7.0
type HTTPResponse = api.HTTPResponse
HTTPResponse contains one bounded outbound HTTP response.
type IconRequest ¶
type IconRequest = api.IconRequest
IconRequest identifies an icon to render through the host.
type LocalizedMacro ¶ added in v0.20.0
type LocalizedMacro[T any] struct { // Value is the parsed macro value. Value T // Locale is the canonical interface locale selected by the host. Locale string }
LocalizedMacro contains one parsed macro invocation and its request locale.
type Localizer ¶ added in v0.20.0
type Localizer struct {
// contains filtered or unexported fields
}
Localizer resolves plugin-owned messages for one host-selected locale.
func NewLocalizer ¶ added in v0.20.0
func NewLocalizer(locale string, translations Translations) Localizer
NewLocalizer binds immutable plugin translations to one request locale.
func (Localizer) Locale ¶ added in v0.20.0
Locale returns the effective locale used by this localizer.
type NavigationNode ¶
type NavigationNode = api.NavigationNode
NavigationNode is an authorized navigation entry.
type Notification ¶ added in v0.16.0
type Notification = api.Notification
Notification is the committed notification receipt.
type NotificationClient ¶ added in v0.16.0
type NotificationClient struct {
// contains filtered or unexported fields
}
NotificationClient creates core-owned in-app notifications.
func Notifications ¶ added in v0.16.0
func Notifications() NotificationClient
Notifications returns in-app notification operations.
func (NotificationClient) Send ¶ added in v0.16.0
func (n NotificationClient) Send(input NotificationInput) (Notification, error)
Send creates one attributed in-app notification for a Kumbuka user.
type NotificationInput ¶ added in v0.16.0
type NotificationInput = api.NotificationInput
NotificationInput describes one in-app notification.
type PageClient ¶
type PageClient struct {
// contains filtered or unexported fields
}
PageClient provides permission-checked page operations.
func (PageClient) Content ¶
func (p PageClient) Content(slug string) (PageContent, error)
Content reads authorized Markdown source.
func (PageClient) Favorites ¶ added in v0.5.0
func (p PageClient) Favorites(limit int) ([]Page, error)
Favorites returns pages favorited by the current viewer.
func (PageClient) Get ¶
func (p PageClient) Get(slug string) (Page, error)
Get returns authorized metadata for a canonical page slug.
func (PageClient) Links ¶ added in v0.4.0
func (p PageClient) Links(slug string) (PageLinks, error)
Links returns authorized incoming and outgoing wiki-link relationships.
func (PageClient) Navigation ¶
func (p PageClient) Navigation() ([]NavigationNode, error)
Navigation returns the prepared navigation tree.
func (PageClient) Popular ¶ added in v0.5.0
func (p PageClient) Popular(limit int) ([]Page, error)
Popular returns the most viewed authorized pages.
func (PageClient) Recent ¶ added in v0.5.0
func (p PageClient) Recent(limit int) ([]Page, error)
Recent returns the newest authorized pages.
func (PageClient) RecentEdited ¶ added in v0.5.0
func (p PageClient) RecentEdited(limit int) ([]RecentEdit, error)
RecentEdited returns pages most recently edited by the current viewer.
func (PageClient) RecentViewed ¶ added in v0.5.0
func (p PageClient) RecentViewed(limit int) ([]Page, error)
RecentViewed returns pages most recently viewed by the current viewer.
func (PageClient) Revisions ¶ added in v0.4.0
func (p PageClient) Revisions(query RevisionQuery) (RevisionHistory, error)
Revisions returns bounded public revision metadata for one authorized page.
func (PageClient) Search ¶
func (p PageClient) Search(query PageQuery) ([]Page, error)
Search returns authorized pages matching a bounded query.
func (PageClient) UpdateContent ¶ added in v0.21.0
func (p PageClient) UpdateContent(update PageContentUpdate) (PageContent, error)
UpdateContent replaces one page's Markdown body through the host's normal authorized, revisioned, optimistic-concurrency write path.
type PageContentUpdate ¶ added in v0.21.0
type PageContentUpdate = api.PageContentUpdate
PageContentUpdate replaces one page body with optimistic concurrency.
type PageDraft ¶ added in v0.5.0
PageDraft is bounded private draft metadata for the current viewer.
type PageListQuery ¶ added in v0.5.0
type PageListQuery = api.PageListQuery
PageListQuery selects a bounded page/activity list.
type Part ¶
type Part = api.RenderPart
Part is literal intermediate output or Markdown rendered by Kumbuka.
type PluginResourceListRequest ¶ added in v0.7.0
type PluginResourceListRequest = api.PluginResourceListRequest
PluginResourceListRequest selects all records from one structured plugin setting resource.
type PluginResourceRecord ¶ added in v0.7.0
type PluginResourceRecord = api.PluginResourceRecord
PluginResourceRecord contains one structured plugin setting record.
type PluginResourceRequest ¶ added in v0.7.0
type PluginResourceRequest = api.PluginResourceRequest
PluginResourceRequest selects one structured plugin setting record.
type RecentEdit ¶ added in v0.5.0
type RecentEdit = api.RecentEdit
RecentEdit is public metadata for one recent edit.
type RenderPart ¶
type RenderPart = api.RenderPart
RenderPart is one wire-level render output fragment.
type RenderRequest ¶
type RenderRequest = api.RenderRequest
RenderRequest is the wire-level render request used by the Kumbuka host.
type RenderResult ¶
type RenderResult = api.RenderResult
RenderResult is the wire-level render result used by the Kumbuka host.
type ResourceClient ¶ added in v0.7.0
type ResourceClient struct {
// contains filtered or unexported fields
}
ResourceClient reads structured plugin settings declared as admin resources.
func Resources ¶ added in v0.7.0
func Resources() ResourceClient
Resources returns manifest-declared structured settings owned by this plugin.
func (ResourceClient) Get ¶ added in v0.7.0
func (r ResourceClient) Get(resource, key string) (PluginResourceRecord, error)
Get returns one configured resource record, including decrypted secret fields.
func (ResourceClient) List ¶ added in v0.7.0
func (r ResourceClient) List(resource string) ([]PluginResourceRecord, error)
List returns configured records for one resource in deterministic key order.
type Result ¶
type Result = api.RenderResult
Result contains intermediate output returned to Kumbuka.
func Dispatch ¶
Dispatch runs a registered handler. It also supports native unit tests without WASM.
type RevisionHistory ¶ added in v0.4.0
type RevisionHistory = api.RevisionHistory
RevisionHistory contains bounded revision metadata and the total count.
type RevisionQuery ¶ added in v0.4.0
type RevisionQuery = api.RevisionQuery
RevisionQuery selects bounded page revision metadata.
type StorageValue ¶
type StorageValue = api.StorageValue
StorageValue carries a plugin storage key and optional value.
type StoredValue ¶
type StoredValue = api.StoredValue
StoredValue distinguishes an absent key from an empty value.
type Translations ¶ added in v0.20.0
Translations contains messages by canonical locale and message key.
type Transport ¶
Transport enables native tests to supply fake host capabilities. Production clients use Kumbuka's WASM transport; permissions remain enforced by the host.
type UserClient ¶ added in v0.16.0
type UserClient struct {
// contains filtered or unexported fields
}
UserClient provides plugin-safe Kumbuka user-directory operations.
func Users ¶ added in v0.16.0
func Users() UserClient
Users returns the plugin-safe Kumbuka user directory.
func (UserClient) ResolveMention ¶ added in v0.16.0
func (u UserClient) ResolveMention(mention string) (User, error)
ResolveMention resolves an @-prefixed mention to one enabled user.
type UserMention ¶ added in v0.16.0
type UserMention = api.UserMention
UserMention resolves one Kumbuka mention.
type Values ¶
type Values struct {
// contains filtered or unexported fields
}
Values is the calling plugin's host-managed key/value namespace.
type WidgetAction ¶ added in v0.4.0
type WidgetAction = api.WidgetAction
WidgetAction is one safe host-rendered widget control.
type WidgetCommandContext ¶ added in v0.6.0
type WidgetCommandContext = api.WidgetCommandContext
WidgetCommandContext describes one host-mediated widget command invocation.
type WidgetCommandResult ¶ added in v0.6.0
type WidgetCommandResult = api.WidgetCommandResult
WidgetCommandResult controls safe host navigation after a widget command.
type WidgetContext ¶ added in v0.4.0
type WidgetContext = api.WidgetContext
WidgetContext describes one host widget invocation.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
kumbuka-plugin
command
Command kumbuka-plugin develops Go plugins for Kumbuka's WASI runtime.
|
Command kumbuka-plugin develops Go plugins for Kumbuka's WASI runtime. |
|
internal
|
|
|
api
Package api contains the versioned wire types shared by Kumbuka and WASM plugins.
|
Package api contains the versioned wire types shared by Kumbuka and WASM plugins. |
|
build
Package build implements development-time validation and standard Go/WASI packaging.
|
Package build implements development-time validation and standard Go/WASI packaging. |
|
cli
Package cli implements the kumbuka-plugin command.
|
Package cli implements the kumbuka-plugin command. |
|
Package markdown provides reusable Markdown parsing helpers for Kumbuka plugins.
|
Package markdown provides reusable Markdown parsing helpers for Kumbuka plugins. |
|
Package pluginpackage reads bounded, versioned .kumbukaplugin ZIP archives.
|
Package pluginpackage reads bounded, versioned .kumbukaplugin ZIP archives. |