mirror of
https://github.com/cwinfo/matterbridge.git
synced 2025-06-27 13:29:25 +00:00
Add vendor (steam)
This commit is contained in:
28
vendor/github.com/Philipp15b/go-steam/economy/inventory/own.go
generated
vendored
Normal file
28
vendor/github.com/Philipp15b/go-steam/economy/inventory/own.go
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
package inventory
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func GetPartialOwnInventory(client *http.Client, contextId uint64, appId uint32, start *uint) (*PartialInventory, error) {
|
||||
// TODO: the "trading" parameter can be left off to return non-tradable items too
|
||||
url := fmt.Sprintf("http://steamcommunity.com/my/inventory/json/%d/%d?trading=1", appId, contextId)
|
||||
if start != nil {
|
||||
url += "&start=" + strconv.FormatUint(uint64(*start), 10)
|
||||
}
|
||||
req, err := http.NewRequest("GET", url, nil)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return DoInventoryRequest(client, req)
|
||||
}
|
||||
|
||||
func GetOwnInventory(client *http.Client, contextId uint64, appId uint32) (*Inventory, error) {
|
||||
return GetFullInventory(func() (*PartialInventory, error) {
|
||||
return GetPartialOwnInventory(client, contextId, appId, nil)
|
||||
}, func(start uint) (*PartialInventory, error) {
|
||||
return GetPartialOwnInventory(client, contextId, appId, &start)
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user