godaddygo

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2020 License: MIT Imports: 1 Imported by: 8

README

godaddygo

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 API endpoint, not just domain/DNS related tasks

Installation

  • go get -u github.com/oze4/godaddygo
  • See here for more on how to obtain an API key and API secret from GoDaddy (click 'API Keys')

Getting Started

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() {
	prodKey := "-"
	prodSecret := "-"

	// Target version 1 of the production API
	api := godaddygo.ConnectProduction(prodKey, prodSecret)
	prodv1 := api.V1()

	// Now have access to all GoDaddy production V1
	// API endpoints (via `prodv1`)

	// eg: prodv1.Domain("xyz.com").Records().GetAll()
	//     prodv1.Domain("xyz.com").Records().Add(someDNSRecord)
	//     prodv1.Domain("xyz.com").GetDetails()
	//     prodv1.Domains().My() // <-- List all domains you own
	//     prodv1.Domains().CheckAvailability("dom.com")
	//     prodv1.Domains().Purchase(dom)
	// etc...
}

Usage

GoDaddy's API currently has 2 versions, v1 and v2. Within the godaddygo package we provide 2 helper functions, one for each version. These helper functions simply "wrap" around our "core", which means you have the ability to create yor own client(s).

We recommend using one of the following:

  • godaddygo.ConnectProduction(key, secret)
  • godaddygo.ConnectDevelopment(key, secret)
Default Client
  • If you would like, you may create a default client "manually", then pass it to endpoints.Connect(<default_client_here>).
  • At a high level, the godaddygo package is essentially just a wrapper for endpoints and client.
  • All we do is "wrap" those packages within godaddygo, as shown below
package main

import (
	"github.com/oze4/godaddygo/pkg/client"
	"github.com/oze4/godaddygo/pkg/endpoints"
)

func main() {
	// Options for client
	key := "api_key"
	secret := "api_secret"
	// See here for more on GoDaddy production vs development (OTE) API's
	// https://developer.godaddy.com/getstarted
	targetProductionAPI := true

	// Create default client
	client := client.Default(key, secret, targetProductionAPI)

	// Connect our client to endpoints
	api := endpoints.Connect(client)

	//
	// Use `api` here...
	//
	// ...for example:
	prodv1 := api.V1()
	// Target specific domain
	mydom := prodv1.Domain("dom.com")
	// Get all DNS records for target domain
	records, err := mydom.Records().GetAll()

	// ...
}
Custom Client
  • If you wish to use your own client instead of the default client, this is how you would do so.
package main

import (
	"github.com/oze4/godaddygo/pkg/endpoints"
)

func main() {
	myCustomClient := &myClient{
		key:    "api_key",
		secret: "api_secret",
		isprod: true,
	}

	api := endpoints.Connect(myCustomClient)

	//
	// Use `api` here!
	//
	// ...
}

// myClient is your custom client
// As long as your client satisfies `client.Interface`
// You can use it to connect to the `endpoints` Gateway
type myClient struct {
	key    string
	secret string
	isprod bool
	// ...your custom stuff
}

func (c *myClient) APIKey() string {
	return c.key
}

func (c *myClient) APISecret() string {
	return c.secret
}

func (c *myClient) IsProduction() string {
	return c.isprod
}

Features

Please see here for more information on GoDaddy API 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


Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectDevelopment

func ConnectDevelopment(apikey, apisecret string) endpoints.Gateway

ConnectDevelopment returns the development endpoints Gateway

func ConnectProduction

func ConnectProduction(apikey, apisecret string) endpoints.Gateway

ConnectProduction returns the production endpoints Gateway

Types

This section is empty.

Jump to

Keyboard shortcuts

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