internal

package
v0.0.0-...-06e720c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2024 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheLicense

func CacheLicense(license License) error

func SaveCacheListLicenses

func SaveCacheListLicenses(licenses []LicenseSummary) error

Types

type License

type License struct {
	LicenseSummary
	Description string   `json:"description"`
	Html_url    string   `json:"html_url"`
	Body        string   `json:"body"`
	Permissions []string `json:"permissions"`
	Conditions  []string `json:"conditions"`
	Limitations []string `json:"limitations"`
}

func GetLicense

func GetLicense(name string) (License, error)

This function assumes that the `name` passed in is the valid key of the license as specified in the GitHub API. https://docs.github.com/en/rest/licenses/licenses?apiVersion=2022-11-28#get-a-license

func LoadCachedLicense

func LoadCachedLicense(name string) (License, error)

type LicenseSummary

type LicenseSummary struct {
	Key     string `json:"key"`
	Name    string `json:"name"`
	Spdx_id string `json:"spdx_id"`
	Url     string `json:"url"`
	Node_id string `json:"node_id"`
}

LicenseSummary struct represents a license.

Currently using the GitHub API to get the list of licenses, so the fields match the object returned by the API.

func ListLicenses

func ListLicenses() ([]LicenseSummary, error)

ListLicenses returns a slice of License structs.

It returns an error if it fails to get the licenses.

func LoadCacheListLicenses

func LoadCacheListLicenses() ([]LicenseSummary, error)

type ListSummaryCache

type ListSummaryCache struct {
	Age            time.Time        `json:"age"`
	LicenseSummary []LicenseSummary `json:"LicenseSummary"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL