v1

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Community

type Community struct {
	Identifier string
}

func (Community) AllPackages

func (comm Community) AllPackages(predicate ...func(item Package, index int) bool) (PackageList, error)

Returns a list of all packages (mods) within this community.

func (Community) GetPackage

func (comm Community) GetPackage(author string, name string) *Package

Gets a single package from this community given the owner and package name.

type CommunityList added in v0.6.0

type CommunityList []Community

func NewCommunityList added in v0.6.0

func NewCommunityList(identifiers ...string) (list CommunityList)

type Package

type Package struct {
	Name           string           `json:"name"`
	FullName       string           `json:"full_name"`
	Owner          string           `json:"owner"`
	UUID           string           `json:"uuid4"`
	PackageURL     string           `json:"package_url"`
	DonationLink   string           `json:"donation_link"`
	DateCreated    util.DateTime    `json:"date_created"`
	DateUpdated    util.DateTime    `json:"date_updated"`
	Rating         uint16           `json:"rating_score"`
	Pinned         bool             `json:"is_pinned"`
	Deprecated     bool             `json:"is_deprecated"`
	HasNsfwContent bool             `json:"has_nsfw_content"`
	Categories     []string         `json:"categories"`
	Versions       []PackageVersion `json:"versions"`
}

Represents a package/mod on Thunderstore that is global and not specific to any community.

To easily find a version from Versions, use Package.GetVersion.

func (Package) GetVersion added in v0.2.0

func (pkg Package) GetVersion(verNumber string) *PackageVersion

Gets a specific PackageVersion from this package's list of versions.

verNumber should be specified in the format: major.minor.patch

Good:

"v3.0.0", "2.1.1", "1.0.0-beta.1"

Bad:

"v3.1", "v2", "1.0"

func (Package) Metrics added in v0.2.0

func (pkg Package) Metrics(version ...string) (PackageMetrics, error)

Gets this package's statistics such as downloads and likes.

type PackageDependency

type PackageDependency struct {
	CommunityID   *string `json:"community_identifier"`
	CommunityName *string `json:"community_name"`
	Description   string  `json:"description"`
	ImageSource   *string `json:"image_src"`
	Namespace     string  `json:"namespace"`
	PackageName   string  `json:"package_name"`
	VersionNumber string  `json:"version_number"`
}

type PackageList

type PackageList []Package

An alias for a Package array with helper functions attached.

func PackagesFromCommunities added in v0.6.0

func PackagesFromCommunities(communities []Community) (PackageList, error)

Returns a single slice with all packages from the specified communities.

func (*PackageList) AddFlat added in v0.6.0

func (original *PackageList) AddFlat(list PackageList)

func (PackageList) ExcludeCategories added in v0.6.0

func (list PackageList) ExcludeCategories(categories ...string) PackageList

Returns a new list containing only packages that do NOT have any of the input categories. If no parameters are passed, the original list is returned unchanged.

func (PackageList) Filter

func (list PackageList) Filter(predicate func(pkg Package) bool) PackageList

Performs a filter on the list, returning a new list containing only packages that satisfy the predicate.

func (PackageList) Get

func (list PackageList) Get(author string, name string) *Package

Grab a single package from the list given the package owner's name and the package's short name.

func (PackageList) GetByUUID added in v0.2.0

func (list PackageList) GetByUUID(uuid string) *Package

Grab a single package from the list given the package owner's name and the package's short name.

func (PackageList) GetExact added in v0.2.0

func (list PackageList) GetExact(fullName string) *Package

Grab a single package from the list given the package's full name.

A full name would look like so:

"Owen3H-CSync"

func (PackageList) Size

func (list PackageList) Size() uint

The amount of packages in the list.

Equivalent to len(list) casted to a uint.

func (*PackageList) ToMap added in v0.6.0

func (original *PackageList) ToMap() map[string]Package

type PackageMetrics

type PackageMetrics struct {
	Downloads     uint32 `json:"downloads"`
	Rating        uint16 `json:"rating_score"`
	LatestVersion string `json:"latest_version"`
}

type PackageVersion

type PackageVersion struct {
	Name          string        `json:"name"`
	FullName      string        `json:"full_name"`
	UUID          string        `json:"uuid4"`
	Dependencies  []string      `json:"dependencies"`
	Description   string        `json:"description"`
	DownloadURL   string        `json:"download_url"`
	Downloads     uint32        `json:"downloads"`
	DateCreated   util.DateTime `json:"date_created"`
	FileSize      uint64        `json:"file_size"`
	Icon          string        `json:"icon"`
	Active        bool          `json:"is_active"`
	VersionNumber string        `json:"version_number"`
	WebsiteURL    string        `json:"website_url"`
}

A specific version of a package.

Note: This is NOT equivalent to Package as its fields differ.

type PackageVersionMetrics

type PackageVersionMetrics struct {
	Downloads uint32 `json:"downloads"`
}

type SocialAuthConnection

type SocialAuthConnection struct {
	Provider string `json:"provider"`
	Username string `json:"username"`
	Avatar   string `json:"avatar"`
}

type SubscriptionStatus

type SubscriptionStatus struct {
	Expires string `json:"expires"`
}

type UserMedia

type UserMedia struct {
	UUID        string        `json:"uuid"`
	FileName    string        `json:"filename"`
	Size        uint64        `json:"size"`
	DateCreated util.DateTime `json:"datetime_created"`
	Expiry      *string       `json:"expiry"`
	Status      []string      `json:"status"`
}

type UserProfile

type UserProfile struct {
	Username      string                 `json:"username"`
	Capabilities  []*string              `json:"capabilities"`
	Connections   []SocialAuthConnection `json:"connections"`
	Subscription  SubscriptionStatus     `json:"subscription"`
	RatedPackages []*string              `json:"rated_packages"`
	Teams         []*string              `json:"teams"`
	TeamsFull     []UserTeam             `json:"teams_full"`
}

Represents the profile of a Thunderstore user.

type UserTeam

type UserTeam struct {
	Name        string `json:"name"`
	Role        string `json:"role"`
	MemberCount uint8  `json:"member_count"`
}

Represents a user within a Thunderstore team.

Jump to

Keyboard shortcuts

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