- rbac/: Role type, constants, HasPermission, RoleFromString - blocks/: BlockFunc, BlockMeta, BlockContext, context accessors, BlockRegistry interface - templates/: TemplateFunc, meta types, TemplateRegistry interface - auth/: Claims, PublicClaims, context extractors - content/: Content interface, AuthorProfile/PageInfo/PostInfo types - settings/: Settings interface, map accessor helpers - gating/: AccessRule, AccessResult, EvaluateAccess, Gating interface - crypto/: Crypto interface (Encrypt/Decrypt) - render/: BlockNoteToHTML standalone renderer - video/: ParseEmbedURL, EmbedIframeURL - ai/: ToolDefinition, ToolResult, ToolRegistry interface Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
48 lines
1.2 KiB
Go
48 lines
1.2 KiB
Go
package content
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
// AuthorProfile is a simplified author representation for plugins.
|
|
type AuthorProfile struct {
|
|
ID uuid.UUID
|
|
Name string
|
|
Slug string
|
|
Bio string
|
|
AvatarURL string
|
|
Website string
|
|
SocialLinks map[string]string
|
|
}
|
|
|
|
// PageInfo is a simplified page representation for plugins.
|
|
type PageInfo struct {
|
|
ID uuid.UUID
|
|
Slug string
|
|
Title string
|
|
}
|
|
|
|
// PostInfo is a simplified post representation for plugins.
|
|
type PostInfo struct {
|
|
ID uuid.UUID
|
|
Slug string
|
|
Title string
|
|
Excerpt string
|
|
FeaturedImageURL string
|
|
AuthorID uuid.UUID
|
|
}
|
|
|
|
// Content provides content access for plugins.
|
|
// The CMS implements this interface and wires it into ServiceDeps.
|
|
type Content interface {
|
|
GetAuthorProfile(ctx context.Context, id uuid.UUID) (*AuthorProfile, error)
|
|
GetPage(ctx context.Context, slug string) (*PageInfo, error)
|
|
GetPost(ctx context.Context, slug string) (*PostInfo, error)
|
|
Slugify(text string) string
|
|
BlockNoteToHTML(doc any) string
|
|
GenerateExcerpt(html string, maxLen int) string
|
|
StripHTML(s string) string
|
|
}
|