Skip to content

Commit

Permalink
use new acquirevehicle endpoint
Browse files Browse the repository at this point in the history
fixes #35
  • Loading branch information
zivillian committed Jan 14, 2025
1 parent 8efaf52 commit 10f8305
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions libgwmapi.test/GwmApiClientTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Text.Json.Serialization;
using libgwmapi.DTO.UserAuth;
using libgwmapi.DTO.Vehicle;
using Microsoft.Extensions.Logging.Abstractions;
using Xunit.Abstractions;

namespace libgwmapi.test;
Expand Down Expand Up @@ -94,7 +95,7 @@ public async Task CanGetUserBaseInfo()
public async Task CanAcquireVehicles()
{
var client = GetAuthenticatedClient();
var vehicles = await client.AquireVehiclesAsync(CancellationToken.None);
var vehicles = await client.AcquireVehiclesAsync(CancellationToken.None);
Assert.NotNull(vehicles);
Assert.NotEmpty(vehicles);
var vehicle = vehicles[0];
Expand Down Expand Up @@ -232,7 +233,7 @@ private GwmApiClient GetClient()
store.Add(cert);
}
}
return new GwmApiClient(new HttpClient(), new HttpClient(httpHandler));
return new GwmApiClient(new HttpClient(), new HttpClient(httpHandler), new NullLoggerFactory());
}

private GwmApiClient GetAuthenticatedClient()
Expand Down
4 changes: 2 additions & 2 deletions libgwmapi/GwmApiClient.Vehicle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ namespace libgwmapi;

public partial class GwmApiClient
{
public Task<Vehicle[]> AquireVehiclesAsync(CancellationToken cancellationToken)
public Task<Vehicle[]> AcquireVehiclesAsync(CancellationToken cancellationToken)
{
return GetAppAsync<Vehicle[]>("vehicle/acquireVehicles", cancellationToken);
return GetAppAsync<Vehicle[]>("globalapp/vehicle/acquireVehicles", cancellationToken);
}

public Task<VehicleBasicsInfo> GetVehicleBasicsInfoAsync(string vin, CancellationToken cancellationToken)
Expand Down
2 changes: 1 addition & 1 deletion ora2mqtt/RunCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private async Task RefreshTokenAsync(GwmApiClient client, Ora2MqttOptions option

private async Task PublishStatusAsync(IMqttClient mqtt, GwmApiClient gwm, CancellationToken cancellationToken)
{
var vehicles = await gwm.AquireVehiclesAsync(cancellationToken);
var vehicles = await gwm.AcquireVehiclesAsync(cancellationToken);
foreach (var vehicle in vehicles)
{
var status = await gwm.GetLastVehicleStatusAsync(vehicle.Vin, cancellationToken);
Expand Down

0 comments on commit 10f8305

Please sign in to comment.