Documentation ¶
Overview ¶
Package namecheap implements a client for the Namecheap API.
In order to use this package you will need a Namecheap account and your API Token.
Index ¶
- type ApiError
- type ApiErrors
- type ApiRequest
- type ApiResponse
- type Client
- func (client *Client) DomainCreate(domainName string, years int, options ...DomainCreateOption) (*DomainCreateResult, error)
- func (client *Client) DomainDNSSetCustom(sld, tld, nameservers string) (*DomainDNSSetCustomResult, error)
- func (client *Client) DomainDNSSetHosts(sld, tld string, hosts []DomainDNSHost) (*DomainDNSSetHostsResult, error)
- func (client *Client) DomainGetInfo(domainName string) (*DomainInfo, error)
- func (client *Client) DomainRenew(domainName string, years int) (*DomainRenewResult, error)
- func (client *Client) DomainSetContacts(domainName string) (*DomainSetContactsResult, error)
- func (client *Client) DomainsCheck(domainNames ...string) ([]DomainCheckResult, error)
- func (client *Client) DomainsDNSGetHosts(sld, tld string) (*DomainDNSGetHostsResult, error)
- func (client *Client) DomainsGetList() ([]DomainGetListResult, error)
- func (client *Client) DomainsTLDList() ([]TLDListResult, error)
- func (client *Client) NSGetInfo(sld, tld, nameserver string) (*DomainNSInfoResult, error)
- func (client *Client) NewRegistrant(...)
- func (client *Client) SslActivate(params SslActivateParams) (*SslActivateResult, error)
- func (client *Client) SslCreate(productType string, years int) (*SslCreateResult, error)
- func (client *Client) SslGetList() ([]SslGetListResult, error)
- func (client *Client) UsersGetPricing(productType string) ([]UsersGetPricingResult, error)
- func (client *Client) WhoisguardDisable(id int64) error
- func (client *Client) WhoisguardEnable(id int64, email string) error
- func (client *Client) WhoisguardGetList() ([]WhoisguardGetListResult, error)
- func (client *Client) WhoisguardRenew(id int64, years int) (*WhoisguardRenewResult, error)
- type DNSDetails
- type DomainCheckResult
- type DomainCreateOption
- type DomainCreateResult
- type DomainDNSGetHostsResult
- type DomainDNSHost
- type DomainDNSSetCustomResult
- type DomainDNSSetHostsResult
- type DomainGetListResult
- type DomainInfo
- type DomainNSInfoResult
- type DomainRenewResult
- type DomainSetContactsResult
- type Registrant
- type SSLCertificate
- type SslActivateParams
- type SslActivateResult
- type SslCreateResult
- type SslDcValidation
- type SslDns
- type SslGetListResult
- type TLDListResult
- type UsersGetPricingResult
- type Whoisguard
- type WhoisguardGetListResult
- type WhoisguardRenewResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiErrors ¶
type ApiErrors []ApiError
ApiErrors holds multiple ApiError's but implements the error interface
type ApiRequest ¶
type ApiRequest struct {
// contains filtered or unexported fields
}
type ApiResponse ¶
type ApiResponse struct { Status string `xml:"Status,attr"` Command string `xml:"RequestedCommand"` TLDList []TLDListResult `xml:"CommandResponse>Tlds>Tld"` Domains []DomainGetListResult `xml:"CommandResponse>DomainGetListResult>Domain"` DomainInfo *DomainInfo `xml:"CommandResponse>DomainGetInfoResult"` DomainDNSHosts *DomainDNSGetHostsResult `xml:"CommandResponse>DomainDNSGetHostsResult"` DomainDNSSetHosts *DomainDNSSetHostsResult `xml:"CommandResponse>DomainDNSSetHostsResult"` DomainCreate *DomainCreateResult `xml:"CommandResponse>DomainCreateResult"` DomainRenew *DomainRenewResult `xml:"CommandResponse>DomainRenewResult"` DomainsCheck []DomainCheckResult `xml:"CommandResponse>DomainCheckResult"` DomainNSInfo *DomainNSInfoResult `xml:"CommandResponse>DomainNSInfoResult"` DomainDNSSetCustom *DomainDNSSetCustomResult `xml:"CommandResponse>DomainDNSSetCustomResult"` DomainSetContacts *DomainSetContactsResult `xml:"CommandResponse>DomainSetContactResult"` SslActivate *SslActivateResult `xml:"CommandResponse>SSLActivateResult"` SslCreate *SslCreateResult `xml:"CommandResponse>SSLCreateResult"` SslCertificates []SslGetListResult `xml:"CommandResponse>SSLListResult>SSL"` UsersGetPricing []UsersGetPricingResult `xml:"CommandResponse>UserGetPricingResult>ProductType"` WhoisguardList []WhoisguardGetListResult `xml:"CommandResponse>WhoisguardGetListResult>Whoisguard"` WhoisguardEnable whoisguardEnableResult `xml:"CommandResponse>WhoisguardEnableResult"` WhoisguardDisable whoisguardDisableResult `xml:"CommandResponse>WhoisguardDisableResult"` WhoisguardRenew *WhoisguardRenewResult `xml:"CommandResponse>WhoisguardRenewResult"` Errors ApiErrors `xml:"Errors>Error"` }
type Client ¶
type Client struct { ApiUser string ApiToken string UserName string HttpClient *http.Client ClientIp string // Base URL for API requests. // Defaults to the public Namecheap API, // but can be set to a different endpoint (e.g. the sandbox). // BaseURL should always be specified with a trailing slash. BaseURL string *Registrant }
Client represents a client used to make calls to the Namecheap API.
func (*Client) DomainCreate ¶
func (client *Client) DomainCreate(domainName string, years int, options ...DomainCreateOption) (*DomainCreateResult, error)
func (*Client) DomainDNSSetCustom ¶
func (client *Client) DomainDNSSetCustom(sld, tld, nameservers string) (*DomainDNSSetCustomResult, error)
func (*Client) DomainDNSSetHosts ¶
func (client *Client) DomainDNSSetHosts( sld, tld string, hosts []DomainDNSHost, ) (*DomainDNSSetHostsResult, error)
func (*Client) DomainGetInfo ¶
func (client *Client) DomainGetInfo(domainName string) (*DomainInfo, error)
func (*Client) DomainRenew ¶
func (client *Client) DomainRenew(domainName string, years int) (*DomainRenewResult, error)
func (*Client) DomainSetContacts ¶
func (client *Client) DomainSetContacts(domainName string) (*DomainSetContactsResult, error)
func (*Client) DomainsCheck ¶
func (client *Client) DomainsCheck(domainNames ...string) ([]DomainCheckResult, error)
func (*Client) DomainsDNSGetHosts ¶
func (client *Client) DomainsDNSGetHosts(sld, tld string) (*DomainDNSGetHostsResult, error)
func (*Client) DomainsGetList ¶
func (client *Client) DomainsGetList() ([]DomainGetListResult, error)
func (*Client) DomainsTLDList ¶
func (client *Client) DomainsTLDList() ([]TLDListResult, error)
func (*Client) NSGetInfo ¶
func (client *Client) NSGetInfo(sld, tld, nameserver string) (*DomainNSInfoResult, error)
func (*Client) NewRegistrant ¶
func (client *Client) NewRegistrant( firstName, lastName, addr1, addr2, city, state, postalCode, country, phone, email string, )
NewRegistrant associates a new registrant with the
func (*Client) SslActivate ¶
func (client *Client) SslActivate(params SslActivateParams) (*SslActivateResult, error)
SslActivate activates a purchased and non-activated SSL certificate
func (*Client) SslCreate ¶
func (client *Client) SslCreate(productType string, years int) (*SslCreateResult, error)
SslCreate creates a new SSL certificate by purchasing it using the account funds
func (*Client) SslGetList ¶
func (client *Client) SslGetList() ([]SslGetListResult, error)
SslGetList gets a list of SSL certificates for a particular user
func (*Client) UsersGetPricing ¶
func (client *Client) UsersGetPricing(productType string) ([]UsersGetPricingResult, error)
func (*Client) WhoisguardDisable ¶
func (*Client) WhoisguardEnable ¶
func (*Client) WhoisguardGetList ¶
func (client *Client) WhoisguardGetList() ([]WhoisguardGetListResult, error)
func (*Client) WhoisguardRenew ¶
func (client *Client) WhoisguardRenew(id int64, years int) (*WhoisguardRenewResult, error)
type DNSDetails ¶
type DomainCheckResult ¶
type DomainCheckResult struct { Domain string `xml:"Domain,attr"` Available bool `xml:"Available,attr"` IsPremiumName bool `xml:"IsPremiumName,attr"` PremiumRegistrationPrice float64 `xml:"PremiumRegistrationPrice,attr"` PremiumRenewalPrice float64 `xml:"PremiumRenewalPrice,attr"` PremiumRestorePrice float64 `xml:"PremiumRestorePrice,attr"` PremiumTransferPrice float64 `xml:"PremiumTransferPrice,attr"` IcannFee float64 `xml:"IcannFee,attr"` }
type DomainCreateOption ¶
type DomainCreateResult ¶
type DomainCreateResult struct { Domain string `xml:"Domain,attr"` Registered bool `xml:"Registered,attr"` ChargedAmount float64 `xml:"ChargedAmount,attr"` DomainID int `xml:"DomainID,attr"` OrderID int `xml:"OrderID,attr"` TransactionID int `xml:"TransactionID,attr"` WhoisguardEnable bool `xml:"WhoisguardEnable,attr"` NonRealTimeDomain bool `xml:"NonRealTimeDomain,attr"` }
type DomainDNSGetHostsResult ¶
type DomainDNSGetHostsResult struct { Domain string `xml:"Domain,attr"` IsUsingOurDNS bool `xml:"IsUsingOurDNS,attr"` Hosts []DomainDNSHost `xml:"host"` }
type DomainDNSHost ¶
type DomainDNSSetHostsResult ¶
type DomainGetListResult ¶
type DomainGetListResult struct { ID int `xml:"ID,attr"` Name string `xml:"Name,attr"` User string `xml:"User,attr"` Created string `xml:"Created,attr"` Expires string `xml:"Expires,attr"` IsExpired bool `xml:"IsExpired,attr"` IsLocked bool `xml:"IsLocked,attr"` AutoRenew bool `xml:"AutoRenew,attr"` WhoisGuard string `xml:"WhoisGuard,attr"` }
DomainGetListResult represents the data returned by 'domains.getList'
type DomainInfo ¶
type DomainInfo struct { ID int `xml:"ID,attr"` Name string `xml:"DomainName,attr"` Owner string `xml:"OwnerName,attr"` Created string `xml:"DomainDetails>CreatedDate"` Expires string `xml:"DomainDetails>ExpiredDate"` IsExpired bool `xml:"IsExpired,attr"` IsLocked bool `xml:"IsLocked,attr"` AutoRenew bool `xml:"AutoRenew,attr"` DNSDetails DNSDetails `xml:"DnsDetails"` Whoisguard Whoisguard `xml:"Whoisguard"` }
DomainInfo represents the data returned by 'domains.getInfo'
type DomainNSInfoResult ¶
type DomainRenewResult ¶
type DomainRenewResult struct { DomainID int `xml:"DomainID,attr"` Name string `xml:"DomainName,attr"` Renewed bool `xml:"Renew,attr"` ChargedAmount float64 `xml:"ChargedAmount,attr"` OrderID int `xml:"OrderID,attr"` TransactionID int `xml:"TransactionID,attr"` ExpireDate string `xml:"DomainDetails>ExpiredDate"` }
type DomainSetContactsResult ¶
type Registrant ¶
type Registrant struct {
RegistrantFirstName, RegistrantLastName,
RegistrantAddress1, RegistrantAddress2, RegistrantCity,
RegistrantStateProvince, RegistrantPostalCode, RegistrantCountry,
RegistrantPhone, RegistrantEmailAddress, RegistrantOrganizationName,
TechFirstName, TechLastName,
TechAddress1, TechAddress2,
TechCity, TechStateProvince, TechPostalCode, TechCountry,
TechPhone, TechEmailAddress, TechOrganizationName,
AdminFirstName, AdminLastName,
AdminAddress1, AdminAddress2,
AdminCity, AdminStateProvince, AdminPostalCode, AdminCountry,
AdminPhone, AdminEmailAddress, AdminOrganizationName,
AuxBillingFirstName, AuxBillingLastName,
AuxBillingAddress1, AuxBillingAddress2,
AuxBillingCity, AuxBillingStateProvince, AuxBillingPostalCode, AuxBillingCountry,
AuxBillingPhone, AuxBillingEmailAddress, AuxBillingOrganizationName string
}
Registrant is a struct that contains all the data necesary to register a domain. That is to say, every field in this struct is REQUIRED by the namecheap api to crate a new domain. In order for `addValues` method to work, all fields must remain strings.
type SSLCertificate ¶
type SslActivateParams ¶
type SslActivateResult ¶
type SslActivateResult struct { ID int `xml:"ID,attr"` IsSuccess bool `xml:"IsSuccess,attr"` HttpDCValidation SslDcValidation `xml:"HttpDCValidation"` DNSDCValidation SslDcValidation `xml:"DNSDCValidation"` }
type SslCreateResult ¶
type SslCreateResult struct { IsSuccess bool `xml:"IsSuccess,attr"` OrderId int `xml:"OrderId,attr"` TransactionId int `xml:"TransactionId,attr"` ChargedAmount float64 `xml:"ChargedAmount,attr"` SSLCertificate []SSLCertificate `xml:"SSLCertificate"` }
type SslDcValidation ¶
type SslGetListResult ¶
type SslGetListResult struct { CertificateID int `xml:"CertificateID,attr"` HostName string `xml:"HostName,attr"` SSLType string `xml:"SSLType,attr"` PurchaseDate string `xml:"PurchaseDate,attr"` ExpireDate string `xml:"ExpireDate,attr"` ActivationExpireDate string `xml:"ActivationExpireDate,attr"` IsExpired bool `xml:"IsExpiredYN,attr"` Status string `xml:"Status,attr"` }
SslGetListResult represents the data returned by 'domains.getList'
type TLDListResult ¶
type TLDListResult struct {
Name string `xml:"Name,attr"`
}
type UsersGetPricingResult ¶
type UsersGetPricingResult struct { ProductType string `xml:"Name,attr"` ProductCategory []struct { Name string `xml:"Name,attr"` Product []struct { Name string `xml:"Name,attr"` Price []struct { Duration int `xml:"Duration,attr"` DurationType string `xml:"DurationType,attr"` Price float64 `xml:"Price,attr"` RegularPrice float64 `xml:"RegularPrice,attr"` YourPrice float64 `xml:"YourPrice,attr"` CouponPrice float64 `xml:"CouponPrice,attr"` Currency string `xml:"Currency,attr"` } `xml:"Price"` } `xml:"Product"` } `xml:"ProductCategory"` }