# README
godaddygo
Table of Contents
Intro
- See here for more on which features this package currently supports
- Whenever we reference endpoints, this is what we are referring to
Pull requests welcome! We would like to eventually support each GoDaddy Gateway endpoint, not just domain/DNS related tasks
Installation
go get -u github.com/oze4/godaddygo
- See here for more on how to obtain an Gateway key and Gateway secret from GoDaddy (click 'API Keys')
Usage
Basic Usage
Bare minimum what you need to get started (aka how you will typically use this package):
package main
import (
"github.com/oze4/godaddygo"
)
func main() {
key := "<your_key>"
secret := "<your_secret>"
// Target production GoDaddy API
// 99% of the time this is what you are looking for
api, err := godaddygo.NewProduction(key, secret)
if err != nil {
panic(err.Error())
}
// Target version 1 of the production API
godaddy := api.V1()
//
// See `Extended Example` section below for more
//
}
Custom Client
package main
import (
"net/http"
"github.com/oze4/godaddygo"
)
func main() {
key := "<your_key>"
secret := "<your_secret>"
// Target production API (godaddygo.APIDevEnv | godaddygo.APIProdEnv)
target := godaddygo.APIProdEnv
// Build new config
myConfig := godaddygo.NewConfig(key, secret, target)
// Build custom client
myClient := &http.Client{}
// Establish "connection" with API
api, err := godaddygo.WithClient(myClient, myConfig)
if err != nil {
panic(err.Error())
}
// Target version 1 of the production API
godaddy := api.V1()
//
// See `Extended Example` section below for more
//
}
Extended Example
Regardless of your client, how you actually use this package will be the same either way.
/* We are continuing from within `main()`
* ... pretend code from above is here,
* regardless of your client */
// We now have access to "all" GoDaddy production
// version 1 gateway endpoints (via `godaddy`)
// !! the following is pseudo code !!
foo := godaddy.Domain("foo.com")
bar := godaddy.Domain("bar.com")
// ...more domains...
// Get domain details
foo.GetDetails(ctx)
bar.GetDetails(ctxtwo)
// Anything you can do with `foo`
// you can do with `bar`
// Domain records
fooRecs := foo.Records()
// Do stuff with records
fooRecs.List(ctx)
fooRecs.Add(ctx, someDNSRecord)
fooRecs.FindByType(ctx, godaddygo.RecordTypeA)
// Account related tasks
// View all domains for your account
godaddy.ListDomains(ctx)
// Check availability for domain you don't own
godaddy.CheckAvailability(ctx, "fizz.buzz")
// Purchase domain (this hasn't been tested - it should use the card you have on file)
// I'm not sure what happens when you don't have a card on file =/ lmk
godaddy.Purchase(ctx, myNewDomain)
// etc...
Features
Please see here for more information on GoDaddy Gateway endpoints
- Abuse
- Aftermarket
- Agreements
- Certificates
- Countries
- Domains
- Check domain availability
- Get all DNS records
- Get all DNS records of specific type
- Get specific DNS record
- Set DNS record(s)
- Add/create DNS record(s)
- Delete/remove DNS record(s)
- Purchase domain
- Purchase privacy for domain
- Remove privacy for domain
- Orders
- Shoppers
- Subscriptions
# Packages
No description provided by the author
# Functions
NewConfig creates a new config.
NewDevelopment targets GoDaddy development API.
NewProduction targets GoDaddy production API.
WithClient returns API using your own `*http.Client`.
# Constants
This is a comment so my IDE quits complaining to me.
Env variables - which godaddy api to target.
Allowed API Versions - which version of the godaddy api to target.
This is a comment so my IDE quits complaining to me.
Domain statuses (added "Domain" prefix to legacy constants).
This is a comment so my IDE quits complaining to me.
MaxHTTPClientTimeout in seconds is the defalt max http client timeout https://medium.com/@nate510/don-t-use-go-s-default-http-client-4804cb19f779 1 minute by default.
DNS record types.
This is a comment so my IDE quits complaining to me.
This is a comment so my IDE quits complaining to me.
This is a comment so my IDE quits complaining to me.
This is a comment so my IDE quits complaining to me.
This is a comment so my IDE quits complaining to me.
This is a comment so my IDE quits complaining to me.
This is a comment so my IDE quits complaining to me.
Legacy Domain statuses (to support rename).
This is a comment so my IDE quits complaining to me.
# Structs
AddressMailing defines a mailing address.
Config holds connection options.
Contact defines the details of a contact.
DomainAvailability holds data about domain availability.
DomainDetails defines the details of a domain.
DomainName defines a domain name.
DomainSummary is what gets returned when listing all of your domains.
RealName defines the real name.
Record defines a DNS record.
Verifications defines who verified purchases, etc..
# Interfaces
API knows which version to target.
Domain knows how to interact with the Domains GoDaddy Gateway endpoint.
Records knows how to interact with the Records GoDaddy Gateway endpoint.
V1 knows how to interact with GoDaddy Gateway version 1.
V2 knows how to interact with GoDaddy Gateway version 2.
# Type aliases
APIEnv represents which endpoint to target (dev|prod)
.
APIURL represents which URL to target
.
APIVersion represents which endpoint version to target (v1|v2)
.
RecordType represents a DNS record type
.