experimental

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: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddIfEmpty added in v0.4.1

func AddIfEmpty(arr *[]string, str *string, errStr string) bool

func AddIfFalse added in v0.4.1

func AddIfFalse(arr *[]string, val *bool, errStr string)

func AddIfInvalid added in v0.4.1

func AddIfInvalid(arr *[]string, str *string, errStr string)

func NewErr added in v0.4.1

func NewErr(msg string) error

func SubmitPackage added in v0.4.0

func SubmitPackage(data []byte) (bool, error)

TODO: Implement this

func ValidateIcon

func ValidateIcon(params IconValidatorParams) (bool, error)

Decodes image data and validates that the image is a PNG and the dimensions are 256x256.

Additionally, if the file name is specified, it will validate that it is named correctly.

func ValidateManifest

func ValidateManifest(author string, data []byte) (bool, []string, error)

func ValidateReadme

func ValidateReadme(data []byte) (bool, error)

TODO: Implement this

Types

type AuthOptions added in v0.3.0

type AuthOptions struct {
	Code        string `json:"code"`
	RedirectURI string `json:"redirect_uri"`
}

type AuthResponse added in v0.3.0

type AuthResponse struct {
	Username  string  `json:"username"`
	Email     *string `json:"email"`
	SessionID string  `json:"session_id"`
}

func LoginWithGithub added in v0.4.0

func LoginWithGithub(auth AuthOptions) (AuthResponse, error)

TODO: Implement this.

type Base64String

type Base64String string

func (Base64String) String

func (b Base64String) String() string

type Category

type Category = common.PackageCategory

type CommunitiesResponse added in v0.4.0

type CommunitiesResponse struct {
	Results CommunityList `json:"results"`
}

type Community

type Community struct {
	Identifier              string  `json:"identifier"`
	Name                    string  `json:"name"`
	DiscordURL              *string `json:"discord_url"`
	WikiURL                 *string `json:"wiki_url"`
	PackageApprovalRequired bool    `json:"require_package_listing_approval"`
}

region Community Struct

func GetCommunity

func GetCommunity(nameOrId string) (*Community, bool, error)

Get a specific Community by it's identifier or short name.

If the name/id does not match any existing community, the result will be nil.

func (Community) Categories

func (community Community) Categories() ([]Category, error)

type CommunityCategories

type CommunityCategories struct {
	Results    []Category `json:"results"`
	Pagination struct {
		NextLink     any `json:"next_link"`
		PreviousLink any `json:"previous_link"`
	} `json:"pagination"`
}

type CommunityList

type CommunityList []Community

func GetCommunities

func GetCommunities() (CommunityList, error)

func (CommunityList) Size added in v0.5.0

func (list CommunityList) Size() int

type IconValidatorParams

type IconValidatorParams struct {
	FileName  string
	ImageData []byte
}

type ManifestMetadata added in v0.4.0

type ManifestMetadata struct {
	Name          string   `json:"name"`
	VersionNumber string   `json:"version_number"`
	WebsiteURL    *string  `json:"website_url"`
	Description   string   `json:"description"`
	Dependencies  []string `json:"dependencies"`
}

type Package

type Package struct {
	Namespace      string         `json:"namespace"`
	Name           string         `json:"name"`
	FullName       string         `json:"full_name"`
	Owner          string         `json:"owner"`
	PackageURL     string         `json:"package_url"`
	DateCreated    util.DateTime  `json:"date_created"`
	DateUpdated    util.DateTime  `json:"date_updated"`
	Rating         string         `json:"rating_score"`
	Pinned         bool           `json:"is_pinned"`
	Deprecated     bool           `json:"is_deprecated"`
	TotalDownloads string         `json:"total_downloads"`
	Latest         PackageVersion `json:"latest"`
}

func GetPackage

func GetPackage(author string, name string) (*Package, error)

Get a single Package given it's owner and package short name. Both are case-sensitive!

If an error occurred or it was not found, the result will be nil.

type PackageListing

type PackageListing struct {
	HasNsfwContent bool         `json:"has_nsfw_content"`
	Categories     string       `json:"categories"`
	Community      string       `json:"community"`
	ReviewStatus   ReviewStatus `json:"review_status"`
}

type PackageSubmissionMetadata added in v0.4.0

type PackageSubmissionMetadata struct {
	UUID                string   `json:"upload_uuid"`
	Author              string   `json:"author_name"`
	Communities         []string `json:"communities"`
	CommunityCategories []string `json:"community_categories"`
	Categories          []string `json:"categories"`
	HasNsfwContent      bool     `json:"has_nsfw_content"`
}

type PackageVersion

type PackageVersion struct {
	Namespace     string        `json:"namespace"`
	Name          string        `json:"name"`
	FullName      string        `json:"full_name"`
	DateCreated   util.DateTime `json:"date_created"`
	VersionNumber string        `json:"version_number"`
	Description   string        `json:"description"`
	Icon          string        `json:"icon"`
	Dependencies  []string      `json:"dependencies"`
	Downloads     int32         `json:"total_downloads"`
	DownloadURL   string        `json:"download_url"`
	WebsiteURL    string        `json:"website_url"`
	Active        bool          `json:"is_active"`
}

region PackageVersion Struct

func (PackageVersion) Changelog

func (pkg PackageVersion) Changelog() (string, error)

func (PackageVersion) Readme

func (pkg PackageVersion) Readme() (string, error)

type PackageWiki

type PackageWiki struct {
	Namespace string `json:"namespace"`
	Name      string `json:"name"`
	Wiki      Wiki   `json:"wiki"`
}

type ReviewStatus

type ReviewStatus string

region ReviewStatus Enum

const (
	UNREVIEWED ReviewStatus = "unreviewed"
	APPROVED   ReviewStatus = "approved"
	REJECTED   ReviewStatus = "rejected"
)

func (ReviewStatus) Approved

func (rs ReviewStatus) Approved() bool

func (ReviewStatus) Rejected

func (rs ReviewStatus) Rejected() bool

func (ReviewStatus) Unreviewed

func (rs ReviewStatus) Unreviewed() bool

type Wiki

type Wiki struct {
	Id          string          `json:"id"`
	Title       string          `json:"title"`
	Slug        string          `json:"slug"`
	DateCreated util.DateTime   `json:"datetime_created"`
	DateUpdated util.DateTime   `json:"datetime_updated"`
	Pages       []WikiPageIndex `json:"pages"`
}

Represents the wiki section/tab of a Thunderstore package.

type WikiList

type WikiList struct {
	Results []PackageWiki `json:"results"`
	Cursor  string        `json:"cursor"`
	HasMore bool          `json:"has_more"`
}

type WikiPage

type WikiPage struct {
	WikiPageIndex
	MarkdownContent string `json:"markdown_content"`
}

type WikiPageIndex

type WikiPageIndex struct {
	ID          string        `json:"id"`
	Title       string        `json:"title"`
	Slug        string        `json:"slug"`
	DateCreated util.DateTime `json:"datetime_created"`
	DateUpdated util.DateTime `json:"datetime_updated"`
}

func (WikiPageIndex) GetContent added in v0.3.0

func (index WikiPageIndex) GetContent() (*string, error)

Requests the content of this page.

The received string will usually be formatted as Markdown.

Jump to

Keyboard shortcuts

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