diff --git a/wowgd.go b/wowgd.go index 2f73b8d..05aa5c3 100644 --- a/wowgd.go +++ b/wowgd.go @@ -381,6 +381,68 @@ func (c *Client) WoWItemMedia(ctx context.Context, itemID int) (*wowgd.ItemMedia return dat.(*wowgd.ItemMedia), header, err } +// WoWItemAppearance returns an item appearance by ID. +func (c *Client) WoWItemAppearance(ctx context.Context, appearanceID int) (*wowgd.ItemAppearance, *Header, error) { + dat, header, err := c.getStructData(ctx, + fmt.Sprintf("/data/wow/item-appearance/%d", appearanceID), + c.GetStaticNamespace(), + &wowgd.ItemAppearance{}, + ) + return dat.(*wowgd.ItemAppearance), header, err +} + +// WoWItemAppearanceSearch item appearance search data. +func (c *Client) WoWItemAppearanceSearch(ctx context.Context, opts ...wowsearch.Opt) (*wowgd.ItemAppearanceSearch, *Header, error) { + dat, header, err := c.getStructData( + ctx, + fmt.Sprintf("/data/wow/search/item-appearance%s", buildSearchParams(opts...)), + c.GetStaticNamespace(), + &wowgd.ItemAppearanceSearch{}, + ) + + return dat.(*wowgd.ItemAppearanceSearch), header, err +} + +// WoWItemAppearanceSetsIndex returns an index of item appearance sets. +func (c *Client) WoWItemAppearanceSetsIndex(ctx context.Context) (*wowgd.ItemAppearanceSetsIndex, *Header, error) { + dat, header, err := c.getStructData(ctx, + "/data/wow/item-appearance/set/index", + c.GetStaticNamespace(), + &wowgd.ItemAppearanceSetsIndex{}, + ) + return dat.(*wowgd.ItemAppearanceSetsIndex), header, err +} + +// WoWItemAppearanceSet returns an item appearance set by ID. +func (c *Client) WoWItemAppearanceSet(ctx context.Context, itemAppearanceSetID int) (*wowgd.ItemAppearanceSet, *Header, error) { + dat, header, err := c.getStructData(ctx, + fmt.Sprintf("/data/wow/item-appearance/set/%d", itemAppearanceSetID), + c.GetStaticNamespace(), + &wowgd.ItemAppearanceSet{}, + ) + return dat.(*wowgd.ItemAppearanceSet), header, err +} + +// WoWItemAppearanceSlotIndex returns an index of item appearance slot. +func (c *Client) WoWItemAppearanceSlotIndex(ctx context.Context) (*wowgd.ItemAppearanceSlotIndex, *Header, error) { + dat, header, err := c.getStructData(ctx, + "/data/wow/item-appearance/slot/index", + c.GetStaticNamespace(), + &wowgd.ItemAppearanceSlotIndex{}, + ) + return dat.(*wowgd.ItemAppearanceSlotIndex), header, err +} + +// 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), + c.GetStaticNamespace(), + &wowgd.ItemAppearanceSlot{}, + ) + return dat.(*wowgd.ItemAppearanceSlot), header, err +} + // WoWJournalExpansionsIndex returns an index of journal expansions. func (c *Client) WoWJournalExpansionsIndex(ctx context.Context) (*wowgd.JournalExpansionsIndex, *Header, error) { dat, header, err := c.getStructData(ctx, diff --git a/wowgd/item.go b/wowgd/item.go index 3c0349e..e310a5d 100644 --- a/wowgd/item.go +++ b/wowgd/item.go @@ -130,6 +130,63 @@ type Item struct { MaxCount int `json:"max_count"` IsEquippable bool `json:"is_equippable"` IsStackable bool `json:"is_stackable"` + PreviewItem struct { + Item struct { + Key struct { + Href string `json:"href"` + } `json:"key"` + ID int `json:"id"` + } `json:"item"` + Quality struct { + Type string `json:"type"` + Name string `json:"name"` + } `json:"quality"` + Name string `json:"name"` + Media struct { + Key struct { + Href string `json:"href"` + } `json:"key"` + ID int `json:"id"` + } `json:"media"` + ItemClass struct { + Key struct { + Href string `json:"href"` + } `json:"key"` + Name string `json:"name"` + ID int `json:"id"` + } `json:"item_class"` + ItemSubclass struct { + Key struct { + Href string `json:"href"` + } `json:"key"` + Name string `json:"name"` + ID int `json:"id"` + } `json:"item_subclass"` + InventoryType struct { + Type string `json:"type"` + Name string `json:"name"` + } `json:"inventory_type"` + Binding struct { + Type string `json:"type"` + Name string `json:"name"` + } `json:"binding"` + UniqueEquipped string `json:"unique_equipped"` + Spells []struct { + Spell struct { + Key struct { + Href string `json:"href"` + } `json:"key"` + Name string `json:"name"` + ID int `json:"id"` + } `json:"spell"` + Description string `json:"description"` + } `json:"spells"` + IsSubclassHidden bool `json:"is_subclass_hidden"` + NameDescription *struct { + DisplayString string `json:"display_string"` + } `json:"name_description"` + } `json:"preview_item"` + PurchaseQuantity int `json:"purchase_quantity"` } // ItemMedia structure @@ -249,3 +306,136 @@ type ItemSearch struct { } `json:"data"` } `json:"results"` } + +type ItemAppearance struct { + Links struct { + Self struct { + Href string `json:"href"` + } `json:"self"` + } `json:"_links"` + ID int `json:"id"` + Slot struct { + Type string `json:"type"` + Name string `json:"name"` + } `json:"slot"` + ItemClass struct { + Key struct { + Href string `json:"href"` + } `json:"key"` + Name string `json:"name"` + ID int `json:"id"` + } `json:"item_class"` + ItemSubclass struct { + Key struct { + Href string `json:"href"` + } `json:"key"` + Name string `json:"name"` + ID int `json:"id"` + } `json:"item_subclass"` + ItemDisplayInfoID int `json:"item_display_info_id"` + Items []struct { + Key struct { + Href string `json:"href"` + } `json:"key"` + Name string `json:"name"` + ID int `json:"id"` + } `json:"items"` + Media struct { + Key struct { + Href string `json:"href"` + } `json:"key"` + ID int `json:"id"` + } `json:"media"` +} + +type ItemAppearanceSearch struct { + Page int `json:"page"` + PageSize int `json:"pageSize"` + MaxPageSize int `json:"maxPageSize"` + PageCount int `json:"pageCount"` + ResultCountCapped bool `json:"resultCountCapped"` + Results []struct { + Key struct { + Href string `json:"href"` + } `json:"key"` + Data struct { + ItemDisplayInfoID int `json:"item_display_info_id"` + ID int `json:"id"` + Slot struct { + Name struct { + ItIT string `json:"it_IT"` + RuRU string `json:"ru_RU"` + EnGB string `json:"en_GB"` + ZhTW string `json:"zh_TW"` + KoKR string `json:"ko_KR"` + EnUS string `json:"en_US"` + EsMX string `json:"es_MX"` + PtBR string `json:"pt_BR"` + EsES string `json:"es_ES"` + ZhCN string `json:"zh_CN"` + FrFR string `json:"fr_FR"` + DeDE string `json:"de_DE"` + } `json:"name"` + Type string `json:"type"` + } `json:"slot"` + } `json:"data"` + } `json:"results"` +} + +type ItemAppearanceSetsIndex struct { + Links struct { + Self struct { + Href string `json:"href"` + } `json:"self"` + } `json:"_links"` + AppearanceSets []struct { + Key struct { + Href string `json:"href"` + } `json:"key"` + Name string `json:"name"` + ID int `json:"id"` + } `json:"appearance_sets"` +} + +type ItemAppearanceSet struct { + Links struct { + Self struct { + Href string `json:"href"` + } `json:"self"` + } `json:"_links"` + ID int `json:"id"` + SetName string `json:"set_name"` + Appearances []struct { + Key struct { + Href string `json:"href"` + } `json:"key"` + ID int `json:"id"` + } `json:"appearances"` +} + +type ItemAppearanceSlotIndex struct { + Links struct { + Self struct { + Href string `json:"href"` + } `json:"self"` + } `json:"_links"` + Slots []struct { + Key struct { + Href string `json:"href"` + } `json:"key"` + } `json:"slots"` +} + +type ItemAppearanceSlot struct { + Links struct { + Self struct { + Href string `json:"href"` + } `json:"self"` + } `json:"_links"` + Appearances []struct { + Key struct { + Href string `json:"href"` + } `json:"key"` + ID int `json:"id"` + } `json:"appearances"` +} diff --git a/wowgd_test.go b/wowgd_test.go index c3f9362..7536650 100644 --- a/wowgd_test.go +++ b/wowgd_test.go @@ -461,6 +461,83 @@ func TestWoWJournalExpansionsIndex(t *testing.T) { } } +func TestWoWItemAppearance(t *testing.T) { + dat, _, err := usClient.WoWItemAppearance(context.Background(), 321) + if err != nil { + fmt.Println(err) + t.Fail() + } + + if printOutput != "" { + fmt.Printf("%+v\n", dat) + } +} + +func TestWoWItemAppearanceSearch(t *testing.T) { + dat, _, err := usClient.WoWItemAppearanceSearch(context.Background(), + wowsearch.Page(1), + wowsearch.PageSize(5), + wowsearch.Field(). + AND("slot.type", "HEAD")) + + if err != nil { + fmt.Println(err) + t.Fail() + } + + if printOutput != "" { + fmt.Printf("%+v\n", dat) + } +} + +func TestWoWItemAppearanceSetsIndex(t *testing.T) { + dat, _, err := usClient.WoWItemAppearanceSetsIndex(context.Background()) + if err != nil { + fmt.Println(err) + t.Fail() + } + + if printOutput != "" { + fmt.Printf("%+v\n", dat) + } +} + +func TestWoWItemAppearanceSet(t *testing.T) { + dat, _, err := usClient.WoWItemAppearanceSet(context.Background(), 13) + if err != nil { + fmt.Println(err) + t.Fail() + } + + if printOutput != "" { + fmt.Printf("%+v\n", dat) + } +} + +func TestWoWItemAppearanceSlotIndex(t *testing.T) { + dat, _, err := usClient.WoWItemAppearanceSlotIndex(context.Background()) + if err != nil { + fmt.Println(err) + t.Fail() + } + + if printOutput != "" { + fmt.Printf("%+v\n", dat) + } +} + +func TestWoWItemAppearanceSlot(t *testing.T) { + dat, _, err := usClient.WoWItemAppearanceSlot(context.Background(), "HEAD") + if err != nil { + fmt.Println(err) + t.Fail() + } + + if printOutput != "" { + fmt.Printf("%+v\n", dat) + } +} + func TestWoWJournalExpansion(t *testing.T) { dat, _, err := usClient.WoWJournalExpansion(context.Background(), 396) if err != nil { diff --git a/wowp/characterCollections.go b/wowp/characterCollections.go index b858edb..e970dd5 100644 --- a/wowp/characterCollections.go +++ b/wowp/characterCollections.go @@ -119,7 +119,7 @@ type CharacterTransmogsCollectionSummary struct { Key struct { Href string `json:"href"` } `json:"key"` - Id string `json:"id"` + Id int `json:"id"` Name string `json:"name"` } `json:"appearance_sets"` Links struct { @@ -127,16 +127,19 @@ type CharacterTransmogsCollectionSummary struct { Href string `json:"href"` } `json:"self"` } `json:"_links"` - Slots []struct { - Slot struct { - Name string `json:"name"` - Type string `json:"type"` - } `json:"slot"` - Appearances []struct { - Key struct { - Href string `json:"href"` - } `json:"key"` - ID int `json:"id"` - } `json:"appearances"` - } `json:"slots"` + Slots []CharacterTransmogsCollectionSummarySlots `json:"slots"` +} + +type CharacterTransmogsCollectionSummarySlots struct { + Slot struct { + Name string `json:"name"` + Type string `json:"type"` + } `json:"slot"` + Appearances []struct { + Key struct { + Href string `json:"href"` + } `json:"key"` + ID int `json:"id"` + } `json:"appearances"` + }