Documentation ¶
Overview ¶
Package platform provides a client for interacting with Technic Platform API.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { // Base URL for API requests. Defaults to Technic's Platform // 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 Platform API. UserAgent string // Build to use when communicating with the Platform API - as // Technic requires a valid launcher build to access the API. Build string // Services used for accessing different parts of the Platform // API. Modpack *ModpackService // contains filtered or unexported fields }
A client manages communication with a Solder API, defaulting to Technic's instance.
func NewClient ¶
NewClient returns a new Platform 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 Modpack ¶
type Modpack struct { ID int `json:"id"` Name string `json:"name"` DisplayName string `json:"displayName"` User string `json:"user"` PlatformURL string `json:"platformUrl"` Ratings int `json:"ratings"` Downloads int `json:"downloads"` Runs int `json:"runs"` Description string `json:"description"` // Direct Download URL string `json:"url"` Minecraft string `json:"minecraft"` Version string `json:"version"` // Solder Solder string `json:"solder"` // Images Icon *Image `json:"icon"` Logo *Image `json:"logo"` Background *Image `json:"background"` }
type ModpackService ¶
type ModpackService service
ModpackService provides access to the modpack routes of the Technic Platform API.
func (*ModpackService) GetModpack ¶
func (s *ModpackService) GetModpack(slug string) (*Modpack, error)
GetModpack gets information about the given modpack from the Technic Platform API.