Update DefaultEndpoint
Update ControlActionEnum.cs
This commit is contained in:
2024-11-03 01:11:33 +01:00
parent 7693aa8b09
commit ce0a287e4e
6 changed files with 10 additions and 23 deletions

View File

@ -20,7 +20,7 @@ public class OpenShockHttp : OpenShockApi
" \"shocks\": [" +
" {" +
$" \"id\": \"{openShockShocker.ID}\"," +
$" \"type\": {ControlActionToByte(action)}," +
$" \"type\": \"{Enum.GetName(action)}\"," +
$" \"intensity\": {intensity}," +
$" \"duration\": {duration}" +
" }" +
@ -31,17 +31,6 @@ public class OpenShockHttp : OpenShockApi
ApiHttpClient.MakeAPICall(HttpMethod.Post, $"{Endpoint}/2/shockers/control", json, this.Logger, new ValueTuple<string, string>("OpenShockToken", ApiKey));
}
private byte ControlActionToByte(ControlAction action)
{
return action switch
{
ControlAction.Beep => 3,
ControlAction.Vibrate => 2,
ControlAction.Shock => 1,
_ => 0
};
}
public OpenShockHttp(string apiKey, string endpoint = "https://api.shocklink.net", ILogger? logger = null) : base(DeviceApi.OpenShockHttp, apiKey, endpoint, logger)
{
}