inventory

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2016 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Includes inventory types as used in the trade package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Name string
	Link string
}

type AppInfo

type AppInfo struct {
	AppId uint32
	Name  string
	Icon  string
	Link  string
}

type Context

type Context struct {
	ContextId  uint64 `json:"id,string"`
	AssetCount uint32 `json:"asset_count"`
	Name       string
}

type Contexts

type Contexts map[string]*Context

func (*Contexts) Get

func (c *Contexts) Get(contextId uint64) (*Context, error)

func (*Contexts) ToMap

func (c *Contexts) ToMap() map[string]*Context

type Currencies

type Currencies map[string]*Currency

func (*Currencies) ToMap

func (c *Currencies) ToMap() map[string]*Currency

func (*Currencies) UnmarshalJSON

func (c *Currencies) UnmarshalJSON(data []byte) error

type Currency

type Currency struct {
	Id         uint64 `json:",string"`
	ClassId    uint64 `json:",string"`
	IsCurrency bool   `json:"is_currency"`
	Pos        uint32
}

type Description

type Description struct {
	AppId      uint32 `json:",string"`
	ClassId    uint64 `json:",string"`
	InstanceId uint64 `json:",string"`

	IconUrl      string `json:"icon_url"`
	IconUrlLarge string `json:"icon_url_large"`
	IconDragUrl  string `json:"icon_drag_url"`

	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                  jsont.UintBool
	Marketable                jsont.UintBool
	Commodity                 jsont.UintBool
	MarketTradableRestriction uint32 `json:"market_tradable_restriction,string"`

	Descriptions DescriptionLines
	Actions      []*Action
	// Application-specific data, like "def_index" and "quality" for TF2
	AppData map[string]string
	Tags    []*Tag
}

type DescriptionLine

type DescriptionLine struct {
	Value string
	Type  *string // Is `html` for HTML descriptions
	Color *string
}

type DescriptionLines

type DescriptionLines []*DescriptionLine

func (*DescriptionLines) UnmarshalJSON

func (d *DescriptionLines) UnmarshalJSON(data []byte) error

type Descriptions

type Descriptions map[string]*Description

Descriptions key format is %d_%d, first %d is ClassId, second is InstanceId

func (*Descriptions) Get

func (d *Descriptions) Get(classId uint64, instanceId uint64) (*Description, error)

func (*Descriptions) ToMap

func (d *Descriptions) ToMap() map[string]*Description

func (*Descriptions) UnmarshalJSON

func (d *Descriptions) UnmarshalJSON(data []byte) error

type GenericInventory

type GenericInventory map[uint32]map[uint64]*Inventory

func NewGenericInventory

func NewGenericInventory() GenericInventory

func (*GenericInventory) Add

func (i *GenericInventory) Add(appId uint32, contextId uint64, inv *Inventory)

func (*GenericInventory) Get

func (i *GenericInventory) Get(appId uint32, contextId uint64) (*Inventory, error)

Get inventory for specified AppId and ContextId

type Inventory

type Inventory struct {
	Items        Items        `json:"rgInventory"`
	Currencies   Currencies   `json:"rgCurrency"`
	Descriptions Descriptions `json:"rgDescriptions"`
	AppInfo      *AppInfo     `json:"rgAppInfo"`
}

func GetFullInventory

func GetFullInventory(getFirst func() (*PartialInventory, error), getNext func(start uint) (*PartialInventory, error)) (*Inventory, error)

func GetOwnInventory

func GetOwnInventory(client *http.Client, contextId uint64, appId uint32) (*Inventory, error)

func Merge

func Merge(p ...*Inventory) *Inventory

Merges the given Inventory into a single Inventory. The given slice must have at least one element. The first element of the slice is used and modified.

type InventoryApp

type InventoryApp struct {
	AppId            uint32
	Name             string
	Icon             string
	Link             string
	AssetCount       uint32   `json:"asset_count"`
	TradePermissions string   `json:"trade_permissions"`
	Contexts         Contexts `json:"rgContexts"`
}

type InventoryApps

type InventoryApps map[string]*InventoryApp

func GetInventoryApps

func GetInventoryApps(client *http.Client, steamId steamid.SteamId) (InventoryApps, error)

func (*InventoryApps) Get

func (i *InventoryApps) Get(appId uint32) (*InventoryApp, error)

func (*InventoryApps) ToMap

func (i *InventoryApps) ToMap() map[string]*InventoryApp

type Item

type Item struct {
	Id         uint64 `json:",string"`
	ClassId    uint64 `json:",string"`
	InstanceId uint64 `json:",string"`
	Amount     uint64 `json:",string"`
	Pos        uint32
}

type Items

type Items map[string]*Item

Items key is an AssetId

func (*Items) Get

func (i *Items) Get(assetId uint64) (*Item, error)

func (*Items) ToMap

func (i *Items) ToMap() map[string]*Item

func (*Items) UnmarshalJSON

func (i *Items) UnmarshalJSON(data []byte) error

type MoreStart

type MoreStart uint

func (*MoreStart) UnmarshalJSON

func (m *MoreStart) UnmarshalJSON(data []byte) error

type PartialInventory

type PartialInventory struct {
	Success bool
	Error   string
	Inventory
	More      bool
	MoreStart MoreStart `json:"more_start"`
}

A partial inventory as sent by the Steam API.

func DoInventoryRequest

func DoInventoryRequest(client *http.Client, req *http.Request) (*PartialInventory, error)

func GetPartialOwnInventory

func GetPartialOwnInventory(client *http.Client, contextId uint64, appId uint32, start *uint) (*PartialInventory, error)

type Tag

type Tag struct {
	InternalName string `json:internal_name`
	Name         string
	Category     string
	CategoryName string `json:category_name`
}

Jump to

Keyboard shortcuts

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