Documentation
¶
Index ¶
- type Bundle
- type BundleDetails
- type BundleMap
- type ChoicePeriod
- type ClaimStatus
- type ContentChoiceData
- type ContentChoiceOptions
- type DownloadInfo
- type DownloadURL
- type GameData
- type GameKey
- type HumbleChoice
- type HumbleTime
- type MatchMode
- type Product
- type ProductDownload
- type ProductKey
- type Tpkd
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bundle ¶
type Bundle struct {
Gamekey string `json:"gamekey"`
Created HumbleTime `json:"created"`
Claimed bool `json:"claimed"`
TpkdDict map[string]any `json:"tpkd_dict"`
Details BundleDetails `json:"product"`
Products []Product `json:"-"` // Custom unmarshal
AmountSpent *float64 `json:"amount_spent,omitempty"`
Currency *string `json:"currency,omitempty"`
}
Bundle represents a purchased Humble Bundle
func (*Bundle) ClaimStatus ¶
ClaimStatus returns the claim status of the bundle
func (*Bundle) ProductKeys ¶
func (b *Bundle) ProductKeys() []ProductKey
ProductKeys extracts all product keys from tpkd_dict
func (*Bundle) UnmarshalJSON ¶
UnmarshalJSON implements custom JSON unmarshaling to skip malformed products
type BundleDetails ¶
type BundleDetails struct {
MachineName string `json:"machine_name"`
HumanName string `json:"human_name"`
}
BundleDetails contains bundle metadata
type ChoicePeriod ¶
type ChoicePeriod struct {
// contains filtered or unexported fields
}
ChoicePeriod represents a Humble Choice period
func NewChoicePeriod ¶
func NewChoicePeriod(s string) ChoicePeriod
func (ChoicePeriod) IsCurrent ¶
func (c ChoicePeriod) IsCurrent() bool
func (ChoicePeriod) String ¶
func (c ChoicePeriod) String() string
type ClaimStatus ¶
type ClaimStatus int
ClaimStatus represents whether a bundle has been claimed
const ( ClaimStatusAll ClaimStatus = iota ClaimStatusYes ClaimStatusNo )
func ParseClaimStatus ¶
func ParseClaimStatus(s string) (ClaimStatus, error)
func (ClaimStatus) String ¶
func (c ClaimStatus) String() string
type ContentChoiceData ¶
ContentChoiceData contains game data for the choice period
type ContentChoiceOptions ¶
type ContentChoiceOptions struct {
Data ContentChoiceData `json:"contentChoiceData"`
Gamekey *string `json:"gamekey,omitempty"`
IsActiveContent bool `json:"isActiveContent"`
Title string `json:"title"`
}
ContentChoiceOptions contains choice subscription details
type DownloadInfo ¶
type DownloadInfo struct {
MD5 string `json:"md5"`
Format string `json:"name"`
FileSize uint64 `json:"file_size"`
URL DownloadURL `json:"url"`
}
DownloadInfo contains download metadata
type DownloadURL ¶
DownloadURL contains web and torrent URLs
type GameKey ¶
type GameKey struct {
Gamekey string `json:"gamekey"`
}
GameKey represents a simple gamekey response
type HumbleChoice ¶
type HumbleChoice struct {
Options ContentChoiceOptions `json:"contentChoiceOptions"`
}
HumbleChoice represents a Humble Choice subscription period
type HumbleTime ¶
HumbleTime is a custom time type that handles Humble Bundle's datetime format
func (*HumbleTime) UnmarshalJSON ¶
func (ht *HumbleTime) UnmarshalJSON(data []byte) error
UnmarshalJSON implements custom JSON unmarshaling for HumbleTime
type MatchMode ¶
type MatchMode int
MatchMode represents how keywords should match products
func ParseMatchMode ¶
type Product ¶
type Product struct {
MachineName string `json:"machine_name"`
HumanName string `json:"human_name"`
ProductDetailsURL string `json:"url"`
Downloads []ProductDownload `json:"downloads"`
}
Product represents a product within a bundle
func (*Product) FormatsAsVec ¶
FormatsAsVec returns all formats as a slice
func (*Product) NameMatches ¶
NameMatches checks if the product name matches the given keywords
type ProductDownload ¶
type ProductDownload struct {
Items []DownloadInfo `json:"download_struct"`
}
ProductDownload represents a downloadable item
func (*ProductDownload) Formats ¶
func (pd *ProductDownload) Formats() string
Formats returns all formats as a comma-separated string
func (*ProductDownload) FormatsAsVec ¶
func (pd *ProductDownload) FormatsAsVec() []string
FormatsAsVec returns all formats as a slice
func (*ProductDownload) TotalSize ¶
func (pd *ProductDownload) TotalSize() uint64
TotalSize returns the sum of all item file sizes
type ProductKey ¶
ProductKey represents a redeemable product key