File: README.md

package info (click to toggle)
golang-github-weppos-dnsimple-go 0.0~git20160204.0.65c1ca7-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, stretch
  • size: 144 kB
  • ctags: 147
  • sloc: makefile: 2
file content (57 lines) | stat: -rw-r--r-- 1,623 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# go-dnsimple

A Go client for the [DNSimple API](https://developer.dnsimple.com/).

[![Build Status](https://travis-ci.org/weppos/dnsimple-go.svg)](https://travis-ci.org/weppos/dnsimple-go)
[![Coverage Status](https://img.shields.io/coveralls/weppos/dnsimple-go.svg)](https://coveralls.io/r/weppos/dnsimple-go?branch=master)
[![GoDoc](https://godoc.org/github.com/weppos/dnsimple-go/dnsimple?status.svg)](https://godoc.org/github.com/weppos/dnsimple-go/dnsimple)

## Installation

```
$ go get github.com/weppos/dnsimple-go/dnsimple
```


## Getting Started

This library is a Go client you can use to interact with the [DNSimple API](https://developer.dnsimple.com/). Here are some examples.


```go
package main

import (
  "fmt"
  "github.com/weppos/dnsimple-go/dnsimple"
)

func main() {
  apiToken := "xxxxxxx"
  email := "foo@example.com"

  client := dnsimple.NewClient(apiToken, email)

  // Get a list of your domains
  domains, _, _ := client.Domains.List()
  for _, domain := range domains {
      fmt.Printf("Domain: %s (id: %d)\n", domain.Name, domain.Id)
  }

  // Get a list of your domains (with error management)
  domains, _, error := client.Domains.List()
  if error != nil {
      log.Fatalln(error)
  }
  for _, domain := range domains {
      fmt.Printf("Domain: %s (id: %d)\n", domain.Name, domain.Id)
  }

  // Create a new Domain
  newDomain := Domain{Name: "example.com"}
  domain, _, _ := client.Domains.Create(newDomain)
  fmt.Printf("Domain: %s\n (id: %d)", domain.Name, domain.Id)
}
```

For more complete documentation, see [godoc](https://godoc.org/github.com/weppos/dnsimple-go/dnsimple).