Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ValidPriority = []int{0, 1, 5, 10, 20, 30, 40, 50, 60}
ValidPriority is an array containing all the valid Priority values
var ValidTTL = []int{60, 300, 900, 3600, 10800, 21600, 86400}
ValidTTL is an array containing all the valid TTL values
Functions ¶
func EditRecord ¶
EditRecord edits a record for a given domain. This function is fairly dumb. It takes in a `Record` struct, and uses all its filled fields to send to Njalla. So, if you want to only change a given field, get the `Record` object from say ListRecords, change the one field you want, and then pass that here.
func RemoveRecord ¶
RemoveRecord removes a given record from a given domain. If there are no errors it will return `nil`.
func Request ¶
Request common function for all of Njalla's API. Njalla's API uses JSON-RPC, and contains just one endpoint. The endpoint is POST only, and takes in a JSON in the body, with two arguments, check the `request` struct for more info. The `params` argument is variable. Some methods require no parameters, (like `list-domains`), while other methods require parameters (like `get-domain` which requires `domain: string`).
Types ¶
type Domain ¶
type Domain struct { Name string `json:"name"` Status string `json:"status"` Expiry time.Time `json:"expiry"` Locked *bool `json:"locked,omitempty"` Mailforwarding *bool `json:"mailforwarding,omitempty"` MaxNameservers *int `json:"max_nameservers,omitempty"` }
Domain struct contains data returned by `list-domains` and `get-domains`
func ListDomains ¶
ListDomains returns a listing of domains with minimal data
type HTTPClient ¶
HTTPClient interface. Useful for mocked unit tests later on.
var ( // Client used in all requests by Request. Can be overwritten for tests. Client HTTPClient )
type MarketDomain ¶
type MarketDomain struct { Name string `json:"name"` Status string `json:"status"` Price int `json:"price"` }
func FindDomains ¶
func FindDomains(token string, query string) ([]MarketDomain, error)
type Record ¶
type Record struct { ID int `json:"id"` Name string `json:"name"` Type string `json:"type"` Content string `json:"content"` TTL int `json:"ttl"` Priority *int `json:"prio,omitempty"` }
Record struct contains data returned by `list-records`