tangled
alpha
login
or
join now
altagos.dev
/
space
0
fork
atom
A SpaceTraders Agent
0
fork
atom
overview
issues
pulls
pipelines
info model + get request
altagos.dev
4 months ago
5b3f18b2
b09d2a88
verified
This commit was signed with the committer's
known signature
.
altagos.dev
SSH Key Fingerprint:
SHA256:UbTjEcCZlc6GzQWLCuDK3D//HESWD2xFPkzue9XMras=
+67
2 changed files
expand all
collapse all
unified
split
src
st
models
Info.zig
models.zig
+2
src/st/models.zig
···
1
1
+
pub const Info = @import("models/Info.zig");
2
2
+
1
3
pub fn Wrapper(comptime T: type) type {
2
4
return struct {
3
5
data: ?T = null,
+65
src/st/models/Info.zig
···
1
1
+
const st = @import("../root.zig");
2
2
+
const Client = st.http.Client;
3
3
+
const RawResponse = st.http.RawResponse;
4
4
+
5
5
+
const Info = @This();
6
6
+
7
7
+
status: []const u8,
8
8
+
version: []const u8,
9
9
+
resetDate: []const u8,
10
10
+
description: []const u8,
11
11
+
stats: Stats,
12
12
+
health: struct {
13
13
+
lastMarketUpdate: []const u8,
14
14
+
},
15
15
+
leaderboards: Leaderboards,
16
16
+
serverResets: Resets,
17
17
+
announcements: []Announcements,
18
18
+
links: []Links,
19
19
+
20
20
+
pub const Stats = struct {
21
21
+
agents: u64,
22
22
+
ships: u64,
23
23
+
systems: u64,
24
24
+
waypoints: u64,
25
25
+
accounts: u64,
26
26
+
};
27
27
+
28
28
+
pub const Leaderboards = struct {
29
29
+
mostCredits: []Credits,
30
30
+
mostSubmittedCharts: []SubmittedCharts,
31
31
+
32
32
+
pub const Credits = struct {
33
33
+
agentSymbol: []const u8,
34
34
+
credits: u64,
35
35
+
};
36
36
+
37
37
+
pub const SubmittedCharts = struct {
38
38
+
agentSymbol: []const u8,
39
39
+
chartCount: u64,
40
40
+
};
41
41
+
};
42
42
+
43
43
+
pub const Resets = struct {
44
44
+
next: []const u8,
45
45
+
frequency: enum { daily, weekly },
46
46
+
};
47
47
+
48
48
+
pub const Announcements = struct {
49
49
+
title: []const u8,
50
50
+
body: []const u8,
51
51
+
};
52
52
+
53
53
+
pub const Links = struct {
54
54
+
name: []const u8,
55
55
+
url: []const u8,
56
56
+
};
57
57
+
58
58
+
pub fn get(client: *Client) !RawResponse(Info) {
59
59
+
return client.request(
60
60
+
Info,
61
61
+
"/",
62
62
+
.{},
63
63
+
.{ .auth = .none },
64
64
+
);
65
65
+
}