📘 API client for libraries.io written in Go
Switch branches/tags
Nothing to show
Clone or download
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.
librariesio
.gitignore
.travis.yml
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LICENSE
Makefile
README.md

README.md

go-librariesio

GoDoc Reference Build Status Report Card

go-librariesio is a Go client library for accessing the libraries.io API.

Installation

go get github.com/hackebrot/go-librariesio/librariesio

libraries.io API

Connecting to the libraries.io API with go-librariesio requires a private API key.

Usage

// Create new API client with your API key
c := librariesio.NewClient("... your API key ...")

// Create a new context (with a timeout if you want)
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
defer cancel()

// Request information about a project using the client
project, _, err := c.Project(ctx, "pypi", "cookiecutter")

if err != nil {
    fmt.Fprintf(os.Stderr, "%v\n", err)
    os.Exit(1)
}

// All structs for API resources use pointer values.
// If you expect fields to not be returned by the API
// make sure to check for nil values before dereferencing.
fmt.Printf("name: %v\n", *project.Name)
fmt.Printf("version: %v\n", *project.LatestReleaseNumber)
fmt.Printf("language: %v\n", *project.Language)

License

Distributed under the terms of the MIT License, go-librariesio is free and open source software.

Contributing

Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.

Please check out this guide to get started!

Code of Conduct

Please note that this project is released with a Contributor Code of Conduct.

By participating in this project you agree to abide by its terms.

About

Read about why I created go-librariesio in this blog post.