annismckenzie / desec

Go library for accessing the deSEC API.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Go library for accessing the deSEC API

Build Status PkgGoDev Go Report Card

An deSEC API client written in Go.

desec is a Go client library for accessing the deSEC API.

Examples

package main

import (
	"context"
	"fmt"

	"github.com/nrdcg/desec"
)

func main() {
	client := desec.NewClient("token")

	newDomain, err := client.Domains.Create(context.Background(), "example.com")
	if err != nil {
		panic(err)
	}

	fmt.Println(newDomain)
}
package main

import (
	"context"

	"github.com/nrdcg/desec"
)

func main() {
	client := desec.NewClient("")
	registration := desec.Registration{
		Email:    "email@example.com",
		Password: "secret",
		Captcha: &desec.Captcha{
			ID:       "00010203-0405-0607-0809-0a0b0c0d0e0f",
			Solution: "12H45",
		},
	}

	err := client.Account.Register(context.Background(), registration)
	if err != nil {
		panic(err)
	}
}
package main

import (
	"context"
	"fmt"

	"github.com/nrdcg/desec"
)

func main() {
	client := desec.NewClient("")

	_, err := client.Account.Login(context.Background(), "email@example.com", "secret")
	if err != nil {
		panic(err)
	}

	domains, err := client.Domains.GetAll(context.Background())
	if err != nil {
		panic(err)
	}

	fmt.Println(domains)

	err = client.Account.Logout(context.Background())
	if err != nil {
		panic(err)
	}
}

API Documentation

About

Go library for accessing the deSEC API.

License:Mozilla Public License 2.0


Languages

Language:Go 99.6%Language:Makefile 0.4%