modrinth

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2023 License: BSD-2-Clause Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// SearchFacetCategories filters by project's categories.
	SearchFacetCategories = "categories"

	// SearchFacetVersions filters by Minecraft version.
	SearchFacetVersions = "versions"

	// SearchFacetLicence filters by project's licence.
	SearchFacetLicence = "license"

	// SearchFacetProjectType filters by project's type.
	SearchFacetProjectType = "project_type"
)
View Source
const (
	// SearchIndexRelevance sorts search results by Modrinth's assessment of relevance.
	SearchIndexRelevance = "relevance"

	// SearchIndexDownloads sorts search results by the order of downloads.
	SearchIndexDownloads = "downloads"

	// SearchIndexFollows sorts search results by the order of project followers.
	SearchIndexFollows = "follows"

	// SearchIndexNewest sorts search results by the newest projects.
	SearchIndexNewest = "newest"

	// SearchIndexUpdated sorts search results by the latest updated projects.
	SearchIndexUpdated = "updated"
)
View Source
const (
	// SideRequired indicates that the project is required on the side.
	SideRequired = "required"

	// SideOptional indicates that the project is optional on the side.
	SideOptional = "optional"

	// SideUnsupported indicates that the project is unsupported on the side.
	SideUnsupported = "unsupported"
)

Variables

This section is empty.

Functions

func Bool added in v0.2.0

func Bool(v bool) *bool

Bool returns a pointer to the bool v.

func CheckResponse

func CheckResponse(r *http.Response) error

func String added in v0.2.0

func String(v string) *string

String returns a pointer to the string v.

func UInt32 added in v0.4.0

func UInt32(v uint32) *uint32

UInt32 returns a pointer to the 32-bit unsigned int v.

func UInt64 added in v0.4.0

func UInt64(v uint64) *uint64

UInt64 returns a pointer to the 64-bit unsigned int v.

Types

type CategoryTag added in v0.1.1

type CategoryTag struct {
	Icon        *string `json:"icon,omitempty"`
	Name        *string `json:"name,omitempty"`
	ProjectType *string `json:"project_type,omitempty"`
	Header      *string `json:"header,omitempty"`
}

type Client

type Client struct {

	// Base URL for API requests. BaseURL should always be set with a
	// trailing slash.
	BaseURL *url.URL

	// User Agent used when communicating with the Modrinth API.
	UserAgent string

	// Token used for authorisation with the Modrinth API.
	//
	// This is a GitHub token.
	Token string

	// Services used for accessing different parts of the Modrinth
	// API.
	Projects     *ProjectsService
	Versions     *VersionsService
	VersionFiles *VersionFilesService
	Users        *UsersService
	Teams        *TeamsService
	Tags         *TagsService
	Misc         *MiscellaneousService
	// contains filtered or unexported fields
}

Client manages communication with the Modrinth API.

func NewClient

func NewClient(httpClient *http.Client) *Client

NewClient returns a new Modrinth API client. If a nil client is provided, http.DefaultClient will be used.

func (*Client) Do

func (c *Client) Do(req *http.Request, v interface{}) (*http.Response, error)

Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v.

func (*Client) NewRequest

func (c *Client) NewRequest(method string, urlStr string, body interface{}) (*http.Request, error)

NewRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved to the BaseURL of the Client. Relative URLs should always be specified without a preceding slash. If specified, the value pointed to by the body is JSON encoded and included as the request body.

type Dependency

type Dependency struct {
	ProjectID      *string `json:"project_id,omitempty"`
	VersionID      *string `json:"version_id,omitempty"`
	DependencyType *string `json:"dependency_type,omitempty"`
}

type DonationPlatformTag added in v0.1.1

type DonationPlatformTag struct {
	Short *string `json:"short,omitempty"`
	Name  *string `json:"name,omitempty"`
}

type DonationURL added in v0.5.0

type DonationURL struct {
	ID       *string `json:"id,omitempty"`
	Platform *string `json:"platform,omitempty"`
	URL      *string `json:"url,omitempty"`
}

type ErrorResponse

type ErrorResponse struct {
	Response *http.Response

	ErrorType   string `json:"error"`
	Description string `json:"description"`
}

func (*ErrorResponse) Error

func (r *ErrorResponse) Error() string

type File

type File struct {
	Hashes   map[string]string `json:"hashes,omitempty"`
	URL      *string           `json:"url,omitempty"`
	Filename *string           `json:"filename,omitempty"`
	Primary  *bool             `json:"primary,omitempty"`
	Size     *uint32           `json:"size,omitempty"`
}

type GalleryImage

type GalleryImage struct {
	Title       *string    `json:"title,omitempty"`
	Description *string    `json:"description,omitempty"`
	Featured    *bool      `json:"featured,omitempty"`
	Created     *time.Time `json:"created,omitempty"`
	URL         *string    `json:"url,omitempty"`
}

type GalleryImageOptions added in v0.3.2

type GalleryImageOptions struct {
	Featured    bool
	Name        string
	Description string
}

type GameVersionTag added in v0.1.1

type GameVersionTag struct {
	Version     *string    `json:"version,omitempty"`
	VersionType *string    `json:"version_type,omitempty"`
	Date        *time.Time `json:"date,omitempty"`
	Major       *bool      `json:"major,omitempty"`
}

type Licence

type Licence struct {
	ID   *string `json:"id,omitempty"`
	Name *string `json:"name,omitempty"`
	URL  *string `json:"url,omitempty"`
}

type LicenceTag added in v0.1.1

type LicenceTag struct {
	Short *string `json:"short,omitempty"`
	Name  *string `json:"name,omitempty"`
}

type ListVersionsOptions added in v0.4.0

type ListVersionsOptions struct {
	Loaders      []string
	GameVersions []string
	Featured     *bool
}

type LoaderTag added in v0.1.1

type LoaderTag struct {
	Icon                  *string  `json:"icon,omitempty"`
	Name                  *string  `json:"name,omitempty"`
	SupportedProjectTypes []string `json:"supported_project_types,omitempty"`
}

type MiscellaneousService added in v0.6.0

type MiscellaneousService service

MiscellaneousService handles communication with the miscellaneous routes of the Modrinth API.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/misc

func (*MiscellaneousService) GetStatistics added in v0.6.0

func (s *MiscellaneousService) GetStatistics() (*Statistics, error)

GetStatistics gets statistics for the Modrinth API.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/misc/operation/statistics

func (*MiscellaneousService) Report added in v0.6.0

func (s *MiscellaneousService) Report(
	reportType string, itemID string, itemType string, body string,
) (*Report, error)

Report reports a user.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/misc/operation/submitReport

type ModeratorMessage added in v0.3.0

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

type ModifyProjectOptions added in v0.6.0

type ModifyProjectOptions struct {
	Title                 *string        `json:"title,omitempty"`
	Description           *string        `json:"description,omitempty"`
	Body                  *string        `json:"body,omitempty"`
	Categories            []string       `json:"categories,omitempty"`
	IssuesURL             *string        `json:"issues_url,omitempty"`
	SourceURL             *string        `json:"source_url,omitempty"`
	WikiURL               *string        `json:"wiki_url,omitempty"`
	LicenceURL            *string        `json:"license_url,omitempty"`
	DiscordURL            *string        `json:"discord_url,omitempty"`
	DonationURLs          []*DonationURL `json:"donation_urls,omitempty"`
	LicenceID             *string        `json:"license_id,omitempty"`
	ClientSide            *string        `json:"client_side,omitempty"`
	ServerSide            *string        `json:"server_side,omitempty"`
	Slug                  *string        `json:"slug,omitempty"`
	Status                *string        `json:"status,omitempty"`
	ModerationMessage     *string        `json:"moderation_message,omitempty"`
	ModerationMessageBody *string        `json:"moderation_message_body,omitempty"`
}

type ModifyUserOptions added in v0.6.0

type ModifyUserOptions struct {
	Username string  `json:"username,omitempty"`
	Name     *string `json:"name,omitempty"`
	Email    *string `json:"email,omitempty"`
	Bio      *string `json:"bio,omitempty"`
}

type ModifyVersionOptions added in v0.6.0

type ModifyVersionOptions struct {
	Name          *string       `json:"name,omitempty"`
	VersionNumber *string       `json:"version_number,omitempty"`
	Changelog     *string       `json:"changelog,omitempty"`
	VersionType   *string       `json:"version_type,omitempty"`
	Dependencies  []*Dependency `json:"dependencies,omitempty"`
	GameVersions  []string      `json:"game_versions,omitempty"`
	Loaders       []string      `json:"loaders,omitempty"`
	Featured      *bool         `json:"featured,omitempty"`
	PrimaryFile   []string      `json:"primary_file,omitempty"`
}

type NotFoundErrorResponse added in v0.5.0

type NotFoundErrorResponse struct {
	Response *http.Response
}

NotFoundErrorResponse occurs when Modrinth return a 404 Not Found response.

func (*NotFoundErrorResponse) Error added in v0.5.0

func (r *NotFoundErrorResponse) Error() string

type Notification added in v0.2.0

type Notification struct {
	ID      *string    `json:"id,omitempty"`
	UserID  *string    `json:"user_id,omitempty"`
	Type    *string    `json:"type,omitempty"`
	Title   *string    `json:"title,omitempty"`
	Text    *string    `json:"text,omitempty"`
	Link    *string    `json:"link,omitempty"`
	Read    *bool      `json:"read,omitempty"`
	Created *time.Time `json:"created,omitempty"`
}

type Project

type Project struct {
	Slug                 *string           `json:"slug,omitempty"`
	Title                *string           `json:"title,omitempty"`
	Description          *string           `json:"description,omitempty"`
	Categories           []string          `json:"categories,omitempty"`
	AdditionalCategories []string          `json:"additional_categories,omitempty"`
	ClientSide           *string           `json:"client_side,omitempty"`
	ServerSide           *string           `json:"server_side,omitempty"`
	Body                 *string           `json:"body,omitempty"`
	IssuesURL            *string           `json:"issues_url,omitempty"`
	SourceURL            *string           `json:"source_url,omitempty"`
	WikiURL              *string           `json:"wiki_url,omitempty"`
	DiscordURL           *string           `json:"discord_url,omitempty"`
	DonationURLs         []*DonationURL    `json:"donation_urls,omitempty"`
	ProjectType          *string           `json:"project_type,omitempty"`
	Downloads            *uint32           `json:"downloads,omitempty"`
	IconURL              *string           `json:"icon_url,omitempty"`
	Colour               *uint32           `json:"color,omitempty"`
	ID                   *string           `json:"id,omitempty"`
	Team                 *string           `json:"team,omitempty"`
	BodyURL              *string           `json:"body_url,omitempty"`
	ModeratorMessage     *ModeratorMessage `json:"moderator_message,omitempty"`
	Published            *time.Time        `json:"published,omitempty"`
	Updated              *time.Time        `json:"updated,omitempty"`
	Approved             *time.Time        `json:"approved,omitempty"`
	Followers            *uint32           `json:"followers,omitempty"`
	Status               *string           `json:"status,omitempty"`
	Licence              *Licence          `json:"license,omitempty"`
	Versions             []string          `json:"versions,omitempty"`
	GameVersions         []string          `json:"game_versions,omitempty"`
	Loaders              []string          `json:"loaders,omitempty"`
	Gallery              []*GalleryImage   `json:"gallery,omitempty"`
}

type ProjectDependencies added in v0.2.0

type ProjectDependencies struct {
	Projects []*Project `json:"projects,omitempty"`
	Versions []*Version `json:"versions,omitempty"`
}

type ProjectsService added in v0.2.0

type ProjectsService service

ProjectsService handles communication with the projects routes of the Modrinth API.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/projects

func (*ProjectsService) Delete added in v0.2.0

func (s *ProjectsService) Delete(idOrSlug string) error

Delete deletes a project.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/projects/operation/deleteProject

func (*ProjectsService) DeleteGalleryImage added in v0.2.0

func (s *ProjectsService) DeleteGalleryImage(idOrSlug string, url string) error

DeleteGalleryImage deletes a gallery image from a project, based on its URL.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/projects/operation/deleteGalleryImage

func (*ProjectsService) Follow added in v0.3.4

func (s *ProjectsService) Follow(idOrSlug string) error

Follow causes the authenticated user to follow the project.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/projects/operation/followProject

func (*ProjectsService) Get added in v0.2.0

func (s *ProjectsService) Get(idOrSlug string) (*Project, error)

Get gets a project.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/projects/operation/getProject

func (*ProjectsService) GetDependencies added in v0.2.0

func (s *ProjectsService) GetDependencies(idOrSlug string) (*ProjectDependencies, error)

GetDependencies gets the project and version dependencies of a project.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/projects/operation/getDependencies

func (*ProjectsService) GetMultiple added in v0.3.2

func (s *ProjectsService) GetMultiple(ids []string) ([]*Project, error)

GetMultiple gets multiples projects.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/projects/operation/getProjects

func (*ProjectsService) Modify added in v0.3.4

func (s *ProjectsService) Modify(idOrSlug string, options ModifyProjectOptions) error

Modify modifies a project.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/projects/operation/modifyProject

func (*ProjectsService) ModifyGalleryImage added in v0.3.2

func (s *ProjectsService) ModifyGalleryImage(idOrSlug string, url string, options *GalleryImageOptions) error

ModifyGalleryImage modifies the name and description of a gallery image from a project, based on it's URL.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/projects/operation/modifyGalleryImage

func (*ProjectsService) Search added in v0.3.0

func (s *ProjectsService) Search(options *SearchOptions) (*SearchResponse, error)

Search searches all projects based on the criteria provided, and returns search results in a paginated response.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/projects/operation/searchProjects

func (*ProjectsService) Unfollow added in v0.3.4

func (s *ProjectsService) Unfollow(idOrSlug string) error

Unfollow causes the authenticated user to unfollow the project.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/projects/operation/unfollowProject

type Report added in v0.2.0

type Report struct {
	ReportType *string    `json:"report_type,omitempty"`
	ItemID     *string    `json:"item_id,omitempty"`
	ItemType   *string    `json:"item_type,omitempty"`
	Body       *string    `json:"body,omitempty"`
	Reporter   *string    `json:"reporter,omitempty"`
	Created    *time.Time `json:"created,omitempty"`
}

type SearchOptions added in v0.3.0

type SearchOptions struct {
	Query   string
	Facets  [][]string
	Index   string
	Offset  int
	Limit   int
	Filters string
	Version string
}

type SearchResponse added in v0.3.0

type SearchResponse struct {
	Hits      []*SearchResult `json:"hits,omitempty"`
	Offset    *uint32         `json:"offset,omitempty"`
	Limit     *uint32         `json:"limit,omitempty"`
	TotalHits *uint32         `json:"total_hits,omitempty"`
}

type SearchResult

type SearchResult struct {
	Slug          *string    `json:"slug,omitempty"`
	Title         *string    `json:"title,omitempty"`
	Description   *string    `json:"description,omitempty"`
	Categories    []string   `json:"categories,omitempty"`
	ClientSide    *string    `json:"client_side,omitempty"`
	ServerSide    *string    `json:"server_side,omitempty"`
	ProjectType   *string    `json:"project_type,omitempty"`
	Downloads     *uint32    `json:"downloads,omitempty"`
	IconURL       *string    `json:"icon_url,omitempty"`
	ProjectID     *string    `json:"project_id,omitempty"`
	Author        *string    `json:"author,omitempty"`
	Versions      []string   `json:"versions,omitempty"`
	Follows       *uint32    `json:"follows,omitempty"`
	DateCreated   *time.Time `json:"date_created,omitempty"`
	DateModified  *time.Time `json:"date_modified,omitempty"`
	LatestVersion *string    `json:"latest_version,omitempty"`
	Licence       *string    `json:"license,omitempty"`
	Gallery       []string   `json:"gallery,omitempty"`
}

type Statistics added in v0.6.0

type Statistics struct {
	Projects uint64 `json:"projects"`
	Versions uint64 `json:"versions"`
	Files    uint64 `json:"files"`
	Authors  uint64 `json:"authors"`
}

type TagsService added in v0.1.1

type TagsService service

TagsService handles communication with the tags routes of the Modrinth API.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/tags

func (*TagsService) GetCategories added in v0.1.1

func (s *TagsService) GetCategories() ([]*CategoryTag, error)

GetCategories gets all category tags available for usage.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/tags/operation/categoryList

func (*TagsService) GetDonationPlatforms added in v0.1.1

func (s *TagsService) GetDonationPlatforms() ([]*DonationPlatformTag, error)

GetDonationPlatforms gets all donation platform tags available for usage.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/tags/operation/donationPlatformList

func (*TagsService) GetGameVersions added in v0.1.1

func (s *TagsService) GetGameVersions() ([]*GameVersionTag, error)

GetGameVersions gets all game version tags available for usage.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/tags/operation/versionList

func (*TagsService) GetLicences added in v0.1.1

func (s *TagsService) GetLicences() ([]*LicenceTag, error)

GetLicences gets all licence tags available for usage.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/tags/operation/licenseList

func (*TagsService) GetLoaders added in v0.1.1

func (s *TagsService) GetLoaders() ([]*LoaderTag, error)

GetLoaders gets all loader tags available for usage.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/tags/operation/loaderList

func (*TagsService) GetReportTypes added in v0.1.1

func (s *TagsService) GetReportTypes() ([]string, error)

GetReportTypes gets all report type tags available for usage.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/tags/operation/reportTypeList

type TeamMember

type TeamMember struct {
	TeamID      *string `json:"team_id,omitempty"`
	User        *User   `json:"user,omitempty"`
	Role        *string `json:"role,omitempty"`
	Permissions *uint64 `json:"permissions,omitempty"`
	Accepted    *bool   `json:"accepted,omitempty"`
}

type TeamsService added in v0.1.1

type TeamsService service

TeamsService handles communication with the teams routes of the Modrinth API.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/teams

func (*TeamsService) AddMember added in v0.1.1

func (s *TeamsService) AddMember(teamID string, userID string) error

AddMember invites a user to a team.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/teams/operation/addTeamMember

func (*TeamsService) Get added in v0.1.1

func (s *TeamsService) Get(id string) ([]*TeamMember, error)

Get gets the team members from a team.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/teams/operation/getTeamMembers

func (*TeamsService) GetMultiple added in v0.5.0

func (s *TeamsService) GetMultiple(ids []string) ([][]*TeamMember, error)

GetMultiple gets multiples teams.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/teams/operation/getTeams

func (*TeamsService) GetProjectTeam added in v0.1.1

func (s *TeamsService) GetProjectTeam(idOrSlug string) ([]*TeamMember, error)

GetProjectTeam gets the team members from a project.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/teams/operation/getProjectTeamMembers

func (*TeamsService) Join added in v0.1.1

func (s *TeamsService) Join(id string) error

Join joins a team.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/teams/operation/joinTeam

func (*TeamsService) RemoveMember added in v0.1.1

func (s *TeamsService) RemoveMember(teamID string, userIDOrUsername string) error

RemoveMember removes a member from a team.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/teams/paths/~1team~1{team_id}~1members~1{user_id}/delete

func (*TeamsService) TransferOwnership added in v0.1.1

func (s *TeamsService) TransferOwnership(teamID string, userID string) error

TransferOwnership transfers ownership of a team to another user.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/teams/operation/transferTeamOwnership

type User

type User struct {
	Username  *string    `json:"username,omitempty"`
	Name      *string    `json:"name,omitempty"`
	Email     *string    `json:"email,omitempty"`
	Bio       *string    `json:"bio,omitempty"`
	ID        *string    `json:"id,omitempty"`
	GitHubID  *uint64    `json:"github_id,omitempty"`
	AvatarURL *string    `json:"avatar_url,omitempty"`
	Created   *time.Time `json:"created,omitempty"`
	Role      *string    `json:"role,omitempty"`
}

type UsersService

type UsersService service

UsersService handles communication with the users routes of the Modrinth API.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/users

func (*UsersService) Delete added in v0.1.1

func (s *UsersService) Delete(idOrUsername string) error

Delete deletes a user.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/users/operation/deleteUser

func (*UsersService) Get

func (s *UsersService) Get(idOrUsername string) (*User, error)

Get gets a users.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/users/operation/getUser

func (*UsersService) GetFollowedProjects added in v0.3.0

func (s *UsersService) GetFollowedProjects(idOrUsername string) ([]*Project, error)

GetFollowedProjects gets all a user's followed projects.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/users/operation/getFollowedProjects

func (*UsersService) GetFromAuthHeader added in v0.4.0

func (s *UsersService) GetFromAuthHeader() (*User, error)

GetFromAuthHeader gets the currently authenticated user.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/users/operation/getUserFromAuth

func (*UsersService) GetMultiple added in v0.3.3

func (s *UsersService) GetMultiple(idOrUsernames []string) ([]*User, error)

GetMultiple gets multiple users.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/users/operation/getUsers

func (*UsersService) GetNotifications added in v0.3.0

func (s *UsersService) GetNotifications(idOrUsername string) ([]*Notification, error)

GetNotifications gets all a user's notifications.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/users/operation/getNotifications

func (*UsersService) GetProjects added in v0.3.0

func (s *UsersService) GetProjects(idOrUsername string) ([]*Project, error)

GetProjects gets all a user's projects.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/users/operation/getUserProjects

func (*UsersService) Modify added in v0.2.0

func (s *UsersService) Modify(idOrUsername string, options ModifyUserOptions) error

Modify modifies a user.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/users/operation/modifyUser

type Version

type Version struct {
	Name          *string       `json:"name,omitempty"`
	VersionNumber *string       `json:"version_number,omitempty"`
	Changelog     *string       `json:"changelog,omitempty"`
	Dependencies  []*Dependency `json:"dependencies,omitempty"`
	GameVersions  []string      `json:"game_versions,omitempty"`
	VersionType   *string       `json:"version_type,omitempty"`
	Loaders       []string      `json:"loaders,omitempty"`
	Featured      *bool         `json:"featured,omitempty"`
	ID            *string       `json:"id,omitempty"`
	ProjectID     *string       `json:"project_id,omitempty"`
	AuthorID      *string       `json:"author_id,omitempty"`
	DatePublished *time.Time    `json:"date_published,omitempty"`
	Downloads     *uint32       `json:"downloads,omitempty"`
	ChangelogURL  *string       `json:"changelog_url,omitempty"`
	Files         []*File       `json:"files,omitempty"`
}

type VersionFilesService

type VersionFilesService service

VersionFilesService handles communication with the version files routes of the Modrinth API.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/version-files

func (*VersionFilesService) DeleteFromHash added in v0.1.1

func (s *VersionFilesService) DeleteFromHash(hash string, algorithm string) error

DeleteFromHash deletes a file from a version based on its hash.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/version-files/operation/deleteFileFromHash

func (*VersionFilesService) GetFromHash

func (s *VersionFilesService) GetFromHash(hash string, algorithm string) (*Version, error)

GetFromHash gets a version from a file's hash.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/version-files/operation/versionFromHash

func (*VersionFilesService) GetFromHashes added in v0.1.1

func (s *VersionFilesService) GetFromHashes(hashes []string, algorithm string) (map[string]*Version, error)

GetFromHashes gets multiple versions from their file's hashes.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/version-files/operation/versionsFromHashes

func (*VersionFilesService) GetLatestVersionFromHash added in v0.1.1

func (s *VersionFilesService) GetLatestVersionFromHash(
	hash string, algorithm string, loaders []string, gameVersions []string,
) (*Version, error)

GetLatestVersionFromHash gets the latest version of a project, based on a hash of a project's version's file.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/version-files/operation/getLatestVersionFromHash

func (*VersionFilesService) GetLatestVersionsFromHashes added in v0.5.0

func (s *VersionFilesService) GetLatestVersionsFromHashes(
	hashes []string, algorithm string, loaders []string, gameVersions []string,
) (map[string]*Version, error)

GetLatestVersionsFromHashes gets the latest versions of projects, based on hashes from version's files.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/version-files/operation/getLatestVersionsFromHashes

type VersionsService

type VersionsService service

VersionsService handles communication with the versions routes of the Modrinth API.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/versions

func (*VersionsService) Delete added in v0.1.1

func (s *VersionsService) Delete(idOrSlug string) error

Delete deletes a version.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/versions/operation/deleteVersion

func (*VersionsService) Get

func (s *VersionsService) Get(idOrSlug string) (*Version, error)

Get gets a version.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/versions/operation/getVersion

func (*VersionsService) GetMultiple added in v0.3.2

func (s *VersionsService) GetMultiple(ids []string) ([]*Version, error)

GetMultiple gets multiple versions.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/versions/operation/getVersions

func (*VersionsService) ListVersions

func (s *VersionsService) ListVersions(projectIDOrSlug string, options ListVersionsOptions) ([]*Version, error)

ListVersions gets all versions of a project.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/versions/operation/getProjectVersions

func (*VersionsService) Modify added in v0.3.4

func (s *VersionsService) Modify(id string, options ModifyVersionOptions) error

Modify modifies a version.

Modrinth API docs: https://docs.modrinth.com/api-spec/#tag/versions/operation/modifyVersion

Jump to

Keyboard shortcuts

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