Documentation
¶
Overview ¶
Package license provides an adapter to fetch license texts from the GitHub Licenses API.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
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.
type NotFoundError ¶ added in v0.3.0
type NotFoundError string
NotFoundError is returned by the client if a license cannot be found via the GitHub Licenses API.
func (NotFoundError) Error ¶ added in v0.3.0
func (e NotFoundError) Error() string