Documentation ¶
Index ¶
- Constants
- func StubbedAncestorAPIResponse(code string) string
- type Ancestor
- type Ancestors
- type AreaDetails
- type Client
- func (c *Client) Checker(ctx context.Context, check *health.CheckState) error
- func (c *Client) GetAncestors(ctx context.Context, ...) (ancestors Ancestors, err error)
- func (c *Client) GetArea(ctx context.Context, ...) (areaDetails AreaDetails, err error)
- func (c *Client) GetRelations(ctx context.Context, ...) (relations []Relation, err error)
- type ErrInvalidAreaAPIResponse
- type Relation
Constants ¶
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
Types ¶
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 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 ¶
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
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 ¶
func (e ErrInvalidAreaAPIResponse) Error() string
Error should be called by the user to print out the stringified version of the error