sdk

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package sdk defines the contract between the Gophenberg core and its plugins. It is the only Gophenberg package a plugin may import.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithSession added in v0.7.0

func WithSession(ctx context.Context, session Session) context.Context

WithSession returns a context carrying the session, which only the host fills.

Types

type ContentReader added in v0.4.0

type ContentReader interface {
	ListPublished(ctx context.Context, contentType string, limit int) ([]Item, error)
}

ContentReader gives plugins read access to published content.

type Deps

type Deps struct {
	DatabaseURL string
	Content     ContentReader
	Getenv      func(string) string
}

Deps carries the host-provided dependencies a plugin's Register function receives at registration.

type Item added in v0.4.0

type Item struct {
	ID          uuid.UUID
	Type        string
	Path        string
	Slug        string
	Title       string
	Excerpt     string
	Content     string
	PublishedAt time.Time
	UpdatedAt   time.Time
}

Item is a published content item as plugins see it: the Content field holds Gutenberg-serialized block HTML, sanitized for public delivery.

type Migrator

type Migrator = pluginkit.Migrator

Migrator is implemented by plugins that own database schema, which the host migrates before starting any plugin.

type Plugin

type Plugin = pluginkit.Plugin

Plugin is an independently addable unit of functionality with a managed lifecycle.

type PublicPathProvider

type PublicPathProvider = pluginkit.PublicPathProvider

PublicPathProvider is implemented by plugins declaring session-exempt public paths.

type RouteProvider

type RouteProvider = pluginkit.RouteProvider

RouteProvider is implemented by plugins that expose HTTP endpoints under their own namespace.

type Session added in v0.7.0

type Session struct {
	ID    uuid.UUID
	Email string
	Name  string
	Role  string
	// contains filtered or unexported fields
}

Session is the account a request is made by, as a plugin reads it.

func NewSession added in v0.7.0

func NewSession(id uuid.UUID, email, name, role string, capabilities []string) Session

NewSession returns the session a host files for a request.

func SessionFrom added in v0.7.0

func SessionFrom(ctx context.Context) (Session, bool)

SessionFrom returns the session a request was made by, reporting whether one was filed.

func (Session) Can added in v0.7.0

func (s Session) Can(capability string) bool

Can reports whether the session holds the named capability.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL