Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

nikita-petko/ns1-go-dev

 
 

Repository files navigation

Build Status GoDoc

NS1 Golang SDK

This project is in active development.

The golang client for the NS1 API: https://ns1.com/api/

Installing

$ go get gopkg.in/nkpetko/ns1-go-dev.v2

Examples

See more

package main

import (
	"fmt"
	"log"
	"net/http"
	"os"
	"time"

	api "gopkg.in/nkpetko/ns1-go-dev.v2/rest"
)

func main() {
	k := os.Getenv("NS1_APIKEY")
	if k == "" {
		fmt.Println("NS1_APIKEY environment variable is not set, giving up")
		os.Exit(1)
	}

	httpClient := &http.Client{Timeout: time.Second * 10}
	client := api.NewClient(httpClient, api.SetAPIKey(k))

	zones, _, err := client.Zones.List()
	if err != nil {
		log.Fatal(err)
	}

	for _, z := range zones {
		fmt.Println(z.Zone)
	}

}

Contributing

Pull Requests and issues are welcome. See the NS1 Contribution Guidelines for more information.

Run tests:

make test

Local dev: use go mod replace in client code to point to local checkout of this repository.

Consider running ./script/install-git-hooks to install local git hooks for this project.

LICENSE

Apache2 - see the included LICENSE file for more information

About

Golang API client for NS1

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 99.6%
  • Other 0.4%