api

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: MIT Imports: 17 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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