diff --git a/item.go b/item.go index 0c1edef..9b8915d 100644 --- a/item.go +++ b/item.go @@ -23,6 +23,22 @@ type Item struct { Owned bool } +// HasItem will return if you own the item +func (s *Session) HasItem(id int) (bool, error) { + resp, err := s.client.Get(fmt.Sprintf("http://api.roblox.com/Ownership/HasAsset?userId=%d&assetId=%d", s.ID, id)) + if err != nil { + return false, err + } + defer resp.Body.Close() + + data, err := ioutil.ReadAll(resp.Body) + if err != nil { + return false, err + } + + return string(data) == "true", nil +} + // AddItem add item by id to inventory func (s *Session) AddItem(id int, seller int) error { v := url.Values{}