artificer/api/schemas/bank_gold_transaction.zig

24 lines
798 B
Zig

const std = @import("std");
const Server = @import("../server.zig");
const json_utils = @import("../json_utils.zig");
const json = std.json;
const Allocator = std.mem.Allocator;
const Cooldown = @import("./cooldown.zig");
const Character = @import("./character.zig");
const BankGoldTransaction = @This();
cooldown: Cooldown,
character: Character,
pub fn parse(api: *Server, obj: json.ObjectMap, allocator: Allocator) !BankGoldTransaction {
const cooldown = json_utils.getObject(obj, "cooldown") orelse return error.MissingProperty;
const character = json_utils.getObject(obj, "character") orelse return error.MissingProperty;
return BankGoldTransaction{
.cooldown = try Cooldown.parse(cooldown),
.character = try Character.parse(api, character, allocator)
};
}