api

package
v0.0.0-...-7b9de4d Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2025 License: GPL-3.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoAcceptableContentType = errors.New("no acceptable content type")

ErrNoAcceptableContentType is returned when the request does not have an acceptable Content-Type OR Accept header.

View Source
var ErrNotBearerAuth = errors.New("not a bearer authentication token")
View Source
var Module = fx.Module("api",
	fx.Decorate(func(slog *slog.Logger) *slog.Logger {
		return slog.With("module", "api")
	}),
	fx.Provide(
		NewServer,
		NewAuthenticator,
		newOpenAPIHandler,
		newOpenAPIHandlerForImportExport,

		(*Authenticator).AuthenticationFunc,

		(*openAPIHandlerForImportExport).asHandler,
	),
)

Functions

This section is empty.

Types

type Authenticator

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

Authenticator is an authenticator that authenticates requests.

func NewAuthenticator

func NewAuthenticator(users *user.UserService) *Authenticator

NewAuthenticator creates a new authenticator.

func (*Authenticator) AuthenticationFunc

func (a *Authenticator) AuthenticationFunc() openapi3filter.AuthenticationFunc

type OpenAPIHandlerServices

type OpenAPIHandlerServices struct {
	fx.In

	Users             *user.UserService
	Notification      notification.NotificationService
	UserNotifications notification.UserNotificationService
	Dosage            dosage.DosageStorage
	DoseHistory       dosage.DoseHistoryStorage
}

OpenAPIHandlerServices is the set of service dependencies required by the OpenAPIHandler.

type Server

type Server struct {
}

Server provides an HTTP server that serves a [Handler].

func NewServer

func NewServer(
	lx fx.Lifecycle,
	inputs ServerInputs,
	config e2clickermodule.API,
	logger *slog.Logger,
) (*Server, error)

NewServer creates a new HTTP server.

type ServerInputs

type ServerInputs struct {
	fx.In

	Handler       openapi.ServerInterface
	Authenticator openapi3filter.AuthenticationFunc
}

ServerInputs is a set of dependencies required by the Server.

Directories

Path Synopsis
Package openapi provides primitives to interact with the openapi HTTP API.
Package openapi provides primitives to interact with the openapi HTTP API.

Jump to

Keyboard shortcuts

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