Documentation ¶
Overview ¶
Package steamapi provides an interface to the Steam Web API methods.
Index ¶
- Constants
- Variables
- func GetCurrentAppVersion(app int) (uint, error)
- func IEconActionTradeOffer(action string, apiKey string, tradeOfferID uint64) error
- func IEconCancelTradeOffer(apiKey string, tradeOfferID uint64) error
- func IsAppUpToDate(app int, version uint) (bool, error)
- func NewIdFrom32bit(i uint32) (id steamId)
- func NewIdFrom64bit(i uint64) (id steamId)
- func NewIdFromString(s string) (id steamId, err error)
- func NewIdFromVanityUrl(vanityUrl, apiKey string) (id steamId, err error)
- type AccountInfo
- type Asset
- type Attribute
- type CEconAsset
- type CEconTradeOffer
- type CEconTradeOffers
- type CommunityVisibilityState
- type ConfirmationMethod
- type EquipInfo
- type Info
- type Inventory
- type Item
- type ItemDescription
- type ItemRank
- type ItemRankSet
- type ItemSet
- type KillEaterScoreType
- type Origin
- type ParticleEffect
- type PersonaState
- type PlayerBan
- type PlayerSummary
- type RegionId
- type Relationship
- type ResolveVanityURLResponse
- type Schema
- type SchemaAttribute
- type SchemaItem
- type SchemaItemAttribute
- type ServerInfo
- type State
- type SteamApp
- type SteamFriend
- type SteamMethod
- type Style
Constants ¶
const BaseSteamAPIURLProduction = "https://api.steampowered.com"
BaseSteamAPIURLProduction is the steam url used to do requests in prod
Variables ¶
var BaseSteamAPIURL = BaseSteamAPIURLProduction
BaseSteamAPIURL is the url used to do requests, defaulted to prod
var (
ErrInvalidId = errors.New("Invalid Steam ID")
)
Functions ¶
func GetCurrentAppVersion ¶
func IEconActionTradeOffer ¶
IEconActionTradeOffer declines a TO created by someone else
func IEconCancelTradeOffer ¶
IEconCancelTradeOffer declines a TO created by someone else
func NewIdFrom32bit ¶
func NewIdFrom32bit(i uint32) (id steamId)
func NewIdFrom64bit ¶
func NewIdFrom64bit(i uint64) (id steamId)
func NewIdFromString ¶
func NewIdFromVanityUrl ¶
Types ¶
type AccountInfo ¶
AccountInfo is id and name of user
type Asset ¶
type Asset struct { Prices map[string]int Defindex int `json:"name,string"` Date string Tags []string TagIDs []int64 }
Asset is an item in the store.
func GetAssetPrices ¶
GetAssetPrices returns a list of assets with their prices
type Attribute ¶
type Attribute struct { Defindex uint32 Value interface{} `json:"value"` FloatValue float64 `json:"float_value,omitempty"` AccountInfo *AccountInfo `json:",omitempty"` }
Attribute is the attribute of an item
type CEconAsset ¶
type CEconAsset struct { AppID uint `json:",string"` ContextID uint64 `json:",string"` AssetID uint64 `json:",string"` CurrencyID uint64 `json:",string"` ClassID uint64 `json:",string"` InstanceID uint64 `json:",string"` Amount uint64 `json:",string"` Missing bool MarketHashName string }
CEconAsset represents an asset in steam web api
type CEconTradeOffer ¶
type CEconTradeOffer struct { TradeOfferID uint64 `json:",string"` OtherAccountID uint64 `json:"accountid_other"` Message string ExpirationTime uint32 `json:"expiration_time"` State State `json:"trade_offer_state"` ToGive []*CEconAsset `json:"items_to_give"` ToReceive []*CEconAsset `json:"items_to_receive"` IsOurs bool `json:"is_our_offer"` TimeCreated uint32 `json:"time_created"` TimeUpdated uint32 `json:"time_updated"` FromRealTimeTrade bool `json:"from_real_time_trade"` EscrowEndDate uint32 `json:"escrow_end_date"` ConfirmationMethod ConfirmationMethod `json:"confirmation_method"` TradeID uint64 `json:"tradeid,string"` }
CEconTradeOffer represent the to from the steam API
func IEconGetTradeOffer ¶
func IEconGetTradeOffer(apiKey string, tradeOfferID uint64) ( *CEconTradeOffer, error, )
IEconGetTradeOffer retrieves details about a specific tradeoffer
type CEconTradeOffers ¶
type CEconTradeOffers struct { Sent []*CEconTradeOffer `json:"trade_offers_sent"` Received []*CEconTradeOffer `json:"trade_offers_received"` }
CEconTradeOffers represent the list of different tradeoffers types
type CommunityVisibilityState ¶
type CommunityVisibilityState int
CommunityVisibilityState contains the visibility of the user
const ( // Private community visibility state Private CommunityVisibilityState = 1 // FriendsOnly community visibility state FriendsOnly CommunityVisibilityState = 2 // Public community visibility state Public CommunityVisibilityState = 3 )
type ConfirmationMethod ¶
type ConfirmationMethod int
ConfirmationMethod different methods in which a trade offer can be confirmed.
const ( // ETradeOfferConfirmationMethodInvalid Invalid ETradeOfferConfirmationMethodInvalid ConfirmationMethod = 0 // ETradeOfferConfirmationMethodEmail An email was sent with details on how to confirm the trade offer ETradeOfferConfirmationMethodEmail ConfirmationMethod = 1 // ETradeOfferConfirmationMethodMobileApp The trade offer may be confirmed via the mobile app ETradeOfferConfirmationMethodMobileApp ConfirmationMethod = 2 )
type Info ¶
type Info struct { ClassID string `json:"classid"` IconURL string `json:"icon_url"` MarketHashName string `json:"market_hash_name"` Tradable string Marketable string }
Info is the details about the class info
type Item ¶
type Item struct { ID uint64 OriginalID uint64 `json:"original_id"` Defindex uint32 Level int Quantity int Origin int Untradeable bool `json:"flag_cannot_trade,omitempty"` Uncraftable bool `json:"flag_cannot_craft,omitempty"` InventoryToken uint32 `json:"inventory"` Quality int CustomName string `json:"custom_name,omitempty"` CustomDescription string `json:"custom_description,omitempty"` Attributes []Attribute `json:",omitempty"` Equipped []EquipInfo `json:",omitempty"` }
Item in an inventory
type ItemDescription ¶
type ItemDescription struct { AppID uint `json:"appid"` ClassID uint64 `json:"classid,string"` InstanceID uint64 `json:"instanceid,string"` MarketHashName string `json:"market_hash_name"` IconURL string `json:"icon_url"` NameColor string `json:"name_color"` Name string `json:"name"` }
ItemDescription represents the details about the items unique w classid instanceid
type ItemRankSet ¶
ItemRankSet is the set of the possible ranks
type ItemSet ¶
type ItemSet struct { InternalName string `json:"item_set"` Name string StoreBundle string `json:"store_bundle,omitempty"` Items []string Attributes []SchemaItemAttribute `json:",omitempty"` }
ItemSet is an item set
type KillEaterScoreType ¶
KillEaterScoreType is the type of kill eater score
type ParticleEffect ¶
type ParticleEffect struct { System string ID int AttachToRootbone bool `json:"attach_to_rootbone"` Attachment string `json:",omitempty"` Name string }
ParticleEffect is the particle effect
type PersonaState ¶
type PersonaState int
PersonaState is the visibility state
const ( // Offline persona state is also // used when the steam user has set his profile // to private. Offline PersonaState = iota // Online is online Online // Busy is busy Busy // Away is away Away // Snooze is sniooze Snooze // LookingToTrade is looking to trade LookingToTrade // LookingToPlay is looking ot play LookingToPlay )
type PlayerBan ¶
type PlayerBan struct { SteamID uint64 `json:"SteamId,string"` CommunityBanned bool VACBanned bool EconomyBan string NumberOfVACBans uint DaysSinceLastBan uint NumberOfGameBans uint }
PlayerBan contains all ban status for community, VAC and economy
type PlayerSummary ¶
type PlayerSummary struct { SteamID uint64 `json:",string"` CommunityVisibilityState CommunityVisibilityState ProfileURL string ProfileState int // Set to 1 if the player has configured the profile. PersonaName string LastLogoff int64 PersonaState PersonaState SmallAvatarURL string `json:"avatar"` // 32x32 MediumAvatarURL string `json:"avatarmedium"` // 64x64 LargeAvatarURL string `json:"avatarfull"` // 184x184 TimeCreated int64 `json:",omitempty"` RealName string `json:",omitempty"` GameExtraInfo string `json:",omitempty"` PrimaryClanID uint64 `json:",string,omitempty"` GameID uint64 `json:",string,omitempty"` GameServerIp string `json:",omitempty"` }
PlayerSummary gives an overall state of the user in steam community
func GetPlayerSummaries ¶
func GetPlayerSummaries(ids []uint64, apiKey string) ([]PlayerSummary, error)
GetPlayerSummaries Fetches the player summaries for the given Steam Ids.
type Relationship ¶
type Relationship string
Relationship is a type of relationship
const ( // All is a type of relationship All Relationship = "all" // Friend is a type of relationship Friend Relationship = "friend" )
type ResolveVanityURLResponse ¶
type ResolveVanityURLResponse struct { Success int SteamID uint64 `json:",omitempty,string"` Message string `json:",omitempty"` }
ResolveVanityURLResponse resolves the response from steam
func ResolveVanityURL ¶
func ResolveVanityURL(vanityURL string, apiKey string) (*ResolveVanityURLResponse, error)
ResolveVanityURL should return a response
type Schema ¶
type Schema struct { Status int FullSchemaURL string `json:"items_game_url"` Qualities map[string]int QualityNames map[string]string OriginNames []Origin Items []SchemaItem Attributes []SchemaAttribute ItemSets []ItemSet AttributeControlledAttachedParticles []ParticleEffect `json:"attribute_controlled_attached_particles"` ItemLevels []ItemRankSet `json:"item_levels"` KillEaterScoreTypes []KillEaterScoreType `json:"kill_eater_score_types"` }
Schema is a game schema
func (*Schema) Item ¶
func (s *Schema) Item(defindex int) *SchemaItem
Item finds an item by its defindex in a Schema.
type SchemaAttribute ¶
type SchemaAttribute struct { Name string Defindex int Class string `json:"attribute_class"` MinValue float64 MaxValue float64 Description string `json:"description_string,omitempty"` DescriptionFormat string `json:"description_format,omitempty"` EffectType string `json:"effect_type"` Hidden bool StoredAsInteger bool `json:"stored_as_integer"` }
SchemaAttribute is a schema attribute
type SchemaItem ¶
type SchemaItem struct { Name string Defindex int ItemClass string `json:"item_class"` ItemTypeName string `json:"item_type_name"` ItemName string `json:"item_name"` Description string `json:"item_description,omitempty"` ProperName bool `json:"proper_name"` Slot string `json:"item_slot"` DefaultQuality int `json:"item_quality"` InventoryImage *string `json:"image_inventory"` // this is null for the "Free Trial Premium Upgrade" ImageURL string `json:"image_url"` ImageURLLarge string `json:"image_url_large"` DropType string `json:"drop_type,omitempty"` ItemSet string `json:"item_set,omitempty"` HolidayRestriction string `json:"holiday_restriction"` MinLevel int `json:"min_ilevel"` MaxLevel int `json:"max_ilevel"` CraftClass string `json:"craft_class,omitempty"` Capabilities map[string]bool `json:",omitempty"` UsedByClasses []string `json:"used_by_classes,omitempty"` ClassLoadoutSlots map[string]string `json:"per_class_loadout_slots,omitempty"` Styles []Style `json:",omitempty"` Attributes []SchemaItemAttribute `json:",omitempty"` }
SchemaItem is a schema description of an Item.
type SchemaItemAttribute ¶
SchemaItemAttribute is the schema items attributes
type ServerInfo ¶
type ServerInfo struct { Addr string // Seems to always be 65534 // TODO: find out meaning of value Gmsindex uint32 Message string AppId uint64 GameDir string Region RegionId VACSecured bool `json:"secure"` LANOnly bool `json:"lan"` GamePort uint16 SpecPort uint16 }
func GetServerInfo ¶
func GetServerInfo(ip net.IP) ([]ServerInfo, error)
type State ¶
type State uint
State represents the state of the tradeoffer, see constants
const ( // ETradeOfferStateCreated /!\ non steam status, used to know the TO has been created ETradeOfferStateCreated State = 0 // ETradeOfferStateInvalid Invalid ETradeOfferStateInvalid State = 1 // ETradeOfferStateActive This trade offer has been sent, neither party has acted on it yet. ETradeOfferStateActive State = 2 // ETradeOfferStateAccepted The trade offer was accepted by the recipient and items were exchanged. ETradeOfferStateAccepted State = 3 // ETradeOfferStateCountered The recipient made a counter offer ETradeOfferStateCountered State = 4 // ETradeOfferStateExpired The trade offer was not accepted before the expiration date ETradeOfferStateExpired State = 5 // ETradeOfferStateCanceled The sender cancelled the offer ETradeOfferStateCanceled State = 6 // ETradeOfferStateDeclined The recipient declined the offer ETradeOfferStateDeclined State = 7 // ETradeOfferStateInvalidItems Some of the items in the offer are no longer available // (indicated by the missing flag in the output) ETradeOfferStateInvalidItems State = 8 // ETradeOfferStateCreatedNeedsConfirmation The offer hasn't been sent yet and is awaiting email/mobile confirmation. The offer is only visible to the sender. ETradeOfferStateCreatedNeedsConfirmation State = 9 // ETradeOfferStateCanceledBySecondFactor Either party canceled the offer via email/mobile. The offer is visible to both parties, even if the sender canceled it before it was sent. ETradeOfferStateCanceledBySecondFactor State = 10 // ETradeOfferStateInEscrow The trade has been placed on hold. The items involved in the trade have all been removed from both parties' inventories and will be automatically delivered in the future. ETradeOfferStateInEscrow State = 11 )
type SteamApp ¶
func GetAppList ¶
type SteamFriend ¶
type SteamFriend struct { SteamID uint64 `json:",string"` Relationship Relationship FriendSince int64 `json:"friend_since"` }
SteamFriend is a relationship between two steam users
func GetFriendsList ¶
func GetFriendsList(steamID uint64, filter Relationship, apiKey string) ([]SteamFriend, error)
GetFriendsList Fetches the friends of the given steam id and returns the result.
It returns nil if the profile is private or if there were no friends found for the given relationship. In either one of both cases, no error is returned.
type SteamMethod ¶
type SteamMethod string
A SteamMethod represents a Steam Web API method.
func NewSteamMethod ¶
func NewSteamMethod(interf, method string, version int) SteamMethod
NewSteamMethod creates a new SteamMethod.