Documentation
¶
Overview ¶
Package api provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen version v1.8.2 DO NOT EDIT.
Index ¶
- func Handler(si ServerInterface) http.Handler
- func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler
- func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler
- func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler
- type Categories
- type ChiServerOptions
- type Error
- type GetCkmeansYearParams
- type GetCkmeansratioYearParams
- type GetGeoParams
- type GetMetadataYearParams
- type GetQueryParams
- type GetQueryYearParams
- type Metadata
- type MetadataResponse
- type MiddlewareFunc
- type ServerInterface
- type ServerInterfaceWrapper
- func (siw *ServerInterfaceWrapper) GetCkmeansYear(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetCkmeansratioYear(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetClearCache(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetGeo(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetMetadataYear(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetMsoaPostcode(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetQuery(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetQueryYear(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetSwagger(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetSwaggerui(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) Preflight(w http.ResponseWriter, r *http.Request)
- type Table
- type Tables
- type Triplet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Handler ¶
func Handler(si ServerInterface) http.Handler
Handler creates http.Handler with routing matching OpenAPI spec.
func HandlerFromMux ¶
func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler
HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.
func HandlerFromMuxWithBaseURL ¶
func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler
func HandlerWithOptions ¶
func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler
HandlerWithOptions creates http.Handler with additional options
Types ¶
type ChiServerOptions ¶
type ChiServerOptions struct { BaseURL string BaseRouter chi.Router Middlewares []MiddlewareFunc }
type Error ¶
type Error struct { // error message Error string `json:"error"` }
Error defines model for Error.
type GetCkmeansYearParams ¶
type GetCkmeansYearParams struct { // The census data category to calculate data breaks for. // (NB - use metadata endpoint to see list of currently available census data). // Can be: // - single values (e.g. QS202EW0002) // - comma-separated array of values (e.g QS202EW0003,QS202EW0003,QS202EW0004) // // Multiple cats parameters can be supplied, e.g. cats=QS202EW0002&cats=QS202EW0003 // NB - use of ranges (e.g. QS202EW0003...QS202EW0004) is NOT supported for the ckmeans endpoint. Cat *[]string `json:"cat,omitempty"` // The type of geography to calculate data breaks for. // At the moment these options are supported: // - LAD // - LSOA // // Can be: // - single values (e.g. LAD) // - comma-separated array of values (e.g LAD,LSOA) // // Multiple geotype parameters can be supplied, e.g. geotype=LAD&geotype=LSOA Geotype *[]string `json:"geotype,omitempty"` // The number of data breaks to estimate. K *int `json:"k,omitempty"` // (OPTIONAL) - census data category to use as denominator (cat/divide_by) to ratios for calculating data // breaks, instead of raw data (NB if multiple cat are supplied, each cat will be divided by divide_by). Only // single values for divide_by are supported. DivideBy *string `json:"divide_by,omitempty"` }
GetCkmeansYearParams defines parameters for GetCkmeansYear.
type GetCkmeansratioYearParams ¶
type GetCkmeansratioYearParams struct { // The census data category to use as numerator (cat1/cat2) when producing the ratio to calculate data breaks for // (NB - use metadata endpoint to see list of currently available census data). Cat1 *string `json:"cat1,omitempty"` // The census data category to use as denominator (cat1/cat2) when producing the ratio to calculate data breaks for // (NB - use metadata endpoint to see list of currently available census data). Cat2 *string `json:"cat2,omitempty"` // The type of geography to calculate data breaks for. Geotype *string `json:"geotype,omitempty"` // The number of data breaks to estimate. K *int `json:"k,omitempty"` }
GetCkmeansratioYearParams defines parameters for GetCkmeansratioYear.
type GetGeoParams ¶
type GetGeoParams struct { // Geography code, eg E09000004 Geocode *string `json:"geocode,omitempty"` // Geography name, eg Bexley Geoname *string `json:"geoname,omitempty"` }
GetGeoParams defines parameters for GetGeo.
type GetMetadataYearParams ¶
type GetMetadataYearParams struct { // Use filtertotals=true if you want to have 'totals' categories separated from other categories in the response (see Examples). Filtertotals *bool `json:"filtertotals,omitempty"` }
GetMetadataYearParams defines parameters for GetMetadataYear.
type GetQueryParams ¶
type GetQueryParams struct { // [ONS codes](https://en.wikipedia.org/wiki/ONS_coding_system) for the geographies that you // want data for. Can be: // - single values (e.g. E01000001) // - comma-separated array of values (e.g E01000001,E01000002,E01000003) // - ellipsis-separated contiguous range of values (e.g. E01000001...E01000010) // // Multiple rows parameters can be supplied, e.g. rows=E01000001&rows=E01000001...E01000010 Rows *[]string `json:"rows,omitempty"` // The census data that you want (NB - use metadata endpoint to see list of currently available census data). Can be: // - single values (e.g. QS101EW0001) // - comma-separated array of values (e.g QS101EW0001,QS101EW0002,QS101EW0003) // - ellipsis-separated contiguous range of values (e.g. QS101EW0001...QS101EW0010) // // Multiple cols parameters can be supplied, e.g. cols=QS101EW0001&rows=QS101EW0001...QS101EW0010 Cols *[]string `json:"cols,omitempty"` // Two long, lat coordinate pairs representing the opposite corners of a bounding box (e.g. bbox=0.1338,51.4635,0.1017,51.4647). // This will select all geographies that lie within this bounding box. Bbox can be used instead of, or in combination with the // rows parameter as a way of selecting geography. Bbox *string `json:"bbox,omitempty"` // Geotype filters API results to a specific geography type. Can be single values or comma-separated array. // At the moment these options are supported: // - LAD // - LSOA // // Multiple geotype parameters can be supplied, e.g. geotype=LAD&geotype=LSOA Geotype *[]string `json:"geotype,omitempty"` // Radius and location (both are required) will select all geographies with radius of the long,lat pair location, // e.g. location=0.1338,51.4635&radius=1000. Radius and location can be used instead of, or in combination with the rows parameter as a way of selecting geography. Location *string `json:"location,omitempty"` // Radius and location (both are required) will select all geographies with radius of the long,lat pair location, // e.g. location=0.1338,51.4635&radius=1000. Radius and location can be used instead of, or in combination with the rows parameter as a way of selecting geography. Radius *int `json:"radius,omitempty"` // A sequence of long, lat coordinate pairs representing a closed polygon (NB - 'closed' means the first and last coordinate pair // must be the same), e.g. polygon=0.0844,51.4897,0.1214,51.4910,0.1338,51.4635,0.1017,51.4647,0.0844,51.4897. This will select // all geographies that lie within this polygon. polygon can be used instead of, or in combination with the rows parameter as a // way of selecting geography. Polygon *string `json:"polygon,omitempty"` Censustable *string `json:"censustable,omitempty"` }
GetQueryParams defines parameters for GetQuery.
type GetQueryYearParams ¶
type GetQueryYearParams struct { // [ONS codes](https://en.wikipedia.org/wiki/ONS_coding_system) for the geographies that you // want data for. Can be: // - single values (e.g. E01000001) // - comma-separated array of values (e.g E01000001,E01000002,E01000003) // - ellipsis-separated contiguous range of values (e.g. E01000001...E01000010) // // Multiple rows parameters can be supplied, e.g. rows=E01000001&rows=E01000001...E01000010 Rows *[]string `json:"rows,omitempty"` // The census data that you want (NB - use metadata endpoint to see list of currently available census data). Can be: // - single values (e.g. QS101EW0001) // - comma-separated array of values (e.g QS101EW0001,QS101EW0002,QS101EW0003) // - ellipsis-separated contiguous range of values (e.g. QS101EW0001...QS101EW0010) // // Multiple cols parameters can be supplied, e.g. cols=QS101EW0001&rows=QS101EW0001...QS101EW0010 Cols *[]string `json:"cols,omitempty"` // Two long, lat coordinate pairs representing the opposite corners of a bounding box (e.g. bbox=0.1338,51.4635,0.1017,51.4647). // This will select all geographies that lie within this bounding box. Bbox can be used instead of, or in combination with the // rows parameter as a way of selecting geography. Bbox *string `json:"bbox,omitempty"` // Geotype filters API results to a specific geography type. Can be single values or comma-separated array. // At the moment these options are supported: // - LAD // - LSOA // // Multiple geotype parameters can be supplied, e.g. geotype=LAD&geotype=LSOA Geotype *[]string `json:"geotype,omitempty"` // Radius and location (both are required) will select all geographies with radius of the long,lat pair location, // e.g. location=0.1338,51.4635&radius=1000. Radius and location can be used instead of, or in combination with the rows parameter as a way of selecting geography. Location *string `json:"location,omitempty"` // Radius and location (both are required) will select all geographies with radius of the long,lat pair location, // e.g. location=0.1338,51.4635&radius=1000. Radius and location can be used instead of, or in combination with the rows parameter as a way of selecting geography. Radius *int `json:"radius,omitempty"` // A sequence of long, lat coordinate pairs representing a closed polygon (NB - 'closed' means the first and last coordinate pair // must be the same), e.g. polygon=0.0844,51.4897,0.1214,51.4910,0.1338,51.4635,0.1017,51.4647,0.0844,51.4897. This will select // all geographies that lie within this polygon. polygon can be used instead of, or in combination with the rows parameter as a // way of selecting geography. Polygon *string `json:"polygon,omitempty"` Censustable *string `json:"censustable,omitempty"` // (OPTIONAL) - census data category to use as denominator (cat/divide_by). // When divide_by is given, the returned value for a category will be the value of the category divided by the value of the // divide_by category. DivideBy *string `json:"divide_by,omitempty"` }
GetQueryYearParams defines parameters for GetQueryYear.
type Metadata ¶
type Metadata struct { Code *string `json:"code,omitempty"` Name *string `json:"name,omitempty"` Slug *string `json:"slug,omitempty"` Tables *Tables `json:"tables,omitempty"` }
Metadata defines model for Metadata.
type MetadataResponse ¶
type MetadataResponse []Metadata
MetadataResponse defines model for MetadataResponse.
type MiddlewareFunc ¶
type MiddlewareFunc func(http.HandlerFunc) http.HandlerFunc
type ServerInterface ¶
type ServerInterface interface { // calculate ckmeans over a given category and geography type // (GET /ckmeans/{year}) GetCkmeansYear(w http.ResponseWriter, r *http.Request, year int, params GetCkmeansYearParams) // calculate ckmeans for the ratio between two given categories (cat1 / cat2) for a given geography type // (GET /ckmeansratio/{year}) GetCkmeansratioYear(w http.ResponseWriter, r *http.Request, year int, params GetCkmeansratioYearParams) // remove all entries from request cache // (GET /clear-cache) GetClearCache(w http.ResponseWriter, r *http.Request) // Get geographic info about an area. Queryable with either geocode or geoname (but not both) // (GET /geo/{year}) GetGeo(w http.ResponseWriter, r *http.Request, year int, params GetGeoParams) // Get Metadata // (GET /metadata/{year}) GetMetadataYear(w http.ResponseWriter, r *http.Request, year int, params GetMetadataYearParams) // return MSOA code and its name // (GET /msoa/{postcode}) GetMsoaPostcode(w http.ResponseWriter, r *http.Request, postcode string) // query census // (GET /query/{year}) GetQueryYear(w http.ResponseWriter, r *http.Request, year int, params GetQueryYearParams) // List geocodes matching search conditions // (GET /query2/{year}) GetQuery(w http.ResponseWriter, r *http.Request, year int, params GetQueryParams) // spec // (GET /swagger) GetSwagger(w http.ResponseWriter, r *http.Request) // spec // (GET /swaggerui) GetSwaggerui(w http.ResponseWriter, r *http.Request) // CORS preflight OPTIONS request // (OPTIONS /{path}/{year}) Preflight(w http.ResponseWriter, r *http.Request, path string, year int) }
ServerInterface represents all server handlers.
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct { Handler ServerInterface HandlerMiddlewares []MiddlewareFunc }
ServerInterfaceWrapper converts contexts to parameters.
func (*ServerInterfaceWrapper) GetCkmeansYear ¶
func (siw *ServerInterfaceWrapper) GetCkmeansYear(w http.ResponseWriter, r *http.Request)
GetCkmeansYear operation middleware
func (*ServerInterfaceWrapper) GetCkmeansratioYear ¶
func (siw *ServerInterfaceWrapper) GetCkmeansratioYear(w http.ResponseWriter, r *http.Request)
GetCkmeansratioYear operation middleware
func (*ServerInterfaceWrapper) GetClearCache ¶
func (siw *ServerInterfaceWrapper) GetClearCache(w http.ResponseWriter, r *http.Request)
GetClearCache operation middleware
func (*ServerInterfaceWrapper) GetGeo ¶
func (siw *ServerInterfaceWrapper) GetGeo(w http.ResponseWriter, r *http.Request)
GetGeo operation middleware
func (*ServerInterfaceWrapper) GetMetadataYear ¶
func (siw *ServerInterfaceWrapper) GetMetadataYear(w http.ResponseWriter, r *http.Request)
GetMetadataYear operation middleware
func (*ServerInterfaceWrapper) GetMsoaPostcode ¶
func (siw *ServerInterfaceWrapper) GetMsoaPostcode(w http.ResponseWriter, r *http.Request)
GetMsoaPostcode operation middleware
func (*ServerInterfaceWrapper) GetQuery ¶
func (siw *ServerInterfaceWrapper) GetQuery(w http.ResponseWriter, r *http.Request)
GetQuery operation middleware
func (*ServerInterfaceWrapper) GetQueryYear ¶
func (siw *ServerInterfaceWrapper) GetQueryYear(w http.ResponseWriter, r *http.Request)
GetQueryYear operation middleware
func (*ServerInterfaceWrapper) GetSwagger ¶
func (siw *ServerInterfaceWrapper) GetSwagger(w http.ResponseWriter, r *http.Request)
GetSwagger operation middleware
func (*ServerInterfaceWrapper) GetSwaggerui ¶
func (siw *ServerInterfaceWrapper) GetSwaggerui(w http.ResponseWriter, r *http.Request)
GetSwaggerui operation middleware
func (*ServerInterfaceWrapper) Preflight ¶
func (siw *ServerInterfaceWrapper) Preflight(w http.ResponseWriter, r *http.Request)
Preflight operation middleware