Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
_fixtures
tools
vendor
.gitignore
.travis.yml
Gopkg.lock
Gopkg.toml
LICENSE
Makefile
README.md
doc.go
examples_test.go
helpers_test.go
maxcdn.go
maxcdn_test.go
types.go

README.md

go-maxcdn

MaxCDN Golang API.

GoDoc Build Status

API Documentation

import "gopkg.in/MaxCDN/go-maxcdn.v2"

Package maxcdn is the Golang bindings for MaxCDN's REST API.

Developer Notes:

Documentation

	// Basic Get
	max := maxcdn.NewMaxCDN(alias, token, secret)
	var got maxcdn.Generic
	res, err := max.Get(&got, "/account.json", nil)
	if err != nil {
		panic(err)
	}

	fmt.Printf("code: %d\n", res.Code)
	fmt.Printf("name: %s\n", got["name"].(string))

	// Basic Put
	form := url.Values{}
	form.Set("name", "new name")

	var put maxcdn.Generic
	if _, err = max.Put(&put, "/account.json", form); err == nil &&
		put["name"].(string) == "new name" {
		fmt.Println("name successfully updated")
	}

	// Basic Delete
	if _, err = max.Delete("/zones/pull.json/123456", nil); err == nil {
		fmt.Println("zone successfully deleted")
	}

    // Logs
    if logs, err := max.GetLogs(nil); err == nil {
        for _, line := range logs.Records {
            fmt.Println("%+v\n", line)
        }
    }