Put.io Go API client
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 6 commits ahead, 8 commits behind igungor:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
putio
.travis.yml
LICENSE
README.md

README.md

putio Build Status

putio is a Go client library for accessing the Put.io API v2.

Documentation

Available on GoDoc

Install

go get -u github.com/putdotio/go-putio/putio"

Usage

package main

import (
        "fmt"
        "log"
        "context"

        "golang.org/x/oauth2"
        "github.com/putdotio/go-putio/putio"
)

func main() {
    oauthToken := "<YOUR-TOKEN-HERE>"
    tokenSource := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: oauthToken})
    oauthClient := oauth2.NewClient(oauth2.NoContext, tokenSource)

    client := putio.NewClient(oauthClient)

    const rootDir = 0
    root, err := client.Files.Get(context.Background(), rootDir)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println(root.Filename)
}