Giter Site home page Giter Site logo

oze4 / godaddygo Goto Github PK

View Code? Open in Web Editor NEW
10.0 3.0 7.0 437 KB

Interact with the GoDaddy API via Golang

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

License: MIT License

Go 99.69% Shell 0.31%
go godaddy godaddy-sdk-golang godaddy-sdk-go godaddy-sdk

godaddygo's Introduction

Check us out on pkg.go.dev


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 '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




mattoestreich.com


godaddygo's People

Contributors

afritzler avatar nemunaire avatar oze4 avatar wtsuench avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

godaddygo's Issues

UpdateExistingRecord doesn't work

Hello.
When I test example "UpdateExistingRecord" I get error:

ErrorInvalidStatusCode : expected 200, got 422
{"code":"MISSING_NAME_SERVER","message":"At least two NS records must be specified in the request body"}

And here is how looks "recordToUpdate":

recordToUpdate := godaddygo.Record{
		Name: "a1",
		Type: godaddygo.RecordTypeA,
		Data: "4.4.4.4",
		TTL: 3600,
	}

But I don't see any method to set NS servers. How to fix it?

Thank.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.