internal

package
v4.13.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: MIT Imports: 8 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 any    `json:"params"`
}

APIRequest represents an API request body.

type APIResponse

type APIResponse[T any] struct {
	ID     string    `json:"id"`
	RPC    string    `json:"jsonrpc"`
	Error  *APIError `json:"error,omitempty"`
	Result T         `json:"result,omitempty"`
}

APIResponse represents an API response body.

func (APIResponse[T]) GetError added in v4.12.0

func (a APIResponse[T]) GetError() error

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(ctx context.Context, record Record) (*Record, error)

AddRecord adds a record.

func (*Client) ListRecords

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

ListRecords list the records for one domain.

func (*Client) RemoveRecord

func (c *Client) RemoveRecord(ctx context.Context, id string, domain string) error

RemoveRecord removes a record.

type Record

type Record struct {
	ID      string `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.

type Response added in v4.12.0

type Response interface {
	GetError() error
}

Jump to

Keyboard shortcuts

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