gorinth

package module
v0.1.0-beta-1 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2023 License: GPL-3.0 Imports: 9 Imported by: 1

README


Logo

Gorinth

Gorinth is a library written in golang to interact with the Modrith API
Report Bug · Request Feature

About The Project

Here's a blank template to get started: To avoid retyping too much info. Do a search and replace with your text editor for the following: github_username, repo_name, twitter_handle, linkedin_username, email_client, email, project_title, project_description

(back to top)

Getting Started

This is an example of how you may give instructions on setting up your project locally. To get a local copy up and running follow these simple example steps.

Prerequisites

Installation

To install gorinth in you golang project, run the command: go get github.com/gearsdatapacks/gorinth

(back to top)

Usage

Project Use the GetProject function to fetch a project from modrinth Project methods:

  • GetVersions - Returns a list of project versions

  • GetLatestVersion - Returns the latest version of the project

  • GetSpecficVersion - Returns the version corresponding to the given semver string

  • CreateVersion - Publishes the given version to the project page on Modrinth

  • Modify - Modifies the project, overwriting the set fields in the given project

(back to top)

Roadmap

  • Add support of all modrinth API routes
  • Add support for the upcoming Datapack Hub API

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the LGPL License. See LICENSE.md for more information.

(back to top)

Contact

Discord Server
Email

Project Link: https://github.com/GearsDatapacks/gorinth

(back to top)

Acknowledgments

(back to top)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dependency

type Dependency struct {
	VersionId      string `json:"version_id"`
	ProjectId      string `json:"project_id"`
	FileName       string `json:"file_name"`
	DependencyType string `json:"dependency_type"`
}

func (Dependency) GetVersion

func (dep Dependency) GetVersion() Version

type File

type File struct {
	Hashes struct {
		// contains filtered or unexported fields
	} `json:"hashes"`
	Url      string `json:"url"`
	Filename string `json:"filename"`
	Primary  bool   `json:"primary"`
	Size     int    `json:"size"`
	FileType string `json:"file_type"`
}

type GalleryImage

type GalleryImage struct {
	Url         string `json:"url"`
	Featured    bool   `json:"featured"`
	Title       string `json:"title"`
	Description string `json:"description"`
	Created     string `json:"created"`
	Ordering    int    `json:"ordering"`
}

type License

type License struct {
	Id   string `json:"id"`
	Name string `json:"name"`
	Url  string `json:"url"`
}

type ModeratorMessage

type ModeratorMessage struct {
	Message string `json:"message"`
	Body    string `json:"body"`
}

type PayoutData

type PayoutData struct {
	Balance          string `json:"balance"`
	PayoutWallet     string `json:"payout_wallet"`
	PayoutWallerType string `json:"payout_wallet_type"`
	PayoutAddress    string `json:"payout_address"`
}

type Project

type Project struct {
	Slug                 string           `json:"slug"`
	Title                string           `json:"title"`
	Description          string           `json:"description"`
	Categories           []string         `json:"categories"`
	ClientSide           string           `json:"client_side"`
	ServerSide           string           `json:"server_side"`
	Body                 string           `json:"body"`
	AdditionalCategories []string         `json:"additional_categories"`
	IssuesUrl            string           `json:"issues_url"`
	SourceUrl            string           `json:"source_url"`
	WikiUrl              string           `json:"wiki_url"`
	DiscordUrl           string           `json:"discord_url"`
	DonationUrls         []string         `json:"donation_urls"`
	ProjectType          string           `json:"project_type"`
	Downloads            int              `json:"downloads"`
	IconUrl              string           `json:"icon_url"`
	Color                int              `json:"color"`
	Id                   string           `json:"id"`
	Team                 string           `json:"team"`
	ModeratorMessage     ModeratorMessage `json:"moderator_message"`
	Published            string           `json:"published"`
	Updated              string           `json:"updated"`
	Approved             string           `json:"approved"`
	Followers            int              `json:"followers"`
	Status               string           `json:"status"`
	License              License          `json:"license"`
	Versions             []string         `json:"versions"`
	GameVersions         []string         `json:"game_versions"`
	Loaders              []string         `json:"loaders"`
	Gallery              []GalleryImage   `json:"gallery"`
	InitialVersions      []map[string]any `json:"initial_versions"`
	// contains filtered or unexported fields
}

func GetProject

func GetProject(id_or_slug string, auth string) (Project, error)

GetProject returns a Project Model of the project with a matching ID or slug with the one provided.

func (Project) CreateVersion

func (project Project) CreateVersion(version Version, auth string) error

func (Project) GetLatestVersion

func (project Project) GetLatestVersion() Version

Gets the most recently created version of a project

func (Project) GetSpecificVersion

func (project Project) GetSpecificVersion(versionNumber string) Version

Get the version of the given project whose semver string matches the given string

func (Project) GetVersions

func (project Project) GetVersions() []Version

Gets all versions of a project

func (Project) Modify

func (project Project) Modify(modified Project, auth string) error

func (*Project) Validate

func (project *Project) Validate()

type User

type User struct {
	Username   string     `json:"username"`
	Name       string     `json:"name"`
	Email      string     `json:"email"`
	Bio        string     `json:"bio"`
	PayoutData PayoutData `json:"payout_data"`
	Id         string     `json:"id"`
	GithubId   int        `json:"github_id"`
	AvatarUrl  string     `json:"avatar_url"`
	Created    string     `json:"created"`
	Role       string     `json:"role"`
	Badges     int8       `json:"badges"`
	// contains filtered or unexported fields
}

func GetUserFromAuth

func GetUserFromAuth(auth string) User

func (User) CreateProject

func (user User) CreateProject(project Project) error

type Version

type Version struct {
	Name            string       `json:"name"`
	VersionNumber   string       `json:"version_number"`
	Changelog       string       `json:"changelog"`
	Dependencies    []Dependency `json:"dependencies"`
	GameVersions    []string     `json:"game_versions"`
	VersionType     string       `json:"version_type"`
	Loaders         []string     `json:"loaders"`
	Featured        bool         `json:"featured"`
	Status          string       `json:"status"`
	RequestedStatus string       `json:"requested_status"`
	Id              string       `json:"id"`
	ProjectId       string       `json:"project_id"`
	AuthorId        string       `json:"author_id"`
	DatePublished   string       `json:"date_published"`
	Downloads       int          `json:"downloads"`
	Files           []File       `json:"files"`
	FileParts       []string     `json:"file_parts"`
}

func GetVersion

func GetVersion(versionId string, auth string) Version

Jump to

Keyboard shortcuts

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