Files
Pilz/Pilz.Net/Api/ApiMessageHandlerAttribute.cs
Pilzinsel64 9dcaa7e507 add support for REST-ful API building
- allow parameters within url
- allow different methods other then just POST
-> still needs to be tested!
2024-11-28 09:03:48 +01:00

22 lines
601 B
C#

namespace Pilz.Net.Api;
[AttributeUsage(AttributeTargets.Method)]
public class ApiMessageHandlerAttribute(string route, params string[] methods) : Attribute
{
public ApiMessageHandlerAttribute(string route, params HttpMethod[] methods)
: this(route, methods.Select(m => m.Method).ToArray())
{
}
public ApiMessageHandlerAttribute(string route)
: this(route, HttpMethod.Post)
{
}
public string Route { get; } = route;
public string[] Methods { get; } = methods;
public Type? Serializer { get; set; }
public bool RequiesAuth { get; set; }
}