diff --git a/wowgd.go b/wowgd.go index 05aa5c3..aa69abd 100644 --- a/wowgd.go +++ b/wowgd.go @@ -70,6 +70,18 @@ func (c *Client) WoWAuctions(ctx context.Context, connectedRealmID int) (*wowgd. return dat.(*wowgd.AuctionHouse), header, err } +// WoWAuctionCommodities returns all active auctions for commodity items for the entire game region. +// Auction house data updates at a set interval. The value was initially set at 1 hour; however, it might change over time without notice. +// Depending on the number of active auctions on the specified connected realm, the response from this endpoint may be rather large, sometimes exceeding 10 MB. +func (c *Client) WoWAuctionCommodities(ctx context.Context) (*wowgd.AuctionHouseCommodities, *Header, error) { + dat, header, err := c.getStructData(ctx, + "/data/wow/auctions/commodities", + c.GetDynamicNamespace(), + &wowgd.AuctionHouseCommodities{}, + ) + return dat.(*wowgd.AuctionHouseCommodities), header, err +} + // WoWAzeriteEssenceIndex returns an index of azerite essences. func (c *Client) WoWAzeriteEssenceIndex(ctx context.Context) (*wowgd.AzeriteEssenceIndex, *Header, error) { dat, header, err := c.getStructData(ctx, @@ -436,7 +448,7 @@ func (c *Client) WoWItemAppearanceSlotIndex(ctx context.Context) (*wowgd.ItemApp // WoWItemAppearanceSlot returns an item appearance slot by slot type. func (c *Client) WoWItemAppearanceSlot(ctx context.Context, itemAppearanceSlot string) (*wowgd.ItemAppearanceSlot, *Header, error) { dat, header, err := c.getStructData(ctx, - fmt.Sprintf("/data/wow/item-appearance/slot/%d", itemAppearanceSlot), + fmt.Sprintf("/data/wow/item-appearance/slot/%s", itemAppearanceSlot), c.GetStaticNamespace(), &wowgd.ItemAppearanceSlot{}, ) diff --git a/wowgd/auctionHouseCommodities.go b/wowgd/auctionHouseCommodities.go new file mode 100644 index 0000000..d764faa --- /dev/null +++ b/wowgd/auctionHouseCommodities.go @@ -0,0 +1,19 @@ +package wowgd + +// AuctionHouseCommodities structure +type AuctionHouseCommodities struct { + Links struct { + Self struct { + Href string `json:"href"` + } `json:"self"` + } `json:"_links"` + Auctions []struct { + ID int `json:"id"` + Item struct { + ID int `json:"id"` + } `json:"item"` + Quantity int `json:"quantity"` + UnitPrice int `json:"unit_price"` + TimeLeft TimeLeft `json:"time_left"` + } `json:"auctions"` +} diff --git a/wowgd_test.go b/wowgd_test.go index 7536650..f5f1cb9 100644 --- a/wowgd_test.go +++ b/wowgd_test.go @@ -81,6 +81,18 @@ func TestWoWAuctions(t *testing.T) { } } +func TestWoWAuctionCommodities(t *testing.T) { + dat, _, err := usClient.WoWAuctionCommodities(context.Background()) + if err != nil { + fmt.Println(err) + t.Fail() + } + + if printOutput != "" { + fmt.Printf("%+v\n", dat) + } +} + func TestWoWAzeriteEssenceIndex(t *testing.T) { dat, _, err := usClient.WoWAzeriteEssenceIndex(context.Background()) if err != nil {