Documentation
¶
Overview ¶
Package license provides an adapter to fetch license texts from the GitHub Licenses API.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("license not found")
ErrNotFound is returned by the Adapter if a license cannot be found via the GitHub Licenses API.
Functions ¶
func ResolvePlaceholders ¶
ResolvePlaceholders takes a text and a field map and resolves all placeholders to the replacement values in the map.
Types ¶
type Client ¶
type Client struct {
GitHubLicensesService
}
Client fetches license information from the GitHub Licenses API Service.
func NewClient ¶
NewClient creates a new *Client which will use httpClient for making http requests. If httpClient is nil, http.DefaultClient will be used instead.
func (*Client) GetLicense ¶
GetLicense fetches the info for the license with name. Will return ErrNotFound if the license is not recognized.
type GitHubLicensesService ¶
type GitHubLicensesService interface {
Get(ctx context.Context, licenseName string) (*github.License, *github.Response, error)
List(ctx context.Context) ([]*github.License, *github.Response, error)
}
GitHubLicensesService is the interface of the GitHub Licenses API Service.