Debian Codegraph @

README.md

raw
1 # go-dnsimple
2
3 A Go client for the [DNSimple API](https://developer.dnsimple.com/).
4
5 [![Build Status](https://travis-ci.org/weppos/dnsimple-go.svg)](https://travis-ci.org/weppos/dnsimple-go)
6 [![Coverage Status](https://img.shields.io/coveralls/weppos/dnsimple-go.svg)](https://coveralls.io/r/weppos/dnsimple-go?branch=master)
7 [![GoDoc](https://godoc.org/github.com/weppos/dnsimple-go/dnsimple?status.svg)](https://godoc.org/github.com/weppos/dnsimple-go/dnsimple)
8
9 ## Installation
10
11 ```
12 $ go get github.com/weppos/dnsimple-go/dnsimple
13 ```
14
15
16 ## Getting Started
17
18 This library is a Go client you can use to interact with the [DNSimple API](https://developer.dnsimple.com/). Here are some examples.
19
20
21 ```go
22 package main
23
24 import (
25 "fmt"
26 "github.com/weppos/dnsimple-go/dnsimple"
27 )
28
29 func main() {
30 apiToken := "xxxxxxx"
31 email := "[email protected]"
32
33 client := dnsimple.NewClient(apiToken, email)
34
35 // Get a list of your domains
36 domains, _, _ := client.Domains.List()
37 for _, domain := range domains {
38 fmt.Printf("Domain: %s (id: %d)\n", domain.Name, domain.Id)
39 }
40
41 // Get a list of your domains (with error management)
42 domains, _, error := client.Domains.List()
43 if error != nil {
44 log.Fatalln(error)
45 }
46 for _, domain := range domains {
47 fmt.Printf("Domain: %s (id: %d)\n", domain.Name, domain.Id)
48 }
49
50 // Create a new Domain
51 newDomain := Domain{Name: "example.com"}
52 domain, _, _ := client.Domains.Create(newDomain)
53 fmt.Printf("Domain: %s\n (id: %d)", domain.Name, domain.Id)
54 }
55 ```
56
57 For more complete documentation, see [godoc](https://godoc.org/github.com/weppos/dnsimple-go/dnsimple).