Documentation ¶
Overview ¶
Package dnsimple implements a client for the DNSimple API.
In order to use this package you will need a DNSimple account and your API Token.
Index ¶
- func CheckResponse(r *http.Response) error
- type Client
- type Contact
- type ContactsService
- func (s *ContactsService) Create(contactAttributes Contact) (Contact, *Response, error)
- func (s *ContactsService) Delete(contactID int) (*Response, error)
- func (s *ContactsService) Get(contactID int) (Contact, *Response, error)
- func (s *ContactsService) List() ([]Contact, *Response, error)
- func (s *ContactsService) Update(contactID int, contactAttributes Contact) (Contact, *Response, error)
- type Domain
- type DomainsService
- func (s *DomainsService) Create(domainAttributes Domain) (Domain, *Response, error)
- func (s *DomainsService) CreateRecord(domain interface{}, recordAttributes Record) (Record, *Response, error)
- func (s *DomainsService) Delete(domain interface{}) (*Response, error)
- func (s *DomainsService) DeleteRecord(domain interface{}, recordID int) (*Response, error)
- func (s *DomainsService) DisableAutoRenewal(domain interface{}) (*Response, error)
- func (s *DomainsService) EnableAutoRenewal(domain interface{}) (*Response, error)
- func (s *DomainsService) Get(domain interface{}) (Domain, *Response, error)
- func (s *DomainsService) GetRecord(domain interface{}, recordID int) (Record, *Response, error)
- func (s *DomainsService) GetZone(domain interface{}) (string, *Response, error)
- func (s *DomainsService) List() ([]Domain, *Response, error)
- func (s *DomainsService) ListRecords(domain interface{}, recordName, recordType string) ([]Record, *Response, error)
- func (s *DomainsService) SetAutoRenewal(domain interface{}, autoRenew bool) (*Response, error)
- func (s *DomainsService) UpdateRecord(domain interface{}, recordID int, recordAttributes Record) (Record, *Response, error)
- type ErrorResponse
- type ExtendedAttributes
- type Record
- type RegistrarService
- func (s *RegistrarService) IsAvailable(domain string) (bool, error)
- func (s *RegistrarService) Register(domain string, registrantID int, extendedAttributes *ExtendedAttributes) (Domain, *Response, error)
- func (s *RegistrarService) Renew(domain string, renewWhoisPrivacy bool) (Domain, *Response, error)
- func (s *RegistrarService) Transfer(domain string, registrantID int, authCode string, ...) (Domain, *Response, error)
- type Response
- type TransferOrder
- type User
- type UsersService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if the status code is different than 2xx. Specific requests may have additional requirements, but this is sufficient in most of the cases.
Types ¶
type Client ¶
type Client struct { // HTTP client used to communicate with the API. HttpClient *http.Client // API Token for the DNSimple account you want to use. ApiToken string // Email associated with the provided DNSimple API Token. Email string // Domain Token to be used for authentication // as an alternative to the DNSimple API Token for some domain-scoped operations. DomainToken string // Base URL for API requests. // Defaults to the public DNSimple API, but can be set to a different endpoint (e.g. the sandbox). // BaseURL should always be specified with a trailing slash. BaseURL string // User agent used when communicating with the DNSimple API. UserAgent string // Services used for talking to different parts of the DNSimple API. Contacts *ContactsService Domains *DomainsService Registrar *RegistrarService Users *UsersService }
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to decode it.
func (*Client) NewRequest ¶
NewRequest creates an API request. The path is expected to be a relative path and will be resolved according to the BaseURL of the Client. Paths should always be specified without a preceding slash.
type Contact ¶
type Contact struct { Id int `json:"id,omitempty"` Label string `json:"label,omitempty"` FirstName string `json:"first_name,omitempty"` LastName string `json:"last_name,omitempty"` JobTitle string `json:"job_title,omitempty"` Organization string `json:"organization_name,omitempty"` Email string `json:"email_address,omitempty"` Phone string `json:"phone,omitempty"` Fax string `json:"fax,omitempty"` Address1 string `json:"address1,omitempty"` Address2 string `json:"address2,omitempty"` City string `json:"city,omitempty"` Zip string `json:"postal_code,omitempty"` Country string `json:"country,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` }
type ContactsService ¶
type ContactsService struct {
// contains filtered or unexported fields
}
ContactsService handles communication with the contact related methods of the DNSimple API.
DNSimple API docs: http://developer.dnsimple.com/contacts/
func (*ContactsService) Create ¶
func (s *ContactsService) Create(contactAttributes Contact) (Contact, *Response, error)
Create a new contact.
DNSimple API docs: http://developer.dnsimple.com/contacts/#create
func (*ContactsService) Delete ¶
func (s *ContactsService) Delete(contactID int) (*Response, error)
Delete a contact.
DNSimple API docs: http://developer.dnsimple.com/contacts/#delete
func (*ContactsService) Get ¶
func (s *ContactsService) Get(contactID int) (Contact, *Response, error)
Get fetches a contact.
DNSimple API docs: http://developer.dnsimple.com/contacts/#get
func (*ContactsService) List ¶
func (s *ContactsService) List() ([]Contact, *Response, error)
List the contacts.
DNSimple API docs: http://developer.dnsimple.com/contacts/#list
func (*ContactsService) Update ¶
func (s *ContactsService) Update(contactID int, contactAttributes Contact) (Contact, *Response, error)
Update a contact.
DNSimple API docs: http://developer.dnsimple.com/contacts/#update
type Domain ¶
type Domain struct { Id int `json:"id,omitempty"` UserId int `json:"user_id,omitempty"` RegistrantId int `json:"registrant_id,omitempty"` Name string `json:"name,omitempty"` UnicodeName string `json:"unicode_name,omitempty"` Token string `json:"token,omitempty"` State string `json:"state,omitempty"` Language string `json:"language,omitempty"` Lockable bool `json:"lockable,omitempty"` AutoRenew bool `json:"auto_renew,omitempty"` WhoisProtected bool `json:"whois_protected,omitempty"` RecordCount int `json:"record_count,omitempty"` ServiceCount int `json:"service_count,omitempty"` ExpiresOn string `json:"expires_on,omitempty"` CreatedAt string `json:"created_at,omitempty"` UpdatedAt string `json:"updated_at,omitempty"` }
type DomainsService ¶
type DomainsService struct {
// contains filtered or unexported fields
}
DomainsService handles communication with the domain related methods of the DNSimple API.
DNSimple API docs: http://developer.dnsimple.com/domains/
func (*DomainsService) Create ¶
func (s *DomainsService) Create(domainAttributes Domain) (Domain, *Response, error)
Create a new domain.
DNSimple API docs: http://developer.dnsimple.com/domains/#create
func (*DomainsService) CreateRecord ¶
func (s *DomainsService) CreateRecord(domain interface{}, recordAttributes Record) (Record, *Response, error)
CreateRecord creates a domain record.
DNSimple API docs: http://developer.dnsimple.com/domains/records/#create
func (*DomainsService) Delete ¶
func (s *DomainsService) Delete(domain interface{}) (*Response, error)
Delete a domain.
DNSimple API docs: http://developer.dnsimple.com/domains/#delete
func (*DomainsService) DeleteRecord ¶
func (s *DomainsService) DeleteRecord(domain interface{}, recordID int) (*Response, error)
DeleteRecord deletes a domain record.
DNSimple API docs: http://developer.dnsimple.com/domains/records/#delete
func (*DomainsService) DisableAutoRenewal ¶
func (s *DomainsService) DisableAutoRenewal(domain interface{}) (*Response, error)
DisableAutoRenewal disables the auto-renewal feature for the domain.
DNSimple API docs: http://developer.dnsimple.com/domains/autorenewal/#disable
func (*DomainsService) EnableAutoRenewal ¶
func (s *DomainsService) EnableAutoRenewal(domain interface{}) (*Response, error)
EnableAutoRenewal enables the auto-renewal feature for the domain.
DNSimple API docs: http://developer.dnsimple.com/domains/autorenewal/#enable
func (*DomainsService) Get ¶
func (s *DomainsService) Get(domain interface{}) (Domain, *Response, error)
Get fetches a domain.
DNSimple API docs: http://developer.dnsimple.com/domains/#get
func (*DomainsService) GetRecord ¶
func (s *DomainsService) GetRecord(domain interface{}, recordID int) (Record, *Response, error)
GetRecord fetches the domain record.
DNSimple API docs: http://developer.dnsimple.com/domains/records/#get
func (*DomainsService) GetZone ¶
func (s *DomainsService) GetZone(domain interface{}) (string, *Response, error)
GetZone downloads the Bind-like zone file.
DNSimple API docs: http://developer.dnsimple.com/domains/zones/#get
func (*DomainsService) List ¶
func (s *DomainsService) List() ([]Domain, *Response, error)
List the domains.
DNSimple API docs: http://developer.dnsimple.com/domains/#list
func (*DomainsService) ListRecords ¶
func (s *DomainsService) ListRecords(domain interface{}, recordName, recordType string) ([]Record, *Response, error)
List the domain records.
DNSimple API docs: http://developer.dnsimple.com/domains/records/#list
func (*DomainsService) SetAutoRenewal ¶
func (s *DomainsService) SetAutoRenewal(domain interface{}, autoRenew bool) (*Response, error)
SetAutoRenewal is a convenient helper to enable/disable the auto-renewal feature for the domain.
DNSimple API docs: http://developer.dnsimple.com/domains/autorenewal/#enable DNSimple API docs: http://developer.dnsimple.com/domains/autorenewal/#disable
func (*DomainsService) UpdateRecord ¶
func (s *DomainsService) UpdateRecord(domain interface{}, recordID int, recordAttributes Record) (Record, *Response, error)
UpdateRecord updates a domain record.
DNSimple API docs: http://developer.dnsimple.com/domains/records/#update
type ErrorResponse ¶
type ErrorResponse struct { Response *http.Response // HTTP response that caused this error Message string `json:"message"` // human-readable message }
An ErrorResponse represents an error caused by an API request.
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
Error implements the error interface.
type ExtendedAttributes ¶
ExtendedAttributes maps the additional attributes required by some registries.
type Record ¶
type Record struct { Id int `json:"id,omitempty"` DomainId int `json:"domain_id,omitempty"` Name string `json:"name,omitempty"` Content string `json:"content,omitempty"` TTL int `json:"ttl,omitempty"` Priority int `json:"prio,omitempty"` Type string `json:"record_type,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` }
type RegistrarService ¶
type RegistrarService struct {
// contains filtered or unexported fields
}
RegistrarService handles communication with the registrar related methods of the DNSimple API.
DNSimple API docs: http://developer.dnsimple.com/registrar/
func (*RegistrarService) IsAvailable ¶
func (s *RegistrarService) IsAvailable(domain string) (bool, error)
IsAvailable checks if the domain is available or registered.
func (*RegistrarService) Register ¶
func (s *RegistrarService) Register(domain string, registrantID int, extendedAttributes *ExtendedAttributes) (Domain, *Response, error)
Register a domain.
DNSimple API docs: http://developer.dnsimple.com/registrar/#register
func (*RegistrarService) Renew ¶
Renew the domain, optionally renewing WHOIS privacy service.
DNSimple API docs: http://developer.dnsimple.com/registrar/#renew
func (*RegistrarService) Transfer ¶
func (s *RegistrarService) Transfer(domain string, registrantID int, authCode string, extendedAttributes *ExtendedAttributes) (Domain, *Response, error)
Transfer a domain.
DNSimple API docs: http://developer.dnsimple.com/registrar/#transfer
type TransferOrder ¶
type TransferOrder struct {
AuthCode string `json:"authinfo,omitempty"`
}
ExtendedAttributes represents the transfer information.
type UsersService ¶
type UsersService struct {
// contains filtered or unexported fields
}
UsersService handles communication with the uer related methods of the DNSimple API.
DNSimple API docs: http://developer.dnsimple.com/users/
func (*UsersService) User ¶
func (s *UsersService) User() (User, *Response, error)
User gets the logged in user.
DNSimple API docs: http://developer.dnsimple.com/users/