Documentation
¶
Overview ¶
Package pouet provides production, user voting data sourced from the Pouet website API.
Index ¶
Constants ¶
const ( // ProdURL is the base URL for the Pouet production API. ProdURL = "https://api.pouet.net/v1/prod/?id=" // Timeout is the HTTP client timeout. Timeout = 5 * time.Second // StarRounder is the rounding value for the stars rating. StarRounder = 0.5 // Sanity is to check the maximum permitted production ID. Sanity = 200000 )
Variables ¶
Functions ¶
Types ¶
type Platfs ¶
type Platfs struct { DosGus Platf `json:"69"` // MS-Dos with GUS Windows Platf `json:"68"` // Windows MSDos Platf `json:"67"` // MS-Dos }
Platfs are the supported platforms from the Pouet API.
type Production ¶
type Production struct { // Platforms are the platforms the prod runs on. Platforms Platfs `json:"platforms"` // Title is the prod title. Title string `json:"title"` // ReleaseDate is the prod release date. ReleaseDate string `json:"release_date"` // Platform is the prod platforms as a string. // If the string is empty then the prod is not supported. Platform string `json:"platform"` // Groups are the releasers that produced the prod. Groups []struct { ID string `json:"id"` Name string `json:"name"` } `json:"groups"` // Types are the prod types. Types Types `json:"types"` // ID is the prod ID. ID int `json:"id"` // Valid is true if this prod is a supported type and platform. Valid bool `json:"valid"` }
Production is the production data from the Pouet API. The Pouet API returns values as null or string, so this struct is used to normalize the data types.
func (*Production) Uploader ¶
func (p *Production) Uploader(id int) error
Uploader retrieves and parses the production data from the Pouet API. The id value is the Pouet production ID and must be greater than 0. The data is intended for the Pouet Uploader.
type Response ¶
type Response struct { Prod struct { ID string `json:"id"` // ID is the prod ID. Voteup string `json:"voteup"` // Voteup is the number of thumbs up votes. Votepig string `json:"votepig"` // Votepig is the number of meh votes. Votedown string `json:"votedown"` // Votedown is the number of thumbs down votes. Voteavg string `json:"voteavg"` // Voteavg is the average votes, the maximum value is 1.0. Title string `json:"name"` // Title is the prod title. ReleaseDate string `json:"releaseDate"` // ReleaseDate is the prod release date. Groups []struct { ID string `json:"id"` Name string `json:"name"` } `json:"groups"` // Groups are the releasers that produced the prod. Platfs Platfs `json:"platforms"` // Platforms are the platforms the prod runs on. Types Types `json:"types"` // Types are the prod types. Download string `json:"download"` // Download is the first download link. DownloadLinks []struct { Type string `json:"type"` Link string `json:"link"` } `json:"downloadLinks"` // DownloadLinks are the additional download links. } `json:"prod"` // Prod is the production data. Success bool `json:"success"` // Success is true if the prod data was found. }
Response is the JSON response from the Pouet API with production voting data.
type Votes ¶
type Votes struct { // ID is the production ID. ID int `json:"id"` // Stars is the production rating using the average votes multiplied by 5. Stars float64 `json:"stars"` // VotesAvg is the average votes, the maximum value is 1.0. VotesAvg float64 `json:"votes_avg"` // VotesUp is the number of thumbs up votes. VotesUp uint64 `json:"votes_up"` // VotesMeh is the number of meh votes otherwise called piggies. VotesMeh uint64 `json:"votes_meh"` // VotesDown is the number of thumbs down votes. VotesDown uint64 `json:"votes_down"` }
Votes is the production voting data from the Pouet API. The Pouet API returns values as null or string, so this struct is used to normalize the data types.