areas

package
v2.109.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DidsburyEast = `` /* 150-byte string literal not displayed */

	Manchester = `` /* 147-byte string literal not displayed */

	NorthWest = `` /* 147-byte string literal not displayed */

	England = `` /* 144-byte string literal not displayed */

)

Variables

This section is empty.

Functions

func StubbedAncestorAPIResponse added in v2.9.2

func StubbedAncestorAPIResponse(code string) string

Types

type Ancestor added in v2.9.2

type Ancestor struct {
	Name      string     `json:"name,omitempty"`
	Level     string     `json:"level,omitempty"`
	Id        string     `json:"id,omitempty"`
	Ancestors []Ancestor `json:"ancestors"`
	Siblings  []Ancestor `json:"siblings"`
	Children  []Ancestor `json:"children"`
}

type Ancestors added in v2.96.7

type Ancestors struct {
	Ancestors []Ancestor `json:"ancestors"`
}

type AreaDetails

type AreaDetails struct {
	Code          string                 `json:"code,omitempty"`
	Name          string                 `json:"name,omitempty"`
	DateStarted   string                 `json:"date_start,omitempty"`
	DateEnd       string                 `json:"date_end,omitempty"`
	WelshName     string                 `json:"name_welsh,omitempty"`
	GeometricData map[string]interface{} `json:"geometry"`
	Visible       bool                   `json:"visible,omitempty"`
	AreaType      string                 `json:"area_type,omitempty"`
}

AreaDetails represents a response area model from the areas api

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a areas api client which can be used to make requests to the server

func New

func New(areasAPIURL string) *Client

New creates a new instance of Client with a given areas api url

func NewWithHealthClient

func NewWithHealthClient(hcCli *healthcheck.Client) *Client

NewWithHealthClient creates a new instance of Client, reusing the URL and Clienter from the provided health check client.

func (*Client) Checker

func (c *Client) Checker(ctx context.Context, check *health.CheckState) error

Checker calls areas api health endpoint and returns a check object to the caller.

func (*Client) GetAncestors added in v2.9.2

func (c *Client) GetAncestors(ctx context.Context, userAuthToken, serviceAuthToken, collectionID, areaID, acceptLang string) (ancestors Ancestors, err error)

GetAncestors gets ancestors data from areas api

func (*Client) GetArea

func (c *Client) GetArea(ctx context.Context, userAuthToken, serviceAuthToken, collectionID, areaID, acceptLang string) (areaDetails AreaDetails, err error)

GetArea returns area information for a given area ID

func (*Client) GetRelations added in v2.9.0

func (c *Client) GetRelations(ctx context.Context, userAuthToken, serviceAuthToken, collectionID, areaID, acceptLang string) (relations []Relation, err error)

GetRelations gets the child areas

type ErrInvalidAreaAPIResponse

type ErrInvalidAreaAPIResponse struct {
	// contains filtered or unexported fields
}

ErrInvalidAreaAPIResponse is returned when the area api does not respond with a valid status

func NewAreaAPIResponse

func NewAreaAPIResponse(resp *http.Response, uri string) (e *ErrInvalidAreaAPIResponse)

NewAreaAPIResponse creates an error response, optionally adding body to e when status is 404

func (ErrInvalidAreaAPIResponse) Code

func (e ErrInvalidAreaAPIResponse) Code() int

Code returns the status code received from Area api if an error is returned

func (ErrInvalidAreaAPIResponse) Error

Error should be called by the user to print out the stringified version of the error

type Relation added in v2.9.0

type Relation struct {
	AreaCode string `json:"area_code,omitempty"`
	AreaName string `json:"area_name,omitempty"`
	Href     string `json:"href,omitempty"`
}

Relation represents a response relation model from area api

Jump to

Keyboard shortcuts

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