areas

package
v2.6.2 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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 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) GetArea

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

GetArea returns area information for a given area ID

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

Jump to

Keyboard shortcuts

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