Documentation ¶
Overview ¶
Package modpacksch provides a client for using the modpacks.ch API.
Index ¶
- Constants
- func CheckResponse(r *http.Response) error
- type Art
- type Author
- type Client
- type CurseForgeService
- type ErrorResponse
- type File
- type Link
- type Mod
- type ModService
- type ModVersion
- type Pack
- type PackService
- func (s *PackService) All() ([]int, error)
- func (s *PackService) Featured(limit int) ([]int, error)
- func (s *PackService) GetPack(id int) (*Pack, error)
- func (s *PackService) GetVersion(packId int, versionId int) (*PackVersion, error)
- func (s *PackService) GetVersionChangelog(packId int, versionId int) (*VersionChangelog, error)
- func (s *PackService) IncrementInstallCount(packId int, versionId int) error
- func (s *PackService) IncrementPlayCount(packId int, versionId int) error
- func (s *PackService) MostInstalled(limit int) ([]int, error)
- func (s *PackService) MostInstalledWithTag(limit int, tag string) ([]int, error)
- func (s *PackService) MostPlayed(limit int) ([]int, error)
- func (s *PackService) MostPlayedWithTag(limit int, tag string) ([]int, error)
- func (s *PackService) RecentlyUpdated(limit int) ([]int, error)
- func (s *PackService) Search(limit int, term string) ([]int, error)
- type PackVersion
- type PackVersionInfo
- type Rating
- type Specs
- type Tag
- type TagService
- type Target
- type VersionChangelog
Constants ¶
const ( StatusSuccess = "success" StatusError = "error" )
Variables ¶
This section is empty.
Functions ¶
func CheckResponse ¶
Types ¶
type Client ¶
type Client struct { // Base URL for API requests. Defaults to the production // modpacks.ch API, but can be set to a domain endpoint // to use with other instances. BaseURL should always be // set with a trailing slash. BaseURL *url.URL // User Agent used when communicating with the modpacks.ch API. UserAgent string // Services used for accessing different parts of the modpacks.ch // API. Packs *PackService Tags *TagService CurseForge *CurseForgeService Mods *ModService // contains filtered or unexported fields }
A client manages communication with the modpacks.ch API.
func NewClient ¶
NewClient returns a new modpacks.ch API client. If a nil client is provided, http.DefaultClient will be used.
func (*Client) Do ¶
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 ¶
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 CurseForgeService ¶
type CurseForgeService service
CurseForgeService handles communication with the CurseForge related methods of the modpacks.ch API.
modpacks.ch API docs: https://modpacksch.docs.apiary.io/#/reference/0/curseforge
func (*CurseForgeService) GetVersion ¶
func (s *CurseForgeService) GetVersion(packId int, versionId int) (*PackVersion, error)
type ErrorResponse ¶
type ErrorResponse struct { Response *http.Response Status string `json:"status"` Message string `json:"message"` }
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
type File ¶
type File struct { ID int `json:"id"` Type string `json:"type"` Path string `json:"path"` Name string `json:"name"` Version string `json:"version"` URL string `json:"url"` Sha1 string `json:"sha1"` Size int `json:"size"` ClientOnly bool `json:"clientonly"` ServerOnly bool `json:"serveronly"` Optional bool `json:"optional"` Tags []string `json:"tags"` Mirrors []string `json:"mirrors"` Updated int64 `json:"updated"` }
type Mod ¶
type Mod struct { ID int `json:"id"` Name string `json:"name"` Synopsis string `json:"synopsis"` Description string `json:"description"` Type string `json:"type"` Installs int `json:"installs"` Art []*Art `json:"art"` Authors []*Author `json:"authors"` Versions []*ModVersion `json:"versions"` Updated int64 `json:"updated"` Refreshed int64 `json:"refreshed"` }
type ModService ¶
type ModService service
ModService handles communication with the mods related methods of the modpacks.ch API.
modpacks.ch API docs: https://modpacksch.docs.apiary.io/#/reference/0/mods
type ModVersion ¶
type ModVersion struct { ID int `json:"id"` Name string `json:"name"` Type string `json:"type"` Path string `json:"path"` Version string `json:"version"` URL string `json:"url"` Sha1 string `json:"sha1"` Size int `json:"size"` ClientOnly bool `json:"clientonly"` Targets []*Target `json:"targets"` Dependencies []int `json:"dependencies"` Updated int64 `json:"updated"` }
type Pack ¶
type Pack struct { ID int `json:"id"` Name string `json:"name"` Synopsis string `json:"synopsis"` Description string `json:"description"` Type string `json:"type"` Featured bool `json:"featured"` Installs int `json:"installs"` Plays int `json:"plays"` Updated int64 `json:"updated"` Refreshed int64 `json:"refreshed"` Notification string `json:"notification"` Rating *Rating `json:"rating"` Art []*Art `json:"art"` Links []*Link `json:"links"` Authors []*Author `json:"authors"` Versions []*PackVersionInfo `json:"versions"` Tags []*Tag `json:"tags"` }
type PackService ¶
type PackService service
PackService handles communication with the pack related methods of the modpacks.ch API.
modpacks.ch API docs: https://modpacksch.docs.apiary.io/#/reference/0/modpacks
func (*PackService) All ¶
func (s *PackService) All() ([]int, error)
func (*PackService) GetVersion ¶
func (s *PackService) GetVersion(packId int, versionId int) (*PackVersion, error)
func (*PackService) GetVersionChangelog ¶
func (s *PackService) GetVersionChangelog(packId int, versionId int) (*VersionChangelog, error)
func (*PackService) IncrementInstallCount ¶
func (s *PackService) IncrementInstallCount(packId int, versionId int) error
func (*PackService) IncrementPlayCount ¶
func (s *PackService) IncrementPlayCount(packId int, versionId int) error
func (*PackService) MostInstalled ¶
func (s *PackService) MostInstalled(limit int) ([]int, error)
func (*PackService) MostInstalledWithTag ¶
func (s *PackService) MostInstalledWithTag(limit int, tag string) ([]int, error)
func (*PackService) MostPlayed ¶
func (s *PackService) MostPlayed(limit int) ([]int, error)
func (*PackService) MostPlayedWithTag ¶
func (s *PackService) MostPlayedWithTag(limit int, tag string) ([]int, error)
func (*PackService) RecentlyUpdated ¶
func (s *PackService) RecentlyUpdated(limit int) ([]int, error)
type PackVersion ¶
type PackVersion struct { ID int `json:"id"` Parent int `json:"parent"` Name string `json:"name"` Type string `json:"type"` Installs int `json:"installs"` Plays int `json:"plays"` Updated int64 `json:"updated"` Refreshed int64 `json:"refreshed"` Specs *Specs `json:"specs"` Targets []*Target `json:"targets"` Files []*File `json:"files"` }
type PackVersionInfo ¶
type Rating ¶ added in v0.3.2
type Rating struct { ID int `json:"id"` Age int `json:"age"` AlcoholDrugs bool `json:"alcoholdrugs"` Configured bool `json:"configured"` Frightening bool `json:"frightening"` Gambling bool `json:"gambling"` Language bool `json:"language"` NuditySexual bool `json:"nuditysexual"` StereotypesHate bool `json:"sterotypeshate"` Verified bool `json:"verified"` Violence bool `json:"violence"` }
type Specs ¶
type Specs struct { ID int `json:"id"` Minimum int `json:"minimum"` Recommended int `json:"recommended"` }
Hardware minimum spec and recommended spec information. Specifically, the Minimum and Recommended fields are for memory in mebibytes.
type TagService ¶
type TagService service
TagService handles communication with the tags related methods of the modpacks.ch API.
modpacks.ch API docs: https://modpacksch.docs.apiary.io/#/reference/0/tags