https://github.com/jeffdoubleyou/go-ups-address
Golang library for validating addresses with UPS API
https://github.com/jeffdoubleyou/go-ups-address
address address-validation go golang golang-library ups
Last synced: 4 months ago
JSON representation
Golang library for validating addresses with UPS API
- Host: GitHub
- URL: https://github.com/jeffdoubleyou/go-ups-address
- Owner: jeffdoubleyou
- License: apache-2.0
- Created: 2020-03-12T16:52:22.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-03-16T20:24:08.000Z (over 6 years ago)
- Last Synced: 2025-12-19T00:00:09.209Z (7 months ago)
- Topics: address, address-validation, go, golang, golang-library, ups
- Language: Go
- Size: 20.5 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-ups-address
Golang library for validating addresses with UPS API
[](https://godoc.org/github.com/jeffdoubleyou/go-ups-address)
## Usage
```
package main
import (
"fmt"
UPSAddress "github.com/jeffdoubleyou/go-ups-address"
)
func main() {
fmt.Println("vim-go")
ups := UPSAddress.NewUPSAddress("yourusername", "yourpassword", "0DBCDEFGHIJKL")
address := ups.NewAddress(map[string]string{
"AddressLine1": "200 Corporate Pointe",
"AddressLine2": "Suite 350",
"City": "Culver City",
"StateProv": "CA",
"PostalCode": "90230",
"CountryCode": "US",
})
ups.Debug(true)
v, err := ups.ValidateAddress(address)
if err != nil {
fmt.Println(err.Error())
} else {
if v.ValidAddress() {
fmt.Printf("The address is valid\n")
fmt.Printf("This is a %s address\n", v.AddressClassification())
} else {
if v.AmbiguousAddress() {
firstCandidate := v.Address()
fmt.Printf("Maybe try street address: %s\n", firstCandidate.AddressLine1)
}
}
}
}
```
### Available Address Fields
```
type Address struct {
AddressLine1 string
AddressLine2 string
AddressLine3 string
City string
StateProv string
PostalCode string
PostalCodeExtended string
AddressType string
CountryCode string
Classification string
}
```