space_traders_api/models/
ship.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/// Ship : Ship details.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Ship {
17    /// The globally unique identifier of the ship in the following format: `[AGENT_SYMBOL]-[HEX_ID]`
18    #[serde(rename = "symbol")]
19    pub symbol: String,
20    #[serde(rename = "registration")]
21    pub registration: Box<models::ShipRegistration>,
22    #[serde(rename = "nav")]
23    pub nav: Box<models::ShipNav>,
24    #[serde(rename = "crew")]
25    pub crew: Box<models::ShipCrew>,
26    #[serde(rename = "frame")]
27    pub frame: Box<models::ShipFrame>,
28    #[serde(rename = "reactor")]
29    pub reactor: Box<models::ShipReactor>,
30    #[serde(rename = "engine")]
31    pub engine: Box<models::ShipEngine>,
32    #[serde(rename = "cooldown")]
33    pub cooldown: Box<models::Cooldown>,
34    /// Modules installed in this ship.
35    #[serde(rename = "modules")]
36    pub modules: Vec<models::ShipModule>,
37    /// Mounts installed in this ship.
38    #[serde(rename = "mounts")]
39    pub mounts: Vec<models::ShipMount>,
40    #[serde(rename = "cargo")]
41    pub cargo: Box<models::ShipCargo>,
42    #[serde(rename = "fuel")]
43    pub fuel: Box<models::ShipFuel>,
44}
45
46impl Ship {
47    /// Ship details.
48    pub fn new(symbol: String, registration: models::ShipRegistration, nav: models::ShipNav, crew: models::ShipCrew, frame: models::ShipFrame, reactor: models::ShipReactor, engine: models::ShipEngine, cooldown: models::Cooldown, modules: Vec<models::ShipModule>, mounts: Vec<models::ShipMount>, cargo: models::ShipCargo, fuel: models::ShipFuel) -> Ship {
49        Ship {
50            symbol,
51            registration: Box::new(registration),
52            nav: Box::new(nav),
53            crew: Box::new(crew),
54            frame: Box::new(frame),
55            reactor: Box::new(reactor),
56            engine: Box::new(engine),
57            cooldown: Box::new(cooldown),
58            modules,
59            mounts,
60            cargo: Box::new(cargo),
61            fuel: Box::new(fuel),
62        }
63    }
64}
65