api

package
v0.0.0-...-8bc0a93 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteBody

func WriteBody(ctx context.Context, w http.ResponseWriter, entity interface{}, status int)

Types

type API

type API struct {
	Store  DataStore
	Router *mux.Router
}

API provides a struct to wrap the api around

func Setup

func Setup(ctx context.Context, r *mux.Router, auth Authenticator, client DataStore) *API

func (*API) BuildFullHierarchy

func (api *API) BuildFullHierarchy() http.Handler

func (*API) GetDatasetDimension

func (api *API) GetDatasetDimension() http.Handler

func (*API) GetDatasetDimensionByIndex

func (api *API) GetDatasetDimensionByIndex() http.Handler

func (*API) GetDatasetDimensionCodes

func (api *API) GetDatasetDimensionCodes() http.Handler

func (*API) GetDatasetDimensions

func (api *API) GetDatasetDimensions() http.Handler

func (*API) GetFilterDimensions

func (api *API) GetFilterDimensions() http.Handler

func (*API) GetHierarchy

func (api *API) GetHierarchy() http.Handler

func (*API) GetHierarchyForCode

func (api *API) GetHierarchyForCode() http.Handler

func (*API) Handler

func (api *API) Handler() http.Handler

type Authenticator

type Authenticator func(http.Handler) http.Handler

type DataStore

type DataStore interface {
	GetData(ctx context.Context, url string) (cantabular.Entity, error)
	GetDatasetCodebook(ctx context.Context, dataset string) (*cantabular.Codebook, error)
}

type DimensionResponse

type DimensionResponse struct {
	Index int    `json:"index"`
	Name  string `json:"name"`
	Code  string `json:"code"`
}

type GetDimensionsResponse

type GetDimensionsResponse struct {
	Dimensions []string `json:"dimensions,omitempty"`
}

type SimpleEntity

type SimpleEntity struct {
	Message string
}

Jump to

Keyboard shortcuts

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