handler

package
v0.0.0-...-bd94320 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DocumentsController

type DocumentsController interface {
	UploadDocument(ctx context.Context, meta models.Metadata, file io.Reader) error
	GetFilesInfo(
		ctx context.Context,
		userID uuid.UUID,
		filesListRequest models.FilesListRequest,
	) ([]models.Metadata, error)
	GetFileInfo(ctx context.Context, id, userID uuid.UUID) (models.Metadata, error)
	GetFile(Ctx context.Context, meta models.Metadata) (io.ReadSeekCloser, error)
	DeleteFile(ctx context.Context, id, userID uuid.UUID) error
}

type Handler

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

func New

func New(settings Settings) *Handler

func (*Handler) ServeHTTP

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

type Settings

type Settings struct {
	JWTResolver       *jwtresolver.JWTResolver
	UserCtrl          UserController
	DocumentsCtrl     DocumentsController
	MaxUploadFileSize int64
}

type UserController

type UserController interface {
	// Returns jwt token with user ID or error if user creation failed.
	// Must be called with valid credentials with non-empty login, password and token.
	Register(ctx context.Context, credentials models.Credentials) (string, error)

	// Login returns jwt token with user ID or error if login failed.
	// Must be called with valid credentials with non-empty login and password.
	Login(ctx context.Context, credentials models.Credentials) (string, error)
}

UserController used to register and login users.

Jump to

Keyboard shortcuts

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