An open API service indexing awesome lists of open source software.

https://github.com/path-network/go-path

Official GoLang bindings for Path's API
https://github.com/path-network/go-path

Last synced: about 1 month ago
JSON representation

Official GoLang bindings for Path's API

Awesome Lists containing this project

README

          

# Go Path

![alt text](img/path.png "Path logo")

[![](https://godoc.org/github.com/path-network/go-path/path?status.svg)](https://godoc.org/github.com/path-network/go-path/path)
[![](https://img.shields.io/badge/go-v.1.13.5-blue)](https://github.com/path-network/go-path)

The official client library written in Go to interact with Path.net's API

## Installation

The package can be downloaded using Go's builtin get command:

`go get github.com/path-network/go-path/path`

After installing go-path, you may use it in your project by importing it

```go
import "github.com/path-network/go-path/path"
```

## Getting Started
To start using Go Path, you must first request an access token. You may either authenticate using account credentials, or a client ID and client secret:

```go
// Request a new OAuth2 token with our credentials
tokenReq := path.AccessTokenRequest{
Username: "foo",
Password: "bar",
}

// Instantiate a new Path API client using our credentials. An access token will be obtained and used in subsequent
// requests to other endpoints
client, err := path.NewClient(tokenReq)

if err != nil {
log.Fatalf("Error authenticating: %s\n", err.Error())
}
```

After successful authentication, you may access endpoints that require authorization:

```go
rules, err := path.GetRules()

if err != nil {
log.Fatalf("Error fetching rules: %s\n", err.Error())
}

. . .

```

## Documentation
For reference on how to use this package, please refer to the [documentation](https://godoc.org/github.com/path-network/go-path/path).