Implement ApiNap::items_icons()
This commit is contained in:
parent
d66c020ad8
commit
8ca23eb221
1 changed files with 14 additions and 1 deletions
|
@ -105,7 +105,7 @@ std::pair<Header, Items> ApiNap::items_list() {
|
||||||
[](const simdjson::dom::element& doc, Items& out) {
|
[](const simdjson::dom::element& doc, Items& out) {
|
||||||
auto items = doc["items"].get_array();
|
auto items = doc["items"].get_array();
|
||||||
out.items.reserve(items.size());
|
out.items.reserve(items.size());
|
||||||
for (const auto& item : items) {
|
for (auto item : items) {
|
||||||
Item new_entry;
|
Item new_entry;
|
||||||
new_entry.item_id = static_cast<unsigned int>(item["item_id"].get_uint64());
|
new_entry.item_id = static_cast<unsigned int>(item["item_id"].get_uint64());
|
||||||
new_entry.unique_name = item["unique_name"];
|
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() {
|
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() {
|
std::pair<Header, Shops> ApiNap::market_list() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue