example

package
v1.91.0-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDocsAPI = errs.Class("example docs api")
View Source
var ErrUsersAPI = errs.Class("example users api")

Functions

This section is empty.

Types

type DocumentsHandler added in v1.87.1

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

DocumentsHandler is an api handler that implements all Documents API endpoints functionality.

func NewDocuments added in v1.87.1

func NewDocuments(log *zap.Logger, mon *monkit.Scope, service DocumentsService, router *mux.Router, auth api.Auth) *DocumentsHandler

type DocumentsService added in v1.87.1

type DocumentsService interface {
	Get(ctx context.Context) ([]struct {
		ID             uuid.UUID      "json:\"id\""
		Path           string         "json:\"path\""
		Date           time.Time      "json:\"date\""
		Metadata       myapi.Metadata "json:\"metadata\""
		LastRetrievals []struct {
			User string    "json:\"user\""
			When time.Time "json:\"when\""
		} "json:\"last_retrievals\""
	}, api.HTTPError)
	GetOne(ctx context.Context, path string) (*myapi.Document, api.HTTPError)
	GetTag(ctx context.Context, path, tagName string) (*[2]string, api.HTTPError)
	GetVersions(ctx context.Context, path string) ([]myapi.Version, api.HTTPError)
	UpdateContent(ctx context.Context, path string, id uuid.UUID, date time.Time, request struct {
		Content string "json:\"content\""
	}) (*struct {
		ID        uuid.UUID "json:\"id\""
		Date      time.Time "json:\"date\""
		PathParam string    "json:\"pathParam\""
		Body      string    "json:\"body\""
	}, api.HTTPError)
}

type UsersHandler added in v1.90.1

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

UsersHandler is an api handler that implements all Users API endpoints functionality.

func NewUsers added in v1.90.1

func NewUsers(log *zap.Logger, mon *monkit.Scope, service UsersService, router *mux.Router, auth api.Auth) *UsersHandler

type UsersService added in v1.90.1

type UsersService interface {
	Get(ctx context.Context) ([]struct {
		Name    string "json:\"name\""
		Surname string "json:\"surname\""
		Email   string "json:\"email\""
	}, api.HTTPError)
	Create(ctx context.Context, request []struct {
		Name    string "json:\"name\""
		Surname string "json:\"surname\""
		Email   string "json:\"email\""
	}) api.HTTPError
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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