Skip to content

Latest commit

 

History

History
48 lines (36 loc) · 1.15 KB

README.md

File metadata and controls

48 lines (36 loc) · 1.15 KB

go-flareio

Go Reference

flareio is a light Flare API SDK that wraps around net/http.Client and automatically manages authentication.

It exposes methods that are similar to net/http.Client with the exception that they accept paths as parameters instead of full URLs.

Usage examples and use cases are documented in the Flare API documentation.

Contributing

  • make test will run tests
  • make format format will format the code
  • make lint will run typechecking + linting

Basic Usage

package main

import (
	"fmt"
	"io"
	"os"

	"github.com/Flared/go-flareio"
)

func main() {
	client := flareio.NewApiClient(
		os.Getenv("FLARE_API_KEY"),
	)
	resp, err := client.Get(
		"/tokens/test", nil,
	)
	if err != nil {
		fmt.Printf("failed to test token: %s\n", err)
		os.Exit(1)
	}
	defer resp.Body.Close()
	if _, err := io.Copy(os.Stdout, resp.Body); err != nil {
		fmt.Printf("failed to print response: %s\n", err)
		os.Exit(1)
	}
}