place

package
v0.1604.0-MLPAB2747lpa... Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package place provides a client for Ordnance Survey's Places API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Line1      string `json:"line1"`
	Line2      string `json:"line2"`
	Line3      string `json:"line3"`
	TownOrCity string `json:"town"`
	Postcode   string `json:"postcode"`
	Country    string `json:"country"`
}

func (Address) Encode

func (a Address) Encode() string

func (Address) Lines

func (a Address) Lines() []string

func (Address) String

func (a Address) String() string

type AddressDetails added in v0.1280.0

type AddressDetails struct {
	Address           string `json:"ADDRESS"`
	SubBuildingName   string `json:"SUB_BUILDING_NAME"`
	BuildingName      string `json:"BUILDING_NAME"`
	BuildingNumber    string `json:"BUILDING_NUMBER"`
	ThoroughFareName  string `json:"THOROUGHFARE_NAME"`
	DependentLocality string `json:"DEPENDENT_LOCALITY"`
	Town              string `json:"POST_TOWN"`
	Postcode          string `json:"POSTCODE"`
}

func (*AddressDetails) TransformToAddress added in v0.1280.0

func (ad *AddressDetails) TransformToAddress() Address

type BadRequestError

type BadRequestError struct {
	Statuscode int    `json:"statuscode"`
	Message    string `json:"message"`
}

func (BadRequestError) Error

func (b BadRequestError) Error() string

type Client

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

func NewClient

func NewClient(baseUrl, apiKey string, httpClient Doer) *Client

func (*Client) LookupPostcode

func (c *Client) LookupPostcode(ctx context.Context, postcode string) ([]Address, error)

type Doer

type Doer interface {
	Do(*http.Request) (*http.Response, error)
}

type ResultSet

type ResultSet struct {
	AddressDetails AddressDetails `json:"DPA"`
}

Jump to

Keyboard shortcuts

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