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 AddressGetInfoResult
- type AddressGetListResult
- type ApiError
- type ApiErrors
- type ApiRequest
- type ApiResponse
- type Client
- func (client *Client) AddressGetInfo(addressID int) (*AddressGetInfoResult, error)
- func (client *Client) AddressGetList() ([]AddressGetListResult, error)
- 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) DomainGetContacts(domainName string) (*DomainGetContactsResult, error)
- func (client *Client) DomainGetInfo(domainName string) (*DomainInfo, error)
- func (client *Client) DomainRenew(domainName string, years int) (*DomainRenewResult, error)
- func (client *Client) DomainsCheck(domainNames ...string) ([]DomainCheckResult, error)
- func (client *Client) DomainsDNSGetHosts(sld, tld string) (*DomainDNSGetHostsResult, error)
- func (client *Client) DomainsGetList(page int, pageSize int) ([]DomainGetListResult, *Paging, error)
- func (client *Client) DomainsTLDList() ([]TLDListResult, error)
- func (client *Client) NSGetInfo(sld, tld, nameserver string) (*DomainNSInfoResult, error)
- func (client *Client) NewRegistrant(...)
- func (client *Client) UsersGetBalances() ([]UsersGetBalancesResult, 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 DomainGetContactsResult
- type DomainGetListResult
- type DomainInfo
- type DomainNSInfoResult
- type DomainRenewResult
- type Paging
- type Registrant
- type TLDListResult
- type UsersGetBalancesResult
- 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 AddressGetInfoResult ¶
type AddressGetInfoResult struct { ID int `xml:"AddressId"` UserName string `xml:"UserName"` Name string `xml:"AddressName"` Default bool `xml:"Default_YN"` FirstName string `xml:"FirstName"` LastName string `xml:"LastName"` JobTitle string `xml:"JobTitle"` Organization string `xml:"Organization"` Address1 string `xml:"Address1"` Address2 string `xml:"Address2"` City string `xml:"City"` StateProvince string `xml:"StateProvince"` StateProvinceChoice string `xml:"StateProvinceChoice"` PostalCode string `xml:"Zip"` Country string `xml:"Country"` Phone string `xml:"Phone"` Fax string `xml:"Fax"` PhoneExt string `xml:"PhoneExt"` EmailAddress string `xml:"EmailAddress"` }
type AddressGetListResult ¶
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"` AddressGetList []AddressGetListResult `xml:"CommandResponse>AddressGetListResult>List"` AddressGetInfo *AddressGetInfoResult `xml:"CommandResponse>GetAddressInfoResult"` 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"` DomainContacts *DomainGetContactsResult `xml:"CommandResponse>DomainContactsResult"` UsersGetPricing []UsersGetPricingResult `xml:"CommandResponse>UserGetPricingResult>ProductType"` UsersGetBalances []UsersGetBalancesResult `xml:"CommandResponse>UserGetBalancesResult"` WhoisguardList []WhoisguardGetListResult `xml:"CommandResponse>WhoisguardGetListResult>Whoisguard"` WhoisguardEnable whoisguardEnableResult `xml:"CommandResponse>WhoisguardEnableResult"` WhoisguardDisable whoisguardDisableResult `xml:"CommandResponse>WhoisguardDisableResult"` WhoisguardRenew *WhoisguardRenewResult `xml:"CommandResponse>WhoisguardRenewResult"` Paging *Paging `xml:"CommandResponse>Paging"` Errors ApiErrors `xml:"Errors>Error"` }
type Client ¶
type Client struct { ApiUser string ApiToken string UserName string HttpClient *http.Client // 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) AddressGetInfo ¶
func (client *Client) AddressGetInfo(addressID int) (*AddressGetInfoResult, error)
func (*Client) AddressGetList ¶
func (client *Client) AddressGetList() ([]AddressGetListResult, error)
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) DomainGetContacts ¶
func (client *Client) DomainGetContacts(domainName string) (*DomainGetContactsResult, 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) 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) 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) UsersGetBalances ¶
func (client *Client) UsersGetBalances() ([]UsersGetBalancesResult, error)
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 DomainCreateOption struct { AddFreeWhoisguard bool WGEnabled bool Nameservers []string RegistrantNexus string RegistrantNexusCountry string RegistrantPurpose string EUAgreeWhoisPolicy string EUAgreeDeletePolicy string EUAdrLang string NUOrgNo string NUvatNo string CIRALegalType string CIRAWhoisDisplay string CIRAAgreementVersion string CIRAAgreementValue string CIRALanguage string COUKLegalType string COUKCompanyID string COUKRegisteredfor string MEUKLegalType string MEUKCompanyID string MEUKRegisteredfor string ORGUKLegalType string ORGUKCompanyID string ORGUKRegisteredfor string }
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 DomainGetContactsResult ¶
type DomainGetContactsResult struct { DomainID int `xml:"domainnameid,attr"` Name string `xml:"Domain,attr"` Registrant }
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"` IsPremium bool `xml:"IsPremium,attr"` IsOurDNS bool `xml:"IsOurDNS,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"` IsOwner bool `xml:"IsOwner,attr"` IsPremium bool `xml:"IsPremium,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 Registrant ¶
type Registrant struct { RegistrantFirstName string `xml:"Registrant>FirstName"` RegistrantLastName string `xml:"Registrant>LastName"` RegistrantAddress1 string `xml:"Registrant>Address1"` RegistrantAddress2 string `xml:"Registrant>Address2"` RegistrantCity string `xml:"Registrant>City"` RegistrantStateProvince string `xml:"Registrant>StateProvince"` RegistrantPostalCode string `xml:"Registrant>PostalCode"` RegistrantCountry string `xml:"Registrant>Country"` RegistrantPhone string `xml:"Registrant>Phone"` RegistrantEmailAddress string `xml:"Registrant>EmailAddress"` TechFirstName string `xml:"Tech>FirstName"` TechLastName string `xml:"Tech>LastName"` TechAddress1 string `xml:"Tech>Address1"` TechAddress2 string `xml:"Tech>Address2"` TechCity string `xml:"Tech>City"` TechStateProvince string `xml:"Tech>StateProvince"` TechPostalCode string `xml:"Tech>PostalCode"` TechCountry string `xml:"Tech>Country"` TechPhone string `xml:"Tech>Phone"` TechEmailAddress string `xml:"Tech>EmailAddress"` AdminFirstName string `xml:"Admin>FirstName"` AdminLastName string `xml:"Admin>LastName"` AdminAddress1 string `xml:"Admin>Address1"` AdminAddress2 string `xml:"Admin>Address2"` AdminCity string `xml:"Admin>City"` AdminStateProvince string `xml:"Admin>StateProvince"` AdminPostalCode string `xml:"Admin>PostalCode"` AdminCountry string `xml:"Admin>Country"` AdminPhone string `xml:"Admin>Phone"` AdminEmailAddress string `xml:"Admin>EmailAddress"` AuxBillingFirstName string `xml:"AuxBilling>FirstName"` AuxBillingLastName string `xml:"AuxBilling>LastName"` AuxBillingAddress1 string `xml:"AuxBilling>Address1"` AuxBillingAddress2 string `xml:"AuxBilling>Address2"` AuxBillingCity string `xml:"AuxBilling>City"` AuxBillingStateProvince string `xml:"AuxBilling>StateProvince"` AuxBillingPostalCode string `xml:"AuxBilling>PostalCode"` AuxBillingCountry string `xml:"AuxBilling>Country"` AuxBillingPhone string `xml:"AuxBilling>Phone"` AuxBillingEmailAddress string `xml:"AuxBilling>EmailAddress"` }
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 TLDListResult ¶
type TLDListResult struct {
Name string `xml:"Name,attr"`
}
type UsersGetBalancesResult ¶
type UsersGetBalancesResult struct { Currency string `xml:"Currency,attr"` AvailableBalance float64 `xml:"AvailableBalance,attr"` AccountBalance float64 `xml:"AccountBalance,attr"` EarnedAmount float64 `xml:"EarnedAmount,attr"` WithdrawableAmount float64 `xml:"WithdrawableAmount,attr"` FundsRequiredForAutoRenew float64 `xml:"FundsRequiredForAutoRenew,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"` }