tangled
alpha
login
or
join now
altagos.dev
/
space
0
fork
atom
A SpaceTraders Agent
0
fork
atom
overview
issues
pulls
pipelines
basic setup for models
altagos.dev
4 months ago
b6f5095b
d62936fd
verified
This commit was signed with the committer's
known signature
.
altagos.dev
SSH Key Fingerprint:
SHA256:UbTjEcCZlc6GzQWLCuDK3D//HESWD2xFPkzue9XMras=
+155
2 changed files
expand all
collapse all
unified
split
src
st
models.zig
root.zig
+153
src/st/models.zig
···
1
1
+
pub fn Wrapper(comptime T: type) type {
2
2
+
return struct {
3
3
+
data: ?T = null,
4
4
+
meta: ?Meta = null,
5
5
+
@"error": ?Error = null,
6
6
+
};
7
7
+
}
8
8
+
9
9
+
pub const Meta = struct {
10
10
+
total: u64 = 0, // [0, ∞)
11
11
+
page: u64 = 1, // [1, ∞)
12
12
+
limit: u8 = 10, // [1, 20]
13
13
+
};
14
14
+
15
15
+
pub const Query = struct {
16
16
+
page: u64 = 1,
17
17
+
/// How many entries to return per page
18
18
+
/// min: 1, max: 20
19
19
+
limit: u64 = 20,
20
20
+
};
21
21
+
22
22
+
pub const Error = struct {
23
23
+
message: []const u8,
24
24
+
code: ErrorCode,
25
25
+
data: ?Data = null,
26
26
+
27
27
+
pub const Data = struct {
28
28
+
type: []const u8,
29
29
+
retryAfter: u64,
30
30
+
limitBurst: u64,
31
31
+
limitPerSecond: u64,
32
32
+
remaining: u64,
33
33
+
reset: []const u8,
34
34
+
};
35
35
+
};
36
36
+
37
37
+
/// List of Possible Error Codes
38
38
+
///
39
39
+
/// Obtained via [/error-codes](https://spacetraders.io/openapi#tag/global/GET/error-codes)
40
40
+
pub const ErrorCode = enum(u16) {
41
41
+
// Standart Error Codes
42
42
+
notFound = 404,
43
43
+
tooManyRequests = 429,
44
44
+
ddosProtection = 502,
45
45
+
46
46
+
// SpaceTraders Error Codes
47
47
+
responseSerializationError = 3000,
48
48
+
unprocessableInputError = 3001,
49
49
+
allErrorHandlersFailedError = 3002,
50
50
+
systemStatusMaintenanceError = 3100,
51
51
+
resetError = 3200,
52
52
+
cooldownConflictError = 4000,
53
53
+
waypointNoAccessError = 4001,
54
54
+
tokenEmptyError = 4100,
55
55
+
tokenMissingSubjectError = 4101,
56
56
+
tokenInvalidSubjectError = 4102,
57
57
+
missingTokenRequestError = 4103,
58
58
+
invalidTokenRequestError = 4104,
59
59
+
invalidTokenSubjectError = 4105,
60
60
+
accountNotExistsError = 4106,
61
61
+
agentNotExistsError = 4107,
62
62
+
accountHasNoAgentError = 4108,
63
63
+
tokenInvalidVersionError = 4109,
64
64
+
registerAgentSymbolReservedError = 4110,
65
65
+
registerAgentConflictSymbolError = 4111,
66
66
+
registerAgentNoStartingLocationsError = 4112,
67
67
+
tokenResetDateMismatchError = 4113,
68
68
+
invalidAccountRoleError = 4114,
69
69
+
invalidTokenError = 4115,
70
70
+
missingAccountTokenRequest = 4116,
71
71
+
navigateInTransitError = 4200,
72
72
+
navigateInvalidDestinationError = 4201,
73
73
+
navigateOutsideSystemError = 4202,
74
74
+
navigateInsufficientFuelError = 4203,
75
75
+
navigateSameDestinationError = 4204,
76
76
+
shipExtractInvalidWaypointError = 4205,
77
77
+
shipExtractPermissionError = 4206,
78
78
+
shipInTransitError = 4214,
79
79
+
shipMissingSensorArraysError = 4215,
80
80
+
purchaseShipCreditsError = 4216,
81
81
+
shipCargoExceedsLimitError = 4217,
82
82
+
shipCargoMissingError = 4218,
83
83
+
shipCargoUnitCountError = 4219,
84
84
+
shipSurveyVerificationError = 4220,
85
85
+
shipSurveyExpirationError = 4221,
86
86
+
shipSurveyWaypointTypeError = 4222,
87
87
+
shipSurveyOrbitError = 4223,
88
88
+
shipSurveyExhaustedError = 4224,
89
89
+
shipCargoFullError = 4228,
90
90
+
waypointChartedError = 4230,
91
91
+
shipTransferShipNotFound = 4231,
92
92
+
shipTransferAgentConflict = 4232,
93
93
+
shipTransferSameShipConflict = 4233,
94
94
+
shipTransferLocationConflict = 4234,
95
95
+
warpInsideSystemError = 4235,
96
96
+
shipNotInOrbitError = 4236,
97
97
+
shipInvalidRefineryGoodError = 4237,
98
98
+
shipInvalidRefineryTypeError = 4238,
99
99
+
shipMissingRefineryError = 4239,
100
100
+
shipMissingSurveyorError = 4240,
101
101
+
shipMissingWarpDriveError = 4241,
102
102
+
shipMissingMineralProcessorError = 4242,
103
103
+
shipMissingMiningLasersError = 4243,
104
104
+
shipNotDockedError = 4244,
105
105
+
purchaseShipNotPresentError = 4245,
106
106
+
shipMountNoShipyardError = 4246,
107
107
+
shipMissingMountError = 4247,
108
108
+
shipMountInsufficientCreditsError = 4248,
109
109
+
shipMissingPowerError = 4249,
110
110
+
shipMissingSlotsError = 4250,
111
111
+
shipMissingMountsError = 4251,
112
112
+
shipMissingCrewError = 4252,
113
113
+
shipExtractDestabilizedError = 4253,
114
114
+
shipJumpInvalidOriginError = 4254,
115
115
+
shipJumpInvalidWaypointError = 4255,
116
116
+
shipJumpOriginUnderConstructionError = 4256,
117
117
+
shipMissingGasProcessorError = 4257,
118
118
+
shipMissingGasSiphonsError = 4258,
119
119
+
shipSiphonInvalidWaypointError = 4259,
120
120
+
shipSiphonPermissionError = 4260,
121
121
+
waypointNoYieldError = 4261,
122
122
+
shipJumpDestinationUnderConstructionError = 4262,
123
123
+
shipScrapInvalidTraitError = 4263,
124
124
+
shipRepairInvalidTraitError = 4264,
125
125
+
agentInsufficientCreditsError = 4265,
126
126
+
shipModuleNoShipyardError = 4266,
127
127
+
shipModuleNotInstalledError = 4267,
128
128
+
shipModuleInsufficientCreditsError = 4268,
129
129
+
cantSlowDownWhileInTransitError = 4269,
130
130
+
shipExtractInvalidSurveyLocationError = 4270,
131
131
+
shipTransferDockedOrbitConflict = 4271,
132
132
+
acceptContractNotAuthorizedError = 4500,
133
133
+
acceptContractConflictError = 4501,
134
134
+
fulfillContractDeliveryError = 4502,
135
135
+
contractDeadlineError = 4503,
136
136
+
contractFulfilledError = 4504,
137
137
+
contractNotAcceptedError = 4505,
138
138
+
contractNotAuthorizedError = 4506,
139
139
+
shipDeliverTermsError = 4508,
140
140
+
shipDeliverFulfilledError = 4509,
141
141
+
shipDeliverInvalidLocationError = 4510,
142
142
+
existingContractError = 4511,
143
143
+
marketTradeInsufficientCreditsError = 4600,
144
144
+
marketTradeNoPurchaseError = 4601,
145
145
+
marketTradeNotSoldError = 4602,
146
146
+
marketTradeUnitLimitError = 4604,
147
147
+
shipNotAvailableForPurchaseError = 4605,
148
148
+
waypointNoFactionError = 4700,
149
149
+
constructionMaterialNotRequired = 4800,
150
150
+
constructionMaterialFulfilled = 4801,
151
151
+
shipConstructionInvalidLocationError = 4802,
152
152
+
unsupportedMediaTypeError = 5000,
153
153
+
};
+2
src/st/root.zig
···
1
1
+
pub const http = @import("http.zig");
2
2
+
pub const models = @import("models.zig");