api

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2020 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractQueryParameters added in v0.3.0

func ExtractQueryParameters(urlQuery url.Values, validDimensions []string) (map[string]string, error)

ExtractQueryParameters creates a map of query parameters (options) by dimension from the provided urlQuery if they exist in the validDimensions list

func GetDimensionOffsetInHeaderRow added in v0.3.0

func GetDimensionOffsetInHeaderRow(headerRow []string) (int, error)

GetDimensionOffsetInHeaderRow splits the first item of the provided headers by '_', and returns the second item as integer

func GetListOfValidDimensionNames added in v0.3.0

func GetListOfValidDimensionNames(dimensions []dataset.VersionDimension) []string

GetListOfValidDimensionNames iterates the provided dimensions and returns an array with their names

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, r *mux.Router, cfg *config.Config, graphDB IGraph, datasetClient IDatasetClient, permissions IAuthHandler) *API

Setup creates the API struct and its endpoints with corresponding handlers

func (*API) Close

func (*API) Close(ctx context.Context) error

Close is called during graceful shutdown to give the API an opportunity to perform any required disposal task

type IAuthHandler added in v0.3.0

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

IAuthHandler represents the required methods from authorisation library by Observation API

type IDatasetClient added in v0.3.0

type IDatasetClient interface {
	GetVersion(ctx context.Context, userAuthToken, serviceAuthToken, downloadServiceAuthToken, collectionID, datasetID, edition, version string) (m dataset.Version, err error)
	Get(ctx context.Context, userAuthToken, serviceAuthToken, collectionID, datasetID string) (m dataset.DatasetDetails, err error)
	Checker(ctx context.Context, check *healthcheck.CheckState) error
}

IDatasetClient represents the required methods from the Dataset Client required by Observation API

type IGraph added in v0.3.0

type IGraph interface {
	driver.Driver
	StreamCSVRows(ctx context.Context, instanceID, filterID string, filters *observation.DimensionFilters, limit *int) (observation.StreamRowReader, error)
}

IGraph defines the required methods from GraphDB required by Observation API

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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