api

package
v0.0.0-...-6c138f2 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: MIT Imports: 7 Imported by: 0

README

There are 2 versions of the thunderstore api parser:

  • when built with no tags LethalModder uses std lib encoding/json package
  • when built with fastjson tag LethalModder uses fastjson package

Documentation

Overview

Better for compatibility but a bit slower

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Download

func Download(url, name string) (os.File, error)

Types

type PackageListing

type PackageListing struct {
	Name           string    `json:"name"`
	FullName       string    `json:"full_name"`
	Owner          string    `json:"owner"`
	PackageURL     string    `json:"package_url"`
	DonationLink   string    `json:"donation_link"`
	DateCreated    string    `json:"date_created"`
	DateUpdated    string    `json:"date_updated"`
	UUID4          string    `json:"uuid4"`
	RatingScore    uint32    `json:"rating_score"`
	IsPinned       bool      `json:"is_pinned"`
	IsDeprecated   bool      `json:"is_deprecated"`
	HasNSFWContent bool      `json:"has_nsfw_content"`
	Categories     []string  `json:"categories"`
	Versions       []Version `json:"versions"` // this may have something to do with the error
}

PackageListing represents the structure of each package listing

func GetMods

func GetMods() ([]PackageListing, error)

func (PackageListing) IsModpack

func (p PackageListing) IsModpack() bool

func (PackageListing) Latest

func (p PackageListing) Latest() Version

func (*PackageListing) UnmarshalJSON

func (p *PackageListing) UnmarshalJSON(data []byte) error

type Version

type Version struct {
	DateCreated   string   `json:"date_created"`
	Dependencies  []string `json:"dependencies"`
	Description   string   `json:"description"`
	DownloadURL   string   `json:"download_url"`
	Downloads     int      `json:"downloads"`
	FileSize      int      `json:"file_size"`
	FullName      string   `json:"full_name"`
	Icon          string   `json:"icon"`
	IsActive      bool     `json:"is_active"`
	Name          string   `json:"name"`
	UUID4         string   `json:"uuid4"`
	VersionNumber string   `json:"version_number"`
	WebsiteURL    string   `json:"website_url"`
}

Version represents the structure of a version listing

Jump to

Keyboard shortcuts

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