godaddygo

package module
v1.1.5 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: 9

README

godaddygo


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("x.com").Records().GetAll()
	//     prodv1.Domain("x.com").Records().Add(someDNSRecord)
	//     prodv1.Domain("x.com").GetDetails()
	//     prodv1.GetDomainAvailability("<some-domain-you-want-to-buy.com>")
	// etc...
}
Our API Structure

Consider the following endpoint, which allows you to add a DNS record to a domain.

screenshot_from_godaddy_docs

Programmatically, this would look like:

api.V1().Domain("dom.com").Records().Add(newDNSRecord)

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
	mydomain := prodv1.Domain("mydomain.com")
	// Get all DNS records for target domain
	records, err := mydomain.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
    • DNS Records
  • 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