space_traders_api/models/system.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/// System : System details.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct System {
17 /// The symbol of the system.
18 #[serde(rename = "symbol")]
19 pub symbol: String,
20 /// The symbol of the sector.
21 #[serde(rename = "sectorSymbol")]
22 pub sector_symbol: String,
23 /// The constellation that the system is part of.
24 #[serde(rename = "constellation", skip_serializing_if = "Option::is_none")]
25 pub constellation: Option<String>,
26 /// The name of the system.
27 #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
28 pub name: Option<String>,
29 #[serde(rename = "type")]
30 pub r#type: models::SystemType,
31 /// Relative position of the system in the sector in the x axis.
32 #[serde(rename = "x")]
33 pub x: i32,
34 /// Relative position of the system in the sector in the y axis.
35 #[serde(rename = "y")]
36 pub y: i32,
37 /// Waypoints in this system.
38 #[serde(rename = "waypoints")]
39 pub waypoints: Vec<models::SystemWaypoint>,
40 /// Factions that control this system.
41 #[serde(rename = "factions")]
42 pub factions: Vec<models::SystemFaction>,
43}
44
45impl System {
46 /// System details.
47 pub fn new(symbol: String, sector_symbol: String, r#type: models::SystemType, x: i32, y: i32, waypoints: Vec<models::SystemWaypoint>, factions: Vec<models::SystemFaction>) -> System {
48 System {
49 symbol,
50 sector_symbol,
51 constellation: None,
52 name: None,
53 r#type,
54 x,
55 y,
56 waypoints,
57 factions,
58 }
59 }
60}
61