github.com/nrdcg/dnspod-go
go get github.com/nrdcg/dnspod-go

github.com/nrdcg/dnspod-go

Go library for accessing the DNSPod API.

by nrdcg

v0.4.0 (see all)License:MIT
go get github.com/nrdcg/dnspod-go
Readme

DNSPod Go API client

Build Status PkgGoDev Go Report Card

A Go client for the DNSPod API.

Originally inspired by dnsimple

Getting Started

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

package main

import (
    "fmt"
    "log"

    "github.com/nrdcg/dnspod-go"
)

func main() {
    apiToken := "xxxxx"

    params := dnspod.CommonParams{LoginToken: apiToken, Format: "json"}
    client := dnspod.NewClient(params)

    // 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, _, err := client.Domains.List()
    if err != nil {
        log.Fatalln(err)
    }
    for _, domain := range domains {
        fmt.Printf("Domain: %s (id: %d)\n", domain.Name, domain.ID)
    }

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

API documentation

License

This is Free Software distributed under the MIT license.

GitHub Stars

12

LAST COMMIT

10mos ago

MAINTAINERS

0

CONTRIBUTORS

8

OPEN ISSUES

0

OPEN PRs

0
VersionTagPublished
v0.4.1-0.20210717025117-2034770b07de
10mos ago
v0.4.1-0.20210227231916-d3c0468b0b9b
1yr ago
v0.0.0-20210227144159-8052f7d2eaaa
1yr ago
v0.4.1-0.20210227144159-8052f7d2eaaa
1yr ago
No alternatives found
No tutorials found
Add a tutorial