File: types.go

package info (click to toggle)
golang-github-xenolf-lego 4.9.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,080 kB
  • sloc: xml: 533; makefile: 128; sh: 18
file content (44 lines) | stat: -rw-r--r-- 1,127 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package internal

import (
	"encoding/json"
	"fmt"
)

type apiResponse struct {
	Data json.RawMessage `json:"data"`
}

type APIError struct {
	Message    string                 `json:"message,omitempty"`
	Errors     map[string]interface{} `json:"errors,omitempty"`
	StatusCode int                    `json:"-"`
}

func (a APIError) Error() string {
	msg := fmt.Sprintf("%d: %s", a.StatusCode, a.Message)
	for k, v := range a.Errors {
		msg += fmt.Sprintf(" %s: %v", k, v)
	}
	return msg
}

type Zone struct {
	ID          int    `json:"id"`
	Name        string `json:"name,omitempty"`
	Email       string `json:"email,omitempty"`
	TTL         int    `json:"ttl,omitempty"`
	Nameserver  string `json:"nameserver,omitempty"`
	Dnssec      bool   `json:"dnssec,omitempty"`
	DnssecEmail string `json:"dnssec_email,omitempty"`
}

type Record struct {
	ID      int    `json:"id,omitempty"`
	Type    string `json:"type,omitempty"`
	Name    string `json:"name,omitempty"`
	Zone    string `json:"zone,omitempty"`
	Text    string `json:"text,omitempty"`
	TTL     int    `json:"ttl,omitempty"`
	Comment string `json:"comment,omitempty"`
}