Documentation ¶
Overview ¶
Implements methods to interact with the official Trade Offer API.
See: https://developer.valvesoftware.com/wiki/Steam_Web_API/IEconService
Index ¶
- type APIKey
- type Asset
- type Client
- func (c *Client) Accept(offerID uint64) error
- func (c *Client) AcceptWithRetry(offerID uint64, retryCount int, retryDelay time.Duration) error
- func (c *Client) Cancel(offerID uint64) error
- func (c *Client) CancelWithRetry(offerID uint64, retryCount int, retryDelay time.Duration) error
- func (c *Client) Create(other steamid.SteamID, accessToken string, myItems, theirItems []TradeItem, ...) (uint64, error)
- func (c *Client) CreateWithRetry(other steamid.SteamID, accessToken string, myItems, theirItems []TradeItem, ...) (uint64, error)
- func (c *Client) Decline(offerID uint64) error
- func (c *Client) DeclineWithRetry(offerID uint64, retryCount int, retryDelay time.Duration) error
- func (c *Client) GetOffer(offerID uint64) (*Result, error)
- func (c *Client) GetOfferEscrowDuration(offerID uint64) (*EscrowDuration, error)
- func (c *Client) GetOfferWithRetry(offerID uint64, retryCount int, retryDelay time.Duration) (*Result, error)
- func (c *Client) GetOffers(getSent bool, getReceived bool, getDescriptions bool, activeOnly bool, ...) (*MultiResult, error)
- func (c *Client) GetOffersWithRetry(getSent bool, getReceived bool, getDescriptions bool, activeOnly bool, ...) (*MultiResult, error)
- func (c *Client) GetOwnInventory(contextID uint64, appID uint32) (*inventory.Inventory, error)
- func (c *Client) GetOwnInventoryWithRetry(contextID uint64, appID uint32, retryCount int, retryDelay time.Duration) (*inventory.Inventory, error)
- func (c *Client) GetPartnerEscrowDuration(other steamid.SteamID, accessToken string) (*EscrowDuration, error)
- func (c *Client) GetPartnerInventory(other steamid.SteamID, contextID uint64, appID uint32, offerID uint64) (*inventory.Inventory, error)
- func (c *Client) GetPartnerInventoryWithRetry(other steamid.SteamID, contextID uint64, appID uint32, offerID uint64, ...) (*inventory.Inventory, error)
- func (c *Client) GetTradeReceipt(tradeID uint64) ([]*ReceiptItem, error)
- func (c *Client) GetTradeReceiptWithRetry(tradeID uint64, retryCount int, retryDelay time.Duration) ([]*ReceiptItem, error)
- type ConfirmationMethod
- type Description
- type EscrowDuration
- type MultiResult
- type Offer
- type ReceiptItem
- type Result
- type State
- type SteamError
- type TradeItem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Accept ¶
Accept accepts received trade offer.
It is best to confirm that offer was actually accepted by calling GetOffer after Accept and checking offer state.
func (*Client) AcceptWithRetry ¶
func (*Client) CancelWithRetry ¶
func (*Client) Create ¶
func (c *Client) Create( other steamid.SteamID, accessToken string, myItems, theirItems []TradeItem, counteredOfferID uint64, message string, ) (uint64, error)
Create sends a new trade offer to the given Steam user.
You can optionally specify an access token if you've got one. In addition, `counteredOfferID` can be non-nil, indicating the trade offer this is a counter for.
On success returns trade offer id.
func (*Client) CreateWithRetry ¶
func (*Client) DeclineWithRetry ¶
func (*Client) GetOfferEscrowDuration ¶
func (c *Client) GetOfferEscrowDuration(offerID uint64) (*EscrowDuration, error)
Get duration of escrow in days. Call this after receiving a trade offer
func (*Client) GetOfferWithRetry ¶
func (*Client) GetOffersWithRetry ¶
func (*Client) GetOwnInventory ¶
func (*Client) GetOwnInventoryWithRetry ¶
func (*Client) GetPartnerEscrowDuration ¶
func (c *Client) GetPartnerEscrowDuration(other steamid.SteamID, accessToken string) (*EscrowDuration, error)
Get duration of escrow in days. Call this before sending a trade offer
func (*Client) GetPartnerInventory ¶
func (*Client) GetPartnerInventoryWithRetry ¶
func (*Client) GetTradeReceipt ¶
func (c *Client) GetTradeReceipt(tradeID uint64) ([]*ReceiptItem, error)
Can be used to verify accepted tradeoffer and find out received asset ids
func (*Client) GetTradeReceiptWithRetry ¶
type ConfirmationMethod ¶
type ConfirmationMethod uint
const ( ConfirmationMethodInvalid ConfirmationMethod = iota ConfirmationMethodEmail ConfirmationMethodMobileApp )
type Description ¶
type Description struct { AppID uint32 `json:"appid"` ClassID uint64 `json:"classid,string"` InstanceID uint64 `json:"instanceid,string"` IconURL string `json:"icon_url"` IconLargeURL string `json:"icon_url_large"` Name string MarketName string `json:"market_name"` MarketHashName string `json:"market_hash_name"` // Colors in hex, for example `B2B2B2` NameColor string `json:"name_color"` BackgroundColor string `json:"background_color"` Type string Tradable bool `json:"tradable"` Commodity bool `json:"commodity"` MarketTradableRestriction uint32 `json:"market_tradable_restriction"` Descriptions inventory.DescriptionLines `json:"descriptions"` Actions []*inventory.Action `json:"actions"` }
type EscrowDuration ¶
type MultiResult ¶
type MultiResult struct { Sent []*Offer `json:"trade_offers_sent"` Received []*Offer `json:"trade_offers_received"` Descriptions []*Description }
type Offer ¶
type Offer struct { TradeOfferID uint64 `json:",string"` TradeID uint64 `json:",string"` OtherAccountID uint32 `json:"accountid_other"` OtherSteamID steamid.SteamID `json:"-"` Message string `json:"message"` ExpirationTime uint32 `json:"expiraton_time"` State State `json:"trade_offer_state"` ToGive []*Asset `json:"items_to_give"` ToReceive []*Asset `json:"items_to_receive"` IsOurOffer bool `json:"is_our_offer"` TimeCreated uint32 `json:"time_created"` TimeUpdated uint32 `json:"time_updated"` EscrowEndDate uint32 `json:"escrow_end_date"` ConfirmationMethod ConfirmationMethod `json:"confirmation_method"` }
func (*Offer) UnmarshalJSON ¶
type ReceiptItem ¶
type Result ¶
type Result struct { Offer *Offer Descriptions []*Description }
type State ¶
type State uint
const ( // Invalid StateInvalid State = iota + 1 // This trade offer has been sent, neither party has acted on it yet. StateActive // The trade offer was accepted by the recipient and items were exchanged. StateAccepted // The recipient made a counter offer StateCountered // The trade offer was not accepted before the expiration date StateExpired // The sender canceled the offer StateCanceled // The recipient declined the offer StateDeclined // Some of the items in the offer are no longer available (indicated by the missing flag in the // output) StateInvalidItems // The offer hasn't been sent yet and is awaiting email/mobile confirmation. The offer is only // visible to the sender. StateCreatedNeedsConfirmation // 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. StateCanceledBySecondFactor // 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. StateInEscrow )
type SteamError ¶
type SteamError struct {
// contains filtered or unexported fields
}
SteamError can be returned by Create, Accept, Decline and Cancel methods. It means we got response from steam, but it was in unknown format or request was declined.
func (*SteamError) Error ¶
func (e *SteamError) Error() string