Skip to content

📘 API client for libraries.io written in Go

License

Notifications You must be signed in to change notification settings

klippa-app/go-librariesio

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

📘 API client for libraries.io written in Go

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 96.7%
  • Makefile 3.3%