Documentation ¶
Index ¶
- type ChangeRecord
- type Client
- func (c *Client) CreateRecord(domain string, opts *ChangeRecord) (string, error)
- func (c *Client) DestroyRecord(domain string, id string) error
- func (c *Client) GetDomains() ([]Domain, error)
- func (c *Client) GetRecords(domain string) ([]Record, error)
- func (c *Client) NewRequest(body map[string]interface{}, method string, endpoint string) (*http.Request, error)
- func (c *Client) RetrieveRecord(domain string, id string) (*Record, error)
- func (c *Client) UpdateRecord(domain string, id string, opts *ChangeRecord) (string, error)
- type DNSimpleError
- type Domain
- type DomainResponse
- type Record
- type RecordResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChangeRecord ¶
type ChangeRecord struct { Name string // name of the record Value string // where the record points Type string // type, i.e a, mx Ttl string // TTL of record }
ChangeRecord contains the request parameters to create or update a record.
type Client ¶
type Client struct { // Access Token Token string // User Email Email string // Domain Token DomainToken string // URL to the DO API to use URL string // HttpClient is the client to use. A client with // default values will be used if not provided. Http *http.Client }
Client provides a client to the DNSimple API
func NewClient ¶
NewClient returns a new dnsimple client, requires an authorization token. You can generate an OAuth token by visiting the Apps & API section of the DNSimple control panel for your account.
func (*Client) CreateRecord ¶
func (c *Client) CreateRecord(domain string, opts *ChangeRecord) (string, error)
CreateRecord creates a record from the parameters specified and returns an error if it fails. If no error and an ID is returned, the Record was succesfully created.
func (*Client) DestroyRecord ¶
DestroyRecord destroys a record by the ID specified and returns an error if it fails. If no error is returned, the Record was succesfully destroyed.
func (*Client) GetDomains ¶
GetDomains retrieves all the domains for a given account.
func (*Client) GetRecords ¶
GetRecords retrieves all the records for the given domain.
func (*Client) NewRequest ¶
func (c *Client) NewRequest(body map[string]interface{}, method string, endpoint string) (*http.Request, error)
Creates a new request with the params
func (*Client) RetrieveRecord ¶
RetrieveRecord gets a record by the ID specified and returns a Record and an error. An error will be returned for failed requests with a nil Record.
func (*Client) UpdateRecord ¶
UpdateRecord updated a record from the parameters specified and returns an error if it fails.
type DNSimpleError ¶
DNSimpleError is the error format that they return to us if there is a problem
func (*DNSimpleError) Join ¶
func (d *DNSimpleError) Join() string
type Domain ¶
type Domain struct { Id int `json:"id"` UserId int `json:"user_id"` RegistrantId int `json:"registrant_id"` Name string `json:"name"` UnicodeName string `json:"unicode_name"` Token string `json:"token"` State string `json:"state"` Language string `json:"language"` Lockable bool `json:"lockable"` AutoRenew bool `json:"auto_renew"` WhoisProtected bool `json:"whois_protected"` RecordCount int `json:"record_count"` ServiceCount int `json:"service_count"` ExpiresOn string `json:"expires_on"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
type DomainResponse ¶
type DomainResponse struct {
Domain Domain `json:"domain"`
}
type Record ¶
type Record struct { Name string `json:"name"` Content string `json:"content"` DomainId int64 `json:"domain_id"` Id int64 `json:"id"` Prio int64 `json:"prio"` RecordType string `json:"record_type"` Ttl int64 `json:"ttl"` }
Record is used to represent a retrieved Record. All properties are set as strings.
type RecordResponse ¶
type RecordResponse struct {
Record Record `json:"record"`
}