handlers

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2022 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = &ErrResponse{HTTPStatusCode: 404, StatusText: "Resource not found."}

ErrNotFound is a 404 convenience variable

Functions

func DeleteDataset added in v0.2.0

func DeleteDataset(w http.ResponseWriter, r *http.Request)

func EADDownload

func EADDownload(w http.ResponseWriter, r *http.Request)

EADDownload is a handler that returns a stored XML for an EAD Archive

func EADMeta added in v0.1.10

func EADMeta(w http.ResponseWriter, r *http.Request)

func ErrInvalidRequest

func ErrInvalidRequest(err error) render.Renderer

ErrInvalidRequest returns an Invalid Request Response

func ErrRender

func ErrRender(err error) render.Renderer

ErrRender creates an error response

func GetScrollResult

func GetScrollResult(w http.ResponseWriter, r *http.Request)

func GetSearchRecord added in v0.2.1

func GetSearchRecord(ctx context.Context, id string) (*fragments.FragmentGraph, error)

func NewPrometheuusMiddleware

func NewPrometheuusMiddleware(name string, buckets ...float64) *prometheusMiddleware

NewMiddleware returns a new prometheus Middleware handler.

func PDFDownload

func PDFDownload(w http.ResponseWriter, r *http.Request)

PDFDownload is a handler that returns a stored PDF for an EAD Archive

func ProcessSearchRequest

func ProcessSearchRequest(w http.ResponseWriter, r *http.Request, searchRequest *fragments.SearchRequest)

func RegisterContentStats

func RegisterContentStats(r chi.Router)

func RegisterDatasets

func RegisterDatasets(router chi.Router)

func RegisterEAD

func RegisterEAD(r chi.Router)

func RegisterElasticSearchProxy

func RegisterElasticSearchProxy(router chi.Router)

func RegisterIntrospection

func RegisterIntrospection(r chi.Router)

IntrospectionRouter gives access to the configuration at runtime when debug mode is enabled.

func RegisterLOD

func RegisterLOD(r chi.Router)

func RegisterLinkedDataFragments

func RegisterLinkedDataFragments(router chi.Router)

func RegisterMetrics

func RegisterMetrics(r chi.Router)

func RegisterSearch

func RegisterSearch(router chi.Router)

func RegisterSparql

func RegisterSparql(r chi.Router)

func RenderLODResource

func RenderLODResource(w http.ResponseWriter, r *http.Request)

RenderLODResource returns a list of matching fragments for a LOD resource. This mimicks a SPARQL describe request

func TreeDescriptionAPI

func TreeDescriptionAPI(w http.ResponseWriter, r *http.Request)

func TreeDescriptionSearch added in v0.1.10

func TreeDescriptionSearch(w http.ResponseWriter, r *http.Request)

func TreeList

func TreeList(w http.ResponseWriter, r *http.Request)

Types

type APIErrorMessage

type APIErrorMessage struct {
	HTTPStatus int    `json:"code"`
	Message    string `json:"type"`
	Error      error  `json:"error"`
}

APIErrorMessage contains the default API error messages

type EchoSearchRequest added in v0.2.1

type EchoSearchRequest struct {
	ScrollPager *fragments.ScrollPager
	// contains filtered or unexported fields
}

func NewEchoSearchRequest added in v0.2.1

func NewEchoSearchRequest(
	r *http.Request,
	searchRequest *fragments.SearchRequest,
	searchService *elastic.SearchService,
	searchResult *elastic.SearchResult,

) *EchoSearchRequest

func (*EchoSearchRequest) HasEcho added in v0.2.1

func (e *EchoSearchRequest) HasEcho() bool

func (*EchoSearchRequest) RenderEcho added in v0.2.1

func (e *EchoSearchRequest) RenderEcho(w http.ResponseWriter) error

type ErrResponse

type ErrResponse struct {
	Err            error `json:"-"` // low-level runtime error
	HTTPStatusCode int   `json:"-"` // http response status code

	StatusText string `json:"status"`          // user-level status message
	AppCode    int64  `json:"code,omitempty"`  // application-specific error code
	ErrorText  string `json:"error,omitempty"` // application-level error message, for debugging
}

ErrResponse renderer type for handling all sorts of errors.

In the best case scenario, the excellent github.com/pkg/errors package helps reveal information on the error, setting it on Err, and in the Render() method, using it to set the application-specific error code in AppCode.

func (*ErrResponse) Render

func (e *ErrResponse) Render(w http.ResponseWriter, r *http.Request) error

Render renders the ErrResponse

type ErrorMessage

type ErrorMessage struct {
	Status  string `json:"status"`
	Message string `json:"message"`
}

ErrorMessage is a placeholder for disabled endpoints

type OldBulkProcessor added in v0.1.8

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

func NewOldBulkProcessor added in v0.1.8

func NewOldBulkProcessor() *OldBulkProcessor

func (OldBulkProcessor) Publish added in v0.1.8

func (bp OldBulkProcessor) Publish(ctx context.Context, msg ...*domainpb.IndexMessage) error

Jump to

Keyboard shortcuts

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