Skip to content
/ desec Public

Go library for accessing the deSEC API.

License

Notifications You must be signed in to change notification settings

nrdcg/desec

Repository files navigation

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