Initial commit, w/ example client. Testing and working
This commit is contained in:
26
example-client/main.go
Normal file
26
example-client/main.go
Normal file
@ -0,0 +1,26 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
easydns "deadbeef.codes/steven/goeasydns"
|
||||
)
|
||||
|
||||
func main() {
|
||||
client := easydns.NewClient("https://sandbox.rest.easydns.net", "APITOKEN", "APIKEY")
|
||||
recordList, err := client.GetRecordList("nextdigital.ca")
|
||||
if err != nil {
|
||||
log.Fatalf("failed to get records for nextdigital.ca: %v", err)
|
||||
}
|
||||
|
||||
for _, record := range recordList.Data {
|
||||
if record.Type == "TXT" {
|
||||
fmt.Printf("ID: %s\n", record.ID)
|
||||
fmt.Printf("Host: %s\n", record.Host)
|
||||
fmt.Printf("Type: %s\n", record.Type)
|
||||
fmt.Printf("rdata: %s\n", record.Rdata)
|
||||
fmt.Printf("\n\n")
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user