internal

package
v4.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Code    int
	Message string
}

APIError is an API error.

func (APIError) Error

func (a APIError) Error() string

type APIRequest

type APIRequest struct {
	Method string      `json:"method"`
	Params interface{} `json:"params"`
}

APIRequest represents an API request body.

type APIResponse

type APIResponse struct {
	ID     string          `json:"id"`
	RPC    string          `json:"jsonrpc"`
	Error  *APIError       `json:"error,omitempty"`
	Result json.RawMessage `json:"result,omitempty"`
}

APIResponse represents an API response body.

type Client

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

Client is a Njalla API client.

func NewClient

func NewClient(token string) *Client

NewClient creates a new Client.

func (*Client) AddRecord

func (c *Client) AddRecord(record Record) (*Record, error)

AddRecord adds a record.

func (*Client) ListRecords

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

ListRecords list the records for one domain.

func (*Client) RemoveRecord

func (c *Client) RemoveRecord(id int, domain string) error

RemoveRecord removes a record.

type Record

type Record struct {
	ID      int    `json:"id,omitempty"`
	Content string `json:"content,omitempty"`
	Domain  string `json:"domain,omitempty"`
	Name    string `json:"name,omitempty"`
	TTL     int    `json:"ttl,omitempty"`
	Type    string `json:"type,omitempty"`
}

Record is a DNS record.

type Records

type Records struct {
	Records []Record `json:"records,omitempty"`
}

Records is a list of DNS records.

Jump to

Keyboard shortcuts

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