space_traders/models/
agent.rs1use serde::{Deserialize, Serialize};
6
7#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9pub struct Agent {
10 #[serde(rename = "accountId", skip_serializing_if = "Option::is_none")]
12 pub account_id: Option<String>,
13 #[serde(rename = "symbol")]
15 pub symbol: String,
16 #[serde(rename = "headquarters")]
18 pub headquarters: String,
19 #[serde(rename = "credits")]
21 pub credits: i64,
22 #[serde(rename = "startingFaction")]
24 pub starting_faction: String,
25 #[serde(rename = "shipCount", skip_serializing_if = "Option::is_none")]
27 pub ship_count: Option<i32>,
28}
29
30impl Agent {
31 #[allow(clippy::too_many_arguments)]
33 pub fn new(
34 symbol: String,
35 headquarters: String,
36 credits: i64,
37 starting_faction: String,
38 ) -> Agent {
39 Agent {
40 account_id: None,
41 symbol,
42 headquarters,
43 credits,
44 starting_faction,
45 ship_count: None,
46 }
47 }
48}