diff --git a/Winleafs.Api/Endpoints/EffectsEndpoint.cs b/Winleafs.Api/Endpoints/EffectsEndpoint.cs
index 86870ecb..4e6ba77e 100644
--- a/Winleafs.Api/Endpoints/EffectsEndpoint.cs
+++ b/Winleafs.Api/Endpoints/EffectsEndpoint.cs
@@ -55,7 +55,6 @@ public void SetSelectedEffect(string effectName)
SendRequest(BaseUrl, Method.PUT, body: new { select = effectName});
}
-
///
public Task GetEffectDetailsAsync(string effectName)
{
@@ -78,6 +77,18 @@ public Effect GetEffectDetails(string effectName)
return SendRequest(BaseUrl, Method.PUT, CreateWriteEffectCommand(effectName));
}
+ ///
+ public void WriteCustomEffectCommand(CustomEffectCommand customEffectCommand)
+ {
+ SendRequest(BaseUrl, Method.PUT, body: CreateWriteAnimationCommand(customEffectCommand));
+ }
+
+ ///
+ public async Task WriteCustomEffectCommandAsync(CustomEffectCommand customEffectCommand)
+ {
+ await SendRequestAsync(BaseUrl, Method.PUT, body: CreateWriteAnimationCommand(customEffectCommand));
+ }
+
private static object CreateWriteEffectCommand(string effectName)
{
return new
@@ -89,5 +100,13 @@ private static object CreateWriteEffectCommand(string effectName)
}
};
}
+
+ private static object CreateWriteAnimationCommand(CustomEffectCommand customAnimationCommand)
+ {
+ return new
+ {
+ write = customAnimationCommand
+ };
+ }
}
}
diff --git a/Winleafs.Api/Endpoints/Interfaces/IEffectsEndpoint.cs b/Winleafs.Api/Endpoints/Interfaces/IEffectsEndpoint.cs
index 92e636f7..64acfd49 100644
--- a/Winleafs.Api/Endpoints/Interfaces/IEffectsEndpoint.cs
+++ b/Winleafs.Api/Endpoints/Interfaces/IEffectsEndpoint.cs
@@ -44,5 +44,15 @@ public interface IEffectsEndpoint
///
Effect GetEffectDetails(string effectName);
+
+ ///
+ /// Send a command for a custom effect.
+ ///
+ /// The custom effect command to be sent.
+ /// The details about the effect.
+ Task WriteCustomEffectCommandAsync(CustomEffectCommand customEffectCommand);
+
+ ///
+ void WriteCustomEffectCommand(CustomEffectCommand customEffectCommand);
}
}
diff --git a/Winleafs.Api/Endpoints/NanoleafEndpoint.cs b/Winleafs.Api/Endpoints/NanoleafEndpoint.cs
index 95c95224..10d1480e 100644
--- a/Winleafs.Api/Endpoints/NanoleafEndpoint.cs
+++ b/Winleafs.Api/Endpoints/NanoleafEndpoint.cs
@@ -4,6 +4,7 @@
using Newtonsoft.Json;
using NLog;
using RestSharp;
+using RestSharp.Serializers.NewtonsoftJson;
namespace Winleafs.Api.Endpoints
{
@@ -60,6 +61,8 @@ protected async Task