1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//! All requests being sent to the api are in this module
use serde::Serialize;
use crate::shared;

/// The representation of a purchase order request
#[derive(Serialize, Debug)]
pub struct PurchaseOrderRequest {
    /// The id of the ship to load the good into
    #[serde(rename(serialize = "shipId"))]
    pub ship_id: String,
    /// The type of good being purchased
    pub good: shared::Good,
    /// The quantity of good being purchased
    pub quantity: i32,
}

/// The representation of a purchase ship request
#[derive(Serialize, Debug)]
pub struct PurchaseShipRequest {
    /// The location to buy the ship from
    pub location: String,
    /// The type of ship to buy
    #[serde(rename(serialize = "type"))]
    pub ship_type: String,
}

/// The representation of a new loan request
#[derive(Serialize, Debug)]
pub struct RequestNewLoanRequest {
    /// The type of loan being requested
    #[serde(rename(serialize = "type"))]
    pub loan_type: shared::LoanType,
}

/// The representation of a flight plan request
#[derive(Serialize, Debug)]
pub struct FlightPlanRequest {
    /// The id of the ship to send to the destination
    #[serde(rename(serialize = "shipId"))]
    pub ship_id: String,
    /// The destination to send the ship to
    pub destination: String,
}

/// The representation of a sell order request
#[derive(Serialize, Debug)]
pub struct SellOrderRequest {
    /// The id of the ship which contains the good to be sold
    #[serde(rename(serialize = "shipId"))]
    pub ship_id: String,
    /// The good to be sold
    pub good: shared::Good,
    /// The quantity of good to sell
    pub quantity: i32,
}

/// The representation of a jettison cargo request
#[derive(Serialize, Debug)]
pub struct JettisonCargo {
    /// The good to be jettisoned
    pub good: shared::Good,
    /// The quantity of good to jettison
    pub quantity: i32,
}

/// The representation of a warp jump request
#[derive(Serialize, Debug)]
pub struct WarpJump {
    /// The ship id to attempt a warp jump
    #[serde(rename(serialize = "shipId"))]
    pub ship_id: String,
}