artificer/api/schemas/single_item.zig

23 lines
656 B
Zig

const std = @import("std");
const Store = @import("../store.zig");
const json_utils = @import("../json_utils.zig");
const json = std.json;
const Allocator = std.mem.Allocator;
const Item = @import("./item.zig");
const SingleItem = @This();
item: Item,
// TODO: Grand exchange
pub fn parse(store: *Store, obj: json.ObjectMap, allocator: Allocator) !SingleItem {
const item_obj = json_utils.getObject(obj, "item") orelse return error.MissingProperty;
const ge_obj = json_utils.getObject(obj, "ge") orelse return error.MissingProperty;
_ = ge_obj;
return SingleItem{
.item = try Item.parse(store, item_obj, allocator),
};
}