A SpaceTraders Agent

account model + get request

altagos.dev 6864f9d8 5b3f18b2

verified
+26
+2
src/st/models.zig
··· 1 + pub const accounts = @import("models/accounts.zig"); 2 + 1 3 pub const Info = @import("models/Info.zig"); 2 4 3 5 pub fn Wrapper(comptime T: type) type {
+24
src/st/models/accounts.zig
··· 1 + const st = @import("../root.zig"); 2 + const Client = st.http.Client; 3 + const Response = st.http.Response; 4 + const Wrapper = st.models.Wrapper; 5 + 6 + pub const AccountWrapper = struct { 7 + account: Account, 8 + }; 9 + 10 + pub const Account = struct { 11 + id: []const u8, 12 + email: ?[]const u8 = null, 13 + token: ?[]const u8 = null, 14 + createdAt: []const u8, 15 + }; 16 + 17 + pub fn get(client: *Client) !Response(AccountWrapper) { 18 + return client.request( 19 + Wrapper(AccountWrapper), 20 + "/my/account", 21 + .{}, 22 + .{ .auth = .agent }, 23 + ); 24 + }