Documentation
¶
Index ¶
- Constants
- Variables
- func Bool(v bool) *bool
- func Int(v int) *int
- func ParseDomain(domain string) (*publicsuffix.DomainName, error)
- func String(v string) *string
- func UInt8(v uint8) *uint8
- type Client
- type ClientOptions
- type DateTime
- type DnsDetails
- type Domain
- type DomainCreateInfo
- type DomainDNSGetHostsResult
- type DomainDNSGetListResult
- type DomainDNSSetDefaultResult
- type DomainDNSSetHostsResult
- type DomainsCheckCommandResponse
- type DomainsCheckResponse
- type DomainsCheckResult
- type DomainsCreateCommandResponse
- type DomainsCreateResponse
- type DomainsCreateResult
- type DomainsDNSGetHostsCommandResponse
- type DomainsDNSGetHostsResponse
- type DomainsDNSGetListCommandResponse
- type DomainsDNSGetListResponse
- type DomainsDNSHostRecord
- type DomainsDNSHostRecordDetailed
- type DomainsDNSService
- func (dds *DomainsDNSService) GetHosts(domain string) (*DomainsDNSGetHostsCommandResponse, error)
- func (dds *DomainsDNSService) GetList(domain string) (*DomainsDNSGetListCommandResponse, error)
- func (dds *DomainsDNSService) SetCustom(domain string, nameservers []string) (*DomainsDNSSetCustomCommandResponse, error)
- func (dds *DomainsDNSService) SetDefault(domain string) (*DomainsDNSSetDefaultCommandResponse, error)
- func (dds DomainsDNSService) SetHosts(args *DomainsDNSSetHostsArgs) (*DomainsDNSSetHostsCommandResponse, error)
- type DomainsDNSSetCustomCommandResponse
- type DomainsDNSSetCustomResponse
- type DomainsDNSSetCustomResult
- type DomainsDNSSetDefaultCommandResponse
- type DomainsDNSSetDefaultResponse
- type DomainsDNSSetHostsArgs
- type DomainsDNSSetHostsCommandResponse
- type DomainsDNSSetHostsResponse
- type DomainsGetInfoCommandResponse
- type DomainsGetInfoResponse
- type DomainsGetInfoResult
- type DomainsGetListArgs
- type DomainsGetListCommandResponse
- type DomainsGetListPaging
- type DomainsGetListResponse
- type DomainsService
- func (ds *DomainsService) DomainsAvailable(domains string) (*DomainsCheckCommandResponse, error)
- func (ds *DomainsService) DomainsCreate(domainName string, info DomainCreateInfo) (*DomainsCreateCommandResponse, error)
- func (ds *DomainsService) GetInfo(domain string) (*DomainsGetInfoCommandResponse, error)
- func (ds *DomainsService) GetList(args *DomainsGetListArgs) (*DomainsGetListCommandResponse, error)
- type PremiumDnsSubscription
Constants ¶
const ( MinTTL int = 60 MaxTTL int = 60000 EmailTypeNone = "NONE" EmailTypeMXE = "MXE" EmailTypeMX = "MX" EmailTypeForward = "FWD" EmailTypePrivate = "OX" EmailTypeGmail = "GMAIL" RecordTypeA = "A" RecordTypeAAAA = "AAAA" RecordTypeAlias = "ALIAS" RecordTypeCAA = "CAA" RecordTypeCNAME = "CNAME" RecordTypeMX = "MX" RecordTypeMXE = "MXE" RecordTypeNS = "NS" RecordTypeTXT = "TXT" RecordTypeURL = "URL" RecordTypeURL301 = "URL301" RecordTypeFrame = "FRAME" )
Variables ¶
var AllowedEmailTypeValues = []string{EmailTypeNone, EmailTypeMXE, EmailTypeMX, EmailTypeForward, EmailTypePrivate, EmailTypeGmail}
var AllowedRecordTypeValues = []string{RecordTypeA, RecordTypeAAAA, RecordTypeAlias, RecordTypeCAA, RecordTypeCNAME, RecordTypeMX, RecordTypeMXE, RecordTypeNS, RecordTypeTXT, RecordTypeURL, RecordTypeURL301, RecordTypeFrame}
Functions ¶
func Bool ¶
Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.
func Int ¶
Int is a helper routine that allocates a new int value to store v and returns a pointer to it.
func ParseDomain ¶
func ParseDomain(domain string) (*publicsuffix.DomainName, error)
ParseDomain is a wrapper around publicsuffix.Parse to throw the correct error
Types ¶
type Client ¶
type Client struct {
ClientOptions *ClientOptions
BaseURL string
Domains *DomainsService
DomainsDNS *DomainsDNSService
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(options *ClientOptions) *Client
NewClient returns a new Namecheap API Client
type ClientOptions ¶
type DateTime ¶
DateTime represents a time that can be unmarshalled from an XML
func (*DateTime) UnmarshalText ¶
type DnsDetails ¶
type Domain ¶
type Domain struct {
ID *string `xml:"ID,attr"`
Name *string `xml:"Name,attr"`
User *string `xml:"User,attr"`
Created *DateTime `xml:"Created,attr"`
Expires *DateTime `xml:"Expires,attr"`
IsExpired *bool `xml:"IsExpired,attr"`
IsLocked *bool `xml:"IsLocked,attr"`
AutoRenew *bool `xml:"AutoRenew,attr"`
WhoisGuard *string `xml:"WhoisGuard,attr"`
IsPremium *bool `xml:"IsPremium,attr"`
IsOurDNS *bool `xml:"IsOurDNS,attr"`
}
type DomainCreateInfo ¶
type DomainCreateInfo struct {
Years string
RegistrantFirstName string
RegistrantLastName string
RegistrantAddress1 string
RegistrantCity string
RegistrantStateProvince string
RegistrantPostalCode string
RegistrantCountry string
RegistrantPhone string
RegistrantEmailAddress string
TechFirstName string
TechLastName string
TechAddress1 string
TechCity string
TechStateProvince string
TechPostalCode string
TechCountry string
TechPhone string
TechEmailAddress string
AdminFirstName string
AdminLastName string
AdminAddress1 string
AdminCity string
AdminStateProvince string
AdminPostalCode string
AdminCountry string
AdminPhone string
AdminEmailAddress string
AuxBillingFirstName string
AuxBillingLastName string
AuxBillingAddress1 string
AuxBillingCity string
AuxBillingStateProvince string
AuxBillingPostalCode string
AuxBillingCountry string
AuxBillingPhone string
AuxBillingEmailAddress string
}
type DomainDNSGetHostsResult ¶
type DomainDNSGetHostsResult struct {
Domain *string `xml:"Domain,attr"`
EmailType *string `xml:"EmailType,attr"`
IsUsingOurDNS *bool `xml:"IsUsingOurDNS,attr"`
Hosts *[]DomainsDNSHostRecordDetailed `xml:"host"`
}
type DomainDNSGetListResult ¶
type DomainDNSGetListResult struct {
Domain *string `xml:"Domain,attr"`
IsUsingOurDNS *bool `xml:"IsUsingOurDNS,attr"`
IsPremiumDNS *bool `xml:"IsPremiumDNS,attr"`
IsUsingFreeDNS *bool `xml:"IsUsingFreeDNS,attr"`
Nameservers *[]string `xml:"Nameserver"`
}
func (DomainDNSGetListResult) String ¶
func (d DomainDNSGetListResult) String() string
type DomainDNSSetDefaultResult ¶
type DomainDNSSetDefaultResult struct {
Domain *string `xml:"Domain,attr"`
Updated *bool `xml:"Updated,attr"`
}
func (DomainDNSSetDefaultResult) String ¶
func (d DomainDNSSetDefaultResult) String() string
type DomainDNSSetHostsResult ¶
type DomainDNSSetHostsResult struct {
Domain *string `xml:"Domain,attr"`
IsSuccess *bool `xml:"IsSuccess,attr"`
}
func (DomainDNSSetHostsResult) String ¶
func (d DomainDNSSetHostsResult) String() string
type DomainsCheckCommandResponse ¶
type DomainsCheckCommandResponse struct {
Result *DomainsCheckResult `xml:"DomainCheckResult"`
}
type DomainsCheckResponse ¶
type DomainsCheckResponse struct {
XMLName *xml.Name `xml:"ApiResponse"`
Errors *[]struct {
Message *string `xml:",chardata"`
Number *string `xml:"Number,attr"`
} `xml:"Errors>Error"`
CommandResponse *DomainsCheckCommandResponse `xml:"CommandResponse"`
}
type DomainsCheckResult ¶
type DomainsCreateCommandResponse ¶
type DomainsCreateCommandResponse struct {
Result *DomainsCreateResult `xml:"DomainCreateResult"`
}
type DomainsCreateResponse ¶
type DomainsCreateResponse struct {
XMLName *xml.Name `xml:"ApiResponse"`
Errors *[]struct {
Message *string `xml:",chardata"`
Number *string `xml:"Number,attr"`
} `xml:"Errors>Error"`
CommandResponse *DomainsCreateCommandResponse `xml:"CommandResponse"`
}
type DomainsCreateResult ¶
type DomainsDNSGetHostsCommandResponse ¶
type DomainsDNSGetHostsCommandResponse struct {
DomainDNSGetHostsResult *DomainDNSGetHostsResult `xml:"DomainDNSGetHostsResult"`
}
type DomainsDNSGetHostsResponse ¶
type DomainsDNSGetHostsResponse struct {
XMLName xml.Name `xml:"ApiResponse"`
Errors []struct {
Message string `xml:",chardata"`
Number string `xml:"Number,attr"`
} `xml:"Errors>Error"`
CommandResponse *DomainsDNSGetHostsCommandResponse `xml:"CommandResponse"`
}
type DomainsDNSGetListCommandResponse ¶
type DomainsDNSGetListCommandResponse struct {
DomainDNSGetListResult *DomainDNSGetListResult `xml:"DomainDNSGetListResult"`
}
type DomainsDNSGetListResponse ¶
type DomainsDNSGetListResponse struct {
XMLName *xml.Name `xml:"ApiResponse"`
Errors *[]struct {
Message *string `xml:",chardata"`
Number *string `xml:"Number,attr"`
} `xml:"Errors>Error"`
CommandResponse *DomainsDNSGetListCommandResponse `xml:"CommandResponse"`
}
type DomainsDNSHostRecord ¶
type DomainsDNSHostRecord struct {
// Sub-domain/hostname to create the record for
HostName *string
// Possible values: A, AAAA, ALIAS, CAA, CNAME, MX, MXE, NS, TXT, URL, URL301, FRAME
RecordType *string
// Possible values are URL or ClientIp address. The value for this parameter is based on RecordType.
Address *string
// MX preference for host. Applicable for MX records only.
MXPref *uint8
// Time to live for all record types.Possible values: any value between 60 to 60000
// Default Value: 1800 (if 0 value has been provided)
TTL *int
}
type DomainsDNSHostRecordDetailed ¶
type DomainsDNSHostRecordDetailed struct {
HostId *int `xml:"HostId,attr"`
Name *string `xml:"Name,attr"`
Type *string `xml:"Type,attr"`
Address *string `xml:"Address,attr"`
MXPref *int `xml:"MXPref,attr"`
TTL *int `xml:"TTL,attr"`
AssociatedAppTitle *string `xml:"AssociatedAppTitle,attr"`
FriendlyName *string `xml:"FriendlyName,attr"`
IsActive *bool `xml:"IsActive,attr"`
IsDDNSEnabled *bool `xml:"IsDDNSEnabled,attr"`
}
func (DomainsDNSHostRecordDetailed) String ¶
func (d DomainsDNSHostRecordDetailed) String() string
type DomainsDNSService ¶
type DomainsDNSService service
DomainsDNSService includes the following methods: DomainsDNSService.GetHosts - retrieves DNS host record settings for the requested domain DomainsDNSService.GetList - gets a list of DNS servers associated with the requested domain DomainsDNSService.SetCustom - sets domain to use custom DNS servers DomainsDNSService.SetDefault - sets domain to use our default DNS servers DomainsDNSService.SetHosts - sets DNS host records settings for the requested domain
Namecheap doc: https://www.namecheap.com/support/api/methods/domains-dns/
func (*DomainsDNSService) GetHosts ¶
func (dds *DomainsDNSService) GetHosts(domain string) (*DomainsDNSGetHostsCommandResponse, error)
GetHosts retrieves DNS host record settings for the requested domain.
Namecheap doc: https://www.namecheap.com/support/api/methods/domains-dns/get-hosts/
func (*DomainsDNSService) GetList ¶
func (dds *DomainsDNSService) GetList(domain string) (*DomainsDNSGetListCommandResponse, error)
GetList gets a list of DNS servers associated with the requested domain
Namecheap doc: https://www.namecheap.com/support/api/methods/domains-dns/get-list/
func (*DomainsDNSService) SetCustom ¶
func (dds *DomainsDNSService) SetCustom(domain string, nameservers []string) (*DomainsDNSSetCustomCommandResponse, error)
SetCustom sets domain to use custom DNS servers NOTE: Services like URL forwarding, Email forwarding, Dynamic DNS will not work for domains using custom nameservers
Namecheap doc: https://www.namecheap.com/support/api/methods/domains-dns/set-custom/
func (*DomainsDNSService) SetDefault ¶
func (dds *DomainsDNSService) SetDefault(domain string) (*DomainsDNSSetDefaultCommandResponse, error)
SetDefault sets domain to use our default DNS servers. Required for free services like Host record management, URL forwarding, email forwarding, dynamic dns and other value added services.
Namecheap doc: https://www.namecheap.com/support/api/methods/domains-dns/set-default/
func (DomainsDNSService) SetHosts ¶
func (dds DomainsDNSService) SetHosts(args *DomainsDNSSetHostsArgs) (*DomainsDNSSetHostsCommandResponse, error)
SetHosts sets DNS host records settings for the requested domain
Namecheap doc: https://www.namecheap.com/support/api/methods/domains-dns/set-hosts/
type DomainsDNSSetCustomCommandResponse ¶
type DomainsDNSSetCustomCommandResponse struct {
DomainDNSSetCustomResult *DomainsDNSSetCustomResult `xml:"DomainDNSSetCustomResult"`
}
type DomainsDNSSetCustomResponse ¶
type DomainsDNSSetCustomResponse struct {
XMLName *xml.Name `xml:"ApiResponse"`
Errors *[]struct {
Message *string `xml:",chardata"`
Number *string `xml:"Number,attr"`
} `xml:"Errors>Error"`
CommandResponse *DomainsDNSSetCustomCommandResponse `xml:"CommandResponse"`
}
type DomainsDNSSetCustomResult ¶
type DomainsDNSSetCustomResult struct {
Domain *string `xml:"Domain,attr"`
Updated *bool `xml:"Updated,attr"`
}
func (DomainsDNSSetCustomResult) String ¶
func (d DomainsDNSSetCustomResult) String() string
type DomainsDNSSetDefaultCommandResponse ¶
type DomainsDNSSetDefaultCommandResponse struct {
DomainDNSSetDefaultResult *DomainDNSSetDefaultResult `xml:"DomainDNSSetDefaultResult"`
}
type DomainsDNSSetDefaultResponse ¶
type DomainsDNSSetDefaultResponse struct {
XMLName *xml.Name `xml:"ApiResponse"`
Errors *[]struct {
Message *string `xml:",chardata"`
Number *string `xml:"Number,attr"`
} `xml:"Errors>Error"`
CommandResponse *DomainsDNSSetDefaultCommandResponse `xml:"CommandResponse"`
}
type DomainsDNSSetHostsArgs ¶
type DomainsDNSSetHostsArgs struct {
// Domain to setHosts
Domain *string
// DomainsDNSHostRecord list
Records *[]DomainsDNSHostRecord
// Possible values are MXE, MX, FWD, OX, GMAIL or NONE
// If empty, then this field won't be forwarded
// Follow https://www.namecheap.com/support/knowledgebase/article.aspx/322/2237/how-can-i-set-up-mx-records-required-for-mail-service/ to read more about email types
EmailType *string
// Is an unsigned integer between 0 and 255.
// The flag value is an 8-bit number, the most significant bit of which indicates the criticality of understanding of a record by a CA.
// It's recommended to use '0'
// If nil provided, then this field is ignored
Flag *uint8
// A non-zero sequence of US-ASCII letters and numbers in lower case. The tag value can be one of the following values:
// "issue" — specifies the certification authority that is authorized to issue a certificate for the domain name or subdomain record used in the title.
// "issuewild" — specifies the certification authority that is allowed to issue a wildcard certificate for the domain name or subdomain record used in the title. The certificate applies to the domain name or subdomain directly and to all its subdomains.
// "iodef" — specifies the e-mail address or URL (compliant with RFC 5070) a CA should use to notify a client if any issuance policy violation spotted by this CA.
Tag *string
}
type DomainsDNSSetHostsCommandResponse ¶
type DomainsDNSSetHostsCommandResponse struct {
DomainDNSSetHostsResult *DomainDNSSetHostsResult `xml:"DomainDNSSetHostsResult"`
}
type DomainsDNSSetHostsResponse ¶
type DomainsDNSSetHostsResponse struct {
XMLName *xml.Name `xml:"ApiResponse"`
Errors *[]struct {
Message *string `xml:",chardata"`
Number *string `xml:"Number,attr"`
} `xml:"Errors>Error"`
CommandResponse *DomainsDNSSetHostsCommandResponse `xml:"CommandResponse"`
}
type DomainsGetInfoCommandResponse ¶
type DomainsGetInfoCommandResponse struct {
DomainDNSGetListResult *DomainsGetInfoResult `xml:"DomainGetInfoResult"`
}
type DomainsGetInfoResponse ¶
type DomainsGetInfoResponse struct {
XMLName *xml.Name `xml:"ApiResponse"`
Errors *[]struct {
Message *string `xml:",chardata"`
Number *string `xml:"Number,attr"`
} `xml:"Errors>Error"`
CommandResponse *DomainsGetInfoCommandResponse `xml:"CommandResponse"`
}
type DomainsGetInfoResult ¶
type DomainsGetInfoResult struct {
DomainName *string `xml:"DomainName,attr"`
IsPremium *bool `xml:"IsPremium,attr"`
PremiumDnsSubscription *PremiumDnsSubscription `xml:"PremiumDnsSubscription"`
DnsDetails *DnsDetails `xml:"DnsDetails"`
}
type DomainsGetListArgs ¶
type DomainsGetListArgs struct {
// Possible values are ALL, EXPIRING, or EXPIRED
// Default Value: ALL
ListType *string
// Keyword to look for in the domain list
SearchTerm *string
// Page to return
// Default value: 1
Page *int
// Number of domains to be listed on a page. Minimum value is 10, and maximum value is 100.
// Default value: 20
PageSize *int
// Possible values are NAME, NAME_DESC, EXPIREDATE, EXPIREDATE_DESC, CREATEDATE, CREATEDATE_DESC
SortBy *string
}
DomainsGetListArgs struct is an input arguments for Client.DomainsGetList function Please consider Page and PageSize parameters to be set.
type DomainsGetListCommandResponse ¶
type DomainsGetListCommandResponse struct {
Domains *[]Domain `xml:"DomainGetListResult>Domain"`
Paging *DomainsGetListPaging `xml:"Paging"`
}
type DomainsGetListPaging ¶
type DomainsGetListResponse ¶
type DomainsGetListResponse struct {
XMLName *xml.Name `xml:"ApiResponse"`
Errors *[]struct {
Message *string `xml:",chardata"`
Number *string `xml:"Number,attr"`
} `xml:"Errors>Error"`
CommandResponse *DomainsGetListCommandResponse `xml:"CommandResponse"`
}
type DomainsService ¶
type DomainsService service
DomainsService includes the following methods: DomainsService.GetList - returns a list of domains for the particular user
Namecheap doc: https://www.namecheap.com/support/api/methods/domains/
func (*DomainsService) DomainsAvailable ¶
func (ds *DomainsService) DomainsAvailable(domains string) (*DomainsCheckCommandResponse, error)
func (*DomainsService) DomainsCreate ¶
func (ds *DomainsService) DomainsCreate(domainName string, info DomainCreateInfo) (*DomainsCreateCommandResponse, error)
func (*DomainsService) GetInfo ¶
func (ds *DomainsService) GetInfo(domain string) (*DomainsGetInfoCommandResponse, error)
func (*DomainsService) GetList ¶
func (ds *DomainsService) GetList(args *DomainsGetListArgs) (*DomainsGetListCommandResponse, error)
GetList returns a list of domains for the particular user Returns DomainsGetListCommandResponse with list of user Domain and paging DomainsGetListPaging DomainsGetListArgs is the input arguments. When nil is passed, then nothing will be passed through. In this case revert to the official documentation to check defaults
Namecheap doc: https://www.namecheap.com/support/api/methods/domains/get-list/
type PremiumDnsSubscription ¶
type PremiumDnsSubscription struct {
IsActive *bool `xml:"IsActive"`
}