Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
asContextMaker is a hannibal.Streams middleware that adds a "context" property to all documents based on their "InReplyTo" property. If a document does not have a context or inReplyTo, then it is its own context, and is updated to reflect that.
func New ¶
func New(innerClient streams.Client, options ...ClientOption) Client
New creates a new instance of asContextMaker
func (Client) IsAllowed ¶
func (client Client) IsAllowed(uri string, config LoadConfig) bool
IsAllowed returns TRUE if the client rules allow the provided URI to be loaded
func (Client) Load ¶
Load implements the streams.Client interface, and loads a document from the Interwebs. This method passes *most* work on to its innerClient, but does some extra work to add a "context" property to each document that passes it.
func (Client) NotAllowed ¶
func (client Client) NotAllowed(uri string, config LoadConfig) bool
NotAllowed returns TRUE if the client rules DO NOT allow the provided URI to be loaded
func (*Client) With ¶
func (client *Client) With(options ...ClientOption)
type ClientOption ¶
type ClientOption func(*Client)
func WithMaxDepth ¶
func WithMaxDepth(maxDepth int) ClientOption
WithMaxDepth sets the maximum number of replies that the context maker will follow before giving up. (Default is 16)
type LoadConfig ¶
type LoadConfig struct {
// contains filtered or unexported fields
}
LoadConfig contains optional settings for the Load() method
func NewLoadConfig ¶
func NewLoadConfig(options ...any) LoadConfig
NewLoadConfig creates a new LoadConfig object with corresponding options
func (*LoadConfig) With ¶
func (config *LoadConfig) With(options ...any)
With applies options to the LoadConfig IF they are ascontextmaker.LoadOption
type LoadOption ¶
type LoadOption func(*LoadConfig)
LoadOption is a function that modifies the default behavior of the LoadConfig
func WithHistory ¶
func WithHistory(uris ...string) LoadOption
WithHistory adds a URI into the load history. This is used to prevent infinite loops when loading documents.