• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.gitignoreH A D09-Jan-202025

.golangci.tomlH A D09-Jan-2020637

.travis.ymlH A D09-Jan-2020438

LICENSEH A D09-Jan-20201 KiB

MakefileH A D09-Jan-2020352

README.mdH A D09-Jan-20201.5 KiB

dnspod.goH A D09-Jan-20205.8 KiB

dnspod_test.goH A D09-Jan-20201.3 KiB

domains.goH A D09-Jan-20204.5 KiB

domains_test.goH A D09-Jan-20203.4 KiB

go.modH A D09-Jan-202043

go.sumH A D09-Jan-20200

records.goH A D09-Jan-20206 KiB

records_test.goH A D09-Jan-20204.9 KiB

README.md

1# DNSPod Go API client
2
3[![Build Status](https://travis-ci.com/nrdcg/dnspod-go.svg?branch=master)](https://travis-ci.com/nrdcg/dnspod-go)
4[![GoDoc](https://godoc.org/github.com/nrdcg/dnspod-go?status.svg)](https://godoc.org/github.com/nrdcg/dnspod-go)
5[![Go Report Card](https://goreportcard.com/badge/github.com/nrdcg/dnspod-go)](https://goreportcard.com/report/github.com/nrdcg/dnspod-go)
6
7A Go client for the [DNSPod API](https://www.dnspod.cn/docs/index.html).
8
9Originally inspired by [dnsimple](https://github.com/weppos/dnsimple-go/dnsimple)
10
11## Getting Started
12
13This library is a Go client you can use to interact with the [DNSPod API](https://www.dnspod.cn/docs/index.html).
14
15```go
16package main
17
18import (
19	"fmt"
20	"log"
21
22	"github.com/nrdcg/dnspod-go"
23)
24
25func main() {
26	apiToken := "xxxxx"
27
28	params := dnspod.CommonParams{LoginToken: apiToken, Format: "json"}
29	client := dnspod.NewClient(params)
30
31	// Get a list of your domains
32	domains, _, _ := client.Domains.List()
33	for _, domain := range domains {
34		fmt.Printf("Domain: %s (id: %d)\n", domain.Name, domain.ID)
35	}
36
37	// Get a list of your domains (with error management)
38	domains, _, err := client.Domains.List()
39	if err != nil {
40		log.Fatalln(err)
41	}
42	for _, domain := range domains {
43		fmt.Printf("Domain: %s (id: %d)\n", domain.Name, domain.ID)
44	}
45
46	// Create a new Domain
47	newDomain := dnspod.Domain{Name: "example.com"}
48	domain, _, _ := client.Domains.Create(newDomain)
49	fmt.Printf("Domain: %s\n (id: %d)", domain.Name, domain.ID)
50}
51```
52
53## License
54
55This is Free Software distributed under the MIT license.
56