kettle

package module
v2.3.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2019 License: MIT Imports: 5 Imported by: 1

README

Kettle GoDoc Go Report Card

Kettle is a simple Go package for accessing theSteam API, or xPaw documentation and the Storefront API.

If you find any errors please create an issue or I'll accept your pull request :)

Install

go get -u github.com/peppage/kettle

Usage


    httpClient := http.DefaultClient
    steamClient = kettle.NewClient(httpClient, "steamkey")
    
    // Get the full app list
    games, _, err := steamClient.ISteamAppsService.GetAppList()
    
    // Get reviews for a game
    d, _, err := steamClient.Store.AppReviews(&kettle.AppReviewsParams{
		AppID:    gameID,
		Language: "all",
	})
	
	// Get details about a game
	d, _, err := steamClient.Store.AppDetails(game.ID)

License

MIT License

Documentation

Index

Constants

View Source
const (
	CategorySinglePlayer = 2
	CategoryDLC          = 21
)

IDs for categories

View Source
const (
	False = BoolAsAnInt(0)
	True  = BoolAsAnInt(1)
)

Option available for BoolAsAnInt

View Source
const (
	Individual        = VanityType(1)
	Group             = VanityType(2)
	OfficialGameGroup = VanityType(3)
)

The options for VanityType

View Source
const (
	GenreEarlyAccess = "70"
)

IDs for Genres

Variables

This section is empty.

Functions

This section is empty.

Types

type Achievement

type Achievement struct {
	APIName  string `json:"apiname"`
	Achieved int    `json:"achieved"`
}

Achievement is part of the PlayerStats returned from ISteamUserStatsService.GetPlayerAchievements

type Achievements

type Achievements struct {
	Total       int                     `json:"total"`
	Highlighted []HighlightedAchivement `json:"highlighted"`
}

Achievements are the achievements associated with AppData

type App

type App struct {
	AppID int64  `json:"appid"`
	Name  string `json:"name"`
}

App is an app on steam from ISteamAppsService.GetAppList

type AppData

type AppData struct {
	Type                string          `json:"type"`
	Name                string          `json:"name"`
	SteamAppID          int64           `json:"steam_appid"`
	RequiredAge         interface{}     `json:"required_age"` // Can be string or int
	IsFree              bool            `json:"is_free"`
	ControllerSupport   string          `json:"controller_support"`
	Dlc                 []int64         `json:"dlc,omitempty"`
	DetailedDescription string          `json:"detailed_description"`
	AboutTheGame        string          `json:"about_the_game"`
	ShortDescription    string          `json:"short_description"`
	SupportedLanguages  string          `json:"supported_languages"`
	Reviews             string          `json:"reviews"`
	HeaderImage         string          `json:"header_image"`
	Website             string          `json:"website"`
	PCRequirements      json.RawMessage `json:"pc_requirements,omitempty"`
	MacRequirements     json.RawMessage `json:"mac_requirements,omitempty"`
	LinuxRequirements   json.RawMessage `json:"linux_requirements,omitempty"`
	LegalNotice         string          `json:"legal_notice"`
	Developers          []string        `json:"developers"`
	Publishers          []string        `json:"publishers"`
	PriceOverview       Price           `json:"price_overview"`
	Packages            json.RawMessage `json:"packages"` // Can be an array of strings or ints
	PackageGroups       []PackageGroup  `json:"package_groups"`
	Platforms           Platform        `json:"platforms"`
	MetaCritic          MetaCritic      `json:"metacritic,omitempty"`
	Categories          []Category      `json:"categories"`
	Genres              []Genre         `json:"genres"`
	Screenshots         []Screenshot    `json:"screenshots"`
	Movies              []Movie         `json:"movies"`
	Recomendations      Recomendations  `json:"recommendations"`
	Achievements        Achievements    `json:"achievements"`
	ReleaseDate         ReleaseDate     `json:"release_date"`
	SupportInfo         SupportInfo     `json:"support_info"`
	Background          string          `json:"background"`
}

AppData holds the data for StoreService.AppDetails https://wiki.teamfortress.com/wiki/User:RJackson/StorefrontAPI#appdetails

type AppReview

type AppReview struct {
	Success      int          `json:"success"`
	QuerySummary QuerySummary `json:"query_summary"`
	Reviews      []Review     `json:"reviews"`
}

type AppReviewsParams

type AppReviewsParams struct {
	JSON         int `url:"json"`
	AppID        int64
	Filter       string `url:"filter,omitempty"`
	Language     string `url:"language,omitempty"`
	DayRange     string `url:"day_range,omitempty"`
	StartOffset  string `url:"start_offset,omitempty"`
	ReviewType   string `url:"review_type,omitempty"`
	PurchaseType string `url:"purchase_type,omitempty"`
}

AppReviewsParams are the parameters for Store.AppReviews https://partner.steamgames.com/doc/store/getreviews

type Author

type Author struct {
	UserID               string `json:"steamid"`
	NumberGamesOwned     int    `json:"num_games_owned"`
	NumberReviews        int    `json:"num_reviews"`
	PlayTimeForever      int    `json:"playtime_forever"`
	PlaytimeLastTwoWeeks int    `json:"playtime_last_two_weeks"`
	LastPlayed           int64  `json:"last_played"`
}

type BoolAsAnInt

type BoolAsAnInt int

BoolAsAnInt is a bool that needs to be an int when transferred to an endpoint

type Category

type Category struct {
	ID          int    `json:"id"`
	Description string `json:"description"`
}

Category associated to an AppData

type Client

type Client struct {
	Store                  *StoreService
	IPlayerService         *IPlayerService
	ISteamAppsService      *ISteamAppsService
	ISteamNewsService      *ISteamNewsService
	ISteamUserService      *ISteamUserService
	ISteamUserStatsService *ISteamUserStatsService
	// contains filtered or unexported fields
}

Client is a Steam client for making Steam API requests

func NewClient

func NewClient(httpClient *http.Client, key string) *Client

NewClient returns a new Client

type Friend

type Friend struct {
	SteamID      string `json:"steamid"`
	Relationship string `json:"relationship"`
	FriendSince  int64  `json:"friend_since"`
}

Friend is a steam users's friend.

type GameAchievement

type GameAchievement struct {
	Name    string  `json:"name"`
	Percent float64 `json:"percent"`
}

GameAchievement is the response for ISteamUserStatsService.GetGlobalAchievementPercentagesForApp

type GameSchema

type GameSchema struct {
	GameName           string `json:"gameName"`
	GameVersion        string `json:"gameVersion"`
	AvailableGameStats Stats  `json:"availableGameStats"`
}

GameSchema is the response for ISteamUserStatsService.GetSchemaForGame

type Genre

type Genre struct {
	ID          string `json:"id"`
	Description string `json:"description"`
}

Genre associated with an AppData

type GetFriendListParams

type GetFriendListParams struct {
	SteamID      int64  `url:"steamid"`
	Relationship string `url:"relationship,omitempty"`
}

GetFriendListParams are the parameters for ISteamUserService.GetFriendList Relatiionship (optional) can be "friend" or "all".

type GetNewsForAppParams

type GetNewsForAppParams struct {
	AppID     int64  `url:"appid"`
	MaxLength int    `url:"maxlength,omitempty"`
	EndDate   int64  `url:"enddate,omitempty"`
	Count     int    `url:"count,omitempty"`
	FeedName  string `url:"feedname,omitempty"`
}

GetNewsForAppParams are the paremeters for ISteamNewsService.GetNewsForApp

type GetPlayerAchievementsParams

type GetPlayerAchievementsParams struct {
	SteamID int64  `url:"steamid"`
	AppID   int64  `url:"appid"`
	Lang    string `url:"l,omitempty"`
}

GetPlayerAchievementsParams are the parameters for ISteamUserStatsService.GetPlayerAchievements

type HighlightedAchivement

type HighlightedAchivement struct {
	Name string `json:"name"`
	Path string `json:"path"`
}

HighlightedAchivement are name/photo of achievements on an App

type IPlayerService

type IPlayerService struct {
	// contains filtered or unexported fields
}

IPlayerService provides a method for accessing player information

func (IPlayerService) GetOwnedGames

func (s IPlayerService) GetOwnedGames(params *OwnedGamesParams) ([]UserGame, *http.Response, error)

GetOwnedGames returns a list of games a player owns along with some playtime information, if the profile is publicly visible. If IncludeAppInfo is not set in the params then the response will only have AppID, Playtime2Seeks, and PlaytimeForever https://developer.valvesoftware.com/wiki/Steam_Web_API#GetOwnedGames_.28v0001.29 https://lab.xpaw.me/steam_api_documentation.html#IPlayerService_GetOwnedGames_v1

func (IPlayerService) GetRecentlyPlayedGames

func (s IPlayerService) GetRecentlyPlayedGames(params *RecentGamesParams) ([]PlayedGame, *http.Response, error)

GetRecentlyPlayedGames returns a list of games a player has played in the last two weeks, if the profile is publicly visible. Private, friends-only, and other privacy settings are not supported unless you are asking for your own personal details (ie the WebAPI key you are using is linked to the steamid you are requesting). https://developer.valvesoftware.com/wiki/Steam_Web_API#GetRecentlyPlayedGames_.28v0001.29

type ISteamAppsService

type ISteamAppsService struct {
	// contains filtered or unexported fields
}

ISteamAppsService provides a method for accessing steam app info

func (*ISteamAppsService) GetAppList

func (s *ISteamAppsService) GetAppList() ([]App, *http.Response, error)

GetAppList returns a list of all apps on steam https://wiki.teamfortress.com/wiki/WebAPI/GetAppList

type ISteamNewsService

type ISteamNewsService struct {
	// contains filtered or unexported fields
}

ISteamNewsService provides a method for accessing news about an app

func (*ISteamNewsService) GetNewsForApp

func (s *ISteamNewsService) GetNewsForApp(params *GetNewsForAppParams) ([]NewsItem, *http.Response, error)

GetNewsForApp returns the latest of a game specified by its appID. https://developer.valvesoftware.com/wiki/Steam_Web_API#GetNewsForApp_.28v0002.29 https://wiki.teamfortress.com/wiki/WebAPI/GetNewsForApp

type ISteamUserService

type ISteamUserService struct {
	// contains filtered or unexported fields
}

ISteamUserService provides access to information about a steam user

func (*ISteamUserService) GetFriendList

func (s *ISteamUserService) GetFriendList(params *GetFriendListParams) ([]Friend, *http.Response, error)

GetFriendList Returns friends Steam user if profile is public. https://developer.valvesoftware.com/wiki/Steam_Web_API#GetFriendList_.28v0001.29 https://wiki.teamfortress.com/wiki/WebAPI/GetFriendList

func (*ISteamUserService) ResolveVanityURL

func (s *ISteamUserService) ResolveVanityURL(params *ResolveVanityURLParams) (*VanityResponse, *http.Response, error)

ResolveVanityURL resolve a vanity url to a steam user id. https://wiki.teamfortress.com/wiki/WebAPI/ResolveVanityURL

type ISteamUserStatsService

type ISteamUserStatsService struct {
	// contains filtered or unexported fields
}

ISteamUserStatsService provides access to information about a user's stats.

func (*ISteamUserStatsService) GetGlobalAchievementPercentagesForApp

func (s *ISteamUserStatsService) GetGlobalAchievementPercentagesForApp(gameid int64) ([]GameAchievement, *http.Response, error)

GetGlobalAchievementPercentagesForApp Statistics showing how much of the player base have unlocked various achievements. https://wiki.teamfortress.com/wiki/WebAPI/GetGlobalAchievementPercentagesForApp https://developer.valvesoftware.com/wiki/Steam_Web_API#GetGlobalAchievementPercentagesForApp_.28v0002.29

func (*ISteamUserStatsService) GetSchemaForGame

func (s *ISteamUserStatsService) GetSchemaForGame(appid int64) (*GameSchema, *http.Response, error)

GetSchemaForGame returns gamename, gameversion and availablegamestats https://wiki.teamfortress.com/wiki/WebAPI/GetSchemaForGame https://developer.valvesoftware.com/wiki/Steam_Web_API#GetSchemaForGame_.28v2.29

type MetaCritic

type MetaCritic struct {
	Score int    `json:"score"`
	URL   string `json:"url"`
}

MetaCritic information about the app

type Movie

type Movie struct {
	ID        int    `json:"id"`
	Name      string `json:"name"`
	Thumbnail string `json:"thumbnail"`
	Webm      Webm   `json:"webm"`
	Highlight bool   `json:"highlight"`
}

Movie are trailers and videos associated with AppData

type NewsItem

type NewsItem struct {
	GID         string `json:"gid"`
	Title       string `json:"title"`
	URL         string `json:"url"`
	ExternalURL bool   `json:"is_external_url"`
	Author      string `json:"author"`
	Contents    string `json:"contents"`
	FeedLabel   string `json:"feedlabel"`
	Date        int64  `json:"date"`
	FeedName    string `json:"feeds"`
}

NewsItem is news about an app from ISteamNewsService.GetNewsForApp

type OwnedGamesParams

type OwnedGamesParams struct {
	SteamID        string      `url:"steamid"`
	IncludeAppInfo BoolAsAnInt `url:"include_appinfo,omitempty"`
	IncludeFree    BoolAsAnInt `url:"include_played_free_games,omitempty"`
}

OwnedGamesParams are the parameters for IPlayerService.GetOwnedGames

type PackageGroup

type PackageGroup struct {
	Name                    string      `json:"name"`
	Title                   string      `json:"title"`
	Description             string      `json:"description"`
	SelectionText           string      `json:"selection_text"`
	SaveText                string      `json:"save_text"`
	DisplayType             interface{} `json:"display_type"` //This can be a string or number
	IsRecurringSubscription string      `json:"is_recurring_subscription"`
	Subs                    []Sub       `json:"subs"`
}

PackageGroup are the packages the app is part of

type Platform

type Platform struct {
	Windows bool `json:"windows"`
	Mac     bool `json:"mac"`
	Linux   bool `json:"linux"`
}

Platform lists what platforms this app works on

type PlayedGame

type PlayedGame struct {
	AppID           int64  `json:"appid"`
	Name            string `json:"name,omitempty"`
	Playtime2Weeks  int    `json:"playtime_2weeks,omitempty"`
	PlaytimeForever int    `json:"playtime_forever"`
	ImgIconURL      string `json:"img_icon_url,omitempty"`
	ImgLogoURL      string `json:"img_logo_url,omitempty"`
}

PlayedGame is a struct for a game from IPlayerService.GetRecentlyPlayedGames

type Player

type Player struct {
	SteamID             string `json:"steamid"`
	CommunityVisibility int    `json:"communityvisibilitystate"`
	ProfileState        int    `json:"profilestate"`
	PersonaName         string `json:"personaname"`
	LastLogoff          int64  `json:"lastlogoff"`
	ProfileURL          string `json:"profileurl"`
	Avatar              string `json:"avatar"`
	AvatarMedium        string `json:"avatarmedium"`
	AvatarFull          string `json:"avatarfull"`
	PersonaState        int    `json:"personastate"`
	RealName            string `json:"realname"`
	PrimaryClanID       string `json:"primaryclanid"`
	TimeCreated         int64  `json:"timecreated"`
	PersonaStateFlags   int    `json:"personastateflags"`
	LocCountryCode      string `json:"loccountrycode"`
	LocStateCode        string `json:"locstatecode"`
	LocCityID           int    `json:"loccityid"`
	GameID              string `json:"gameid"`
	GameTitle           string `json:"gameextrainfo"`
}

Player is a struct of extended details about a steam user

type PlayerStats

type PlayerStats struct {
	SteamID      string        `json:"steamID"`
	GameName     string        `json:"gameName"`
	Achievements []Achievement `json:"achievements"`
	Success      bool          `json:"success"`
}

PlayerStats are returned from ISteamUserStatsService.GetPlayerAchievements

type Price

type Price struct {
	Currency        string `json:"currency"`
	Initial         int    `json:"initial"`
	Final           int    `json:"final"`
	DiscountPercent int    `json:"discount_percent"`
}

Price holds the current and sale price for an app

type QuerySummary

type QuerySummary struct {
	NumberReviews          int    `json:"num_reviews"`
	ReviewScore            int    `json:"review_score"`
	ReviewScoreDescription string `json:"review_score_desc"`
	TotalPositive          int    `json:"total_positive"`
	TotalNegative          int    `json:"total_negative"`
	TotalReviews           int    `json:"total_reviews"`
}

type RecentGamesParams

type RecentGamesParams struct {
	SteamID string `url:"steamid"`
	Count   int    `url:"count,omitempty"`
}

RecentGamesParams are the parameters for IPlayerService.GetRecentlyPlayedGames

type Recomendations

type Recomendations struct {
	Total int64 `json:"total"`
}

Recomendations are how many people recommended the app

type ReleaseDate

type ReleaseDate struct {
	ComingSoon bool   `json:"coming_soon"`
	Date       string `json:"date"`
}

ReleaseDate is the release date for an app

type Requirements

type Requirements struct {
	Minimum     string `json:"minimum"`
	Recommended string `json:"recommended"`
}

Requirements is possibly used for pc/mac/linux requirements. If it's empty it will be an empty array so you will need to cast this yourself.

type ResolveVanityURLParams

type ResolveVanityURLParams struct {
	VanityURL string     `url:"vanityurl"`
	URLType   VanityType `url:"url_type,omitempty"`
}

ResolveVanityURLParams the parameters for ISteamUserService.ResolveVanityURL

type Review

type Review struct {
	ID                string          `json:"recommendationid"`
	Author            Author          `json:"author"`
	Language          string          `json:"language"`
	Review            string          `json:"review"`
	TimeCreated       int64           `json:"timestamp_created"`
	TimeUpdated       int64           `json:"timestamp_updated"`
	VotedUp           bool            `json:"voted_up"`
	VotesUp           int             `json:"votes_up"`
	VotesDown         int             `json:"votes_down"`
	VotesFunny        int             `json:"votes_funny"`
	WeightedVoteScore string          `json:"weighted_vote_score"`
	CommentCount      json.RawMessage `json:"comment_count"` // if < 1 string if == 0 int
	SteamPurchase     bool            `json:"steam_purchase"`
	ReceivedForFree   bool            `json:"received_for_free"`
	EarlyAccess       bool            `json:"written_during_early_access"`
}

type SchemaAchievement

type SchemaAchievement struct {
	Name         string `json:"name"`
	DefaultValue int    `json:"defaultvalue"`
	DisplayName  string `json:"displayName"`
	Hidden       int    `json:"hidden"`
	Description  string `json:"description"`
	Icon         string `json:"icon"`
	IconGray     string `json:"icongray"`
}

SchemaAchievement is an achievement for Stats part of ISteamUserStatsService.GetSchemaForGame

type SchemaStat

type SchemaStat struct {
	Name         string `json:"name"`
	DefaultValue int    `json:"defaultvalue"`
	DisplayName  string `json:"displayName"`
}

SchemaStat is a stat for Stats part of ISteamUserStatsService.GetSchemaForGame

type Screenshot

type Screenshot struct {
	ID            int    `json:"id"`
	PathThumbnail string `json:"path_thumbnail"`
	PathFull      string `json:"path_full"`
}

Screenshot is a screenshot of an app

type Stats

type Stats struct {
	Achievements []SchemaAchievement `json:"achievements"`
	Stats        []SchemaStat        `json:"stats"`
}

Stats are the listed achievements for a GameSchema

type StoreService

type StoreService struct {
	// contains filtered or unexported fields
}

StoreService provides a method for accessing Steam store endpoints

func (*StoreService) AppDetails

func (s *StoreService) AppDetails(id int64) (*AppData, *http.Response, error)

AppDetails gets detailed information about a game Not supported: multiple appids with &filters=price_overview https://wiki.teamfortress.com/wiki/User:RJackson/StorefrontAPI#appdetails

func (*StoreService) AppReviews

func (s *StoreService) AppReviews(params *AppReviewsParams) (*AppReview, *http.Response, error)

AppReviews gets review data for a game https://partner.steamgames.com/doc/store/reviews

type Sub

type Sub struct {
	PackageID                json.RawMessage `json:"packageid"` // This could be a string or int64
	PercentSavingsText       string          `json:"percent_savings_text"`
	PercentSavings           int             `json:"percent_savings"`
	OptionText               string          `json:"option_text"`
	OptionDescription        string          `json:"option_description"`
	CanGetFreeLicense        string          `json:"can_get_free_license"`
	IsFreeLicense            bool            `json:"is_free_license"`
	PriceInCentsWithDiscount int             `json:"price_in_cents_with_discount"`
}

Sub is part of the PackageGroup, details about a package

type SupportInfo

type SupportInfo struct {
	URL   string `json:"url"`
	Email string `json:"email"`
}

SupportInfo holds contact info for support for an app

type UserGame

type UserGame struct {
	AppID           int64  `json:"appid"`
	Name            string `json:"name,omitempty"`
	Playtime2Weeks  int    `json:"playtime_2weeks,omitempty"`
	PlaytimeForever int    `json:"playtime_forever"`
	ImgIconURL      string `json:"img_icon_url,omitempty"`
	ImgLogoURL      string `json:"img_logo_url,omitempty"`
	VisibleStats    bool   `json:"has_community_visible_stats,omitempty"`
}

UserGame is a game listing specific to a user for IPlayerService.GetOwnedGames

type VanityResponse

type VanityResponse struct {
	SteamID string `json:"steamid"`
	Success int    `json:"success"`
	Message string `json:"message"`
}

VanityResponse is the response for ISteamUserService.ResolveVanityURL

type VanityType

type VanityType int

VanityType is the type of vanity url you're trying to resolve

type Webm

type Webm struct {
	Low string `json:"480"`
	Max string `json:"max"`
}

Webm are links to the different quality level of a Movie

Jump to

Keyboard shortcuts

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