space_traders_api/models/
agent.rs

1/*
2 * SpaceTraders API
3 *
4 * SpaceTraders is an open-universe game and learning platform that offers a set of HTTP endpoints to control a fleet of ships and explore a multiplayer universe.  The API is documented using [OpenAPI](https://github.com/SpaceTradersAPI/api-docs). You can send your first request right here in your browser to check the status of the game server.  ```json http {   \"method\": \"GET\",   \"url\": \"https://api.spacetraders.io/v2\", } ```  Unlike a traditional game, SpaceTraders does not have a first-party client or app to play the game. Instead, you can use the API to build your own client, write a script to automate your ships, or try an app built by the community.  We have a [Discord channel](https://discord.com/invite/jh6zurdWk5) where you can share your projects, ask questions, and get help from other players.   
5 *
6 * The version of the OpenAPI document: 2.3.0
7 * Contact: joel@spacetraders.io
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// Agent : Agent details.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Agent {
17    /// Account ID that is tied to this agent. Only included on your own agent.
18    #[serde(rename = "accountId", skip_serializing_if = "Option::is_none")]
19    pub account_id: Option<String>,
20    /// Symbol of the agent.
21    #[serde(rename = "symbol")]
22    pub symbol: String,
23    /// The headquarters of the agent.
24    #[serde(rename = "headquarters")]
25    pub headquarters: String,
26    /// The number of credits the agent has available. Credits can be negative if funds have been overdrawn.
27    #[serde(rename = "credits")]
28    pub credits: i64,
29    /// The faction the agent started with.
30    #[serde(rename = "startingFaction")]
31    pub starting_faction: String,
32    /// How many ships are owned by the agent.
33    #[serde(rename = "shipCount")]
34    pub ship_count: i32,
35}
36
37impl Agent {
38    /// Agent details.
39    pub fn new(symbol: String, headquarters: String, credits: i64, starting_faction: String, ship_count: i32) -> Agent {
40        Agent {
41            account_id: None,
42            symbol,
43            headquarters,
44            credits,
45            starting_faction,
46            ship_count,
47        }
48    }
49}
50