api

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QuerySpotlightFlag int = 1 << iota // powers of 2, for combining bit flags

	// Publications:
	QueryArticlesFlag
	QueryBulletinsFlag
	QueryMethodologiesFlag
	QueryMethodologyArticlesFlag

	// Datasets:
	QueryStaticDatasetsFlag
	QueryTimeseriesFlag
)

Flag values for a query type:

Variables

This section is empty.

Functions

func ReadJSONBody added in v0.3.0

func ReadJSONBody(ctx context.Context, body io.ReadCloser, v interface{}, w http.ResponseWriter, data log.Data) error

ReadJSONBody reads the bytes from the provided body, and marshals it to the provided model interface.

func WriteJSONBody added in v0.3.0

func WriteJSONBody(ctx context.Context, v interface{}, w http.ResponseWriter, data log.Data) error

WriteJSONBody marshals the provided interface into json, and writes it to the response body.

Types

type API

type API struct {
	Router *mux.Router
	// contains filtered or unexported fields
}

API provides a struct to wrap the api around

func Setup

func Setup(ctx context.Context, cfg *config.Config, router *mux.Router, dataStore store.DataStore, permissions AuthHandler, topicAPIURL string) *API

Setup function sets up the api and returns an api

type AuthHandler added in v0.2.0

type AuthHandler interface {
	Require(required auth.Permissions, handler http.HandlerFunc) http.HandlerFunc
}

AuthHandler provides authorisation checks on requests

Jump to

Keyboard shortcuts

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