https://github.com/putdotio/go-putio
Put.io Go API client
https://github.com/putdotio/go-putio
Last synced: about 1 year ago
JSON representation
Put.io Go API client
- Host: GitHub
- URL: https://github.com/putdotio/go-putio
- Owner: putdotio
- License: mit
- Fork: true (igungor/go-putio)
- Created: 2017-01-17T14:50:42.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-09-16T15:58:54.000Z (almost 3 years ago)
- Last Synced: 2024-06-18T17:04:53.584Z (almost 2 years ago)
- Language: Go
- Homepage: https://pkg.go.dev/github.com/putdotio/go-putio
- Size: 172 KB
- Stars: 18
- Watchers: 6
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/putdotio/go-putio/actions/workflows/golangci-lint.yml)
[](https://github.com/putdotio/go-putio/actions/workflows/go-test.yml)
# putio
putio is a Go client library for accessing the [Put.io API v2](https://api.put.io/v2/docs).
## Documentation
Available on [GoDoc](http://godoc.org/github.com/putdotio/go-putio)
## Install
```sh
go get github.com/putdotio/go-putio@latest
go get golang.org/x/oauth2@latest
```
## Usage
```go
package main
import (
"fmt"
"log"
"context"
"golang.org/x/oauth2"
"github.com/putdotio/go-putio"
)
func main() {
oauthToken := ""
tokenSource := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: oauthToken})
oauthClient := oauth2.NewClient(context.TODO(), tokenSource)
client := putio.NewClient(oauthClient)
const rootDir = 0
root, err := client.Files.Get(context.TODO(), rootDir)
if err != nil {
log.Fatal(err)
}
fmt.Println(root.Name)
}
```