brianterry / godaddygo

Interact with the GoDaddy API via Golang

Home Page:https://oze4.github.io/godaddygo/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Check us out on pkg.go.dev *seems to be a little behind a lot of the time


Table of Contents


Intro


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 'Gateway 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 production API
	godaddy := api.V1() 

	// Now have access to all GoDaddy production V1 Gateway endpoints (via `godaddy`)

	// eg: godaddy.Domain("xyz.com").Records().List(ctx)
	//     godaddy.Domain("xyz.com").Records().Add(ctx, someDNSRecord)
	//     godaddy.Domain("xyz.com").Records().FindByType(ctx, godaddygo.RecordTypeA)
	//     godaddy.Domain("xyz.com").GetDetails(ctx)
	//     godaddy.ListDomains(ctx)
	//     godaddy.CheckAvailability(ctx, "dom.com")
	//     godaddy.Purchase(ctx, someDomain)
	// etc...
}

Custom Client

package main

import (
	"net/http"

	"github.com/oze4/godaddygo"
)

func main() {
	key := "<your_key>"
	secret := "<your_secret>"
	// Target production API
	target := godaddygo.APIProdEnv // godaddygo.APIDevEnv

	// 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()
	
	// Now have access to all GoDaddy production V1 Gateway endpoints (via `godaddy`)

	// eg: godaddy.Domain("xyz.com").Records().List(ctx)
	//     godaddy.Domain("xyz.com").Records().Add(ctx, someDNSRecord)
	//     godaddy.Domain("xyz.com").Records().FindByType(ctx, godaddygo.RecordTypeA)
	//     godaddy.Domain("xyz.com").GetDetails(ctx)
	//     godaddy.ListDomains(ctx)
	//     godaddy.CheckAvailability(ctx, "dom.com")
	//     godaddy.Purchase(ctx, someDomain)
	// 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)
    • Purchase domain
    • Purchase privacy for domain
    • Remove privacy for domain
  • Orders
  • Shoppers
  • Subscriptions




mattoestreich.com


About

Interact with the GoDaddy API via Golang

https://oze4.github.io/godaddygo/

License:MIT License


Languages

Language:Go 100.0%