go-dnsimple/

directory
v0.0.0-...-fd97e0e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2016 License: Apache-2.0, MIT

README

go-dnsimple

A Go client for the DNSimple API.

Build Status Coverage Status

Installation

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

Getting Started

This library is a Go client you can use to interact with the DNSimple API.

Here's a short example.

package main

import (
  "fmt"
  "github.com/weppos/go-dnsimple/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, load up godoc and find the package.

Directories

Path Synopsis
Package dnsimple implements a client for the DNSimple API.
Package dnsimple implements a client for the DNSimple API.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL