Implement ApiNap::items_icons()

This commit is contained in:
King_DuckZ 2020-09-03 23:51:38 +01:00
parent d66c020ad8
commit 8ca23eb221

View file

@ -105,7 +105,7 @@ std::pair<Header, Items> ApiNap::items_list() {
[](const simdjson::dom::element& doc, Items& out) {
auto items = doc["items"].get_array();
out.items.reserve(items.size());
for (const auto& item : items) {
for (auto item : items) {
Item new_entry;
new_entry.item_id = static_cast<unsigned int>(item["item_id"].get_uint64());
new_entry.unique_name = item["unique_name"];
@ -121,6 +121,19 @@ std::pair<Header, Items> ApiNap::items_list() {
}
std::pair<Header, Icons> ApiNap::items_icons() {
return fetch_and_parse<Icons>(
g_endpoint_items_icons,
[](const simdjson::dom::element& doc, Icons& out) {
auto icons = doc["icons"].get_array();
out.icons.reserve(icons.size());
for (auto icon : icons) {
Icon new_entry;
new_entry.item_id = static_cast<unsigned int>(icon["item_id"].get_uint64());
new_entry.icon = icon["icon"];
out.icons.push_back(std::move(new_entry));
}
}
);
}
std::pair<Header, Shops> ApiNap::market_list() {