postcode

package
Version: v0.0.0-...-795d1ad Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

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"`
}

Source Files

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL