-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
135 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using EliteAPI.Web.Attributes; | ||
using EliteAPI.Web.Models; | ||
|
||
namespace EliteAPI.Web.Spansh.RoutePlanner.Requests; | ||
|
||
public class TradeRequest : IWebApiRequest | ||
{ | ||
public TradeRequest(string startingSystem, string startingStation, int range, int capacity) | ||
{ | ||
StartingSystem = startingSystem; | ||
StartingStation = startingStation; | ||
JumpRange = range; | ||
CargoCapacity = capacity; | ||
} | ||
|
||
[QueryParameter("system")] | ||
public string StartingSystem { get; init; } | ||
|
||
[QueryParameter("station")] | ||
public string StartingStation { get; init; } | ||
|
||
[QueryParameter("starting_capital")] | ||
public int StartingCapital { get; init; } = 100_000_000; | ||
|
||
[QueryParameter("max_hop_distance")] | ||
public int JumpRange { get; init; } | ||
|
||
[QueryParameter("max_cargo")] | ||
public int CargoCapacity { get; init; } | ||
|
||
[QueryParameter("max_hops")] | ||
public int AmountOfStops { get; init; } = 5; | ||
|
||
[QueryParameter("max_system_distance")] | ||
public int MaxDistanceToArrival { get; init; } = 10_000; | ||
|
||
[QueryParameter("max_price_age")] | ||
public int MaxPriceAge { get; init; } = 60 * 60 * 24 * 7; // 7 days | ||
|
||
[QueryParameter("requires_large_pad")] | ||
public bool RequiresLargePad { get; init; } = false; | ||
|
||
[QueryParameter("allow_planetary")] | ||
public bool AllowPlanetary { get; init; } = false; | ||
|
||
[QueryParameter("allow_prohibited")] | ||
public bool AllowProhibited { get; init; } = false; | ||
|
||
[QueryParameter("permit")] | ||
public bool AllowPermitSystems { get; init; } = false; | ||
|
||
[QueryParameter("unique")] | ||
public bool AvoidLoops { get; init; } = false; | ||
|
||
public string Endpoint => "trade/route"; | ||
public HttpMethod Method => HttpMethod.Post; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
EliteAPI.Web.Spansh/RoutePlanner/Responses/TradeResponse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
using EliteAPI.Web.Models; | ||
using Newtonsoft.Json; | ||
|
||
namespace EliteAPI.Web.Spansh.RoutePlanner.Responses; | ||
|
||
public class TradeResponse : IWebApiResponse | ||
{ | ||
[JsonProperty("commodities")] public IReadOnlyCollection<Commodity> Commodities { get; set; } | ||
|
||
[JsonProperty("cumulative_profit")] public long CumulativeProfit { get; set; } | ||
|
||
[JsonProperty("destination")]public SystemInfo Destination { get; set; } | ||
|
||
[JsonProperty("distance")] public double Distance { get; set; } | ||
|
||
[JsonProperty("source")] public SystemInfo System { get; set; } | ||
|
||
[JsonProperty("total_profit")] public long TotalProfit { get; set; } | ||
|
||
public class Commodity | ||
{ | ||
[JsonProperty("amount")] public long Amount { get; set; } | ||
|
||
[JsonProperty("destination_commodity")] | ||
public TradeCommodity DestinationCommodity { get; set; } | ||
|
||
[JsonProperty("name")] public string Name { get; set; } | ||
|
||
[JsonProperty("profit")] public long Profit { get; set; } | ||
|
||
[JsonProperty("source_commodity")] public TradeCommodity SourceCommodity { get; set; } | ||
|
||
[JsonProperty("total_profit")] public long TotalProfit { get; set; } | ||
} | ||
|
||
public class TradeCommodity | ||
{ | ||
[JsonProperty("buy_price")] public long BuyPrice { get; set; } | ||
|
||
[JsonProperty("demand")] public long Demand { get; set; } | ||
|
||
[JsonProperty("sell_price")] public long SellPrice { get; set; } | ||
|
||
[JsonProperty("supply")] public long Supply { get; set; } | ||
} | ||
|
||
public class SystemInfo | ||
{ | ||
[JsonProperty("distance_to_arrival")] public long DistanceToArrival { get; set; } | ||
|
||
[JsonProperty("market_id")] public long MarketId { get; set; } | ||
|
||
[JsonProperty("market_updated_at")] public long MarketUpdatedAt { get; set; } | ||
|
||
[JsonProperty("station")] public string Station { get; set; } | ||
|
||
[JsonProperty("system")] public string Name { get; set; } | ||
|
||
[JsonProperty("system_id64")] public long Id { get; set; } | ||
|
||
[JsonProperty("x")] public double X { get; set; } | ||
|
||
[JsonProperty("y")] public double Y { get; set; } | ||
|
||
[JsonProperty("z")] public double Z { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters