internal

package
v4.21.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: MIT Imports: 9 Imported by: 0

README

The API doc is mainly wrong on the response schema:

ex:

  • the doc for /zones/records/all/{domain}
{
  "msg": "string",
  "status": 200,
  "tm": 1709190001,
  "data": {
    "id": 60898922,
    "domain": "example.com",
    "host": "hosta",
    "ttl": 300,
    "prio": 0,
    "geozone_id": 0,
    "type": "A",
    "rdata": "1.2.3.4",
    "last_mod": "2019-08-28 19:09:50"
  },
  "count": 0,
  "total": 0,
  "start": 0,
  "max": 0
}
  • The reality:
{
  "tm": 1709190001,
  "data": [
    {
      "id": "60898922",
      "domain": "example.com",
      "host": "hosta",
      "ttl": "300",
      "prio": "0",
      "geozone_id": "0",
      "type": "A",
      "rdata": "1.2.3.4",
      "last_mod": "2019-08-28 19:09:50"
    }
  ],
  "count": 0,
  "total": 0,
  "start": 0,
  "max": 0,
  "status": 200
}

data is an array. id, ttl, geozone_id are strings.

Documentation

Index

Constants

View Source
const DefaultBaseURL = "https://rest.easydns.net"

DefaultBaseURL the default API endpoint.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	BaseURL    *url.URL
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

Client the EasyDNS API client.

func NewClient

func NewClient(token string, key string) *Client

NewClient Creates a new Client.

func (*Client) AddRecord

func (c *Client) AddRecord(ctx context.Context, domain string, record ZoneRecord) (string, error)

func (*Client) DeleteRecord

func (c *Client) DeleteRecord(ctx context.Context, domain, recordID string) error

func (*Client) ListZones added in v4.16.0

func (c *Client) ListZones(ctx context.Context, domain string) ([]ZoneRecord, error)

type Error added in v4.16.0

type Error struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

func (*Error) Error added in v4.16.0

func (e *Error) Error() string

type ZoneRecord

type ZoneRecord struct {
	ID       string `json:"id,omitempty"`
	Domain   string `json:"domain"`
	Host     string `json:"host"`
	TTL      string `json:"ttl"`
	Priority string `json:"prio"`
	Type     string `json:"type"`
	Rdata    string `json:"rdata"`
	LastMod  string `json:"last_mod,omitempty"`
	Revoked  int    `json:"revoked,omitempty"`
	NewHost  string `json:"new_host,omitempty"`
}

Jump to

Keyboard shortcuts

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