Commit from m3o/m3o action

This commit is contained in:
m3o-actions
2021-10-29 06:38:17 +00:00
parent 87f310675d
commit ae73a4aca1
170 changed files with 6189 additions and 42 deletions

86
examples/postcode/README.md Executable file
View File

@@ -0,0 +1,86 @@
# Postcode
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Postcode/api](https://m3o.com/Postcode/api).
Endpoints:
## Lookup
Lookup a postcode to retrieve the related region, county, etc
[https://m3o.com/postcode/api#Lookup](https://m3o.com/postcode/api#Lookup)
```go
package example
import(
"fmt"
"os"
"github.com/go.m3o.com/postcode"
)
// Lookup a postcode to retrieve the related region, county, etc
func LookupPostcode() {
postcodeService := postcode.NewPostcodeService(os.Getenv("M3O_API_TOKEN"))
rsp, err := postcodeService.Lookup(&postcode.LookupRequest{
Postcode: "SW1A 2AA",
})
fmt.Println(rsp, err)
}
```
## Random
Return a random postcode and its related info
[https://m3o.com/postcode/api#Random](https://m3o.com/postcode/api#Random)
```go
package example
import(
"fmt"
"os"
"github.com/go.m3o.com/postcode"
)
// Return a random postcode and its related info
func ReturnArandomPostcodeAndItsInformation() {
postcodeService := postcode.NewPostcodeService(os.Getenv("M3O_API_TOKEN"))
rsp, err := postcodeService.Random(&postcode.RandomRequest{
})
fmt.Println(rsp, err)
}
```
## Validate
Validate a postcode.
[https://m3o.com/postcode/api#Validate](https://m3o.com/postcode/api#Validate)
```go
package example
import(
"fmt"
"os"
"github.com/go.m3o.com/postcode"
)
// Validate a postcode.
func ReturnArandomPostcodeAndItsInformation() {
postcodeService := postcode.NewPostcodeService(os.Getenv("M3O_API_TOKEN"))
rsp, err := postcodeService.Validate(&postcode.ValidateRequest{
Postcode: "SW1A 2AA",
})
fmt.Println(rsp, err)
}
```