Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,14 @@ dotnet_naming_symbols.any_async_methods.required_modifiers = async

dotnet_naming_style.end_in_async.required_suffix = Async
dotnet_naming_style.end_in_async.capitalization = pascal_case

[*.cs]

# SA1101: Prefix local calls with this
dotnet_diagnostic.SA1101.severity = none

# SA1309: Field names should not begin with underscore
dotnet_diagnostic.SA1309.severity = none

# SA1503: Braces should not be omitted
dotnet_diagnostic.SA1503.severity = none
10 changes: 5 additions & 5 deletions src/Tesla.NET/Models/IChargeState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ public interface IChargeState : IState
/// Gets the charging state of a <see cref="IVehicle"/>.
/// </summary>
[JsonProperty("charging_state")]
string ChargingState { get; }
string? ChargingState { get; }

/// <summary>
/// Gets the type of fast charging.
/// </summary>
[JsonProperty("fast_charger_type")]
string FastChargerType { get; }
string? FastChargerType { get; }

/// <summary>
/// Gets the brand of fast charging.
/// </summary>
[JsonProperty("fast_charger_brand")]
string FastChargerBrand { get; }
string? FastChargerBrand { get; }

/// <summary>
/// Gets the charge limit <see cref="IVehicle"/>.
Expand Down Expand Up @@ -171,7 +171,7 @@ public interface IChargeState : IState
/// Gets the type of the charge cable connected to a <see cref="IVehicle"/>.
/// </summary>
[JsonProperty("conn_charge_cable")]
string ConnChargeCable { get; }
string? ConnChargeCable { get; }

/// <summary>
/// Gets the schedule charging start time of a <see cref="IVehicle"/>.
Expand Down Expand Up @@ -213,7 +213,7 @@ public interface IChargeState : IState
/// Gets the charge port latch of a <see cref="IVehicle"/>.
/// </summary>
[JsonProperty("charge_port_latch")]
string ChargePortLatch { get; }
string? ChargePortLatch { get; }

/// <summary>
/// Gets the charge current request of a <see cref="IVehicle"/>.
Expand Down
4 changes: 2 additions & 2 deletions src/Tesla.NET/Models/IDriveState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ public interface IDriveState : IState
/// Gets the shift state of a <see cref="IVehicle"/>.
/// </summary>
[JsonProperty("shift_state")]
string ShiftState { get; }
string? ShiftState { get; }

/// <summary>
/// Gets the speed <see cref="IVehicle"/>.
/// </summary>
[JsonProperty("speed")]
string Speed { get; }
string? Speed { get; }

/// <summary>
/// Gets the power <see cref="IVehicle"/>.
Expand Down
2 changes: 1 addition & 1 deletion src/Tesla.NET/Models/IMessageResponse.Generic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ public interface IMessageResponse<out TData> : IMessageResponse
/// <summary>
/// Gets the <typeparamref name="TData"/> object.
/// </summary>
TData Data { get; }
TData? Data { get; }
}
}
2 changes: 1 addition & 1 deletion src/Tesla.NET/Models/IMessageResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public interface IMessageResponse
/// <summary>
/// Gets the raw JSON of the <see cref="IMessageResponse"/>.
/// </summary>
JObject RawJson { get; }
JObject? RawJson { get; }

/// <summary>
/// Gets the raw JSON of the <see cref="IMessageResponse"/>.
Expand Down
16 changes: 8 additions & 8 deletions src/Tesla.NET/Models/IVehicle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,25 @@ public interface IVehicle
/// Gets the VIN (vehicle identification number) of the <see cref="IVehicle"/>.
/// </summary>
[JsonProperty("vin")]
string Vin { get; }
string? Vin { get; }

/// <summary>
/// Gets the display name of the <see cref="IVehicle"/>.
/// </summary>
[JsonProperty("display_name")]
string DisplayName { get; }
string? DisplayName { get; }

/// <summary>
/// Gets the option codes of the <see cref="IVehicle"/>.
/// </summary>
[JsonProperty("option_codes")]
string OptionCodes { get; }
string? OptionCodes { get; }

/// <summary>
/// Gets the color of the <see cref="IVehicle"/>.
/// </summary>
[JsonProperty("color")]
string Color { get; }
string? Color { get; }

/// <summary>
/// Gets the tokens of the <see cref="IVehicle"/>.
Expand All @@ -57,13 +57,13 @@ public interface IVehicle
/// Gets the state of the <see cref="IVehicle"/>.
/// </summary>
[JsonProperty("state")]
string State { get; }
string? State { get; }

/// <summary>
/// Gets the in service state of the <see cref="IVehicle"/>.
/// </summary>
[JsonProperty("in_service")]
string InService { get; }
string? InService { get; }

/// <summary>
/// Gets a value indicating whether remote start is enabled for the <see cref="IVehicle"/>.
Expand All @@ -87,12 +87,12 @@ public interface IVehicle
/// Gets the <see cref="BackseatToken"/> of the <see cref="IVehicle"/>.
/// </summary>
[JsonProperty("backseat_token")]
string BackseatToken { get; }
string? BackseatToken { get; }

/// <summary>
/// Gets the <see cref="BackseatTokenUpdatedAt"/> of the <see cref="IVehicle"/>.
/// </summary>
[JsonProperty("backseat_token_updated_at")]
string BackseatTokenUpdatedAt { get; }
string? BackseatTokenUpdatedAt { get; }
}
}
14 changes: 7 additions & 7 deletions src/Tesla.NET/Models/IVehicleState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ public interface IVehicleState : IState
/// Gets the state of auto-park.
/// </summary>
[JsonProperty("autopark_state")]
string AutoparkState { get; }
string? AutoparkState { get; }

/// <summary>
/// Gets the state of V2 auto-park.
/// </summary>
[JsonProperty("autopark_state_v2")]
string AutoparkStateV2 { get; }
string? AutoparkStateV2 { get; }

/// <summary>
/// Gets the style of auto-park.
/// </summary>
[JsonProperty("autopark_style")]
string AutoparkStyle { get; }
string? AutoparkStyle { get; }

/// <summary>
/// Gets a value indicating whether the Calendar is supported.
Expand All @@ -45,7 +45,7 @@ public interface IVehicleState : IState
/// Gets the car firmware version.
/// </summary>
[JsonProperty("car_version")]
string CarVersion { get; }
string? CarVersion { get; }

/// <summary>
/// Gets the state of the center display.
Expand Down Expand Up @@ -81,7 +81,7 @@ public interface IVehicleState : IState
/// Gets the last auto-park error.
/// </summary>
[JsonProperty("last_autopark_error")]
string LastAutoparkError { get; }
string? LastAutoparkError { get; }

/// <summary>
/// Gets a value indicating whether the car is locked.
Expand Down Expand Up @@ -147,7 +147,7 @@ public interface IVehicleState : IState
/// Gets the state of the sunroof.
/// </summary>
[JsonProperty("sun_roof_state")]
string SunRoofState { get; }
string? SunRoofState { get; }

/// <summary>
/// Gets a value indicating whether valet mode is enabled.
Expand All @@ -165,6 +165,6 @@ public interface IVehicleState : IState
/// Gets the name of the <see cref="IVehicle"/>.
/// </summary>
[JsonProperty("vehicle_name")]
string VehicleName { get; }
string? VehicleName { get; }
}
}
20 changes: 10 additions & 10 deletions src/Tesla.NET/Models/Internal/ChargeState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ public class ChargeState : IChargeState
/// <param name="notEnoughPowerToHeat">The <see cref="NotEnoughPowerToHeat"/>.</param>
/// <param name="timestamp">The <see cref="Timestamp"/>.</param>
public ChargeState(
string chargingState = null,
string fastChargerType = null,
string fastChargerBrand = null,
string? chargingState = null,
string? fastChargerType = null,
string? fastChargerBrand = null,
long? chargeLimitSoc = null,
long? chargeLimitSocStd = null,
long? chargeLimitSocMin = null,
Expand All @@ -84,13 +84,13 @@ public ChargeState(
bool? tripCharging = null,
long? chargeRate = null,
bool? chargePortDoorOpen = null,
string connChargeCable = null,
string? connChargeCable = null,
long? scheduledChargingStartTime = null,
bool? scheduledChargingPending = null,
bool? userChargeEnableRequest = null,
bool? chargeEnableRequest = null,
int? chargerPhases = null,
string chargePortLatch = null,
string? chargePortLatch = null,
long? chargeCurrentRequest = null,
long? chargeCurrentRequestMax = null,
bool? managedChargingActive = null,
Expand Down Expand Up @@ -146,17 +146,17 @@ public ChargeState(
/// <summary>
/// Gets the charging state of a <see cref="IVehicle"/>.
/// </summary>
public string ChargingState { get; }
public string? ChargingState { get; }

/// <summary>
/// Gets the type of fast charging.
/// </summary>
public string FastChargerType { get; }
public string? FastChargerType { get; }

/// <summary>
/// Gets the brand of fast charging.
/// </summary>
public string FastChargerBrand { get; }
public string? FastChargerBrand { get; }

/// <summary>
/// Gets the charge limit <see cref="IVehicle"/>.
Expand Down Expand Up @@ -276,7 +276,7 @@ public ChargeState(
/// <summary>
/// Gets the type of the charge cable connected to a <see cref="IVehicle"/>.
/// </summary>
public string ConnChargeCable { get; }
public string? ConnChargeCable { get; }

/// <summary>
/// Gets the schedule charging start time of a <see cref="IVehicle"/>.
Expand Down Expand Up @@ -311,7 +311,7 @@ public ChargeState(
/// <summary>
/// Gets the charge port latch of a <see cref="IVehicle"/>.
/// </summary>
public string ChargePortLatch { get; }
public string? ChargePortLatch { get; }

/// <summary>
/// Gets the charge current request of a <see cref="IVehicle"/>.
Expand Down
8 changes: 4 additions & 4 deletions src/Tesla.NET/Models/Internal/DriveState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public class DriveState : IDriveState
/// <param name="gpsAsOf">The <see cref="GpsAsOf"/>.</param>
/// <param name="timestamp">The <see cref="Timestamp"/>.</param>
public DriveState(
string shiftState = null,
string speed = null,
string? shiftState = null,
string? speed = null,
long power = 0L,
double latitude = 0D,
double longitude = 0D,
Expand All @@ -46,12 +46,12 @@ public DriveState(
/// <summary>
/// Gets the shift state of a <see cref="IVehicle"/>.
/// </summary>
public string ShiftState { get; }
public string? ShiftState { get; }

/// <summary>
/// Gets the speed <see cref="IVehicle"/>.
/// </summary>
public string Speed { get; }
public string? Speed { get; }

/// <summary>
/// Gets the power <see cref="IVehicle"/>.
Expand Down
8 changes: 4 additions & 4 deletions src/Tesla.NET/Models/Internal/MessageResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ namespace Tesla.NET.Models.Internal
public class MessageResponse<TData> : IMessageResponse<TData>
where TData : class
{
private readonly JObject _rawJson;
private readonly JObject? _rawJson;

/// <summary>
/// Initializes a new instance of the <see cref="MessageResponse{TData}"/> class.
/// </summary>
/// <param name="httpStatusCode">The <see cref="HttpStatusCode"/>.</param>
/// <param name="rawJson">The raw JSON of the <see cref="Data"/>.</param>
/// <param name="data">The <see cref="Data"/> object.</param>
public MessageResponse(HttpStatusCode httpStatusCode, JObject rawJson = null, TData data = null)
public MessageResponse(HttpStatusCode httpStatusCode, JObject? rawJson = null, TData? data = null)
{
HttpStatusCode = httpStatusCode;
_rawJson = rawJson;
Expand All @@ -40,7 +40,7 @@ public MessageResponse(HttpStatusCode httpStatusCode, JObject rawJson = null, TD
/// <summary>
/// Gets the raw JSON of the <see cref="IMessageResponse"/>.
/// </summary>
public JObject RawJson => (JObject)_rawJson?.DeepClone();
public JObject? RawJson => (JObject?)_rawJson?.DeepClone();

/// <summary>
/// Gets the raw JSON of the <see cref="IMessageResponse"/>.
Expand All @@ -50,7 +50,7 @@ public MessageResponse(HttpStatusCode httpStatusCode, JObject rawJson = null, TD
/// <summary>
/// Gets the <typeparamref name="TData"/> object.
/// </summary>
public TData Data { get; }
public TData? Data { get; }

private string DebuggerDisplay => $"{GetType().Name}: {HttpStatusCode:G}";
}
Expand Down
2 changes: 1 addition & 1 deletion src/Tesla.NET/Models/Internal/ResponseDataWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class ResponseDataWrapper<TResponse> : IResponseDataWrapper<TResponse>
/// Initializes a new instance of the <see cref="ResponseDataWrapper{TResponse}"/> class.
/// </summary>
/// <param name="response">The <see cref="Response"/> object.</param>
public ResponseDataWrapper(TResponse response = default)
public ResponseDataWrapper(TResponse response)
{
Response = response;
}
Expand Down
Loading