Unofficially kenall (ケンオール) client written by Go.
$ go get github.com/osamingo/go-kenall/v2@latest
package main
import (
"context"
"fmt"
"log"
"os"
"github.com/osamingo/go-kenall/v2"
)
func main() {
cli, err := kenall.NewClient(os.Getenv("KENALL_AUTHORIZATION_TOKEN"))
if err != nil {
log.Fatal(err)
}
resAddr, err := cli.GetAddress(context.Background(), "1000001")
if err != nil {
log.Fatal(err)
}
addr := resAddr.Addresses[0]
fmt.Println(addr.Prefecture, addr.City, addr.Town)
// Output: 東京都 千代田区 千代田
resCity, err := cli.GetCity(context.Background(), "13")
if err != nil {
log.Fatal(err)
}
city := resCity.Cities[0]
fmt.Println(city.Prefecture, city.City)
// Output: 東京都 千代田区
res, err := cli.GetCorporation(context.Background(), "7000012050002")
if err != nil {
log.Fatal(err)
}
corp := res.Corporation
fmt.Println(corp.PrefectureName, corp.CityName)
// Output: 東京都 千代田区
}
- ケンオール通信第1号
- This library has been featured on the official blog 🎉
Released under the MIT License.