comments

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2021 License: ISC Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EventTypeNew is emitted when a new comment is made.
	EventTypeNew = "comments-new"
)

Variables

This section is empty.

Functions

func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by default until either UseLogger or SetLogWriter are called.

func UseLogger

func UseLogger(logger slog.Logger)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using slog.

Types

type Comments

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

Comments is the context for the comments API.

func New

func New(cfg *config.Config, pdc *pdclient.Client, udb user.Database, s *sessions.Sessions, e *events.Manager, plugins []pdv2.Plugin) (*Comments, error)

New returns a new Comments context.

func (*Comments) HandleComments

func (c *Comments) HandleComments(w http.ResponseWriter, r *http.Request)

HandleComments is the request handler for the comments v1 Comments route.

func (*Comments) HandleCount

func (c *Comments) HandleCount(w http.ResponseWriter, r *http.Request)

HandleCount is the request handler for the comments v1 Count route.

func (*Comments) HandleDel

func (c *Comments) HandleDel(w http.ResponseWriter, r *http.Request)

HandleDel is the request handler for the comments v1 Del route.

func (*Comments) HandleNew

func (c *Comments) HandleNew(w http.ResponseWriter, r *http.Request)

HandleNew is the request handler for the comments v1 New route.

func (*Comments) HandlePolicy

func (c *Comments) HandlePolicy(w http.ResponseWriter, r *http.Request)

HandlePolicy is the request handler for the comments v1 Policy route.

func (*Comments) HandleTimestamps

func (c *Comments) HandleTimestamps(w http.ResponseWriter, r *http.Request)

HandleTimestamps is the request handler for the comments v1 Timestamps route.

func (*Comments) HandleVote

func (c *Comments) HandleVote(w http.ResponseWriter, r *http.Request)

HandleVote is the request handler for the comments v1 Vote route.

func (*Comments) HandleVotes

func (c *Comments) HandleVotes(w http.ResponseWriter, r *http.Request)

HandleVotes is the request handler for the comments v1 Votes route.

type EventNew

type EventNew struct {
	State   v1.RecordStateT
	Comment v1.Comment
}

EventNew is the event data for the EventTypeNew.

Jump to

Keyboard shortcuts

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