api

package
v0.0.0-...-3fe7dee Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Code generated by gen_pages_const; DO NOT EDIT.

Index

Constants

View Source
const (
	URLParamHabitID = "habitID"
)

Variables

This section is empty.

Functions

func ListPages

func ListPages() []string

ListPages returns a list of page names in the templates directory.

Types

type Authenticator

type Authenticator interface {
	Authenticate(ctx context.Context, session string) (context.Context, error)
	DeleteUser(ctx context.Context, uid auth.UserID) error
	GetUser(ctx context.Context, uid auth.UserID) (*firebase.UserRecord, error)
	SessionCookie(ctx context.Context, idToken string) (string, error)
}

type DynamoRepository

type DynamoRepository interface {
	AllArchivedHabits(ctx context.Context, uid auth.UserID) ([]*repository.DynamoHabit, error)
	AllHabits(ctx context.Context, uid auth.UserID) ([]*repository.DynamoHabit, error)
	ArchiveHabit(ctx context.Context, uid auth.UserID, hid string) error
	CreateCheck(ctx context.Context, uid auth.UserID, hid, date string) (*repository.DynamoCheck, error)
	CreateHabit(ctx context.Context, uid auth.UserID, title string) (*repository.DynamoHabit, error)
	DeleteCheck(ctx context.Context, uid auth.UserID, hid, date string) error
	DeleteHabit(ctx context.Context, uid auth.UserID, hid string) error
	FindArchivedHabit(ctx context.Context, uid auth.UserID, hid string) (*repository.DynamoHabit, error)
	FindHabit(ctx context.Context, uid auth.UserID, hid string) (*repository.DynamoHabit, error)
	ListLastWeekChecksInAllHabits(ctx context.Context, uid auth.UserID) ([]*repository.DynamoCheck, error)
	ListLatestChecksWithLimit(ctx context.Context, uid auth.UserID, hid string, limit int32) ([]*repository.DynamoCheck, error)
	UnarchiveHabit(ctx context.Context, uid auth.UserID, hid string) error
	UpdateHabit(ctx context.Context, in *repository.DynamoRepositoryUpdateHabitInput) error
}

type HTTPHandler

type HTTPHandler struct {
	Authenticator Authenticator
	Repository    DynamoRepository
	Secure        bool
	// contains filtered or unexported fields
}

func NewHTTPHandler

func NewHTTPHandler(in *NewHTTPHandlerInput) *HTTPHandler

func (*HTTPHandler) ServeHTTP

func (h *HTTPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Middleware

type Middleware func(next http.Handler) http.Handler

func NewAuthMiddleware

func NewAuthMiddleware(authenticator *auth.FirebaseAuthenticator) Middleware

func NewCSRFMiddleware

func NewCSRFMiddleware(key []byte, secure bool) Middleware

type NewHTTPHandlerInput

type NewHTTPHandlerInput struct {
	AuthMiddleware Middleware
	CSRFMiddleware Middleware
	Authenticator  Authenticator
	Repository     DynamoRepository
	Secure         bool
}

type TypeTemplatePage

type TypeTemplatePage string
const TemplatePageHabit TypeTemplatePage = "habit.html"
const TemplatePageLogin TypeTemplatePage = "login.html"
const TemplatePageTop TypeTemplatePage = "top.html"

Directories

Path Synopsis
gen

Jump to

Keyboard shortcuts

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