dnsimple

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2016 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package dnsimple provides a client for the DNSimple API. In order to use this package you will need a DNSimple account.

Index

Constants

View Source
const (
	// AuthorizationCodeGrant is the type of access token request
	// for an Authorization Code Grant flow.
	// https://tools.ietf.org/html/rfc6749#section-4.1
	AuthorizationCodeGrant = GrantType("authorization_code")
)

Variables

This section is empty.

Functions

func CheckResponse

func CheckResponse(resp *http.Response) error

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 AccessToken

type AccessToken struct {
	Token     string `json:"access_token"`
	Type      string `json:"token_type"`
	AccountID int    `json:"account_id"`
}

AccessToken represents a DNSimple Oauth access token.

type Account

type Account struct {
	ID    int    `json:"id,omitempty"`
	Email string `json:"email,omitempty"`
}

Account represents a DNSimple account.

type AuthorizationOptions

type AuthorizationOptions struct {
	RedirectURI string `url:"redirect_uri,omitempty"`
	// A randomly generated string to verify the validity of the request.
	// Currently "state" is required by the DNSimple OAuth implementation, so you must specify it.
	State string `url:"state,omitempty"`
}

AuthorizationOptions represents the option you can use to generate an authorization URL.

type Client

type Client struct {
	// HttpClient is the underlying HTTP client
	// used to communicate with the API.
	HttpClient *http.Client

	// Credentials used for accessing the DNSimple API
	Credentials Credentials

	// BaseURL for API requests.
	// Defaults to the public DNSimple API, but can be set to a different endpoint (e.g. the sandbox).
	BaseURL string

	// UserAgent used when communicating with the DNSimple API.
	UserAgent string

	// Services used for talking to different parts of the DNSimple API.
	Identity  *IdentityService
	Contacts  *ContactsService
	Domains   *DomainsService
	Oauth     *OauthService
	Registrar *RegistrarService
	Tlds      *TldsService
	Webhooks  *WebhooksService
	Zones     *ZonesService
	Templates *TemplatesService

	// Set to true to output debugging logs during API calls
	Debug bool
}

Client represents a client to the DNSimple API.

func NewClient

func NewClient(credentials Credentials) *Client

NewClient returns a new DNSimple API client using the given credentials.

func (*Client) Do

func (c *Client) Do(req *http.Request, payload, obj interface{}) (*http.Response, error)

Do sends an API request and returns the API response.

The API response is JSON decoded and stored in the value pointed by obj, or returned as an error if an API error has occurred. If obj implements the io.Writer interface, the raw response body will be written to obj, without attempting to decode it.

func (*Client) NewRequest

func (c *Client) NewRequest(method, path string, payload interface{}) (*http.Request, error)

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"`
	AccountID     int    `json:"account_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"`
	Address1      string `json:"address1,omitempty"`
	Address2      string `json:"address2,omitempty"`
	City          string `json:"city,omitempty"`
	StateProvince string `json:"state_province,omitempty"`
	PostalCode    string `json:"postal_code,omitempty"`
	Country       string `json:"country,omitempty"`
	Phone         string `json:"phone,omitempty"`
	Fax           string `json:"fax,omitempty"`
	Email         string `json:"email_address,omitempty"`
	CreatedAt     string `json:"created_at,omitempty"`
	UpdatedAt     string `json:"updated_at,omitempty"`
}

Contact represents a Contact in DNSimple.

type ContactResponse

type ContactResponse struct {
	Response
	Data *Contact `json:"data"`
}

ContactResponse represents a response from an API method that returns a Contact struct.

type ContactsResponse

type ContactsResponse struct {
	Response
	Data []Contact `json:"data"`
}

ContactsResponse represents a response from an API method that returns a collection of Contact struct.

type ContactsService

type ContactsService struct {
	// contains filtered or unexported fields
}

ContactsService handles communication with the contact related methods of the DNSimple API.

See https://developer.dnsimple.com/v2/contacts/

func (*ContactsService) CreateContact

func (s *ContactsService) CreateContact(accountID string, contactAttributes Contact) (*ContactResponse, error)

CreateContact creates a new contact.

See https://developer.dnsimple.com/v2/contacts/#create

func (*ContactsService) DeleteContact

func (s *ContactsService) DeleteContact(accountID string, contactID int) (*ContactResponse, error)

DeleteContact PERMANENTLY deletes a contact from the account.

See https://developer.dnsimple.com/v2/contacts/#delete

func (*ContactsService) GetContact

func (s *ContactsService) GetContact(accountID string, contactID int) (*ContactResponse, error)

GetContact fetches a contact.

See https://developer.dnsimple.com/v2/contacts/#get

func (*ContactsService) ListContacts

func (s *ContactsService) ListContacts(accountID string, options *ListOptions) (*ContactsResponse, error)

ListContacts list the contacts for an account.

See https://developer.dnsimple.com/v2/contacts/#list

func (*ContactsService) UpdateContact

func (s *ContactsService) UpdateContact(accountID string, contactID int, contactAttributes Contact) (*ContactResponse, error)

UpdateContact updates a contact.

See https://developer.dnsimple.com/v2/contacts/#update

type Credentials

type Credentials interface {
	// Returns the HTTP headers that should be set
	// to authenticate the HTTP Request.
	Headers() map[string]string
}

Provides credentials that can be used for authenticating with DNSimple.

See https://developer.dnsimple.com/v2/#authentication

func NewDomainTokenCredentials

func NewDomainTokenCredentials(domainToken string) Credentials

NewDomainTokenCredentials construct Credentials using the DNSimple Domain Token method.

func NewHTTPBasicCredentials

func NewHTTPBasicCredentials(email, password string) Credentials

NewHTTPBasicCredentials construct Credentials using HTTP Basic Auth.

func NewOauthTokenCredentials

func NewOauthTokenCredentials(oauthToken string) Credentials

NewOauthTokenCredentials construct Credentials using the OAuth access token.

type Delegation

type Delegation []string

Domain represents a list of name servers that correspond to a domain delegation.

type DelegationResponse

type DelegationResponse struct {
	Response
	Data *Delegation `json:"data"`
}

WhoisPrivacyResponse represents a response from an API method that returns a delegation struct.

type Domain

type Domain struct {
	ID           int    `json:"id,omitempty"`
	AccountID    int    `json:"account_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"`
	AutoRenew    bool   `json:"auto_renew,omitempty"`
	PrivateWhois bool   `json:"private_whois,omitempty"`
	ExpiresOn    string `json:"expires_on,omitempty"`
	CreatedAt    string `json:"created_at,omitempty"`
	UpdatedAt    string `json:"updated_at,omitempty"`
}

Domain represents a domain in DNSimple.

type DomainCheck

type DomainCheck struct {
	Domain    string `json:"domain"`
	Available bool   `json:"available"`
	Premium   bool   `json:"premium"`
}

DomainCheck represents the result of a domain check.

type DomainCheckResponse

type DomainCheckResponse struct {
	Response
	Data *DomainCheck `json:"data"`
}

DomainCheckResponse represents a response from the domain check.

type DomainListOptions

type DomainListOptions struct {
	// Select domains where the name contains given string.
	NameLike string `url:"name_like,omitempty"`

	// Select domains where the registrant matches given ID.
	RegistrantID int `url:"registrant_id,omitempty"`

	ListOptions
}

DomainListOptions specifies the optional parameters you can provide to customize the DomainsService.ListDomains method.

type DomainRegisterRequest

type DomainRegisterRequest struct {
	// The ID of the Contact to use as registrant for the domain
	RegistrantID int `json:"registrant_id"`
	// Set to true to enable the whois privacy service. An extra cost may apply.
	// Default to false.
	EnableWhoisPrivacy bool `json:"private_whois,omitempty"`
	// Set to true to enable the auto-renewal of the domain.
	// Default to true.
	EnableAutoRenewal bool `json:"auto_renew,omitempty"`
}

DomainRegisterRequest represents the attributes you can pass to a register API request. Some attributes are mandatory.

type DomainRegistrationResponse

type DomainRegistrationResponse struct {
	Response
	Data *Domain `json:"data"`
}

DomainRegistrationResponse represents a response from an API method that results in a domain registration.

type DomainRenewRequest

type DomainRenewRequest struct {
	// The number of years
	Period int `json:"period"`
}

DomainRenewRequest represents the attributes you can pass to a renew API request. Some attributes are mandatory.

type DomainRenewalResponse

type DomainRenewalResponse struct {
	Response
	Data *Domain `json:"data"`
}

DomainRenewalResponse represents a response from an API method that results in a domain renewal.

type DomainResponse

type DomainResponse struct {
	Response
	Data *Domain `json:"data"`
}

DomainResponse represents a response from an API method that returns a Domain struct.

type DomainTransferOutResponse

type DomainTransferOutResponse struct {
	Response
	Data *Domain `json:"data"`
}

DomainTransferOutResponse represents a response from an API method that results in a domain transfer out.

type DomainTransferRequest

type DomainTransferRequest struct {
	// The ID of the Contact to use as registrant for the domain
	RegistrantID int `json:"registrant_id"`
	// The Auth-Code required to transfer the domain.
	// This is provided by the current registrar of the domain.
	AuthInfo string `json:"auth_info,omitempty"`
	// Set to true to enable the whois privacy service. An extra cost may apply.
	// Default to false.
	EnableWhoisPrivacy bool `json:"private_whois,omitempty"`
	// Set to true to enable the auto-renewal of the domain.
	// Default to true.
	EnableAutoRenewal bool `json:"auto_renew,omitempty"`
}

DomainTransferRequest represents the attributes you can pass to a transfer API request. Some attributes are mandatory.

type DomainTransferResponse

type DomainTransferResponse struct {
	Response
	Data *Domain `json:"data"`
}

DomainTransferResponse represents a response from an API method that results in a domain transfer.

type DomainsResponse

type DomainsResponse struct {
	Response
	Data []Domain `json:"data"`
}

DomainsResponse represents a response from an API method that returns a collection of Domain struct.

type DomainsService

type DomainsService struct {
	// contains filtered or unexported fields
}

DomainsService handles communication with the domain related methods of the DNSimple API.

See https://developer.dnsimple.com/v2/domains/

func (*DomainsService) CreateDomain

func (s *DomainsService) CreateDomain(accountID string, domainAttributes Domain) (*DomainResponse, error)

CreateDomain creates a new domain in the account.

See https://developer.dnsimple.com/v2/domains/#create

func (*DomainsService) CreateEmailForward

func (s *DomainsService) CreateEmailForward(accountID string, domain interface{}, forwardAttributes EmailForward) (*EmailForwardResponse, error)

CreateEmailForward creates a new email forward.

See https://developer.dnsimple.com/v2/domains/email-forwards/#create

func (*DomainsService) DeleteDomain

func (s *DomainsService) DeleteDomain(accountID string, domain interface{}) (*DomainResponse, error)

DeleteDomain PERMANENTLY deletes a domain from the account.

See https://developer.dnsimple.com/v2/domains/#delete

func (*DomainsService) DeleteEmailForward

func (s *DomainsService) DeleteEmailForward(accountID string, domain interface{}, forwardID int) (*EmailForwardResponse, error)

DeleteEmailForward PERMANENTLY deletes an email forward from the domain.

See https://developer.dnsimple.com/v2/domains/email-forwards/#delete

func (*DomainsService) GetDomain

func (s *DomainsService) GetDomain(accountID string, domain interface{}) (*DomainResponse, error)

GetDomain fetches a domain.

See https://developer.dnsimple.com/v2/domains/#get

func (*DomainsService) GetEmailForward

func (s *DomainsService) GetEmailForward(accountID string, domain interface{}, forwardID int) (*EmailForwardResponse, error)

GetEmailForward fetches an email forward.

See https://developer.dnsimple.com/v2/domains/email-forwards/#get

func (*DomainsService) ListDomains

func (s *DomainsService) ListDomains(accountID string, options *DomainListOptions) (*DomainsResponse, error)

ListDomains lists the domains for an account.

See https://developer.dnsimple.com/v2/domains/#list

func (*DomainsService) ListEmailForwards

func (s *DomainsService) ListEmailForwards(accountID string, domain interface{}, options *ListOptions) (*EmailForwardsResponse, error)

ListEmailForwards lists the email forwards for a domain.

See https://developer.dnsimple.com/v2/domains/email-forwards/#list

func (*DomainsService) ResetDomainToken

func (s *DomainsService) ResetDomainToken(accountID string, domain interface{}) (*DomainResponse, error)

ResetDomainToken resets the domain token.

See https://developer.dnsimple.com/v2/domains/#reset-token

type EmailForward

type EmailForward struct {
	ID        int    `json:"id,omitempty"`
	DomainID  int    `json:"domain_id,omitempty"`
	From      string `json:"from,omitempty"`
	To        string `json:"to,omitempty"`
	CreatedAt string `json:"created_at,omitempty"`
	UpdatedAt string `json:"updated_at,omitempty"`
}

EmailForward represents an email forward in DNSimple.

type EmailForwardResponse

type EmailForwardResponse struct {
	Response
	Data *EmailForward `json:"data"`
}

EmailForwardResponse represents a response from an API method that returns an EmailForward struct.

type EmailForwardsResponse

type EmailForwardsResponse struct {
	Response
	Data []EmailForward `json:"data"`
}

EmailForwardsResponse represents a response from an API method that returns a collection of EmailForward struct.

type ErrorResponse

type ErrorResponse struct {
	Response

	// human-readable message
	Message string `json:"message"`
}

An ErrorResponse represents an API response that generated an error.

func (*ErrorResponse) Error

func (r *ErrorResponse) Error() string

Error implements the error interface.

type ExchangeAuthorizationError

type ExchangeAuthorizationError struct {
	// HTTP response
	HttpResponse *http.Response

	ErrorCode        string `json:"error"`
	ErrorDescription string `json:"error_description"`
}

ExchangeAuthorizationError represents a failed request to exchange an authorization code for an access token.

func (*ExchangeAuthorizationError) Error

Error implements the error interface.

type ExchangeAuthorizationRequest

type ExchangeAuthorizationRequest struct {
	Code         string    `json:"code"`
	ClientID     string    `json:"client_id"`
	ClientSecret string    `json:"client_secret"`
	RedirectURI  string    `json:"redirect_uri,omitempty"`
	State        string    `json:"state,omitempty"`
	GrantType    GrantType `json:"grant_type,omitempty"`
}

ExchangeAuthorizationRequest represents a request to exchange an authorization code for an access token. RedirectURI is optional, all the other fields are mandatory.

type GrantType

type GrantType string

GrantType is a string that identifies a particular grant type in the exchange request.

type IdentityService

type IdentityService struct {
	// contains filtered or unexported fields
}

IdentityService handles communication with several authentication identity methods of the DNSimple API.

See https://developer.dnsimple.com/v2/identity/

func (*IdentityService) Whoami

func (s *IdentityService) Whoami() (*WhoamiResponse, error)

Whoami gets the current authenticate context.

See https://developer.dnsimple.com/v2/whoami

type ListOptions

type ListOptions struct {
	// The page to return
	Page int `url:"page,omitempty"`

	// The number of entries to return per page
	PerPage int `url:"per_page,omitempty"`

	// The order criteria to sort the results.
	// The value is a comma-separated list of field[:direction],
	// eg. name | name:desc | name:desc,expiration:desc
	Sort string `url:"sort,omitempty"`
}

ListOptions contains the common options you can pass to a List method in order to control parameters such as paginations and page number.

type OauthService

type OauthService struct {
	// contains filtered or unexported fields
}

OauthService handles communication with the authorization related methods of the DNSimple API.

See https://developer.dnsimple.com/v2/oauth/

func (*OauthService) AuthorizeURL

func (s *OauthService) AuthorizeURL(clientID string, options *AuthorizationOptions) string

AuthorizeURL generates the URL to authorize an user for an application via the OAuth2 flow.

func (*OauthService) ExchangeAuthorizationForToken

func (s *OauthService) ExchangeAuthorizationForToken(authorization *ExchangeAuthorizationRequest) (*AccessToken, error)

ExchangeAuthorizationForToken exchanges the short-lived authorization code for an access token you can use to authenticate your API calls.

type Pagination

type Pagination struct {
	CurrentPage  int `json:"current_page"`
	PerPage      int `json:"per_page"`
	TotalPages   int `json:"total_pages"`
	TotalEntries int `json:"total_entries"`
}

If the response is paginated, Pagination represents the pagination information.

type RegistrarService

type RegistrarService struct {
	// contains filtered or unexported fields
}

RegistrarService handles communication with the registrar related methods of the DNSimple API.

See https://developer.dnsimple.com/v2/registrar/

func (*RegistrarService) ChangeDomainDelegation

func (s *RegistrarService) ChangeDomainDelegation(accountID string, domainName string, newDelegation *Delegation) (*DelegationResponse, error)

ChangeDomainDelegation updates the delegated name severs for the domain.

See https://developer.dnsimple.com/v2/registrar/delegation/#get

func (*RegistrarService) CheckDomain

func (s *RegistrarService) CheckDomain(accountID string, domainName string) (*DomainCheckResponse, error)

CheckDomain checks a domain name.

See https://developer.dnsimple.com/v2/registrar/#check

func (*RegistrarService) DisableDomainAutoRenewal

func (s *RegistrarService) DisableDomainAutoRenewal(accountID string, domainName string) (*DomainResponse, error)

DisableDomainAutoRenewal disables auto-renewal for the domain.

See https://developer.dnsimple.com/v2/registrar/auto-renewal/#enable

func (*RegistrarService) DisableWhoisPrivacy

func (s *RegistrarService) DisableWhoisPrivacy(accountID string, domainName string) (*WhoisPrivacyResponse, error)

DisablePrivacy disables the whois privacy for the domain.

See https://developer.dnsimple.com/v2/registrar/whois-privacy/#enable

func (*RegistrarService) EnableDomainAutoRenewal

func (s *RegistrarService) EnableDomainAutoRenewal(accountID string, domainName string) (*DomainResponse, error)

EnableDomainAutoRenewal enables auto-renewal for the domain.

See https://developer.dnsimple.com/v2/registrar/auto-renewal/#enable

func (*RegistrarService) EnableWhoisPrivacy

func (s *RegistrarService) EnableWhoisPrivacy(accountID string, domainName string) (*WhoisPrivacyResponse, error)

EnableWhoisPrivacy enables the whois privacy for the domain.

See https://developer.dnsimple.com/v2/registrar/whois-privacy/#enable

func (*RegistrarService) GetDomainDelegation

func (s *RegistrarService) GetDomainDelegation(accountID string, domainName string) (*DelegationResponse, error)

GetDomainDelegation gets the current delegated name servers for the domain.

See https://developer.dnsimple.com/v2/registrar/delegation/#get

func (*RegistrarService) GetWhoisPrivacy

func (s *RegistrarService) GetWhoisPrivacy(accountID string, domainName string) (*WhoisPrivacyResponse, error)

GetWhoisPrivacy gets the whois privacy for the domain.

See https://developer.dnsimple.com/v2/registrar/whois-privacy/#get

func (*RegistrarService) RegisterDomain

func (s *RegistrarService) RegisterDomain(accountID string, domainName string, request *DomainRegisterRequest) (*DomainRegistrationResponse, error)

RegisterDomain registers a domain name.

See https://developer.dnsimple.com/v2/registrar/#register

func (*RegistrarService) RenewDomain

func (s *RegistrarService) RenewDomain(accountID string, domainName string, request *DomainRenewRequest) (*DomainRenewalResponse, error)

RenewDomain renews a domain name.

See https://developer.dnsimple.com/v2/registrar/#register

func (*RegistrarService) TransferDomain

func (s *RegistrarService) TransferDomain(accountID string, domainName string, request *DomainTransferRequest) (*DomainTransferResponse, error)

TransferDomain transfers a domain name.

See https://developer.dnsimple.com/v2/registrar/#transfer

func (*RegistrarService) TransferDomainOut

func (s *RegistrarService) TransferDomainOut(accountID string, domainName string) (*DomainTransferOutResponse, error)

Transfer out a domain name.

See https://developer.dnsimple.com/v2/registrar/#transfer-out

type Response

type Response struct {
	// HTTP response
	HttpResponse *http.Response

	// If the response is paginated, the Pagination will store them.
	Pagination *Pagination `json:"pagination"`
}

A Response represents an API response.

func (*Response) RateLimit

func (r *Response) RateLimit() int

RateLimit returns the maximum amount of requests this account can send in an hour.

func (*Response) RateLimitRemaining

func (r *Response) RateLimitRemaining() int

RateLimitRemaining returns the remaining amount of requests this account can send within this hour window.

func (*Response) RateLimitReset

func (r *Response) RateLimitReset() time.Time

RateLimitReset returns when the throttling window will be reset for this account.

type Template

type Template struct {
	ID          int    `json:"id,omitempty"`
	AccountID   int    `json:"account_id,omitempty"`
	Name        string `json:"name,omitempty"`
	ShortName   string `json:"short_name,omitempty"`
	Description string `json:"description,omitempty"`
	CreatedAt   string `json:"created_at,omitempty"`
	UpdatedAt   string `json:"updated_at,omitempty"`
}

Template represents a Template in DNSimple.

type TemplateResponse

type TemplateResponse struct {
	Response
	Data *Template `json:"data"`
}

TemplateResponse represents a response from an API method that returns a Template struct.

type TemplatesResponse

type TemplatesResponse struct {
	Response
	Data []Template `json:"data"`
}

TemplatesResponse represents a response from an API method that returns a collection of Template struct.

type TemplatesService

type TemplatesService struct {
	// contains filtered or unexported fields
}

TemplatesService handles communication with the template related methods of the DNSimple API.

See https://developer.dnsimple.com/v2/templates/

func (*TemplatesService) CreateTemplate

func (s *TemplatesService) CreateTemplate(accountID string, templateAttributes Template) (*TemplateResponse, error)

CreateTemplate creates a new template.

See https://developer.dnsimple.com/v2/templates/#create

func (*TemplatesService) GetTemplate

func (s *TemplatesService) GetTemplate(accountID string, templateID string) (*TemplateResponse, error)

GetTemplate fetches a template.

See https://developer.dnsimple.com/v2/templates/#get

func (*TemplatesService) ListTemplates

func (s *TemplatesService) ListTemplates(accountID string, options *ListOptions) (*TemplatesResponse, error)

ListTemplates list the templates for an account.

See https://developer.dnsimple.com/v2/templates/#list

type Tld

type Tld struct {
	Tld           string `json:"tld"`
	TldType       int    `json:"tld_type"`
	WhoisPrivacy  bool   `json:"whois_privacy"`
	AutoRenewOnly bool   `json:"auto_renew_only"`
}

Tld represents a TLD in DNSimple.

type TldExtendedAttribute

type TldExtendedAttribute struct {
	Name        string                       `json:"name"`
	Description string                       `json:"description"`
	Required    bool                         `json:"required"`
	Options     []TldExtendedAttributeOption `json:"options"`
}

TldExtendedAttribute represents an extended attributes supported or required by a specific TLD.

See https://developer.dnsimple.com/v2/tlds/

type TldExtendedAttributeOption

type TldExtendedAttributeOption struct {
	Title       string `json:"title"`
	Value       string `json:"value"`
	Description string `json:"description"`
}

TldExtendedAttributeOption represents a single option you can assign to an extended attributes.

See https://developer.dnsimple.com/v2/tlds/

type TldExtendedAttributesResponse

type TldExtendedAttributesResponse struct {
	Response
	Data []TldExtendedAttribute `json:"data"`
}

TldExtendedAttributesResponse represents a response from an API method that returns a collection of Tld extended attributes.

type TldResponse

type TldResponse struct {
	Response
	Data *Tld `json:"data"`
}

TldResponse represents a response from an API method that returns a Tld struct.

type TldsResponse

type TldsResponse struct {
	Response
	Data []Tld `json:"data"`
}

TldsResponse represents a response from an API method that returns a collection of Tld struct.

type TldsService

type TldsService struct {
	// contains filtered or unexported fields
}

TldsService handles communication with the Tld related methods of the DNSimple API.

See https://developer.dnsimple.com/v2/tlds/

func (*TldsService) GetTld

func (s *TldsService) GetTld(tld string) (*TldResponse, error)

GetTld fetches a TLD.

See https://developer.dnsimple.com/v2/tlds/#get

func (*TldsService) GetTldExtendedAttributes

func (s *TldsService) GetTldExtendedAttributes(tld string) (*TldExtendedAttributesResponse, error)

GetTld fetches the extended attributes of a TLD.

See https://developer.dnsimple.com/v2/tlds/#get

func (*TldsService) ListTlds

func (s *TldsService) ListTlds(options *ListOptions) (*TldsResponse, error)

ListTlds lists the supported TLDs.

See https://developer.dnsimple.com/v2/tlds/#list

type User

type User struct {
	ID    int    `json:"id,omitempty"`
	Email string `json:"email,omitempty"`
}

User represents a DNSimple user.

type Webhook

type Webhook struct {
	ID  int    `json:"id,omitempty"`
	URL string `json:"url,omitempty"`
}

Webhook represents a DNSimple webhook.

type WebhookResponse

type WebhookResponse struct {
	Response
	Data *Webhook `json:"data"`
}

WebhookResponse represents a response from an API method that returns a Webhook struct.

type WebhooksResponse

type WebhooksResponse struct {
	Response
	Data []Webhook `json:"data"`
}

WebhookResponse represents a response from an API method that returns a collection of Webhook struct.

type WebhooksService

type WebhooksService struct {
	// contains filtered or unexported fields
}

WebhooksService handles communication with the webhook related methods of the DNSimple API.

See PRIVATE

func (*WebhooksService) CreateWebhook

func (s *WebhooksService) CreateWebhook(accountID string, webhookAttributes Webhook) (*WebhookResponse, error)

CreateWebhook creates a new webhook.

See PRIVATE

func (*WebhooksService) DeleteWebhook

func (s *WebhooksService) DeleteWebhook(accountID string, webhookID int) (*WebhookResponse, error)

DeleteWebhook PERMANENTLY deletes a webhook from the account.

See PRIVATE

func (*WebhooksService) GetWebhook

func (s *WebhooksService) GetWebhook(accountID string, webhookID int) (*WebhookResponse, error)

GetWebhook fetches a webhook.

See PRIVATE

func (*WebhooksService) ListWebhooks

func (s *WebhooksService) ListWebhooks(accountID string, _ *ListOptions) (*WebhooksResponse, error)

ListWebhooks lists the webhooks for an account.

See PRIVATE

type WhoamiData

type WhoamiData struct {
	User    *User    `json:"user,omitempty"`
	Account *Account `json:"account,omitempty"`
}

WhoamiData represents an authenticated context that contains information about the current logged User and/or Account.

func Whoami

func Whoami(c *Client) (data *WhoamiData, err error)

Whoami is a state-less shortcut to client.Whoami() that returns only the relevant Data.

type WhoamiResponse

type WhoamiResponse struct {
	Response
	Data *WhoamiData `json:"data"`
}

WhoamiResponse represents a response from an API method that returns a Whoami struct.

type WhoisPrivacy

type WhoisPrivacy struct {
	ID        int    `json:"id,omitempty"`
	DomainID  int    `json:"domain_id,omitempty"`
	Enabled   bool   `json:"enabled,omitempty"`
	ExpiresOn string `json:"expires_on,omitempty"`
	CreatedAt string `json:"created_at,omitempty"`
	UpdatedAt string `json:"updated_at,omitempty"`
}

WhoisPrivacy represents a whois privacy in DNSimple.

type WhoisPrivacyResponse

type WhoisPrivacyResponse struct {
	Response
	Data *WhoisPrivacy `json:"data"`
}

WhoisPrivacyResponse represents a response from an API method that returns a WhoisPrivacy struct.

type Zone

type Zone struct {
	ID        int    `json:"id,omitempty"`
	AccountID int    `json:"account_id,omitempty"`
	Name      string `json:"name,omitempty"`
	Reverse   bool   `json:"reverse,omitempty"`
	CreatedAt string `json:"created_at,omitempty"`
	UpdatedAt string `json:"updated_at,omitempty"`
}

Zone represents a Zone in DNSimple.

type ZoneListOptions

type ZoneListOptions struct {
	// Select domains where the name contains given string.
	NameLike string `url:"name_like,omitempty"`

	ListOptions
}

ZoneListOptions specifies the optional parameters you can provide to customize the ZonesService.ListZones method.

type ZoneRecord

type ZoneRecord struct {
	ID           int    `json:"id,omitempty"`
	ZoneID       string `json:"zone_id,omitempty"`
	ParentID     int    `json:"parent_id,omitempty"`
	Type         string `json:"type,omitempty"`
	Name         string `json:"name"`
	Content      string `json:"content,omitempty"`
	TTL          int    `json:"ttl,omitempty"`
	Priority     int    `json:"priority,omitempty"`
	SystemRecord bool   `json:"system_record,omitempty"`
	CreatedAt    string `json:"created_at,omitempty"`
	UpdatedAt    string `json:"updated_at,omitempty"`
}

ZoneRecord represents a DNS record in DNSimple.

type ZoneRecordListOptions

type ZoneRecordListOptions struct {
	// Select records where the name matches given string.
	Name string `url:"name,omitempty"`

	// Select records where the name contains given string.
	NameLike string `url:"name_like,omitempty"`

	// Select records of given type.
	// Eg. TXT, A, NS.
	Type string `url:"record_type,omitempty"`

	ListOptions
}

ZoneRecordListOptions specifies the optional parameters you can provide to customize the ZonesService.ListZoneRecords method.

type ZoneRecordResponse

type ZoneRecordResponse struct {
	Response
	Data *ZoneRecord `json:"data"`
}

ZoneRecordResponse represents a response from an API method that returns a ZoneRecord struct.

type ZoneRecordsResponse

type ZoneRecordsResponse struct {
	Response
	Data []ZoneRecord `json:"data"`
}

ZoneRecordsResponse represents a response from an API method that returns a collection of ZoneRecord struct.

type ZoneResponse

type ZoneResponse struct {
	Response
	Data *Zone `json:"data"`
}

ZoneResponse represents a response from an API method that returns a Zone struct.

type ZonesResponse

type ZonesResponse struct {
	Response
	Data []Zone `json:"data"`
}

ZonesResponse represents a response from an API method that returns a collection of Zone struct.

type ZonesService

type ZonesService struct {
	// contains filtered or unexported fields
}

ZonesService handles communication with the zone related methods of the DNSimple API.

See https://developer.dnsimple.com/v2/zones/

func (*ZonesService) CreateRecord

func (s *ZonesService) CreateRecord(accountID string, zoneID string, recordAttributes ZoneRecord) (*ZoneRecordResponse, error)

CreateRecord creates a zone record.

See https://developer.dnsimple.com/v2/zones/#create

func (*ZonesService) DeleteRecord

func (s *ZonesService) DeleteRecord(accountID string, zoneID string, recordID int) (*ZoneRecordResponse, error)

DeleteRecord PERMANENTLY deletes a zone record from the zone.

See https://developer.dnsimple.com/v2/zones/#delete

func (*ZonesService) GetRecord

func (s *ZonesService) GetRecord(accountID string, zoneID string, recordID int) (*ZoneRecordResponse, error)

GetRecord fetches a zone record.

See https://developer.dnsimple.com/v2/zones/#get

func (*ZonesService) GetZone

func (s *ZonesService) GetZone(accountID string, zoneName string) (*ZoneResponse, error)

GetZone fetches a zone.

See https://developer.dnsimple.com/v2/zones/#get

func (*ZonesService) ListRecords

func (s *ZonesService) ListRecords(accountID string, zoneID string, options *ZoneRecordListOptions) (*ZoneRecordsResponse, error)

ListRecords lists the zone records for a zone.

See https://developer.dnsimple.com/v2/zones/#list

func (*ZonesService) ListZones

func (s *ZonesService) ListZones(accountID string, options *ZoneListOptions) (*ZonesResponse, error)

ListZones the zones for an account.

See https://developer.dnsimple.com/v2/zones/#list

func (*ZonesService) UpdateRecord

func (s *ZonesService) UpdateRecord(accountID string, zoneID string, recordID int, recordAttributes ZoneRecord) (*ZoneRecordResponse, error)

UpdateRecord updates a zone record.

See https://developer.dnsimple.com/v2/zones/#update

Directories

Path Synopsis
Package webhook provides the support for reading and parsing the events sent from DNSimple via webhook.
Package webhook provides the support for reading and parsing the events sent from DNSimple via webhook.

Jump to

Keyboard shortcuts

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