http

package
v1.12.6 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: MIT Imports: 32 Imported by: 0

Documentation

Overview

Package http DocumentManager API.

The purpose of this application is to provide an api to store uploaded PDFs as images and serve them to various frontends

Terms Of Service:

there are no TOS at this moment, use at your own risk we take no responsibility

Schemes: http
Host: localhost
BasePath: /api
Version: 0.0.1

Consumes:
- application/json
- multipart/form-data

Produces:
- application/json

swagger:meta

Index

Constants

This section is empty.

Variables

View Source
var ErrNoEtagHeader = errors.New("no If-Match header found")
View Source
var (
	PathPrefix = "/api"
)

Functions

func EtagFromHeader

func EtagFromHeader(header http.Header) (time.Time, error)

func SetURLForRecord

func SetURLForRecord(record *api.Record, url url.URL) interface{}

func SetURLForRecordList

func SetURLForRecordList(records []api.Record, url url.URL) interface{}

func URLParamFromContext

func URLParamFromContext(ctx context.Context, key string) string

Types

type ArchiveController

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

func (*ArchiveController) One

type BinaryResponse

type BinaryResponse struct {
	Response
	Data []byte
}

BinaryResponse extends Response with a binary data payload.

func NewBinaryResponseWithStatus

func NewBinaryResponseWithStatus(writer http.ResponseWriter, data []byte, code int) *BinaryResponse

func (*BinaryResponse) SetContentTypeFromExtension

func (r *BinaryResponse) SetContentTypeFromExtension(ex string) *BinaryResponse

func (*BinaryResponse) Write

func (r *BinaryResponse) Write()

type CategoryController

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

func (*CategoryController) All

func (controller *CategoryController) All(w http.ResponseWriter, req *http.Request)

func (*CategoryController) Create

func (controller *CategoryController) Create(w http.ResponseWriter, req *http.Request)

func (*CategoryController) Find

func (controller *CategoryController) Find(w http.ResponseWriter, req *http.Request)

func (*CategoryController) Router

func (controller *CategoryController) Router() http.Handler

func (*CategoryController) Update

func (controller *CategoryController) Update(w http.ResponseWriter, req *http.Request)

type Client

type Client struct {
	Name string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(session *melody.Session) *Client

type ControllerOption

type ControllerOption = func(rootMux *chi.Mux)

func WithArchiveController

func WithArchiveController(archiveService storage.ResourceLocator) ControllerOption

func WithCategoryController

func WithCategoryController(service datastore.CategoryService) ControllerOption

func WithCounterController

func WithCounterController(counter datastore.Counter) ControllerOption

func WithExportController

func WithExportController(recordService datastore.RecordService, pdfCreator pdf.Creator) ControllerOption

func WithHealthController

func WithHealthController(healthService *status.HealthService) ControllerOption

func WithNotificationController

func WithNotificationController(eventService event.Subscriber) ControllerOption

func WithPatientController

func WithPatientController(recordService datastore.RecordService, imageService storage.ImageService, categoryService datastore.CategoryService, tagService datastore.TagService) ControllerOption

func WithRecordController

func WithRecordController(recordService datastore.RecordService, imageService storage.ImageService, archiveService storage.ArchiveService, pdfProcessor pdf.Processor) ControllerOption

func WithStatisticController

func WithStatisticController(statisticsService *status.StatisticsService) ControllerOption

func WithTagController

func WithTagController(tagService datastore.TagService) ControllerOption

type DataResponse

type DataResponse struct {
	Response
	Data interface{}
}

DataResponse extends Response a generic payload.

func NewResponse

func NewResponse(writer http.ResponseWriter, data interface{}) *DataResponse

func NewResponseWithStatus

func NewResponseWithStatus(writer http.ResponseWriter, data interface{}, code int) *DataResponse

func (*DataResponse) SetEtag

func (r *DataResponse) SetEtag(etag ETag) *DataResponse

func (*DataResponse) WriteJSON

func (r *DataResponse) WriteJSON()

type ETag

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

func NewEtag

func NewEtag(t time.Time) ETag

func (ETag) Header

func (e ETag) Header() (string, string)

func (ETag) String

func (e ETag) String() string

type ErrorResponse

type ErrorResponse struct {
	Response
	Error string
}

ErrorResponse indicates an error and provides the error message.

func NewErrorResponse

func NewErrorResponse(writer http.ResponseWriter, err error, code int) *ErrorResponse

func (*ErrorResponse) WriteJSON

func (r *ErrorResponse) WriteJSON()

type ExporterController

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

func (*ExporterController) Export

func (t *ExporterController) Export(w http.ResponseWriter, req *http.Request)

type HealthController

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

func (*HealthController) Status

func (h *HealthController) Status(w http.ResponseWriter, req *http.Request)

type PatientController

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

func (*PatientController) Categories

func (controller *PatientController) Categories(w http.ResponseWriter, req *http.Request)

func (*PatientController) Records

func (controller *PatientController) Records(w http.ResponseWriter, req *http.Request)

func (*PatientController) Router

func (controller *PatientController) Router() http.Handler

func (*PatientController) Tags

func (controller *PatientController) Tags(w http.ResponseWriter, req *http.Request)

type RecordController

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

func (*RecordController) All

func (controller *RecordController) All(w http.ResponseWriter, req *http.Request)

func (*RecordController) Append

func (controller *RecordController) Append(w http.ResponseWriter, req *http.Request)

func (*RecordController) Create

func (controller *RecordController) Create(w http.ResponseWriter, req *http.Request)

func (*RecordController) Delete

func (controller *RecordController) Delete(w http.ResponseWriter, req *http.Request)

func (*RecordController) Duplicate

func (controller *RecordController) Duplicate(w http.ResponseWriter, req *http.Request)

func (*RecordController) One

func (controller *RecordController) One(w http.ResponseWriter, req *http.Request)

func (*RecordController) Page

func (controller *RecordController) Page(w http.ResponseWriter, req *http.Request)

func (*RecordController) Reset

func (controller *RecordController) Reset(w http.ResponseWriter, req *http.Request)

func (*RecordController) Router

func (controller *RecordController) Router() http.Handler

func (*RecordController) Update

func (controller *RecordController) Update(w http.ResponseWriter, req *http.Request)

Update updates a Records It supports an If-Modified header containing the Etag received from a previous request

func (*RecordController) UpdatePages

func (controller *RecordController) UpdatePages(w http.ResponseWriter, req *http.Request)

type Response

type Response struct {
	StatusCode int
	// contains filtered or unexported fields
}

Response serves as the base and most generic form of response

func (*Response) SetEtag

func (r *Response) SetEtag(etag ETag) *Response

func (*Response) Write

func (r *Response) Write()

type Server

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

func NewServer

func NewServer(serviceName string, options ...ControllerOption) *Server

func (*Server) Run

func (s *Server) Run(port string) error

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

type StatisticsController

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

func (*StatisticsController) Statistics

func (h *StatisticsController) Statistics(w http.ResponseWriter, req *http.Request)

type TagController

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

func (*TagController) All

func (t *TagController) All(w http.ResponseWriter, req *http.Request)

type WebsocketController

type WebsocketController struct {
	Subscriber event.Subscriber
}

type WebsocketService

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

func NewWebSocketService

func NewWebSocketService() *WebsocketService

func (*WebsocketService) AddClient

func (ws *WebsocketService) AddClient(client *Client)

func (*WebsocketService) GetClient

func (ws *WebsocketService) GetClient(session *melody.Session) *Client

func (*WebsocketService) RemoveClient

func (ws *WebsocketService) RemoveClient(session *melody.Session)

Jump to

Keyboard shortcuts

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