Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LookupRequest ¶
type LookupRequest struct { // UK postcode e.g SW1A 2AA Postcode string `json:"postcode"` }
type LookupResponse ¶
type LookupResponse struct { // country e.g United Kingdom Country string `json:"country"` // e.g Westminster District string `json:"district"` // e.g 51.50354 Latitude float64 `json:"latitude"` // e.g -0.127695 Longitude float64 `json:"longitude"` // UK postcode e.g SW1A 2AA Postcode string `json:"postcode"` // related region e.g London Region string `json:"region"` // e.g St James's Ward string `json:"ward"` }
type PostcodeService ¶
type PostcodeService struct {
// contains filtered or unexported fields
}
func NewPostcodeService ¶
func NewPostcodeService(token string) *PostcodeService
func (*PostcodeService) Lookup ¶
func (t *PostcodeService) Lookup(request *LookupRequest) (*LookupResponse, error)
Lookup a postcode to retrieve the related region, county, etc
func (*PostcodeService) Random ¶
func (t *PostcodeService) Random(request *RandomRequest) (*RandomResponse, error)
Return a random postcode and its related info
func (*PostcodeService) Validate ¶
func (t *PostcodeService) Validate(request *ValidateRequest) (*ValidateResponse, error)
Validate a postcode.
type RandomRequest ¶
type RandomRequest struct { }
type RandomResponse ¶
type RandomResponse struct { // country e.g United Kingdom Country string `json:"country"` // e.g Westminster District string `json:"district"` // e.g 51.50354 Latitude float64 `json:"latitude"` // e.g -0.127695 Longitude float64 `json:"longitude"` // UK postcode e.g SW1A 2AA Postcode string `json:"postcode"` // related region e.g London Region string `json:"region"` // e.g St James's Ward string `json:"ward"` }
type ValidateRequest ¶
type ValidateRequest struct { // UK postcode e.g SW1A 2AA Postcode string `json:"postcode"` }
type ValidateResponse ¶
type ValidateResponse struct { // Is the postcode valid (true) or not (false) Valid bool `json:"valid"` }
Click to show internal directories.
Click to hide internal directories.