builder

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: AGPL-3.0 Imports: 57 Imported by: 0

Documentation

Overview

Package build contains build objects, which are passed to HTML templates to generate HTML pages. Render objects wrap a specific model object, providing some safety against direct access to protected data. Render objects also include additional methods to query related records in the database. For example, the "Stream" builder has queries for `Ancestors`, `Parent`, `Siblings`, and `Children` streams.

This package also contains implementations for all the action steps available to template designers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseModal

func CloseModal(ctx echo.Context)

CloseModal sets Response header to close a modal on the client and optionally forward to a new location.

func FuncMap

func FuncMap(icons icon.Provider) template.FuncMap

func RefreshPage

func RefreshPage(ctx echo.Context)

func TriggerEvent

func TriggerEvent(ctx echo.Context, event string)

func WrapForm

func WrapForm(endpoint string, content string, options ...string) string

func WrapInlineError

func WrapInlineError(response http.ResponseWriter, err error) error

WrapInlineError sends an error message to the #htmx-response-message element

func WrapInlineSuccess

func WrapInlineSuccess(response http.ResponseWriter, message any) error

WrapInlineSuccess sends a confirmation message to the #htmx-response-message element

func WrapModal

func WrapModal(response http.ResponseWriter, content string, options ...string) string

func WrapModalForm

func WrapModalForm(response http.ResponseWriter, endpoint string, content string, options ...string) string

func WrapModalWithCloseButton

func WrapModalWithCloseButton(response http.ResponseWriter, content string, options ...string) string

func WrapTooltip

func WrapTooltip(response http.ResponseWriter, content string) string

Types

type ActionMethod

type ActionMethod uint8

ActionMethod enumerates the HTTP methods that can be performed on Actions

const ActionMethodGet ActionMethod = 0

ActionMethodGet signifies a GET operation on an action

const ActionMethodPost ActionMethod = 1

ActionMethodPost signifies a POST operation on an action

type Builder

type Builder interface {

	// Render is the main entry-point for templates to use a Builder
	Render() (template.HTML, error)     // Render function outputs an HTML template
	View(string) (template.HTML, error) // Render function outputs an HTML template

	// COMMON API METHODS
	Host() string                        // String representation of the protocol + hostname
	Protocol() string                    // String representation of the HTTP protocol to use when addressing this record (http:// or https://)
	Hostname() string                    // Hostname for this server
	Token() string                       // URL Token of the record being builded
	NavigationID() string                // ID of the Top-Level item to highlight in the navigation.
	PageTitle() string                   // Human-friendly title to put at the top of the page.
	Summary() string                     // Human-friendly summary to put at the top of the page (maybe)
	Permalink() string                   // Permanent link to the record being builded
	BasePath() string                    // URL Path of the root of this object, without any additional actions.
	URL() string                         // Complete URL of the requested page
	QueryParam(string) string            // Query parameter of the requested page
	SetQueryParam(string, string)        // Sets a queryString parameter
	ActionID() string                    // Token that identifies the action requested via the URL.
	Action() model.Action                // The pipeline action to be taken by this builder
	IsAuthenticated() bool               // Returns TRUE if the user is signed in
	IsPartialRequest() bool              // Returns TRUE if this is an HTMX request for a page fragment
	UserCan(string) bool                 // Returns TRUE if the signed-in user has access to the named action
	AuthenticatedID() primitive.ObjectID // Returns the ID of the signed-in user (or zero if not signed in)

	GetBool(name string) bool
	GetFloat(name string) float64
	GetHTML(name string) template.HTML
	GetInt(name string) int
	GetInt64(name string) int64
	GetString(name string) string

	GetContent() template.HTML
	SetContent(string)
	// contains filtered or unexported methods
}

Builder safely wraps model objects for consumption by an html Template

type Common

type Common struct {
	// contains filtered or unexported fields
}

Common provides common building functions that are needed by ALL builders

func NewCommon

func NewCommon(factory Factory, request *http.Request, response http.ResponseWriter, template model.Template, actionID string) (Common, error)

func (Common) Action

func (w Common) Action() model.Action

Action returns the model.Action configured into this builder

func (Common) ActionID

func (w Common) ActionID() string

func (Common) ActivityStream

func (w Common) ActivityStream(url string) streams.Document

ActivityStream returns an ActivityStream document for the provided URL. The returned document uses Emissary's custom ActivityStream service, which uses document values and rules from the server's shared cache.

func (Common) ActivityStreamActor

func (w Common) ActivityStreamActor(url string) streams.Document

ActivityStreamActor returns an ActivityStream actor document for the provided URL. The returned document uses Emissary's custom ActivityStream service, which uses document values and rules from the server's shared cache.

func (Common) ActivityStreamActors

func (w Common) ActivityStreamActors(search string) ([]model.ActorSummary, error)

func (Common) AdminSections

func (w Common) AdminSections() []form.LookupCode

AdminSections returns labels and values for all hard-coded sections of the administrator area.

func (Common) AuthenticatedID

func (w Common) AuthenticatedID() primitive.ObjectID

AuthenticatedID returns the unique ID of the currently logged in user (may be nil).

func (Common) DomainHasSignupForm

func (w Common) DomainHasSignupForm() (bool, error)

func (Common) DomainLabel

func (w Common) DomainLabel() (string, error)

func (Common) GetBool

func (w Common) GetBool(name string) bool

func (Common) GetContent

func (w Common) GetContent() template.HTML

func (Common) GetFloat

func (w Common) GetFloat(name string) float64

func (Common) GetFollowingID

func (w Common) GetFollowingID(url string) string

IsFollowing returns TRUE if the curren user is following the document at a specific URI (or the actor who created the document)

func (Common) GetHTML

func (w Common) GetHTML(name string) template.HTML

func (Common) GetInt

func (w Common) GetInt(name string) int

func (Common) GetInt64

func (w Common) GetInt64(name string) int64

func (Common) GetResponseID

func (w Common) GetResponseID(responseType string, url string) string

func (Common) GetResponseSummary

func (w Common) GetResponseSummary(url string) model.UserResponseSummary

func (Common) GetString

func (w Common) GetString(name string) string

func (Common) Host

func (w Common) Host() string

Host returns the protocol + the Hostname

func (Common) Hostname

func (w Common) Hostname() string

Hostname returns the configured hostname for this request

func (Common) IsAuthenticated

func (w Common) IsAuthenticated() bool

IsAuthenticated returns TRUE if the user is signed in

func (Common) IsMe

func (w Common) IsMe(url string) bool

IsMe returns TRUE if the provided URI is the profileURL of the current user

func (Common) IsOwner

func (w Common) IsOwner() bool

IsOwner returns TRUE if the user is a Domain Owner

func (Common) IsPartialRequest

func (w Common) IsPartialRequest() bool

IsPartialRequest returns TRUE if this is a partial page request from htmx.

func (Common) Method

func (w Common) Method() string

Returns the request method

func (Common) Navigation

func (w Common) Navigation() (sliceof.Object[model.StreamSummary], error)

Navigation returns an array of Streams that have a Zero ParentID

func (Common) NavigationID

func (w Common) NavigationID() string

NavigationID returns the the identifier of the top-most stream in the navigation. The "common" builder just returns a default value that other builders should override.

func (Common) NotMe

func (w Common) NotMe(url string) bool

NotMe returns TRUE if the provided URI is NOT the ProfileURL of the current user

func (Common) Now

func (w Common) Now() int64

Now returns the current time in milliseconds since the Unix epoch

func (Common) PageTitle

func (w Common) PageTitle() string

func (Common) Path

func (w Common) Path() string

Path returns the HTTP Request path

func (Common) PathList

func (w Common) PathList() list.List

PathList returns the HTTP Request path as a List of strings

func (Common) Protocol

func (w Common) Protocol() string

Protocol returns http:// or https:// used for this request

func (Common) QueryParam

func (w Common) QueryParam(param string) string

Returns the designated request parameter. If there are multiple values for the parameter, then only the first value is returned.

func (Common) QueryString

func (w Common) QueryString() template.URL

QueryString returns the raw query string (encoded as a template.URL) to be re-embedded in a template link.

func (Common) SetContent

func (w Common) SetContent(value string)

func (Common) SetQueryParam

func (w Common) SetQueryParam(name string, value string)

SetQueryParam updates the HTTP request, setting a new value for an individual query parameter.

func (Common) SubBuilder

func (w Common) SubBuilder(object any) (Builder, error)

SubBuilder creates a new builder for a child object. This function works with Rule, Folder, Follower, Following, and Stream objects. It will return an error if the object is not one of those types.

func (Common) Summary

func (w Common) Summary() string

func (Common) URL

func (w Common) URL() string

URL returns the originally requested URL

func (Common) UserCan

func (w Common) UserCan(_ string) bool

UserCan returns TRUE if the current user has the specified permission. Default implementation returns FALSE for all requests.

func (Common) UserImage

func (w Common) UserImage() (string, error)

UserAvatar returns the avatar image of the user

func (Common) UserName

func (w Common) UserName() (string, error)

UserName returns the DisplayName of the user

type DocumentLinker

type DocumentLinker interface {
	DocumentLink() model.DocumentLink
}

type Domain

type Domain struct {
	Common
	// contains filtered or unexported fields
}

Domain is the builder for the admin/domain page It can only be accessed by a Domain Owner

func NewDomain

func NewDomain(factory Factory, request *http.Request, response http.ResponseWriter, template model.Template, actionID string) (Domain, error)

NewDomain returns a fully initialized `Domain` builder.

func (Domain) BasePath

func (w Domain) BasePath() string

func (Domain) Client

func (w Domain) Client(providerID string) model.Client

func (Domain) NavigationID

func (w Domain) NavigationID() string

func (Domain) PageTitle

func (w Domain) PageTitle() string
func (w Domain) Permalink() string

func (Domain) Provider

func (w Domain) Provider(providerID string) providers.Provider

func (Domain) Providers

func (w Domain) Providers() []form.LookupCode

func (Domain) Render

func (w Domain) Render() (template.HTML, error)

Render generates the string value for this Stream

func (Domain) SignupForm

func (w Domain) SignupForm() model.SignupForm

SignupForm returns the SignupForm associated with this Domain.

func (Domain) Theme

func (w Domain) Theme(themeID string) model.Theme

func (Domain) ThemeID

func (w Domain) ThemeID() string

func (Domain) Themes

func (w Domain) Themes() []model.Theme

func (Domain) Token

func (w Domain) Token() string

func (Domain) View

func (w Domain) View(actionID string) (template.HTML, error)

View executes a separate view for this Group

type Factory

type Factory interface {
	// Model Services
	ActivityStream() *service.ActivityStream
	Attachment() *service.Attachment
	Rule() *service.Rule
	Folder() *service.Folder
	Following() *service.Following
	Follower() *service.Follower
	Group() *service.Group
	Inbox() *service.Inbox
	Mention() *service.Mention
	Outbox() *service.Outbox
	Provider() *service.Provider
	Response() *service.Response
	Stream() *service.Stream
	StreamDraft() *service.StreamDraft
	Template() *service.Template
	Theme() *service.Theme
	User() *service.User
	Widget() *service.Widget

	// Other data services
	Config() config.Domain
	Content() *service.Content
	Domain() *service.Domain
	Email() *service.DomainEmail
	Host() string
	Hostname() string
	Icons() icon.Provider
	MediaServer() mediaserver.MediaServer
	ModelService(data.Object) service.ModelService
	Locator() service.Locator
	LookupProvider(primitive.ObjectID) form.LookupProvider
	OAuthClient() *service.OAuthClient
	OAuthUserToken() *service.OAuthUserToken
	Providers() set.Slice[config.Provider]
	Queue() queue.Queue
	Steranko() *steranko.Steranko
	StreamUpdateChannel() chan model.Stream
}

Factory is used to locate all necessary services

type Group

type Group struct {
	Common
	// contains filtered or unexported fields
}

Group is a builder for the admin/groups page It can only be accessed by a Domain Owner

func NewGroup

func NewGroup(factory Factory, request *http.Request, response http.ResponseWriter, template model.Template, group *model.Group, actionID string) (Group, error)

NewGroup returns a fully initialized `Group` builder.

func (Group) BasePath

func (w Group) BasePath() string

func (Group) GroupID

func (w Group) GroupID() string

func (Group) Groups

func (w Group) Groups() *QueryBuilder[model.Group]

func (Group) Label

func (w Group) Label() string

func (Group) NavigationID

func (w Group) NavigationID() string

func (Group) PageTitle

func (w Group) PageTitle() string
func (w Group) Permalink() string

func (Group) Render

func (w Group) Render() (template.HTML, error)

Render generates the string value for this Stream

func (Group) Token

func (w Group) Token() string

func (Group) View

func (w Group) View(actionID string) (template.HTML, error)

View executes a separate view for this Group

type Inbox

type Inbox struct {
	Common
	// contains filtered or unexported fields
}

Inbox is a builder for the @user/inbox page

func NewInbox

func NewInbox(factory Factory, request *http.Request, response http.ResponseWriter, user *model.User, actionID string) (Inbox, error)

NewInbox returns a fully initialized `Inbox` builder

func (Inbox) AmFollowing

func (w Inbox) AmFollowing(url string) model.Following

func (Inbox) AnnouncesBefore

func (w Inbox) AnnouncesBefore(url string, dateString string, maxRows int) sliceof.Object[streams.Document]

func (Inbox) BasePath

func (w Inbox) BasePath() string

func (Inbox) DisplayName

func (w Inbox) DisplayName() string

func (Inbox) FilteredByFollowing

func (w Inbox) FilteredByFollowing() model.Following

FIlteredByFollowing returns the Following record that is being used to filter the Inbox

func (Inbox) Folders

func (w Inbox) Folders() (model.FolderList, error)

Folders returns a slice of all folders owned by the current User

func (Inbox) FoldersWithSelection

func (w Inbox) FoldersWithSelection() (model.FolderList, error)

func (Inbox) FollowerCount

func (w Inbox) FollowerCount() int

func (Inbox) Followers

func (w Inbox) Followers() QueryBuilder[model.FollowerSummary]

func (Inbox) Following

func (w Inbox) Following() QueryBuilder[model.FollowingSummary]

func (Inbox) FollowingByFolder

func (w Inbox) FollowingByFolder(token string) ([]model.FollowingSummary, error)

func (Inbox) FollowingByToken

func (w Inbox) FollowingByToken(followingToken string) (model.Following, error)

func (Inbox) FollowingCount

func (w Inbox) FollowingCount() int

func (Inbox) HasRule

func (w Inbox) HasRule(ruleType string, trigger string) model.Rule

HasRule returns a rule that matches the current user, rule type, and trigger. If no rule is found, then an empty rule is returned.

func (Inbox) ImageURL

func (w Inbox) ImageURL() string

func (Inbox) Inbox

func (w Inbox) Inbox() (QueryBuilder[model.Message], error)

Inbox returns a slice of messages in the current User's inbox

func (Inbox) IsInboxEmpty

func (w Inbox) IsInboxEmpty(inbox []model.Message) bool

IsInboxEmpty returns TRUE if the inbox has no results and there are no filters applied This corresponds to there being NOTHING in the inbox, instead of just being filtered out.

func (Inbox) LikesBefore

func (w Inbox) LikesBefore(url string, dateString string, maxRows int) sliceof.Object[streams.Document]

func (Inbox) Message

func (w Inbox) Message() model.Message

Message uses the queryString ?messageId= parameter to load a Message from the database If the messageId parameter does not exist, is malformed, or if the message does not exist, then a new, empty Message is returned. In addition, if there is a "sibling" URL parameter (either "next" or "prev") then the next/previous message is loaded instead.

func (Inbox) Myself

func (w Inbox) Myself() bool

Myself returns TRUE if the current user is viewing their own profile

func (Inbox) NavigationID

func (w Inbox) NavigationID() string

NavigationID returns the ID to use for highlighing navigation menus

func (Inbox) PageTitle

func (w Inbox) PageTitle() string
func (w Inbox) Permalink() string

func (Inbox) ProfileURL

func (w Inbox) ProfileURL() string

func (Inbox) Render

func (w Inbox) Render() (template.HTML, error)

Render generates the string value for this Inbox

func (Inbox) RepliesAfter

func (w Inbox) RepliesAfter(url string, dateString string, maxRows int) sliceof.Object[streams.Document]

func (Inbox) RepliesBefore

func (w Inbox) RepliesBefore(url string, dateString string, maxRows int) sliceof.Object[streams.Document]

func (Inbox) RuleByToken

func (w Inbox) RuleByToken(token string) model.Rule

func (Inbox) RuleCount

func (w Inbox) RuleCount() int

func (Inbox) Rules

func (w Inbox) Rules() QueryBuilder[model.Rule]

func (Inbox) Token

func (w Inbox) Token() string

func (Inbox) UserCan

func (w Inbox) UserCan(actionID string) bool

UserCan returns TRUE if this Request is authorized to access the requested view

func (Inbox) UserID

func (w Inbox) UserID() string

func (Inbox) Username

func (w Inbox) Username() string

func (Inbox) View

func (w Inbox) View(actionID string) (template.HTML, error)

View executes a separate view for this Inbox

type Model

type Model struct {
	Common
	// contains filtered or unexported fields
}

Model builds objects from any model service that implements the ModelService interface

func NewModel

func NewModel(factory Factory, request *http.Request, response http.ResponseWriter, object data.Object, template model.Template, actionID string) (Model, error)

NewModel returns a fully initialized `Model` builder.

func (Model) BasePath

func (w Model) BasePath() string

func (Model) Label

func (w Model) Label() string

func (Model) Object

func (w Model) Object() any

func (Model) ObjectID

func (w Model) ObjectID() string

func (Model) PageTitle

func (w Model) PageTitle() string
func (w Model) Permalink() string

func (Model) Render

func (w Model) Render() (template.HTML, error)

func (Model) Token

func (w Model) Token() string

func (Model) UserCan

func (w Model) UserCan(string) bool

func (Model) View

func (w Model) View(actionID string) (template.HTML, error)

View executes a separate view for this Stream

type Navigation struct {
	Common
	// contains filtered or unexported fields
}

Navigation is a builder for the admin/navigation page It can only be accessed by a Domain Owner

func NewNavigation

func NewNavigation(factory Factory, request *http.Request, response http.ResponseWriter, template model.Template, stream *model.Stream, actionID string) (Navigation, error)

NewNavigation returns a fully initialized `Navigation` builder.

func (w Navigation) BasePath() string
func (w Navigation) NavigationID() string
func (w Navigation) PageTitle() string
func (w Navigation) Permalink() string
func (w Navigation) Render() (template.HTML, error)

Render generates the string value for this Stream

func (w Navigation) Token() string
func (w Navigation) View(actionID string) (template.HTML, error)

View executes a separate view for this Group

type OAuthAuthorization

type OAuthAuthorization struct {
	// contains filtered or unexported fields
}

OAuthAuthorization is a lightweight builder that displays UI pages for an OAuth Application.

func NewOAuthAuthorization

func NewOAuthAuthorization(factory Factory, request model.OAuthAuthorizationRequest) (OAuthAuthorization, error)

NewOAuthAuthorization returns a fully initialized/loaded `OAuthAuthorization` builder

func (OAuthAuthorization) ClientID

func (r OAuthAuthorization) ClientID() string

func (OAuthAuthorization) Name

func (r OAuthAuthorization) Name() string

func (OAuthAuthorization) RedirectURI

func (r OAuthAuthorization) RedirectURI() string

func (OAuthAuthorization) ResponseType

func (r OAuthAuthorization) ResponseType() string

func (OAuthAuthorization) Scope

func (r OAuthAuthorization) Scope() string

func (OAuthAuthorization) Scopes

func (r OAuthAuthorization) Scopes() []string

func (OAuthAuthorization) Website

func (r OAuthAuthorization) Website() string

type Outbox

type Outbox struct {
	Common
	// contains filtered or unexported fields
}

Outbox builds individual messages from a User's Outbox.

func NewOutbox

func NewOutbox(factory Factory, request *http.Request, response http.ResponseWriter, user *model.User, actionID string) (Outbox, error)

NewOutbox returns a fully initialized `Outbox` builder.

func (Outbox) ActivityPubAvatarURL

func (w Outbox) ActivityPubAvatarURL() string

func (Outbox) ActivityPubFollowersURL

func (w Outbox) ActivityPubFollowersURL() string

func (Outbox) ActivityPubFollowingURL

func (w Outbox) ActivityPubFollowingURL() string

func (Outbox) ActivityPubInboxURL

func (w Outbox) ActivityPubInboxURL() string

func (Outbox) ActivityPubLikedURL

func (w Outbox) ActivityPubLikedURL() string

func (Outbox) ActivityPubOutboxURL

func (w Outbox) ActivityPubOutboxURL() string

func (Outbox) ActivityPubPublicKeyURL

func (w Outbox) ActivityPubPublicKeyURL() string

func (Outbox) ActivityPubURL

func (w Outbox) ActivityPubURL() string

func (Outbox) BasePath

func (w Outbox) BasePath() string

func (Outbox) DisplayName

func (w Outbox) DisplayName() string

func (Outbox) FollowerCount

func (w Outbox) FollowerCount() int

func (Outbox) FollowingCount

func (w Outbox) FollowingCount() int

func (Outbox) ImageURL

func (w Outbox) ImageURL() string

func (Outbox) IsMyself

func (w Outbox) IsMyself() bool

IsMyself returns TRUE if the outbox record is owned by the currently signed-in user

func (w Outbox) Links() []model.PersonLink

func (Outbox) Location

func (w Outbox) Location() string

func (Outbox) Myself

func (w Outbox) Myself() bool

Myself returns TRUE if the current user is viewing their own profile

func (Outbox) NavigationID

func (w Outbox) NavigationID() string

NavigationID returns the ID to use for highlighing navigation menus

func (Outbox) Outbox

func (w Outbox) Outbox() QueryBuilder[model.StreamSummary]

func (Outbox) PageTitle

func (w Outbox) PageTitle() string
func (w Outbox) Permalink() string

func (Outbox) ProfileURL

func (w Outbox) ProfileURL() string

func (Outbox) Render

func (w Outbox) Render() (template.HTML, error)

Render generates the string value for this Outbox

func (Outbox) Replies

func (w Outbox) Replies() QueryBuilder[model.StreamSummary]

func (Outbox) Responses

func (w Outbox) Responses() QueryBuilder[model.Response]

func (Outbox) RuleCount

func (w Outbox) RuleCount() int

func (Outbox) StatusMessage

func (w Outbox) StatusMessage() string

func (Outbox) Token

func (w Outbox) Token() string

func (Outbox) UserCan

func (w Outbox) UserCan(actionID string) bool

UserCan returns TRUE if this Request is authorized to access the requested view

func (Outbox) UserID

func (w Outbox) UserID() string

func (Outbox) Username

func (w Outbox) Username() string

func (Outbox) View

func (w Outbox) View(actionID string) (template.HTML, error)

View executes a separate view for this Outbox

type Pipeline

type Pipeline []step.Step

func (Pipeline) Execute

func (pipeline Pipeline) Execute(factory Factory, builder Builder, buffer io.Writer, actionMethod ActionMethod) PipelineResult

Execute switches between GET and POST methods for this pipeline, based on the provided ActionMethod

func (Pipeline) Get

func (pipeline Pipeline) Get(factory Factory, builder Builder, buffer io.Writer) PipelineResult

Get runs all of the pipeline steps using the GET method

func (Pipeline) IsEmpty

func (pipeline Pipeline) IsEmpty() bool

func (Pipeline) Post

func (pipeline Pipeline) Post(factory Factory, builder Builder, buffer io.Writer) PipelineResult

Post runs runs all of the pipeline steps using the POST method

type PipelineBehavior

type PipelineBehavior func(*PipelineResult)

func Continue

func Continue() PipelineBehavior

Continue is a NOOP that does not change the PipelineResult object

func Halt

func Halt() PipelineBehavior

Halt sets the Halt flag on the PipelineResult object

func UseResult

func UseResult(newStatus PipelineResult) PipelineBehavior

UseResult takes a new PipelineResult object, and merges it into the existing PipelineResult object.

func (PipelineBehavior) AsFullPage

func (exit PipelineBehavior) AsFullPage() PipelineBehavior

AsFullPage sets the FullPage flag on the PipelineResult object, which tells the builder to NOT include the header/footer from the site theme.

func (PipelineBehavior) RemoveEvent

func (exit PipelineBehavior) RemoveEvent(name string) PipelineBehavior

RemoveEvent removes an HX-Trigger event to the PipelineResult object

func (PipelineBehavior) WithContentType

func (exit PipelineBehavior) WithContentType(contentType string) PipelineBehavior

func (PipelineBehavior) WithError

func (exit PipelineBehavior) WithError(err error) PipelineBehavior

WithError sets the Error value on the PipelineResult object

func (PipelineBehavior) WithEvent

func (exit PipelineBehavior) WithEvent(name string, value string) PipelineBehavior

WithEvent adds an HX-Trigger event to the PipelineResult object

func (PipelineBehavior) WithHeader

func (exit PipelineBehavior) WithHeader(name string, value string) PipelineBehavior

WithHeader adds an HX-Trigger event to the PipelineResult object

func (PipelineBehavior) WithStatusCode

func (exit PipelineBehavior) WithStatusCode(statusCode int) PipelineBehavior

type PipelineHalter

type PipelineHalter interface {

	// HaltPipeline optionally allows a step to halt processing of an action pipeline
	HaltPipeline(Builder) bool
}

type PipelineResult

type PipelineResult struct {
	StatusCode  int          // HTTP Status Code to be returned
	ContentType string       // If present, then this option sets the content-type header
	Headers     mapof.String // Map of header values to be applied to the response
	Events      mapof.String // Map of events to trigger on the client (via HX-Trigger)
	FullPage    bool         // If true, then this result represents the entire page of content, and should not be wrapped in the global template
	Halt        bool         // If true, then this pipeline should halt execution
	Error       error        // If present, then there was an error building this page
}

func NewPipelineResult

func NewPipelineResult() PipelineResult

func (PipelineResult) Apply

func (result PipelineResult) Apply(response http.ResponseWriter)

func (PipelineResult) GetContentType

func (result PipelineResult) GetContentType() string

func (PipelineResult) GetStatusCode

func (result PipelineResult) GetStatusCode() int

func (*PipelineResult) Merge

func (result *PipelineResult) Merge(newStatus PipelineResult)

Merge combines two PipelineResult objects into one.

type QueryBuilder

type QueryBuilder[T model.FieldLister] struct {
	Criteria      exp.Expression
	SortField     string
	SortDirection string
	MaxRows       int64
	// contains filtered or unexported fields
}

func NewQueryBuilder

func NewQueryBuilder[T model.FieldLister](service service.ModelService, criteria exp.Expression) QueryBuilder[T]

func (QueryBuilder[T]) All

func (builder QueryBuilder[T]) All() QueryBuilder[T]

func (QueryBuilder[T]) By

func (builder QueryBuilder[T]) By(sortField string) QueryBuilder[T]

func (QueryBuilder[T]) ByCreateDate

func (builder QueryBuilder[T]) ByCreateDate() QueryBuilder[T]

func (QueryBuilder[T]) ByDisplayName

func (builder QueryBuilder[T]) ByDisplayName() QueryBuilder[T]

func (QueryBuilder[T]) ByExpirationDate

func (builder QueryBuilder[T]) ByExpirationDate() QueryBuilder[T]

func (QueryBuilder[T]) ByLabel

func (builder QueryBuilder[T]) ByLabel() QueryBuilder[T]

func (QueryBuilder[T]) ByPublishDate

func (builder QueryBuilder[T]) ByPublishDate() QueryBuilder[T]

func (QueryBuilder[T]) ByRank

func (builder QueryBuilder[T]) ByRank() QueryBuilder[T]

func (QueryBuilder[T]) ByReadDate

func (builder QueryBuilder[T]) ByReadDate() QueryBuilder[T]

func (QueryBuilder[T]) ByUpdateDate

func (builder QueryBuilder[T]) ByUpdateDate() QueryBuilder[T]

func (QueryBuilder[T]) Reverse

func (builder QueryBuilder[T]) Reverse() QueryBuilder[T]

func (QueryBuilder[T]) Slice

func (builder QueryBuilder[T]) Slice() (sliceof.Object[T], error)

func (QueryBuilder[T]) Top1

func (builder QueryBuilder[T]) Top1() QueryBuilder[T]

func (QueryBuilder[T]) Top12

func (builder QueryBuilder[T]) Top12() QueryBuilder[T]

func (QueryBuilder[T]) Top120

func (builder QueryBuilder[T]) Top120() QueryBuilder[T]

func (QueryBuilder[T]) Top30

func (builder QueryBuilder[T]) Top30() QueryBuilder[T]

func (QueryBuilder[T]) Top6

func (builder QueryBuilder[T]) Top6() QueryBuilder[T]

func (QueryBuilder[T]) Top60

func (builder QueryBuilder[T]) Top60() QueryBuilder[T]

func (QueryBuilder[T]) Top600

func (builder QueryBuilder[T]) Top600() QueryBuilder[T]

type Rule

type Rule struct {
	Common
	// contains filtered or unexported fields
}

Rule is a builder for the admin/rules page It can only be accessed by a Domain Owner

func NewRule

func NewRule(factory Factory, request *http.Request, response http.ResponseWriter, rule *model.Rule, template model.Template, actionID string) (Rule, error)

NewRule returns a fully initialized `Rule` builder.

func (Rule) BasePath

func (w Rule) BasePath() string

func (Rule) Label

func (w Rule) Label() string

func (Rule) NavigationID

func (w Rule) NavigationID() string

func (Rule) PageTitle

func (w Rule) PageTitle() string
func (w Rule) Permalink() string

func (Rule) Render

func (w Rule) Render() (template.HTML, error)

Render generates the string value for this Stream

func (Rule) RuleID

func (w Rule) RuleID() string

func (Rule) Rules

func (w Rule) Rules() *QueryBuilder[model.Rule]

func (Rule) ServerWideRules

func (w Rule) ServerWideRules() *QueryBuilder[model.Rule]

func (Rule) Token

func (w Rule) Token() string

func (Rule) View

func (w Rule) View(actionID string) (template.HTML, error)

View executes a separate view for this Rule

type ServerFactory

type ServerFactory interface {
	ByDomainName(string) (Factory, error)
}

type StateSetter

type StateSetter interface {
	// contains filtered or unexported methods
}

type Step

type Step interface {
	Get(Builder, io.Writer) PipelineBehavior
	Post(Builder, io.Writer) PipelineBehavior
}

func ExecutableStep

func ExecutableStep(stepInfo step.Step) Step

ExecutableStep uses an Step object to create a new action

type StepAddModelObject

type StepAddModelObject struct {
	Form     form.Element
	Defaults []step.Step
}

StepAddModelObject is an action that can add new model objects of any type

func (StepAddModelObject) Get

func (step StepAddModelObject) Get(builder Builder, buffer io.Writer) PipelineBehavior

Get displays a modal form that lets users enter data for their new model object.

func (StepAddModelObject) Post

func (step StepAddModelObject) Post(builder Builder, buffer io.Writer) PipelineBehavior

Post initializes a new model object, populates it with data from the form, then saves it to the database.

type StepAddStream

type StepAddStream struct {
	Style         string                        // Style of input widget to use. Options are: "chooser"  and "inline".  Defaults to "chooser".
	Title         string                        // Title to use on the create modal. Defaults to "Add a Stream"
	Location      string                        // Options are: "top", "child", "outbox".  Defaults to "child".
	TemplateID    string                        // ID of the template to use.  If empty, then template roles are used.
	TemplateRoles []string                      // List of acceptable Template Roles that can be used to make a stream.  If empty, then all template for this container are valid.
	WithData      map[string]*template.Template // Map of values to preset in the new stream
}

func (StepAddStream) Get

func (step StepAddStream) Get(builder Builder, buffer io.Writer) PipelineBehavior

Get builds the HTML for this step - either a modal template selector, or the embedded edit form

func (StepAddStream) Post

func (step StepAddStream) Post(builder Builder, buffer io.Writer) PipelineBehavior

type StepAsConfirmation

type StepAsConfirmation struct {
	Title   string
	Message string
	Submit  string
}

StepAsConfirmation displays a confirmation dialog on GET, giving users an option to continue or not

func (StepAsConfirmation) Get

func (step StepAsConfirmation) Get(builder Builder, buffer io.Writer) PipelineBehavior

Get displays a modal that asks users to continue or not.

func (StepAsConfirmation) Post

func (step StepAsConfirmation) Post(builder Builder, _ io.Writer) PipelineBehavior

Post does nothing. (Other steps in the pipeline will make changes)

type StepAsModal

type StepAsModal struct {
	SubSteps   []step.Step
	Options    []string
	Background string
}

StepAsModal represents an action-step that can update the data.DataMap custom data stored in a Stream

func (StepAsModal) Get

func (step StepAsModal) Get(builder Builder, buffer io.Writer) PipelineBehavior

Get displays a form where users can update stream data

func (StepAsModal) Post

func (step StepAsModal) Post(builder Builder, buffer io.Writer) PipelineBehavior

Post updates the stream with approved data from the request body.

type StepAsTooltip

type StepAsTooltip struct {
	SubSteps []step.Step
}

StepAsTooltip represents an action-step that can update the data.DataMap custom data stored in a Stream

func (StepAsTooltip) Get

func (step StepAsTooltip) Get(builder Builder, buffer io.Writer) PipelineBehavior

Get displays a form where users can update stream data

func (StepAsTooltip) Post

func (step StepAsTooltip) Post(builder Builder, buffer io.Writer) PipelineBehavior

Post updates the stream with approved data from the request body.

func (StepAsTooltip) UseGlobalWrapper

func (step StepAsTooltip) UseGlobalWrapper() bool

type StepDelete

type StepDelete struct {
	Title   *template.Template
	Message *template.Template
	Submit  string
}

StepDelete represents an action-step that can delete a Stream from the Domain

func (StepDelete) Get

func (step StepDelete) Get(builder Builder, buffer io.Writer) PipelineBehavior

Get displays a customizable confirmation form for the delete

func (StepDelete) Post

func (step StepDelete) Post(builder Builder, _ io.Writer) PipelineBehavior

Post removes the object from the database (likely using a soft-delete, though)

type StepDeleteAttachments

type StepDeleteAttachments struct {
	All bool
}

StepDeleteAttachments represents an action that can upload attachments. It can only be used on a StreamBuilder

func (StepDeleteAttachments) Get

func (StepDeleteAttachments) Post

func (step StepDeleteAttachments) Post(builder Builder, _ io.Writer) PipelineBehavior

type StepDo

type StepDo struct {
	Action string
}

StepDo represents an action-step that sends an HTMX 'forward' to a new page.

func (StepDo) Get

func (step StepDo) Get(builder Builder, buffer io.Writer) PipelineBehavior

func (StepDo) Post

func (step StepDo) Post(builder Builder, buffer io.Writer) PipelineBehavior

Post updates the stream with approved data from the request body.

type StepEditConnection

type StepEditConnection struct{}

func (StepEditConnection) Get

func (step StepEditConnection) Get(builder Builder, buffer io.Writer) PipelineBehavior

func (StepEditConnection) Post

func (step StepEditConnection) Post(builder Builder, _ io.Writer) PipelineBehavior

type StepEditContent

type StepEditContent struct {
	Filename string
	Format   string
}

StepEditContent represents an action-step that can edit/update Container in a streamDraft.

func (StepEditContent) Get

func (step StepEditContent) Get(builder Builder, buffer io.Writer) PipelineBehavior

func (StepEditContent) Post

func (step StepEditContent) Post(builder Builder, _ io.Writer) PipelineBehavior

type StepEditModelObject

type StepEditModelObject struct {
	Form    form.Element
	Options []*template.Template
}

StepEditModelObject is an action that can add new sub-streams to the domain.

func (StepEditModelObject) Get

func (step StepEditModelObject) Get(builder Builder, buffer io.Writer) PipelineBehavior

Get displays a modal form that lets users enter data for their new model object.

func (StepEditModelObject) Post

func (step StepEditModelObject) Post(builder Builder, _ io.Writer) PipelineBehavior

Post initializes a new model object, populates it with data from the form, then saves it to the database.

type StepEditWidget

type StepEditWidget struct{}

StepEditWidget represents an action-step that can update the data.DataMap custom data stored in a Stream

func (StepEditWidget) Get

func (step StepEditWidget) Get(builder Builder, buffer io.Writer) PipelineBehavior

func (StepEditWidget) Post

func (step StepEditWidget) Post(builder Builder, _ io.Writer) PipelineBehavior

Post updates the stream with approved data from the request body.

type StepError

type StepError struct {
	Original step.Step
}

func (StepError) Get

func (step StepError) Get(builder Builder, buffer io.Writer) PipelineBehavior

func (StepError) Post

func (step StepError) Post(builder Builder, _ io.Writer) PipelineBehavior

type StepForwardTo

type StepForwardTo struct {
	URL *template.Template
}

StepForwardTo represents an action-step that sends an HTMX 'forward' to a new page.

func (StepForwardTo) Get

func (step StepForwardTo) Get(builder Builder, buffer io.Writer) PipelineBehavior

func (StepForwardTo) Post

func (step StepForwardTo) Post(builder Builder, _ io.Writer) PipelineBehavior

Post updates the stream with approved data from the request body.

type StepHalt

type StepHalt struct{}

StepHalt represents an action-step that can save changes to any object

func (StepHalt) Get

func (step StepHalt) Get(builder Builder, _ io.Writer) PipelineBehavior

func (StepHalt) Post

func (step StepHalt) Post(builder Builder, _ io.Writer) PipelineBehavior

Post saves the object to the database

type StepIfCondition

type StepIfCondition struct {
	Condition *template.Template
	Then      []step.Step
	Otherwise []step.Step
}

StepIfCondition represents an action-step that can update the data.DataMap custom data stored in a Stream

func (StepIfCondition) Get

func (step StepIfCondition) Get(builder Builder, buffer io.Writer) PipelineBehavior

Get displays a form where users can update stream data

func (StepIfCondition) Post

func (step StepIfCondition) Post(builder Builder, buffer io.Writer) PipelineBehavior

Post updates the stream with approved data from the request body.

type StepInlineError

type StepInlineError struct {
	Message *template.Template
}

StepInlineError represents an action-step that can build a Stream into HTML

func (StepInlineError) Get

func (step StepInlineError) Get(builder Builder, buffer io.Writer) PipelineBehavior

Get builds the Stream HTML to the context

func (StepInlineError) Post

func (step StepInlineError) Post(builder Builder, buffer io.Writer) PipelineBehavior

type StepInlineSuccess

type StepInlineSuccess struct {
	Message *template.Template
}

StepInlineSuccess represents an action-step that can build a Stream into HTML

func (StepInlineSuccess) Get

func (step StepInlineSuccess) Get(builder Builder, buffer io.Writer) PipelineBehavior

Get builds the Stream HTML to the context

func (StepInlineSuccess) Post

func (step StepInlineSuccess) Post(builder Builder, buffer io.Writer) PipelineBehavior

type StepProcessContent

type StepProcessContent struct {
	RemoveHTML bool
	AddTags    bool
	AddLinks   bool
}

StepProcessContent is an action step that adds tags to a stream, either by scanning the content, or by calculating template values

func (StepProcessContent) Get

func (step StepProcessContent) Get(builder Builder, buffer io.Writer) PipelineBehavior

Get builds the HTML for this step - either a modal template selector, or the embedded edit form

func (StepProcessContent) Post

func (step StepProcessContent) Post(builder Builder, buffer io.Writer) PipelineBehavior

type StepPublish

type StepPublish struct{}

StepPublish represents an action-step that can update a stream's PublishDate with the current time.

func (StepPublish) Get

func (step StepPublish) Get(builder Builder, _ io.Writer) PipelineBehavior

func (StepPublish) Post

func (step StepPublish) Post(builder Builder, _ io.Writer) PipelineBehavior

Post updates the stream with the current date as the "PublishDate"

type StepRedirectTo

type StepRedirectTo struct {
	URL *template.Template
}

StepRedirectTo represents an action-step that sends an HTTP redirect to another page.

func (StepRedirectTo) Get

func (step StepRedirectTo) Get(builder Builder, buffer io.Writer) PipelineBehavior

func (StepRedirectTo) Post

func (step StepRedirectTo) Post(builder Builder, _ io.Writer) PipelineBehavior

Post updates the stream with approved data from the request body.

type StepRefreshPage

type StepRefreshPage struct{}

StepRefreshPage represents an action-step that forwards the user to a new page.

func (StepRefreshPage) Get

func (step StepRefreshPage) Get(builder Builder, _ io.Writer) PipelineBehavior

func (StepRefreshPage) Post

func (step StepRefreshPage) Post(builder Builder, _ io.Writer) PipelineBehavior

Post updates the stream with approved data from the request body.

type StepReloadPage

type StepReloadPage struct{}

StepReloadPage represents an action-step that forwards the user to a new page.

func (StepReloadPage) Get

func (step StepReloadPage) Get(builder Builder, _ io.Writer) PipelineBehavior

func (StepReloadPage) Post

func (step StepReloadPage) Post(builder Builder, _ io.Writer) PipelineBehavior

Post updates the stream with approved data from the request body.

type StepRemoveEvent

type StepRemoveEvent struct {
	Event string
}

StepRemoveEvent represents an action-step that forwards the user to a new page.

func (StepRemoveEvent) Get

func (StepRemoveEvent) Post

Post updates the stream with approved data from the request body.

type StepSave

type StepSave struct {
	Comment *template.Template
}

StepSave represents an action-step that can save changes to any object

func (StepSave) Get

func (step StepSave) Get(builder Builder, _ io.Writer) PipelineBehavior

func (StepSave) Post

func (step StepSave) Post(builder Builder, _ io.Writer) PipelineBehavior

Post saves the object to the database

type StepSendEmail

type StepSendEmail struct {
	Email string
}

StepSendEmail represents an action-step that can send a named email to a recipient

func (StepSendEmail) Get

func (StepSendEmail) Post

func (step StepSendEmail) Post(builder Builder, _ io.Writer) PipelineBehavior

Post saves the object to the database

type StepServerRedirect

type StepServerRedirect struct {
	On     string // "get" or "post" or "both"
	Action string
}

StepServerRedirect represents an action-step that continues building the output stream as a GET request to a new action.

func (StepServerRedirect) Get

func (step StepServerRedirect) Get(builder Builder, buffer io.Writer) PipelineBehavior

func (StepServerRedirect) Post

func (step StepServerRedirect) Post(builder Builder, _ io.Writer) PipelineBehavior

Post updates the stream with approved data from the request body.

type StepSetData

type StepSetData struct {
	FromURL  []string                      // List of paths to pull from URL data
	FromForm []string                      // List of paths to pull from Form data
	Values   map[string]*template.Template // values to set directly into the object
	Defaults mapof.Any                     // values to set into the object IFF they are currently empty.
}

StepSetData represents an action-step that can update the custom data stored in a Stream

func (StepSetData) Get

func (step StepSetData) Get(builder Builder, buffer io.Writer) PipelineBehavior

func (StepSetData) Post

func (step StepSetData) Post(builder Builder, _ io.Writer) PipelineBehavior

Post updates the stream with approved data from the request body.

type StepSetHeader

type StepSetHeader struct {
	Method string
	Name   string
	Value  *template.Template
}

StepSetHeader represents an action-step that can update the custom data stored in a Stream

func (StepSetHeader) Get

func (step StepSetHeader) Get(builder Builder, buffer io.Writer) PipelineBehavior

func (StepSetHeader) Post

func (step StepSetHeader) Post(builder Builder, _ io.Writer) PipelineBehavior

Post updates the stream with approved data from the request body.

type StepSetQueryParam

type StepSetQueryParam struct {
	Values map[string]*template.Template
}

StepSetQueryParam represents an action-step that sets values to the request query string

func (StepSetQueryParam) Do

func (step StepSetQueryParam) Do(builder Builder) PipelineBehavior

func (StepSetQueryParam) Get

func (step StepSetQueryParam) Get(builder Builder, buffer io.Writer) PipelineBehavior

Get displays a form where users can update stream data

func (StepSetQueryParam) Post

func (step StepSetQueryParam) Post(builder Builder, _ io.Writer) PipelineBehavior

Post updates the stream with approved data from the request body.

type StepSetRenderData

type StepSetRenderData struct {
	Values map[string]*template.Template
}

StepSetRenderData represents an action-step that sets values to the request query string

func (StepSetRenderData) Do

func (step StepSetRenderData) Do(builder Builder) PipelineBehavior

func (StepSetRenderData) Get

func (step StepSetRenderData) Get(builder Builder, buffer io.Writer) PipelineBehavior

Get displays a form where users can update stream data

func (StepSetRenderData) Post

func (step StepSetRenderData) Post(builder Builder, _ io.Writer) PipelineBehavior

Post updates the stream with approved data from the request body.

type StepSetResponse

type StepSetResponse struct{}

func (StepSetResponse) Get

func (step StepSetResponse) Get(builder Builder, buffer io.Writer) PipelineBehavior

func (StepSetResponse) Post

func (step StepSetResponse) Post(builder Builder, _ io.Writer) PipelineBehavior

type StepSetResponseTransaction

type StepSetResponseTransaction struct {
	URL     string `json:"url"     form:"url"`     // The URL of the object being responded to
	Type    string `json:"type"    form:"type"`    // The Response.Type (Like, Dislike, etc)
	Content string `json:"content" form:"content"` // Addional Value (for Emoji, etc)
	Exists  string `json:"exists"  form:"exists"`  // If TRUE, then create/update the response.  If FALSE, remove it.
}

type StepSetSimpleSharing

type StepSetSimpleSharing struct {
	Title   string
	Message string
	Roles   []string
}

StepSetSimpleSharing represents an action that can edit a top-level folder in the Domain

func (StepSetSimpleSharing) Get

func (step StepSetSimpleSharing) Get(builder Builder, buffer io.Writer) PipelineBehavior

func (StepSetSimpleSharing) Post

func (step StepSetSimpleSharing) Post(builder Builder, _ io.Writer) PipelineBehavior

type StepSetState

type StepSetState struct {
	State string
}

StepSetState represents an action-step that can change a Stream's state

func (StepSetState) Get

func (step StepSetState) Get(builder Builder, _ io.Writer) PipelineBehavior

func (StepSetState) Post

func (step StepSetState) Post(builder Builder, _ io.Writer) PipelineBehavior

Post updates the stream with configured data, and moves the stream to a new state

type StepSetThumbnail

type StepSetThumbnail struct {
	Path string
}

StepSetThumbnail represents an action-step that can update the data.DataMap custom data stored in a Stream

func (StepSetThumbnail) Get

func (step StepSetThumbnail) Get(builder Builder, _ io.Writer) PipelineBehavior

func (StepSetThumbnail) Post

func (step StepSetThumbnail) Post(builder Builder, _ io.Writer) PipelineBehavior

Post updates the stream with approved data from the request body.

type StepSort

type StepSort struct {
	Keys    string
	Values  string
	Message string
}

StepSort represents an action-step that can update multiple records at once

func (StepSort) Get

func (step StepSort) Get(builder Builder, _ io.Writer) PipelineBehavior

func (StepSort) Post

func (step StepSort) Post(builder Builder, _ io.Writer) PipelineBehavior

Post updates the stream with approved data from the request body.

type StepSortAttachments

type StepSortAttachments struct {
	Keys    string
	Values  string
	Message string
}

StepSortAttachments represents an action-step that can update multiple records at once

func (StepSortAttachments) Get

func (step StepSortAttachments) Get(builder Builder, _ io.Writer) PipelineBehavior

func (StepSortAttachments) Post

func (step StepSortAttachments) Post(builder Builder, _ io.Writer) PipelineBehavior

Post updates the stream with approved data from the request body.

type StepSortWidgets

type StepSortWidgets struct{}

StepSortWidgets represents an action-step that can edit/update Container in a streamDraft.

func (StepSortWidgets) Get

func (step StepSortWidgets) Get(builder Builder, buffer io.Writer) PipelineBehavior

func (StepSortWidgets) Post

func (step StepSortWidgets) Post(builder Builder, _ io.Writer) PipelineBehavior

type StepStreamPromoteDraft

type StepStreamPromoteDraft struct {
	StateID string
}

StepStreamPromoteDraft represents an action-step that can copy the Container from a StreamDraft into its corresponding Stream

func (StepStreamPromoteDraft) Get

func (StepStreamPromoteDraft) Post

Post copies relevant information from the draft into the primary stream, then deletes the draft

type StepTableEditor

type StepTableEditor struct {
	Path string
	Form form.Element
}

func (StepTableEditor) Get

func (step StepTableEditor) Get(builder Builder, buffer io.Writer) PipelineBehavior

func (StepTableEditor) Post

func (step StepTableEditor) Post(builder Builder, _ io.Writer) PipelineBehavior

type StepTriggerEvent

type StepTriggerEvent struct {
	Event string
	Value *template.Template
}

StepTriggerEvent represents an action-step that forwards the user to a new page.

func (StepTriggerEvent) Get

func (step StepTriggerEvent) Get(builder Builder, _ io.Writer) PipelineBehavior

func (StepTriggerEvent) Post

func (step StepTriggerEvent) Post(builder Builder, _ io.Writer) PipelineBehavior

Post updates the stream with approved data from the request body.

type StepUnPublish

type StepUnPublish struct {
	Role string
}

StepUnPublish represents an action-step that can update a stream's PublishDate with the current time.

func (StepUnPublish) Get

func (step StepUnPublish) Get(builder Builder, _ io.Writer) PipelineBehavior

func (StepUnPublish) Post

func (step StepUnPublish) Post(builder Builder, _ io.Writer) PipelineBehavior

Post updates the stream with the current date as the "PublishDate"

type StepUploadAttachment

type StepUploadAttachment struct {
	Maximum int
}

StepUploadAttachment represents an action that can upload attachments. It can only be used on a StreamBuilder

func (StepUploadAttachment) Get

func (step StepUploadAttachment) Get(builder Builder, _ io.Writer) PipelineBehavior

func (StepUploadAttachment) Post

func (step StepUploadAttachment) Post(builder Builder, buffer io.Writer) PipelineBehavior

type StepViewFeed

type StepViewFeed struct{}

StepViewFeed represents an action-step that can build a Stream into HTML

func (StepViewFeed) Get

func (step StepViewFeed) Get(builder Builder, buffer io.Writer) PipelineBehavior

Get builds the Stream HTML to the context

func (StepViewFeed) Post

func (step StepViewFeed) Post(builder Builder, _ io.Writer) PipelineBehavior

type StepViewHTML

type StepViewHTML struct {
	File   string
	Method string
}

StepViewHTML represents an action-step that can build a Stream into HTML

func (StepViewHTML) Get

func (step StepViewHTML) Get(builder Builder, buffer io.Writer) PipelineBehavior

Get builds the Stream HTML to the context

func (StepViewHTML) Post

func (step StepViewHTML) Post(builder Builder, buffer io.Writer) PipelineBehavior

type StepViewJSONLD

type StepViewJSONLD struct {
	Method string
}

StepViewJSONLD represents an action-step that can build a Stream into HTML

func (StepViewJSONLD) Get

func (step StepViewJSONLD) Get(builder Builder, buffer io.Writer) PipelineBehavior

Get builds the Stream HTML to the context

func (StepViewJSONLD) Post

func (step StepViewJSONLD) Post(builder Builder, buffer io.Writer) PipelineBehavior

type StepWebSub

type StepWebSub struct {
}

StepWebSub represents an action-step that can build a Stream into HTML

func (StepWebSub) Get

func (step StepWebSub) Get(builder Builder, buffer io.Writer) PipelineBehavior

Get is not required by WebSub. So let's redirect to the primary action.

func (StepWebSub) Post

func (step StepWebSub) Post(builder Builder, _ io.Writer) PipelineBehavior

Post accepts a WebSub request, verifies it, and potentially creates a new Follower record.

type StepWithChildren

type StepWithChildren struct {
	SubSteps []step.Step
}

StepWithChildren represents an action-step that can update the data.DataMap custom data stored in a Stream

func (StepWithChildren) Get

func (step StepWithChildren) Get(builder Builder, buffer io.Writer) PipelineBehavior

func (StepWithChildren) Post

func (step StepWithChildren) Post(builder Builder, buffer io.Writer) PipelineBehavior

Post updates the stream with approved data from the request body.

type StepWithDraft

type StepWithDraft struct {
	SubSteps []step.Step
}

StepWithDraft represents an action-step that can update the data.DataMap custom data stored in a Stream

func (StepWithDraft) Get

func (step StepWithDraft) Get(builder Builder, buffer io.Writer) PipelineBehavior

Get displays a form where users can update stream data

func (StepWithDraft) Post

func (step StepWithDraft) Post(builder Builder, buffer io.Writer) PipelineBehavior

Post updates the stream with approved data from the request body.

type StepWithFolder

type StepWithFolder struct {
	SubSteps []step.Step
}

StepWithFolder represents an action-step that can update the data.DataMap custom data stored in a Stream

func (StepWithFolder) Get

func (step StepWithFolder) Get(builder Builder, buffer io.Writer) PipelineBehavior

func (StepWithFolder) Post

func (step StepWithFolder) Post(builder Builder, buffer io.Writer) PipelineBehavior

Post updates the stream with approved data from the request body.

type StepWithFollower

type StepWithFollower struct {
	SubSteps []step.Step
}

StepWithFollower represents an action-step that can update the data.DataMap custom data stored in a Stream

func (StepWithFollower) Get

func (step StepWithFollower) Get(builder Builder, buffer io.Writer) PipelineBehavior

func (StepWithFollower) Post

func (step StepWithFollower) Post(builder Builder, buffer io.Writer) PipelineBehavior

Post updates the stream with approved data from the request body.

type StepWithFollowing

type StepWithFollowing struct {
	SubSteps []step.Step
}

StepWithFollowing represents an action-step that can update the data.DataMap custom data stored in a Stream

func (StepWithFollowing) Get

func (step StepWithFollowing) Get(builder Builder, buffer io.Writer) PipelineBehavior

func (StepWithFollowing) Post

func (step StepWithFollowing) Post(builder Builder, buffer io.Writer) PipelineBehavior

Post updates the stream with approved data from the request body.

type StepWithMessage

type StepWithMessage struct {
	SubSteps []step.Step
}

StepWithMessage is an action-step that executes a new pipeline on an Inbox Message, identified by the query parameter "messageId"

func (StepWithMessage) Get

func (step StepWithMessage) Get(builder Builder, buffer io.Writer) PipelineBehavior

func (StepWithMessage) Post

func (step StepWithMessage) Post(builder Builder, buffer io.Writer) PipelineBehavior

Post updates the message with data from the request body.

type StepWithNextSibling

type StepWithNextSibling struct {
	SubSteps []step.Step
}

StepWithNextSibling represents an action-step that can update the data.DataMap custom data stored in a Stream

func (StepWithNextSibling) Get

func (step StepWithNextSibling) Get(builder Builder, buffer io.Writer) PipelineBehavior

func (StepWithNextSibling) Post

func (step StepWithNextSibling) Post(builder Builder, buffer io.Writer) PipelineBehavior

Post executes the subSteps on the parent Stream

type StepWithParent

type StepWithParent struct {
	SubSteps []step.Step
}

StepWithParent represents an action-step that can update the data.DataMap custom data stored in a Stream

func (StepWithParent) Get

func (step StepWithParent) Get(builder Builder, buffer io.Writer) PipelineBehavior

func (StepWithParent) Post

func (step StepWithParent) Post(builder Builder, buffer io.Writer) PipelineBehavior

Post executes the subSteps on the parent Stream

type StepWithPrevSibling

type StepWithPrevSibling struct {
	SubSteps []step.Step
}

StepWithPrevSibling represents an action-step that can update the data.DataMap custom data stored in a Stream

func (StepWithPrevSibling) Get

func (step StepWithPrevSibling) Get(builder Builder, buffer io.Writer) PipelineBehavior

func (StepWithPrevSibling) Post

func (step StepWithPrevSibling) Post(builder Builder, buffer io.Writer) PipelineBehavior

Post executes the subSteps on the parent Stream

type StepWithResponse

type StepWithResponse struct {
	SubSteps []step.Step
}

StepWithResponse represents an action-step that can update the data.DataMap custom data stored in a Stream

func (StepWithResponse) Get

func (step StepWithResponse) Get(builder Builder, buffer io.Writer) PipelineBehavior

func (StepWithResponse) Post

func (step StepWithResponse) Post(builder Builder, buffer io.Writer) PipelineBehavior

Post updates the stream with approved data from the request body.

type StepWithRule

type StepWithRule struct {
	SubSteps []step.Step
}

StepWithRule represents an action-step that can update the data.DataMap custom data stored in a Stream

func (StepWithRule) Get

func (step StepWithRule) Get(builder Builder, buffer io.Writer) PipelineBehavior

func (StepWithRule) Post

func (step StepWithRule) Post(builder Builder, buffer io.Writer) PipelineBehavior

Post updates the stream with approved data from the request body.

type Stream

type Stream struct {
	Common
	// contains filtered or unexported fields
}

Stream wraps a model.Stream object and provides functions that make it easy to build an HTML template with it.

func NewStream

func NewStream(factory Factory, request *http.Request, response http.ResponseWriter, template model.Template, stream *model.Stream, actionID string) (Stream, error)

NewStream creates a new object that can generate HTML for a specific stream/view

func NewStreamFromURI

func NewStreamFromURI(serverFactory ServerFactory, request *http.Request, response http.ResponseWriter, stream *model.Stream, actionID string) (Stream, error)

NewStreamFromURI creates a new Stream builder for the provided request context. IMPORTANT: The stream parameter is expected to be an empty stream in the caller's scope that will be populated by this function.

func NewStreamWithoutTemplate

func NewStreamWithoutTemplate(factory Factory, request *http.Request, response http.ResponseWriter, stream *model.Stream, actionID string) (Stream, error)

NewStreamWithoutTemplate creates a new object that can generate HTML for a specific stream/view

func (Stream) Ancestors

func (w Stream) Ancestors() QueryBuilder[model.StreamSummary]

Ancestors returns all Streams that have the same "parent" as the current Stream's parent

func (Stream) AnnouncesBefore

func (w Stream) AnnouncesBefore(dateString string, maxRows int) sliceof.Object[streams.Document]

func (Stream) Attachment

func (w Stream) Attachment() (model.Attachment, error)

Reference to the first file attached to this stream

func (Stream) Attachments

func (w Stream) Attachments() ([]model.Attachment, error)

Attachments lists all attachments for this stream.

func (Stream) AttributedTo

func (w Stream) AttributedTo() model.PersonLink

AttributedTo returns ALL AttributedTo records for this stream

func (Stream) Author

func (w Stream) Author() model.PersonLink

Author returns the "first" AttributedTo record for this stream

func (Stream) BasePath

func (w Stream) BasePath() string

func (Stream) Breadcrumbs

func (w Stream) Breadcrumbs() ([]model.StreamSummary, error)

func (Stream) CanCreate

func (w Stream) CanCreate() []form.LookupCode

CanCreate returns all of the templates that can be created underneath the current stream.

func (Stream) Children

func (w Stream) Children() QueryBuilder[model.StreamSummary]

Children returns all Streams with a "parent" is the current Stream

func (Stream) ContentHTML

func (w Stream) ContentHTML() template.HTML

Returns the body content as an HTML template

func (Stream) ContentRaw

func (w Stream) ContentRaw() string

func (Stream) CreateDate

func (w Stream) CreateDate() int64

CreateDate returns the CreateDate of the stream being builded

func (Stream) Data

func (w Stream) Data(value string) any

Data returns the custom data map of the stream being builded

func (Stream) Document

func (w Stream) Document() model.DocumentLink

Document returns the DocumentLink record for this stream

func (Stream) FirstChild

func (w Stream) FirstChild(sort string, action string) (Stream, error)

FirstChild returns the first child Stream underneath this one, based on the provided sort field

func (Stream) Following

func (w Stream) Following() ([]model.Following, error)

func (Stream) HasParent

func (w Stream) HasParent() bool

HasParent returns TRUE if the stream being builded has a parend objec

func (Stream) ImageURL

func (w Stream) ImageURL() string

ImageURL returns the thumbnail image URL of the stream being builded

func (Stream) InReplyTo

func (w Stream) InReplyTo() streams.Document

InReplyTo returns an ActivityStream reference to the URL that this stream replies to

func (Stream) IsCurrentStream

func (w Stream) IsCurrentStream() bool

func (Stream) IsEmpty

func (w Stream) IsEmpty() bool

IsEmpty returns TRUE if the stream is an empty placeholder.

func (Stream) IsNew

func (w Stream) IsNew() bool

IsNew returns TRUE if this stream has not been saved to the database

func (Stream) IsReply

func (w Stream) IsReply() bool

IsReply returns TRUE if this stream is marked as a reply to another stream or resource

func (Stream) Label

func (w Stream) Label() string

Label returns the Label for the stream being builded

func (Stream) LastChild

func (w Stream) LastChild(sort string, action string) (Stream, error)

FirstChild returns the first child Stream underneath this one, based on the provided sort field

func (Stream) LikesBefore

func (w Stream) LikesBefore(dateString string, maxRows int) sliceof.Object[streams.Document]

func (Stream) ListAllWidgets

func (w Stream) ListAllWidgets() []form.LookupCode

ListAllWidgets returns a list of all the widgets available on this server

func (Stream) ListWidgetsByLocation

func (w Stream) ListWidgetsByLocation(location string) []model.StreamWidget

ListWidgetsByLocation returns a list of all the widgets in the specified location

func (Stream) Mentions

func (w Stream) Mentions() ([]model.Mention, error)

Mentions returns a slice of all Mentions for this Stream

func (Stream) NavigationID

func (w Stream) NavigationID() string

NavigationID returns the unique ID of the top-level stream in this stream's hierarchy

func (Stream) NextSibling

func (w Stream) NextSibling(sortField string, action string) (Stream, error)

NextSibling returns the sibling Stream that immediately follows this one, based on the provided sort field

func (Stream) PageTitle

func (w Stream) PageTitle() string

PageTitle returns the Label for the stream being builded

func (Stream) Parent

func (w Stream) Parent(actionID string) (Stream, error)

Parent returns a Stream containing the parent of the current stream

func (Stream) ParentID

func (w Stream) ParentID() string

StreamID returns the unique ID for the stream being builded

func (w Stream) Permalink() string

Permalink returns a complete URL for this stream

func (Stream) PrevSibling

func (w Stream) PrevSibling(sortField string, action string) (Stream, error)

PrevSibling returns the sibling Stream that immediately preceeds this one, based on the provided sort field

func (Stream) PublishDate

func (w Stream) PublishDate() int64

PublishDate returns the PublishDate of the stream being builded

func (Stream) Rank

func (w Stream) Rank() int

Rank returns the Rank of the stream being builded

func (Stream) Render

func (w Stream) Render() (template.HTML, error)

Render generates the string value for this Stream

func (Stream) RepliesAfter

func (w Stream) RepliesAfter(dateString string, maxRows int) sliceof.Object[streams.Document]

func (Stream) RepliesBefore

func (w Stream) RepliesBefore(dateString string, maxRows int) sliceof.Object[streams.Document]

RepliesBefore returns a slice of all ActivityStreams before the specified date

func (Stream) Roles

func (w Stream) Roles() []string

func (Stream) ShortSummary

func (w Stream) ShortSummary() string

SummarySummary returns a plaintext summary (<200 characters) of the stream's description

func (Stream) Siblings

func (w Stream) Siblings() QueryBuilder[model.StreamSummary]

Siblings returns all Streams that have the same "parent" as the current Stream

func (Stream) StateID

func (w Stream) StateID() string

StateID returns the current state of the stream being builded

func (Stream) StreamID

func (w Stream) StreamID() string

StreamID returns the unique ID for the stream being builded

func (Stream) Summary

func (w Stream) Summary() string

Summary returns the description of the stream being builded

func (Stream) SummaryHTML

func (w Stream) SummaryHTML() template.HTML

SummaryHTML returns the description of the stream being builded

func (Stream) TemplateID

func (w Stream) TemplateID() string

TemplateID returns the name of the template being used

func (Stream) Token

func (w Stream) Token() string

Token returns the unique URL token for the stream being builded

func (Stream) UpdateDate

func (w Stream) UpdateDate() int64

UpdateDate returns the UpdateDate of the stream being builded

func (Stream) UserCan

func (w Stream) UserCan(actionID string) bool

UserCan returns TRUE if this Request is authorized to access the requested view

func (Stream) View

func (w Stream) View(actionID string) (template.HTML, error)

View executes a separate view for this Stream

func (Stream) Widgets

func (w Stream) Widgets(location string) (template.HTML, error)

Widgets returns HTML for all the widgets in the specified location

type TemplateLike

type TemplateLike interface {
	Execute(wr io.Writer, data interface{}) error
}

type User

type User struct {
	Common
	// contains filtered or unexported fields
}

User is a builder for the admin/users page It can only be accessed by a Domain Owner

func NewUser

func NewUser(factory Factory, request *http.Request, response http.ResponseWriter, template model.Template, user *model.User, actionID string) (User, error)

NewUser returns a fully initialized `User` builder.

func (User) AssignedGroups

func (w User) AssignedGroups() ([]model.Group, error)

AssignedGroups lists all groups to which the current user is assigned.

func (User) BasePath

func (w User) BasePath() string

func (User) DisplayName

func (w User) DisplayName() string

func (User) ImageURL

func (w User) ImageURL() string

func (User) Label

func (w User) Label() string

func (User) NavigationID

func (w User) NavigationID() string

func (User) PageTitle

func (w User) PageTitle() string
func (w User) Permalink() string

func (User) Render

func (w User) Render() (template.HTML, error)

Render generates the string value for this User

func (User) SignupForm

func (w User) SignupForm() model.SignupForm

func (User) Token

func (w User) Token() string

func (User) UserID

func (w User) UserID() string

func (User) Users

func (w User) Users() *QueryBuilder[model.UserSummary]

func (User) View

func (w User) View(actionID string) (template.HTML, error)

View executes a separate view for this User

type Widget

type Widget struct {
	Widget model.StreamWidget
	*Stream
}

Widget builder is created by the "with-widget" action, and can execute additional action steps on a widget that is embedded in a stream. To save the final result, you must call "save" on the stream itself, not within this widget.

func NewWidget

func NewWidget(builder *Stream, widget model.StreamWidget) Widget

Source Files

Jump to

Keyboard shortcuts

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