api

package
v0.0.0-...-9752a96 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2025 License: MIT, MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const GinContextKey = "gin_context"

Variables

This section is empty.

Functions

func CheckModerationVariables

func CheckModerationVariables(config *model.Config) error

func GetGinContext

func GetGinContext(ctx context.Context) *gin.Context

func GetServer

func GetServer(db *abstraction.Database, config *model.Config) (*gin.Engine, error)

func LoggerMiddleware

func LoggerMiddleware() gin.HandlerFunc

func NormalizePath

func NormalizePath(input string) string

NormalizePath adds a missing slash at the front or the end of given input path

func ShortenAuthor

func ShortenAuthor(input string, allowedLength int) string

ShortenAuthor shortens the author name to an acceptable lenght, suffixing it with ...

Types

type CreateCommentInput

type CreateCommentInput struct {
	Body model.CreateCommentBody
}

type CreateCommentOutput

type CreateCommentOutput struct {
	Body model.CreateCommentResponse
}

type DeleteCommentInput

type DeleteCommentInput struct {
	Body model.DeleteCommentBody
}

type GetAdminConfigOutput

type GetAdminConfigOutput struct {
	Body configModel.AdminConfig
}

type GetAllCommentsOutput

type GetAllCommentsOutput struct {
	Body []dbModel.Comment
}

type GetAllThreadsOutput

type GetAllThreadsOutput struct {
	Body []dbModel.Thread
}

type GetClientConfigOutput

type GetClientConfigOutput struct {
	Body configModel.ClientConfig
}

type GetCommentsInput

type GetCommentsInput struct {
	Uri string `query:"uri" doc:"The thread URI"`
}

type GetCommentsOutput

type GetCommentsOutput struct {
	Body   []dbModel.Comment
	XCache string `header:"X-Cache"`
}

type LoginInput

type LoginInput struct {
	Body model.LoginBody
}

type Router

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

func New

func New(db *abstraction.Database, config *configModel.Config, cache *cache.Cache) *Router

func (*Router) CreateComment

func (r *Router) CreateComment(ctx context.Context, input *CreateCommentInput) (*CreateCommentOutput, error)

func (*Router) DeleteComment

func (r *Router) DeleteComment(ctx context.Context, input *DeleteCommentInput) (*struct{}, error)

func (*Router) GetAdminConfig

func (r *Router) GetAdminConfig(ctx context.Context, input *struct{}) (*GetAdminConfigOutput, error)

func (*Router) GetAllComments

func (r *Router) GetAllComments(ctx context.Context, input *struct{}) (*GetAllCommentsOutput, error)

func (*Router) GetAllThreads

func (r *Router) GetAllThreads(ctx context.Context, input *struct{}) (*GetAllThreadsOutput, error)

func (*Router) GetClientConfig

func (r *Router) GetClientConfig(ctx context.Context, input *struct{}) (*GetClientConfigOutput, error)

func (*Router) GetComments

func (r *Router) GetComments(ctx context.Context, input *GetCommentsInput) (*GetCommentsOutput, error)

func (*Router) Login

func (r *Router) Login(ctx context.Context, input *LoginInput) (*struct{}, error)

func (*Router) OAuth

func (r *Router) OAuth(c *gin.Context)

func (*Router) OAuthCallback

func (r *Router) OAuthCallback(c *gin.Context)

func (*Router) RegisterHumaRoutes

func (r *Router) RegisterHumaRoutes(api huma.API, limitMiddleware func(huma.Context, func(huma.Context)))

func (*Router) RestoreDeletedComment

func (r *Router) RestoreDeletedComment(ctx context.Context, input *DeleteCommentInput) (*struct{}, error)

func (*Router) SetProviders

func (r *Router) SetProviders(input map[string]*provider.Provider)

func (*Router) Status

func (r *Router) Status(ctx context.Context, input *struct{}) (*StatusOutput, error)

func (*Router) UpdateComment

func (r *Router) UpdateComment(ctx context.Context, input *UpdateCommentInput) (*struct{}, error)

type StatusOutput

type StatusOutput struct {
	Body struct {
		Message string `json:"message"`
	}
}

type UnmoderatedFs

type UnmoderatedFs struct {
	http.FileSystem
}

UnmoderatedFs a file system we use to serve only the client.js

func (UnmoderatedFs) Exists

func (cfs UnmoderatedFs) Exists(prefix string, filepath string) bool

Exists determines if the file exists or not

type UpdateCommentInput

type UpdateCommentInput struct {
	Body model.UpdateCommentBody
}

Directories

Path Synopsis
Package model contains the model definitions for mouthful API response and request types.
Package model contains the model definitions for mouthful API response and request types.

Jump to

Keyboard shortcuts

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