Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/Somfic/EliteAPI into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Somfic committed Aug 10, 2023
2 parents d3386a4 + 904fcbe commit 50e0407
Show file tree
Hide file tree
Showing 21 changed files with 225 additions and 40 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/qodana_code_quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Qodana
on:
workflow_dispatch:
pull_request:
push:
branches:
- dev
- main

jobs:
qodana:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: 'Qodana Scan'
uses: JetBrains/[email protected]
env:
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
4 changes: 2 additions & 2 deletions EliteAPI.Abstractions/EliteAPI.Abstractions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<LangVersion>10</LangVersion>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<FileVersion>3.0.0.0</FileVersion>
<InformationalVersion>3.1.0-alpha.169+Branch.dev.Sha.8630d1c7d7db92bca3a8cc854f777a4b9cd93435</InformationalVersion>
<InformationalVersion>3.1.0-alpha.182+Branch.dev.Sha.0fd6d5a6f5a17cbe313c176d121f8bf359e348de</InformationalVersion>
<Version>3.0.0-alpha5155</Version>
<AssemblyVersion>3.1.0.0</AssemblyVersion>
<FileVersion>3.1.0.0</FileVersion>
Expand All @@ -18,7 +18,7 @@
<Description>Abstractions for EliteAPI</Description>
<Copyright>© Somfic 2022</Copyright>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Version>3.1.0-alpha0169</Version>
<Version>3.1.0-alpha0182</Version>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<PackageIcon>icon.png</PackageIcon>
<IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true</IsWindows>
Expand Down
4 changes: 2 additions & 2 deletions EliteAPI.Events/EliteAPI.Events.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<LangVersion>10</LangVersion>
<AssemblyVersion>3.1.0.0</AssemblyVersion>
<FileVersion>3.1.0.0</FileVersion>
<InformationalVersion>3.1.0-alpha.169+Branch.dev.Sha.8630d1c7d7db92bca3a8cc854f777a4b9cd93435</InformationalVersion>
<InformationalVersion>3.1.0-alpha.182+Branch.dev.Sha.0fd6d5a6f5a17cbe313c176d121f8bf359e348de</InformationalVersion>
<Version>3.0.0-alpha5167</Version>
<IsPackable>true</IsPackable>
<PackageProjectUrl>https://github.com/EliteAPI/EliteAPI</PackageProjectUrl>
Expand All @@ -17,7 +17,7 @@
<Description>Events for EliteAPI</Description>
<Copyright>© Somfic 2022</Copyright>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Version>3.1.0-alpha0169</Version>
<Version>3.1.0-alpha0182</Version>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<PackageIcon>icon.png</PackageIcon>
<TargetFramework>netstandard2.0</TargetFramework>
Expand Down
4 changes: 2 additions & 2 deletions EliteAPI.Tests/Conventions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void Properties(PropertyInfo property)
static IImmutableList<PropertyInfo> GetProperties()

Check notice on line 81 in EliteAPI.Tests/Conventions.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Use explicit or implicit modifier definition for type members

Inconsistent modifiers style: missing 'private' modifier
{
var eventParser = new EventParser(Mock.Of<IServiceProvider>());
eventParser.Use<LocalisedConverter>();;
eventParser.Use<LocalisedConverter>();
var events = new Events.Events(Mock.Of<ILogger<Events.Events>>(), eventParser);
events.Register();

Expand All @@ -102,7 +102,7 @@ static IImmutableList<Type> GetTypes()
{
var eventParser = new EventParser(Mock.Of<IServiceProvider>());
eventParser.Use<LocalisedConverter>();
;

var events = new Events.Events(Mock.Of<ILogger<Events.Events>>(), eventParser);
events.Register();

Expand Down
6 changes: 3 additions & 3 deletions EliteAPI.Tests/EliteAPI.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<IsTestProject>true</IsTestProject>
<AssemblyVersion>3.1.0.0</AssemblyVersion>
<FileVersion>3.1.0.0</FileVersion>
<InformationalVersion>3.1.0-alpha.169+Branch.dev.Sha.8630d1c7d7db92bca3a8cc854f777a4b9cd93435</InformationalVersion>
<Version>3.1.0-alpha0169</Version>
<InformationalVersion>3.1.0-alpha.182+Branch.dev.Sha.0fd6d5a6f5a17cbe313c176d121f8bf359e348de</InformationalVersion>
<Version>3.1.0-alpha0182</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="itext7" Version="8.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.0" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
Expand Down
2 changes: 1 addition & 1 deletion EliteAPI.Tests/JournalManual.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class JournalManual
public void Setup()
{
var eventParser = new EventParser(Mock.Of<IServiceProvider>());
eventParser.Use<LocalisedConverter>();;
eventParser.Use<LocalisedConverter>();
_events = new Events.Events(Mock.Of<ILogger<Events.Events>>(), eventParser);
_events.Register();
}
Expand Down
4 changes: 2 additions & 2 deletions EliteAPI.Web.Spansh/EliteAPI.Web.Spansh.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<LangVersion>default</LangVersion>
<AssemblyVersion>3.1.0.0</AssemblyVersion>
<FileVersion>3.1.0.0</FileVersion>
<InformationalVersion>3.1.0-alpha.169+Branch.dev.Sha.8630d1c7d7db92bca3a8cc854f777a4b9cd93435</InformationalVersion>
<Version>3.1.0-alpha0169</Version>
<InformationalVersion>3.1.0-alpha.182+Branch.dev.Sha.0fd6d5a6f5a17cbe313c176d121f8bf359e348de</InformationalVersion>
<Version>3.1.0-alpha0182</Version>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\EliteAPI.Web\EliteAPI.Web.csproj" />
Expand Down
57 changes: 57 additions & 0 deletions EliteAPI.Web.Spansh/RoutePlanner/Requests/TradeRequest.cs
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; }

Check warning on line 17 in EliteAPI.Web.Spansh/RoutePlanner/Requests/TradeRequest.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Auto-property accessor is never used (non-private accessibility)

Auto-property accessor 'StartingSystem.get' is never used

[QueryParameter("station")]
public string StartingStation { get; init; }

Check warning on line 20 in EliteAPI.Web.Spansh/RoutePlanner/Requests/TradeRequest.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Auto-property accessor is never used (non-private accessibility)

Auto-property accessor 'StartingStation.get' is never used

[QueryParameter("starting_capital")]
public int StartingCapital { get; init; } = 100_000_000;

Check notice on line 23 in EliteAPI.Web.Spansh/RoutePlanner/Requests/TradeRequest.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Type member is never used (non-private accessibility)

Property 'StartingCapital' is never used

[QueryParameter("max_hop_distance")]
public int JumpRange { get; init; }

Check warning on line 26 in EliteAPI.Web.Spansh/RoutePlanner/Requests/TradeRequest.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Auto-property accessor is never used (non-private accessibility)

Auto-property accessor 'JumpRange.get' is never used

[QueryParameter("max_cargo")]
public int CargoCapacity { get; init; }

Check warning on line 29 in EliteAPI.Web.Spansh/RoutePlanner/Requests/TradeRequest.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Auto-property accessor is never used (non-private accessibility)

Auto-property accessor 'CargoCapacity.get' is never used

[QueryParameter("max_hops")]
public int AmountOfStops { get; init; } = 5;

Check notice on line 32 in EliteAPI.Web.Spansh/RoutePlanner/Requests/TradeRequest.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Type member is never used (non-private accessibility)

Property 'AmountOfStops' is never used

[QueryParameter("max_system_distance")]
public int MaxDistanceToArrival { get; init; } = 10_000;

Check notice on line 35 in EliteAPI.Web.Spansh/RoutePlanner/Requests/TradeRequest.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Type member is never used (non-private accessibility)

Property 'MaxDistanceToArrival' is never used

[QueryParameter("max_price_age")]
public int MaxPriceAge { get; init; } = 60 * 60 * 24 * 7; // 7 days

Check notice on line 38 in EliteAPI.Web.Spansh/RoutePlanner/Requests/TradeRequest.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Type member is never used (non-private accessibility)

Property 'MaxPriceAge' is never used

[QueryParameter("requires_large_pad")]
public bool RequiresLargePad { get; init; } = false;

Check notice on line 41 in EliteAPI.Web.Spansh/RoutePlanner/Requests/TradeRequest.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Type member is never used (non-private accessibility)

Property 'RequiresLargePad' is never used

[QueryParameter("allow_planetary")]
public bool AllowPlanetary { get; init; } = false;

Check notice on line 44 in EliteAPI.Web.Spansh/RoutePlanner/Requests/TradeRequest.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Type member is never used (non-private accessibility)

Property 'AllowPlanetary' is never used

[QueryParameter("allow_prohibited")]
public bool AllowProhibited { get; init; } = false;

Check notice on line 47 in EliteAPI.Web.Spansh/RoutePlanner/Requests/TradeRequest.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Type member is never used (non-private accessibility)

Property 'AllowProhibited' is never used

[QueryParameter("permit")]
public bool AllowPermitSystems { get; init; } = false;

Check notice on line 50 in EliteAPI.Web.Spansh/RoutePlanner/Requests/TradeRequest.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Type member is never used (non-private accessibility)

Property 'AllowPermitSystems' is never used

[QueryParameter("unique")]
public bool AvoidLoops { get; init; } = false;

Check notice on line 53 in EliteAPI.Web.Spansh/RoutePlanner/Requests/TradeRequest.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Type member is never used (non-private accessibility)

Property 'AvoidLoops' is never used

public string Endpoint => "trade/route";
public HttpMethod Method => HttpMethod.Post;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace EliteAPI.Web.Spansh.RoutePlanner.Responses;

public class NeutronResponse : IJobResponse
public class NeutronResponse
{
[JsonProperty("destination_system")]
public string DestinationSystem { get; init; }

Check warning on line 9 in EliteAPI.Web.Spansh/RoutePlanner/Responses/NeutronResponse.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Non-nullable member is uninitialized.

Non-nullable property 'DestinationSystem' is uninitialized. Consider declaring the property as nullable.
Expand Down
67 changes: 67 additions & 0 deletions EliteAPI.Web.Spansh/RoutePlanner/Responses/TradeResponse.cs
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; }

Check warning on line 8 in EliteAPI.Web.Spansh/RoutePlanner/Responses/TradeResponse.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Non-nullable member is uninitialized.

Non-nullable property 'Commodities' is uninitialized. Consider declaring the property as nullable.

[JsonProperty("cumulative_profit")] public long CumulativeProfit { get; set; }

[JsonProperty("destination")]public SystemInfo Destination { get; set; }

Check warning on line 12 in EliteAPI.Web.Spansh/RoutePlanner/Responses/TradeResponse.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Non-nullable member is uninitialized.

Non-nullable property 'Destination' is uninitialized. Consider declaring the property as nullable.

[JsonProperty("distance")] public double Distance { get; set; }

[JsonProperty("source")] public SystemInfo System { get; set; }

Check warning on line 16 in EliteAPI.Web.Spansh/RoutePlanner/Responses/TradeResponse.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Non-nullable member is uninitialized.

Non-nullable property 'System' is uninitialized. Consider declaring the property as nullable.

[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; }

Check warning on line 25 in EliteAPI.Web.Spansh/RoutePlanner/Responses/TradeResponse.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Non-nullable member is uninitialized.

Non-nullable property 'DestinationCommodity' is uninitialized. Consider declaring the property as nullable.

[JsonProperty("name")] public string Name { get; set; }

Check warning on line 27 in EliteAPI.Web.Spansh/RoutePlanner/Responses/TradeResponse.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Non-nullable member is uninitialized.

Non-nullable property 'Name' is uninitialized. Consider declaring the property as nullable.

[JsonProperty("profit")] public long Profit { get; set; }

[JsonProperty("source_commodity")] public TradeCommodity SourceCommodity { get; set; }

Check warning on line 31 in EliteAPI.Web.Spansh/RoutePlanner/Responses/TradeResponse.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Non-nullable member is uninitialized.

Non-nullable property 'SourceCommodity' is uninitialized. Consider declaring the property as nullable.

[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; }

Check warning on line 55 in EliteAPI.Web.Spansh/RoutePlanner/Responses/TradeResponse.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Non-nullable member is uninitialized.

Non-nullable property 'Station' is uninitialized. Consider declaring the property as nullable.

[JsonProperty("system")] public string Name { get; set; }

Check warning on line 57 in EliteAPI.Web.Spansh/RoutePlanner/Responses/TradeResponse.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Non-nullable member is uninitialized.

Non-nullable property 'Name' is uninitialized. Consider declaring the property as nullable.

[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; }
}
}
7 changes: 7 additions & 0 deletions EliteAPI.Web.Spansh/RoutePlanner/RoutePlannerApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,12 @@ public async Task<Result<NeutronResponse>> Neutron(NeutronRequest request)

return await api.Utilities.FromJob<NeutronResponse>(job);

Check warning on line 28 in EliteAPI.Web.Spansh/RoutePlanner/RoutePlannerApi.cs

View workflow job for this annotation

GitHub Actions / test

Dereference of a possibly null reference.

Check warning on line 28 in EliteAPI.Web.Spansh/RoutePlanner/RoutePlannerApi.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Dereference of a possibly null reference.

Dereference of a possibly null reference
}

public async Task<Result<IReadOnlyCollection<TradeResponse>>> Trade(TradeRequest request)
{
var api = Api as SpanshApi;
var job = await Execute<TradeRequest, JobResponse>(request);
return await api.Utilities.FromJob<IReadOnlyCollection<TradeResponse>>(job);

Check warning on line 35 in EliteAPI.Web.Spansh/RoutePlanner/RoutePlannerApi.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Dereference of a possibly null reference.

Dereference of a possibly null reference
}

}
12 changes: 0 additions & 12 deletions EliteAPI.Web.Spansh/SpanshApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,4 @@ public SpanshApi(IServiceProvider services) : base(services)
public RoutePlannerApi Routes { get; }

internal UtilitiesApi Utilities { get; }
}

public interface IJobResponse : IWebApiResponse
{
[JsonProperty("job")]
public string Job { get; init; }
}

public interface IJobRequest : IWebApiRequest
{
[JsonProperty("job")]
public string Job { get; init; }
}
2 changes: 1 addition & 1 deletion EliteAPI.Web.Spansh/Utilities/Requests/JobRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace EliteAPI.Web.Spansh.Utilities.Requests;

public class JobRequest : IJobRequest
public class JobRequest : IWebApiRequest
{
public JobRequest(string job)
{
Expand Down
4 changes: 2 additions & 2 deletions EliteAPI.Web.Spansh/Utilities/UtilitiesApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ internal async Task<WebApiResponse<WebApiResult<JobResponse<T>>>> Job<T>(JobRequ
}
}

internal async Task<Result<TResponse>> FromJob<TResponse>(WebApiResponse<WebApiResult<JobResponse>> job) where TResponse : class, IJobResponse
internal async Task<Result<TResponse>> FromJob<TResponse>(WebApiResponse<WebApiResult<JobResponse>> job) where TResponse : class
{
var api = Api as SpanshApi;

var result = await job.MapAsync(
ok: x => api.Utilities.Job<NeutronResponse>(new JobRequest(x.Content.Job)),
ok: x => api.Utilities.Job<TResponse>(new JobRequest(x.Content.Job)),

Check warning on line 52 in EliteAPI.Web.Spansh/Utilities/UtilitiesApi.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Dereference of a possibly null reference.

Dereference of a possibly null reference
error: x => x
);

Expand Down
4 changes: 2 additions & 2 deletions EliteAPI.Web/EliteAPI.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyVersion>3.1.0.0</AssemblyVersion>
<FileVersion>3.1.0.0</FileVersion>
<InformationalVersion>3.1.0-alpha.169+Branch.dev.Sha.8630d1c7d7db92bca3a8cc854f777a4b9cd93435</InformationalVersion>
<Version>3.1.0-alpha0169</Version>
<InformationalVersion>3.1.0-alpha.182+Branch.dev.Sha.0fd6d5a6f5a17cbe313c176d121f8bf359e348de</InformationalVersion>
<Version>3.1.0-alpha0182</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="IsExternalInit" Version="1.0.3">
Expand Down
4 changes: 2 additions & 2 deletions EliteAPI/EliteAPI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
<Description>A powerful event based .NET API for Elite: Dangerous</Description>
<Copyright>© Somfic 2022</Copyright>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Version>3.1.0-alpha0169</Version>
<Version>3.1.0-alpha0182</Version>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<PackageIcon>icon.png</PackageIcon>
<IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true</IsWindows>
<LangVersion>10</LangVersion>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<Authors>Somfic</Authors>
<InformationalVersion>3.1.0-alpha.169+Branch.dev.Sha.8630d1c7d7db92bca3a8cc854f777a4b9cd93435</InformationalVersion>
<InformationalVersion>3.1.0-alpha.182+Branch.dev.Sha.0fd6d5a6f5a17cbe313c176d121f8bf359e348de</InformationalVersion>
<Nullable>enable</Nullable>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions Examples/Example.Web/Example.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<IsPackable>false</IsPackable>
<AssemblyVersion>3.1.0.0</AssemblyVersion>
<FileVersion>3.1.0.0</FileVersion>
<InformationalVersion>3.1.0-alpha.169+Branch.dev.Sha.8630d1c7d7db92bca3a8cc854f777a4b9cd93435</InformationalVersion>
<Version>3.1.0-alpha0169</Version>
<InformationalVersion>3.1.0-alpha.182+Branch.dev.Sha.0fd6d5a6f5a17cbe313c176d121f8bf359e348de</InformationalVersion>
<Version>3.1.0-alpha0182</Version>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\EliteAPI.Web.Spansh\EliteAPI.Web.Spansh.csproj" />
Expand Down
16 changes: 14 additions & 2 deletions Examples/Example.Web/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,20 @@
.GetRequiredService<SpanshApi>();

Console.WriteLine("Getting route ... ");
var response = await spansh.Routes.Neutron(new NeutronRequest("Sol", "Colonia"));
var response = await spansh.Routes.Trade(new TradeRequest("Shinrarta Dezhra", "Jameson Memorial", 50, 720));

response.On(
ok: r => Console.WriteLine(string.Join(" > ", r.SystemJumps.Select(x => x.System))),
ok: route =>
{
foreach (var stop in route)
{
Console.WriteLine(stop.System.Name + " - " + stop.System.Station);
foreach (var commodity in stop.Commodities)
{
Console.WriteLine($" - {commodity.Name} {commodity.Amount}x (+{commodity.TotalProfit:N0}cr)");
}
Console.WriteLine();
}
},
error: e => Console.WriteLine(e.Message));
6 changes: 4 additions & 2 deletions Examples/Example/Example.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<Nullable>enable</Nullable>
<AssemblyVersion>3.1.0.0</AssemblyVersion>
<FileVersion>3.1.0.0</FileVersion>
<InformationalVersion>3.1.0-alpha.169+Branch.dev.Sha.8630d1c7d7db92bca3a8cc854f777a4b9cd93435</InformationalVersion>
<Version>3.1.0-alpha0169</Version>
<InformationalVersion>3.1.0-alpha.182+Branch.dev.Sha.0fd6d5a6f5a17cbe313c176d121f8bf359e348de</InformationalVersion>
<Version>3.1.0-alpha0182</Version>
<IsPackable>false</IsPackable>
<LangVersion>10</LangVersion>
<OutputType>Exe</OutputType>
Expand All @@ -17,6 +17,8 @@
<ItemGroup>
<ProjectReference Include="..\..\EliteAPI.Events\EliteAPI.Events.csproj" />
<ProjectReference Include="..\..\EliteAPI\EliteAPI.csproj" />
<ProjectReference Include="..\EliteAPI.Events\EliteAPI.Events.csproj" />
<ProjectReference Include="..\EliteAPI\EliteAPI.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="appsettings.json">
Expand Down
Loading

0 comments on commit 50e0407

Please sign in to comment.