internal

package
v4.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client the Servercow client.

func NewClient

func NewClient(username, password string) *Client

NewClient Creates a Servercow client.

func (*Client) CreateUpdateRecord

func (c *Client) CreateUpdateRecord(domain string, data Record) (*Message, error)

CreateUpdateRecord creates or updates a record.

func (*Client) DeleteRecord

func (c *Client) DeleteRecord(domain string, data Record) (*Message, error)

DeleteRecord deletes a record.

func (*Client) GetRecords

func (c *Client) GetRecords(domain string) ([]Record, error)

GetRecords from API.

type Message

type Message struct {
	Message  string `json:"message,omitempty"`
	ErrorMsg string `json:"error,omitempty"`
}

Message is the basic response representation. Can be an error.

func (Message) Error

func (a Message) Error() string

type Record

type Record struct {
	Name string `json:"name"`
	Type string `json:"type"`
	TTL  int    `json:"ttl,omitempty"`

	Content Value `json:"content,omitempty"`
}

Record is the record representation.

type Value

type Value []string

Value is the value of a record. Allows to handle dynamic type (string and string array).

func (Value) MarshalJSON

func (v Value) MarshalJSON() ([]byte, error)

func (*Value) UnmarshalJSON

func (v *Value) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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