steam

package module
v0.0.0-...-c2f2151 Latest Latest
Warning

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

Go to latest
Published: May 30, 2018 License: LGPL-2.1 Imports: 22 Imported by: 89

README

Steam Build Status

Steam is a library for interactions with Steam, it's written in Go.
Steam tries to keep-it-simple and does not add extra non-sense. There are absolutely no internal-polling or such, everything is up to you, all it does is wrap around Steam API.

Why?

  • You don't want a library to be "re-trying" automatically
  • You don't want a library to be doing your homework
  • You are an on-point person and just want stuff that works as-needed

Installation

Make sure you have at least Go 1.6 with a GOPATH set then run:

go get github.com/PuerkitoBio/goquery
go get github.com/doctype/steam

Example

package main

import (
	"log"
	"os"

	"github.com/doctype/steam"
)

func main() {
	log.SetFlags(log.LstdFlags | log.Lshortfile)

	timeTip, err := steam.GetTimeTip()
	if err != nil {
		log.Fatal(err)
	}
	log.Printf("Time tip: %#v\n", timeTip)
	timeDiff := time.Duration(timeTip.Time - time.Now().Unix())
	
	session := steam.NewSession(&http.Client{}, "")
	if err := session.Login(os.Getenv("steamAccount"), os.Getenv("steamPassword"), os.Getenv("steamSharedSecret"), timeDiff); err != nil {
		log.Fatal(err)
	}
	log.Print("Login successful")
}

Find more examples in the examples/ directory. Even better is to read through the source code, it's simple and straight-forward to understand.

Authors

License

LGPL 2.1

Documentation

Index

Constants

View Source
const (
	PersonaStateOffline = iota
	PersonaStateOnline
	PersonaStateBusy
	PersonaStateAway
	PersonaStateSnooze
	PersonaStateLookingToTrade
	PersonaStateLookingToPlay
)
View Source
const (
	PersonaStateFlagRichPresence   = 1 << 0
	PersonaStateFlagInJoinableGame = 1 << 1
	PersonaStateFlagWeb            = 1 << 8
	PersonaStateFlagMobile         = 1 << 9
	PersonaStateFlagBigPicture     = 1 << 10
)
View Source
const (
	MessageTypeStatus  = "personastate"
	MessageTypeTyping  = "typing"
	MessageTypeSayText = "saytext"
)
View Source
const (
	ChatUIModeMobile = "mobile" // empty string works too
	ChatUIModeWeb    = "web"
)
View Source
const (
	CurrencyUSD = "1"
	CurrencyGBP = "2"
	CurrencyEUR = "3"
	CurrencyCHF = "4"
	CurrencyRUB = "5"
	CurrencyPLN = "6"
	CurrencyBRL = "7"
	CurrencyJPY = "8"
	CurrencyNOK = "9"
	CurrencyIDR = "10"
	CurrencyMYR = "11"
	CurrencyPHP = "12"
	CurrencySGD = "13"
	CurrencyTHB = "14"
	CurrencyVND = "15"
	CurrencyKRW = "16"
	CurrencyTRY = "17"
	CurrencyUAH = "18"
	CurrencyMXN = "19"
	CurrencyCAD = "20"
	CurrencyAUD = "21"
	CurrencyNZD = "22"
	CurrencyCNY = "23"
	CurrencyINR = "24"
	CurrencyCLP = "25"
	CurrencyPEN = "26"
	CurrencyCOP = "27"
	CurrencyZAR = "28"
	CurrencyHKD = "29"
	CurrencyTWD = "30"
	CurrencySAR = "31"
	CurrencyAED = "32"
	CurrencyARS = "34"
	CurrencyILS = "35"
	CurrencyBYN = "36"
	CurrencyKZT = "37"
	CurrencyKWD = "38"
	CurrencyQAR = "39"
	CurrencyCRC = "40"
	CurrencyUYU = "41"
	CurrencyRMB = "9000"
)
View Source
const (
	PrivacyStatePrivate     = 1
	PrivacyStateFriendsOnly = 2
	PrivacyStatePublic      = 3
)
View Source
const (
	CommentSettingSelf    = "commentselfonly"
	CommentSettingFriends = "commentfriendsonly"
	CommentSettingPublic  = "commentanyone"
)
View Source
const (
	UniverseInvalid = iota
	UniversePublic
	UniverseBeta
	UniverseInternal
	UniverseDev
)
View Source
const (
	AccountTypeInvalid = iota
	AccountTypeIndividual
	AccountTypeMultiSeat
	AccountTypeGameServer
	AccountTypeAnonymousGameServer
	AccountTypePending
	AccountTypeContentServer
	AccountTypeClan
	AccountTypeChat
	AccountTypeP2PSuperSeeder
	AccountTypeAnonymous
)
View Source
const (
	AccountInstanceAll = iota
	AccountInstanceDesktop
	AccountInstanceConsole
	AccountInstanceWeb
)
View Source
const (
	ChatInstanceFlagClan     = 0x80000
	ChatInstanceFlagLobby    = 0x40000
	ChatInstanceFlagMMSLobby = 0x20000
)
View Source
const (
	TradeStateNone = iota
	TradeStateInvalid
	TradeStateActive
	TradeStateAccepted
	TradeStateCountered
	TradeStateExpired
	TradeStateCanceled
	TradeStateDeclined
	TradeStateInvalidItems
	TradeStateCreatedNeedsConfirmation
	TradeStateCanceledByTwoFactor
	TradeStateInEscrow
)
View Source
const (
	TradeConfirmationNone = iota
	TradeConfirmationEmail
	TradeConfirmationMobileApp
	TradeConfirmationMobile
)
View Source
const (
	TradeFilterNone             = iota
	TradeFilterSentOffers       = 1 << 0
	TradeFilterRecvOffers       = 1 << 1
	TradeFilterActiveOnly       = 1 << 3
	TradeFilterHistoricalOnly   = 1 << 4
	TradeFilterItemDescriptions = 1 << 5
)
View Source
const (
	InventoryEndpoint = "http://steamcommunity.com/inventory/%d/%d/%d?"
)

Variables

View Source
var (
	ErrConfirmationsUnknownError = errors.New("unknown error occurered finding confirmations")
	ErrCannotFindConfirmations   = errors.New("unable to find confirmations")
	ErrCannotFindDescriptions    = errors.New("unable to find confirmation descriptions")
	ErrConfiramtionsDescMismatch = errors.New("cannot match confirmations with their respective descriptions")
)
View Source
var (
	ErrInvalidUsername = errors.New("invalid username")
	ErrNeedTwoFactor   = errors.New("invalid twofactor code")
)
View Source
var (
	ErrCannotLoadPrices     = errors.New("unable to load prices at this time")
	ErrInvalidPriceResponse = errors.New("invalid market pricehistory response")
)
View Source
var (
	ErrInvalidSteam2ID = errors.New("invalid input specified for a Steam 2 ID")
	ErrInvalidSteam3ID = errors.New("invalid input specified for a Steam 3 ID")
)
View Source
var (
	ErrReceiptMatch        = errors.New("unable to match items in trade receipt")
	ErrCannotAcceptActive  = errors.New("unable to accept a non-active trade")
	ErrCannotFindOfferInfo = errors.New("unable to match data from trade offer url")
)
View Source
var (
	ErrCannotRegisterKey = errors.New("unable to register API key")
	ErrCannotRevokeKey   = errors.New("unable to revoke API key")
	ErrAccessDenied      = errors.New("access is denied")
	ErrKeyNotFound       = errors.New("key not found")
)
View Source
var ErrCannotDisable = errors.New("unable to process disable two factor request")
View Source
var ErrCannotFindVanityMatch = errors.New("no match for the vanity URL")
View Source
var ErrInvalidPhoneNumber = errors.New("invalid phone number specified")

Functions

func GenerateConfirmationCode

func GenerateConfirmationCode(identitySecret, tag string, current int64) (string, error)

func GenerateTwoFactorCode

func GenerateTwoFactorCode(sharedSecret string, current int64) (string, error)

Types

type APIResponse

type APIResponse struct {
	Inner *TradeOfferResponse `json:"response"`
}

type ChatFriendResponse

type ChatFriendResponse struct {
	AccountID   uint32  `json:"m_unAccountID"`
	SteamID     SteamID `json:"m_ulSteamID,string"`
	Name        string  `json:"m_strName"`
	State       uint8   `json:"m_ePersonaState"`
	StateFlags  uint32  `json:"m_nPersonaStateFlags"`
	AvatarHash  string  `json:"m_strAvatarHash"`
	InGame      bool    `json:"m_bIngame"`
	InGameAppID uint64  `json:"m_nInGameAppID,string"`
	InGameName  string  `json:"m_strInGameName"`
	LastMessage int64   `json:"m_tsLastMessage"`
	LastView    int64   `json:"m_tsLastView"`
}

type ChatLogMessage

type ChatLogMessage struct {
	Partner   uint32 `json:"m_unAccountID"`
	Timestamp int64  `json:"m_tsTimestamp"`
	Message   string `json:"m_strMessage"`
}

type ChatMessage

type ChatMessage struct {
	Type         string `json:"type"`
	Text         string `json:"text"`
	TimestampOff int64  `json:"timestamp"`
	UTCTimestamp int64  `json:"utc_timestamp"`
	Partner      uint32 `json:"accountid_from"`
	StatusFlags  uint32 `json:"status_flags"`
	PersonaState uint32 `json:"persona_state"`
	PersonaName  string `json:"persona_name"`
}

type ChatResponse

type ChatResponse struct {
	Message      int            `json:"message"`       // Login / Internal
	UmqID        string         `json:"umqid"`         // Login / Internal
	TimestampOff int64          `json:"timestamp"`     // Login
	UTCTimestamp int64          `json:"utc_timestamp"` // Login
	Push         int            `json:"push"`          // Login
	ErrorMessage string         `json:"error"`         // All (returned as error if not "OK")
	MessageBase  uint32         `json:"messagebase"`   // ChatPoll
	LastMessages uint32         `json:"messagelast"`   // ChatPoll
	Messages     []*ChatMessage `json:"messages"`      // ChatPoll
	SecTimeout   uint32         `json:"sectimeout"`    // ChatPoll
}

type Confirmation

type Confirmation struct {
	ID        uint64
	Key       uint64
	Title     string
	Receiving string
	Since     string
	OfferID   uint64
}

func (*Confirmation) Answer

func (confirmation *Confirmation) Answer(session *Session, key, answer string, current int64) error

type EconAction

type EconAction struct {
	Link string `json:"link"`
	Name string `json:"name"`
}

type EconDesc

type EconDesc struct {
	Type  string `json:"type"`
	Value string `json:"value"`
	Color string `json:"color"`
}

type EconItem

type EconItem struct {
	AssetID    uint64 `json:"assetid,string,omitempty"`
	InstanceID uint64 `json:"instanceid,string,omitempty"`
	ClassID    uint64 `json:"classid,string,omitempty"`
	AppID      uint32 `json:"appid"`
	ContextID  uint64 `json:"contextid,string"`
	Amount     uint16 `json:"amount,string"`
	Missing    bool   `json:"missing,omitempty"`
}

type EconItemDesc

type EconItemDesc struct {
	ClassID         uint64        `json:"classid,string"`    // for matching with EconItem
	InstanceID      uint64        `json:"instanceid,string"` // for matching with EconItem
	Tradable        int           `json:"tradable"`
	BackgroundColor string        `json:"background_color"`
	IconURL         string        `json:"icon_url"`
	IconLargeURL    string        `json:"icon_url_large"`
	IconDragURL     string        `json:"icon_drag_url"`
	Name            string        `json:"name"`
	NameColor       string        `json:"name_color"`
	MarketName      string        `json:"market_name"`
	MarketHashName  string        `json:"market_hash_name"`
	Comodity        bool          `json:"comodity"`
	Actions         []*EconAction `json:"actions"`
	Tags            []*EconTag    `json:"tags"`
	Descriptions    []*EconDesc   `json:"descriptions"`
}

type EconTag

type EconTag struct {
	InternalName string `json:"internal_name"`
	Name         string `json:"name"`
	Category     string `json:"category"`
	CategoryName string `json:"category_name"`
}

type EscrowSteamGuardInfo

type EscrowSteamGuardInfo struct {
	MyDays   int64
	ThemDays int64
	ErrorMsg string
}

type Filter

type Filter func(*InventoryItem) bool

Filter get InventoryItem and return true if item meet its condition false otherwise

func IsSouvenir

func IsSouvenir(cond bool) Filter

IsSouvenir filters souvenir items

func IsTradable

func IsTradable(cond bool) Filter

IsTradable return Filter for item.Tradable option

type FinalizeTwoFactorInfo

type FinalizeTwoFactorInfo struct {
	Status     uint32 `json:"status"`
	ServerTime uint64 `json:"server_time,string"`
}

type Friend

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

type Game

type Game struct {
	AppID           uint32 `json:"appid"`
	PlaytimeForever int64  `json:"playtime_forever"`
	Playtime2Weeks  int64  `json:"playtime_2weeks"`
}

type InventoryAppStats

type InventoryAppStats struct {
	AppID            uint64                       `json:"appid"`
	Name             string                       `json:"name"`
	AssetCount       uint32                       `json:"asset_count"`
	Icon             string                       `json:"icon"`
	Link             string                       `json:"link"`
	TradePermissions string                       `json:"trade_permissions"`
	Contexts         map[string]*InventoryContext `json:"rgContexts"`
}

type InventoryContext

type InventoryContext struct {
	ID         uint64 `json:"id,string"` /* Apparently context id needs at least 64 bits...  */
	AssetCount uint32 `json:"asset_count"`
	Name       string `json:"name"`
}

type InventoryItem

type InventoryItem struct {
	AppID      uint32        `json:"appid"`
	ContextID  uint64        `json:"contextid"`
	AssetID    uint64        `json:"id,string,omitempty"`
	ClassID    uint64        `json:"classid,string,omitempty"`
	InstanceID uint64        `json:"instanceid,string,omitempty"`
	Amount     uint64        `json:"amount,string"`
	Desc       *EconItemDesc `json:"-"` /* May be nil  */
}

Due to the JSON being string, etc... we cannot re-use EconItem Also, "assetid" is included as "id" not as assetid.

type ItemTag

type ItemTag struct {
	Category              string `json:"category"`
	InternalName          string `json:"internal_name"`
	LocalizedCategoryName string `json:"localized_category_name"`
	LocalizedTagName      string `json:"localized_tag_name"`
}

type LoginResponse

type LoginResponse struct {
	Success      bool   `json:"success"`
	PublicKeyMod string `json:"publickey_mod"`
	PublicKeyExp string `json:"publickey_exp"`
	Timestamp    string
	TokenGID     string
}

type LoginSession

type LoginSession struct {
	Success           bool   `json:"success"`
	LoginComplete     bool   `json:"login_complete"`
	RequiresTwoFactor bool   `json:"requires_twofactor"`
	Message           string `json:"message"`
	RedirectURI       string `json:"redirect_uri"`
	OAuthInfo         string `json:"oauth"`
}

type MarketBuyOrderResponse

type MarketBuyOrderResponse struct {
	ErrCode int    `json:"success"`
	ErrMsg  string `json:"message"` // Set if ErrCode != 1
	OrderID uint64 `json:"buy_orderid,string"`
}

type MarketItemPrice

type MarketItemPrice struct {
	Date  string
	Price float64
	Count string
}

type MarketItemPriceOverview

type MarketItemPriceOverview struct {
	Success     bool   `json:"success"`
	LowestPrice string `json:"lowest_price"`
	MedianPrice string `json:"median_price"`
	Volume      string `json:"volume"`
}

type MarketItemResponse

type MarketItemResponse struct {
	Success     bool        `json:"success"`
	PricePrefix string      `json:"price_prefix"`
	PriceSuffix string      `json:"price_suffix"`
	Prices      interface{} `json:"prices"`
}

type MarketSellResponse

type MarketSellResponse struct {
	Success                    bool   `json:"success"`
	RequiresConfirmation       uint32 `json:"requires_confirmation"`
	MobileConfirmationRequired bool   `json:"needs_mobile_confirmation"`
	EmailConfirmationRequired  bool   `json:"needs_email_confirmation"`
	EmailDomain                string `json:"email_domain"`
}

type OAuth

type OAuth struct {
	SteamID       SteamID `json:"steamid,string"`
	Token         string  `json:"oauth_token"`
	WGToken       string  `json:"wgtoken"`
	WGTokenSecure string  `json:"wgtoken_secure"`
	WebCookie     string  `json:"webcookie"`
}

type OwnedGamesResponse

type OwnedGamesResponse struct {
	Count uint32  `json:"game_count"`
	Games []*Game `json:"games"`
}

type PhoneAPIResponse

type PhoneAPIResponse struct {
	Success   bool   `json:"success"`
	State     string `json:"state"`
	ErrorText string `json:"errorText"`
}

type PlayerBan

type PlayerBan struct {
	SteamID          uint64 `json:"SteamId,string"`
	CommunityBanned  bool   `json:"CommunityBanned"`
	VACBanned        bool   `json:"VACBanned"`
	NumberOfVACBans  int    `json:"NumberOfVACBans"`
	DaysSinceLastBan int    `json:"DaysSinceLastBan"`
	NumberOfGameBans int    `json:"NumberOfGameBans"`
	EconomyBan       string `json:"EconomyBan"`
}

type PlayerSummary

type PlayerSummary struct {
	SteamID           SteamID `json:"steamid,string"`
	VisibilityState   uint32  `json:"communityvisibilitystate"`
	ProfileState      uint32  `json:"profilestate"`
	PersonaName       string  `json:"personaname"`
	PersonaState      uint32  `json:"personastate"`
	PersonaStateFlags uint32  `json:"personastateflags"`
	RealName          string  `json:"realname"`
	LastLogoff        int64   `json:"lastlogoff"`
	ProfileURL        string  `json:"profileurl"`
	AvatarURL         string  `json:"avatar"`
	AvatarMediumURL   string  `json:"avatarmedium"`
	AvatarFullURL     string  `json:"avatarfull"`
	PrimaryClanID     uint64  `json:"primaryclanid,string"`
	TimeCreated       int64   `json:"timecreated"`
	LocCountryCode    string  `json:"loccountrycode"`
	LocStateCode      string  `json:"locstatecode"`
	LocCityID         uint32  `json:"loccityid"`
	GameID            uint64  `json:"gameid,string"`
	GameServerIP      string  `json:"gameserverip"`
	GameExtraInfo     string  `json:"gameextrainfo"`
}

type ServerTimeTip

type ServerTimeTip struct {
	Time                              int64  `json:"server_time,string"`
	SkewToleranceSeconds              uint32 `json:"skew_tolerance_seconds,string"`
	LargeTimeJink                     uint32 `json:"large_time_jink,string"`
	ProbeFrequencySeconds             uint32 `json:"probe_frequency_seconds"`
	AdjustedTimeProbeFrequencySeconds uint32 `json:"adjusted_time_probe_frequency_seconds"`
	HintProbeFrequencySeconds         uint32 `json:"hint_probe_frequency_seconds"`
	SyncTimeout                       uint32 `json:"sync_timeout"`
	TryAgainSeconds                   uint32 `json:"try_again_seconds"`
	MaxAttempts                       uint32 `json:"max_attempts"`
}

func GetTimeTip

func GetTimeTip() (*ServerTimeTip, error)

type Session

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

func NewSession

func NewSession(client *http.Client, apiKey string) *Session

func NewSessionWithAPIKey

func NewSessionWithAPIKey(apiKey string) *Session

func (*Session) AcceptTradeOffer

func (session *Session) AcceptTradeOffer(id uint64) error

func (*Session) AddPhoneNumber

func (session *Session) AddPhoneNumber(number string) error

func (*Session) AnswerConfirmation

func (session *Session) AnswerConfirmation(confirmation *Confirmation, identitySecret, answer string, current int64) error

func (*Session) CancelBuyOrder

func (session *Session) CancelBuyOrder(orderid uint64) error

func (*Session) CancelTradeOffer

func (session *Session) CancelTradeOffer(id uint64) error

func (*Session) ChatFriendState

func (session *Session) ChatFriendState(sid SteamID) (*ChatFriendResponse, error)

func (*Session) ChatLog

func (session *Session) ChatLog(partner uint32) ([]*ChatLogMessage, error)

func (*Session) ChatLogin

func (session *Session) ChatLogin(uiMode string) error

func (*Session) ChatLogoff

func (session *Session) ChatLogoff() error

func (*Session) ChatPoll

func (session *Session) ChatPoll(timeoutSeconds string) (*ChatResponse, error)

func (*Session) ChatSendMessage

func (session *Session) ChatSendMessage(sid SteamID, message, messageType string) error

func (*Session) ConfirmRemovePhoneNumber

func (session *Session) ConfirmRemovePhoneNumber(mobileCode string) error

func (*Session) DeclineTradeOffer

func (session *Session) DeclineTradeOffer(id uint64) error

func (*Session) DisableTwoFactor

func (session *Session) DisableTwoFactor(revocationCode string) error

func (*Session) EnableTwoFactor

func (session *Session) EnableTwoFactor() (*TwoFactorInfo, error)

func (*Session) FinalizeTwoFactor

func (session *Session) FinalizeTwoFactor(authCode, mobileCode string) (*FinalizeTwoFactorInfo, error)

func (*Session) GetConfirmations

func (session *Session) GetConfirmations(identitySecret string, current int64) ([]*Confirmation, error)

func (*Session) GetEscrowGuardInfo

func (session *Session) GetEscrowGuardInfo(sid SteamID, token string) (*EscrowSteamGuardInfo, error)

func (*Session) GetFilterableInventory

func (session *Session) GetFilterableInventory(sid SteamID, appID, contextID uint64, filters []Filter) ([]InventoryItem, error)

func (*Session) GetFriends

func (session *Session) GetFriends(sid SteamID) ([]*Friend, error)

func (*Session) GetInventory

func (session *Session) GetInventory(sid SteamID, appID, contextID uint64, tradableOnly bool) ([]InventoryItem, error)

func (*Session) GetInventoryAppStats

func (session *Session) GetInventoryAppStats(sid SteamID) (map[string]InventoryAppStats, error)

func (*Session) GetMarketItemPriceHistory

func (session *Session) GetMarketItemPriceHistory(appID uint64, marketHashName string) ([]*MarketItemPrice, error)

func (*Session) GetMarketItemPriceOverview

func (session *Session) GetMarketItemPriceOverview(appID uint64, country, currencyID, marketHashName string) (*MarketItemPriceOverview, error)

func (*Session) GetMyTradeToken

func (session *Session) GetMyTradeToken() (string, error)

func (*Session) GetOwnedGames

func (session *Session) GetOwnedGames(sid SteamID, freeGames bool, appInfo bool) (*OwnedGamesResponse, error)

func (*Session) GetPlayerBans

func (session *Session) GetPlayerBans(steamids string) ([]*PlayerBan, error)

func (*Session) GetPlayerSummaries

func (session *Session) GetPlayerSummaries(steamids string) ([]*PlayerSummary, error)

func (*Session) GetProfileURL

func (session *Session) GetProfileURL() (string, error)

func (*Session) GetRequiredSteamAppVersion

func (session *Session) GetRequiredSteamAppVersion(appID int) (int, error)

func (*Session) GetSteamID

func (session *Session) GetSteamID() SteamID

func (*Session) GetTradeOffer

func (session *Session) GetTradeOffer(id uint64) (*TradeOffer, error)

func (*Session) GetTradeOffers

func (session *Session) GetTradeOffers(filter uint32, timeCutOff time.Time) (*TradeOfferResponse, error)

func (*Session) GetTradeReceivedItems

func (session *Session) GetTradeReceivedItems(receiptID uint64) ([]*InventoryItem, error)

func (*Session) GetWebAPIKey

func (session *Session) GetWebAPIKey() (string, error)

func (*Session) InitiateRemovePhoneNumber

func (session *Session) InitiateRemovePhoneNumber() error

func (*Session) Login

func (session *Session) Login(accountName, password, sharedSecret string, timeOffset time.Duration) error

Login requests log in information first, then generates two factor code, and proceeds to do the actual login, this provides a better chance that the code generated will work because of the slowness of the API.

func (*Session) LoginTwoFactorCode

func (session *Session) LoginTwoFactorCode(accountName, password, twoFactorCode string) error

LoginTwoFactorCode logs in with the @twoFactorCode provided, note that in the case of having shared secret known, then it's better to use Login() because it's more accurate. Note: You can provide an empty two factor code if two factor authentication is not enabled on the account provided.

func (*Session) PlaceBuyOrder

func (session *Session) PlaceBuyOrder(appid uint64, priceTotal float64, quantity uint64, currencyID, marketHashName string) (*MarketBuyOrderResponse, error)

func (*Session) PrepareForSteamStore

func (session *Session) PrepareForSteamStore()

func (*Session) ReSendVerificationCode

func (session *Session) ReSendVerificationCode() error

func (*Session) RegisterWebAPIKey

func (session *Session) RegisterWebAPIKey(domain string) (string, error)

func (*Session) ResolveVanityURL

func (session *Session) ResolveVanityURL(vanityURL string) (uint64, error)

func (*Session) RevokeWebAPIKey

func (session *Session) RevokeWebAPIKey() error

func (*Session) SellItem

func (session *Session) SellItem(item *InventoryItem, amount, price uint64) (*MarketSellResponse, error)

func (*Session) SendTradeOffer

func (session *Session) SendTradeOffer(offer *TradeOffer, sid SteamID, token string) error

func (*Session) SetLanguage

func (session *Session) SetLanguage(lang string)

func (*Session) SetProfileInfo

func (session *Session) SetProfileInfo(profileURL string, values *map[string][]string) error

func (*Session) SetProfilePrivacy

func (session *Session) SetProfilePrivacy(profileURL string, commentPrivacy string, privacy uint8) error

func (*Session) SetupProfile

func (session *Session) SetupProfile(profileURL string) error

func (*Session) ValidatePhoneNumber

func (session *Session) ValidatePhoneNumber(number string) error

func (*Session) VerifyPhoneNumber

func (session *Session) VerifyPhoneNumber(code string) error

type SteamID

type SteamID uint64

* Full Steam 64-bit ID * Upper 32 bits Lower 32 bits * Upper 16 bits Lower 16 bits * Universe Type Acc Instance Account ID * |||| |||| xxxx |||| xxxx xx|| |||| |||| |||| |||| |||| |||| |||| |||| |||| ||||

func (*SteamID) GetAccountID

func (sid *SteamID) GetAccountID() uint32

func (*SteamID) GetAccountInstance

func (sid *SteamID) GetAccountInstance() uint32

func (*SteamID) GetAccountType

func (sid *SteamID) GetAccountType() uint32

func (*SteamID) GetAccountUniverse

func (sid *SteamID) GetAccountUniverse() uint32

func (*SteamID) Parse

func (sid *SteamID) Parse(accid uint32, instance uint32, accountType uint32, universe uint8)

func (*SteamID) ParseDefaults

func (sid *SteamID) ParseDefaults(accid uint32)

func (*SteamID) ParseSteam2ID

func (sid *SteamID) ParseSteam2ID(input string) error

func (*SteamID) ParseSteam3ID

func (sid *SteamID) ParseSteam3ID(input string) error

func (*SteamID) ToSteam2ID

func (sid *SteamID) ToSteam2ID() string

func (*SteamID) ToSteam3ID

func (sid *SteamID) ToSteam3ID() string

func (*SteamID) ToString

func (sid *SteamID) ToString() string

type TradeOffer

type TradeOffer struct {
	ID                 uint64      `json:"tradeofferid,string"`
	Partner            uint32      `json:"accountid_other"`
	ReceiptID          uint64      `json:"tradeid,string"`
	RecvItems          []*EconItem `json:"items_to_receive"`
	SendItems          []*EconItem `json:"items_to_give"`
	Message            string      `json:"message"`
	State              uint8       `json:"trade_offer_state"`
	ConfirmationMethod uint8       `json:"confirmation_method"`
	Created            int64       `json:"time_created"`
	Updated            int64       `json:"time_updated"`
	Expires            int64       `json:"expiration_time"`
	EscrowEndDate      int64       `json:"escrow_end_date"`
	RealTime           bool        `json:"from_real_time_trade"`
	IsOurOffer         bool        `json:"is_our_offer"`
}

func (*TradeOffer) Accept

func (offer *TradeOffer) Accept(session *Session) error

func (*TradeOffer) Cancel

func (offer *TradeOffer) Cancel(session *Session) error

func (*TradeOffer) Send

func (offer *TradeOffer) Send(session *Session, sid SteamID, token string) error

type TradeOfferResponse

type TradeOfferResponse struct {
	Offer          *TradeOffer     `json:"offer"`                 // GetTradeOffer
	SentOffers     []*TradeOffer   `json:"trade_offers_sent"`     // GetTradeOffers
	ReceivedOffers []*TradeOffer   `json:"trade_offers_received"` // GetTradeOffers
	Descriptions   []*EconItemDesc `json:"descriptions"`          // GetTradeOffers
}

type TwoFactorInfo

type TwoFactorInfo struct {
	Status         uint32 `json:"status"`
	SharedSecret   string `json:"shared_secret"`
	IdentitySecret string `json:"identity_secret"`
	Secret1        string `json:"secret_1"`
	SerialNumber   uint64 `json:"serial_number,string"`
	RevocationCode string `json:"revocation_code"`
	URI            string `json:"uri"`
	ServerTime     uint64 `json:"server_time,string"`
	TokenGID       string `json:"token_gid"`
}

Directories

Path Synopsis
examples
all

Jump to

Keyboard shortcuts

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