godaddy

package module
v0.0.0-...-95fe2f0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2017 License: MIT Imports: 7 Imported by: 2

README

godaddy

GoDaddy API for getting availability and purchasing a domain

Documentation

Index

Constants

View Source
const AgreementRoot = "https://api.ote-godaddy.com/v1/domains/agreements"

AgreementRoot is the location for agreeing to purchasing under TLD

View Source
const AvailableRoot = "https://api.ote-godaddy.com/v1/domains/available"

AvailableRoot is the address for the domain availability API endpoint

View Source
const PurchaseRoot = "https://api.ote-godaddy.com/v1/domains/purchase"

PurchaseRoot location for purchasing domain

Variables

View Source
var ErrNoKeySecret = errors.New("Key or secret not supplied")

Functions

This section is empty.

Types

type Address

type Address struct {
	Address1   string `json:"address1,omitempty"`
	City       string `json:"city,omitempty"`
	State      string `json:"state,omitempty"`
	PostalCode string `json:"postalCode,omitempty"`
	Country    string `json:"country,omitempty"`
}

Address is used for the Contact object

type AvailableResponse

type AvailableResponse struct {
	Available  bool   `json:"available"`
	Domain     string `json:"domain"`
	Definitive bool   `json:"definitive"`
	Price      uint64 `json:"price"`
	Currency   string `json:"currency"`
	Period     int    `json:"period"`
}

AvailableResponse is the structure that contains how responses are given by the GoDaddy API

type Client

type Client struct {
	Key     string
	Secret  string
	Contact Contact
}

func NewClient

func NewClient(key, secret string, contact Contact) (*Client, error)

func (*Client) GetName

func (c *Client) GetName() string

func (*Client) IsAvailable

func (c *Client) IsAvailable(domain string) (bool, uint64, error)

IsAvailable

func (*Client) Purchase

func (c *Client) Purchase(domain string) error

Purchase handles the purchasing of the specified domain. For GoDaddy, the process for purchasing a domain is:

  1. Get consent key from the AgreementRoot by creating a LegalAgreement object
  2. Create DomainPurchase object
  3. Purchase domain by making a request to PurchaseRoot
type Consent struct {
	AgreementKeys []string `json:"agreementKeys,omitempty"`
	AgreedBy      string   `json:"agreedBy,omitempty"`
	AgreedAt      string   `json:"agreedAt,omitempty"`
}

Consent is needed for TLDs that need to be purchased

type Contact

type Contact struct {
	First          string  `json:"nameFirst,omitempty"`
	Middle         string  `json:"nameMiddle,omitempty"`
	Last           string  `json:"nameLast,omitempty"`
	Organization   string  `json:"organization,omitempty"`
	JobTitle       string  `json:"jobTitle,omitempty"`
	Email          string  `json:"email,omitempty"`
	Phone          string  `json:"phone,omitempty"`
	Fax            string  `json:"fax,omitempty"`
	AddressMailing Address `json:"addressMailing,omitempty"`
}

Contact is what is listed in the whois information if privact isn't selected

type DomainPurchase

type DomainPurchase struct {
	Domain            string   `json:"domain,omitempty"`
	Consent           Consent  `json:"consent,omitempty"`
	Period            int32    `json:"period,omitempty"`
	NameServers       []string `json:"nameServers,omitempty"`
	RenewAuto         bool     `json:"renewAuto,omitempty"`
	Privacy           bool     `json:"privacy,omitempty"`
	ContactRegistrant Contact  `json:"contactRegistrant,omitempty"`
	ContactAdmin      Contact  `json:"contactAdmin,omitempty"`
	ContactTech       Contact  `json:"contactTech,omitempty"`
	ContactBilling    Contact  `json:"contactBilling,omitempty"`
}

DomainPurchase is the object needed for purchasing a domain

type DomainPurchaseResponse

type DomainPurchaseResponse struct {
	// The actual response
	OrderID   int32  `json:"orderId,omitempty"`
	ItemCount int32  `json:"itemCount,omitempty"`
	Total     int32  `json:"total,omitempty"`
	Currency  string `json:"currency,omitempty"`

	// Error
	Code    string `json:"code"`
	Message string `json:"message"`
	Name    string `json:"name"`
}

DomainPurchaseResponse is the response object from buying a domain

type LegalAgreementResponse

type LegalAgreementResponse struct {
	AgreementKey string `json:"agreementKey,omitempty"`
	Title        string `json:"title,omitempty"`
	Url          string `json:"url,omitempty"`
	Content      string `json:"content,omitempty"`
	// Used for errors
	Code    string `json:"code,omitempty"`
	Message string `json:"message,omitempty"`
}

LegalAgreement is an object for gettin the Consent key

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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