nidus-sync/lob/cmd/address-list/main.go
Eli Ribble 2c0aa980e7
Working creation of a letter
I had to use an address ID for 'to' and 'from' and then did really
weak-sauce inline HTML.
2026-04-17 01:00:16 +00:00

29 lines
585 B
Go

package main
import (
"context"
"log"
"os"
"github.com/Gleipnir-Technology/nidus-sync/lob"
)
func main() {
key := os.Getenv("LOB_API_KEY")
if key == "" {
log.Println("LOB_API_KEY is empty")
os.Exit(1)
}
client := lob.NewLob(key)
ctx := context.TODO()
addresses, err := client.AddressList(ctx)
if err != nil {
log.Printf("err: %v", err)
os.Exit(2)
}
for _, addr := range addresses {
log.Printf("%s %s %s: %s %s, %s, %s, %s", addr.ID, addr.Name, addr.Company, addr.AddressLine1, addr.AddressCity, addr.AddressState, addr.AddressCountry, addr.AddressZip)
}
}