namecheap

package
v2.0.0-...-a589439 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
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

Functions

func Bool

func Bool(v bool) *bool

Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.

func Int

func Int(v int) *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

func String

func String(v string) *string

String is a helper routine that allocates a new string value to store v and returns a pointer to it.

func UInt8

func UInt8(v uint8) *uint8

UInt8 is a helper routine that allocates a new uint8 value to store v and returns a pointer to it.

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

func (*Client) DoXML

func (c *Client) DoXML(body map[string]string, obj interface{}) (*http.Response, error)

func (*Client) NewRequest

func (c *Client) NewRequest(body map[string]string) (*http.Request, error)

NewRequest creates a new request with the params

type ClientOptions

type ClientOptions struct {
	UserName   string
	ApiUser    string
	ApiKey     string
	ClientIp   string
	UseSandbox bool
}

type DateTime

type DateTime struct {
	time.Time
}

DateTime represents a time that can be unmarshalled from an XML

func (DateTime) Equal

func (dt DateTime) Equal(u DateTime) bool

Equal reports whether dt and u are equal based on time.Equal

func (DateTime) String

func (dt DateTime) String() string

func (*DateTime) UnmarshalText

func (dt *DateTime) UnmarshalText(text []byte) (err error)

type DnsDetails

type DnsDetails struct {
	ProviderType  *string   `xml:"ProviderType,attr"`
	IsUsingOurDNS *bool     `xml:"IsUsingOurDNS,attr"`
	Nameservers   *[]string `xml:"Nameserver"`
}

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"`
}

func (Domain) String

func (d Domain) String() string

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 DomainsCheckResult struct {
	Domain    *string `xml:"Domain,attr"`
	Available *bool   `xml:"Available,attr"`
}

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 DomainsCreateResult struct {
	Domain        *string `xml:"Domain,attr"`
	Registered    *bool   `xml:"Registered,attr"`
	ChargedAmount *string `xml:"ChargedAmount,attr"`
}

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

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

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

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

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

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 DomainsGetListPaging struct {
	TotalItems  *int `xml:"TotalItems"`
	CurrentPage *int `xml:"CurrentPage"`
	PageSize    *int `xml:"PageSize"`
}

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

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"`
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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