39 lines
710 B
Markdown
39 lines
710 B
Markdown
# api-go
|
|
|
|
[![status-badge](https://build.pitz.tech/api/badges/2/status.svg)](https://build.pitz.tech/repos/2)
|
|
|
|
A Golang implementation of the Licensing API as defined by the [proto][] repository.
|
|
|
|
[proto]: https://code.pitz.tech/licensing/proto
|
|
|
|
```go
|
|
package main
|
|
|
|
import (
|
|
"google.golang.org/grpc"
|
|
|
|
"code.pitz.tech/licensing/api-go"
|
|
)
|
|
|
|
func main() {
|
|
clientConn, err := grpc.Dial("host:port") // grpc.Dial("host:port", dialopts...)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
client, err := api.NewClient(api.ClientConfig{
|
|
ClientConn: clientConn,
|
|
})
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
client.Contributors()
|
|
client.Licenses()
|
|
client.Packages()
|
|
client.Products()
|
|
client.Tokens()
|
|
client.Users()
|
|
}
|
|
```
|