add support for REST-ful API building
- allow parameters within url - allow different methods other then just POST -> still needs to be tested!
This commit is contained in:
@@ -1,9 +1,21 @@
|
||||
namespace Pilz.Net.Api;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public class ApiMessageHandlerAttribute(string route) : Attribute
|
||||
public class ApiMessageHandlerAttribute(string route, params string[] methods) : Attribute
|
||||
{
|
||||
public string Route { get; set; } = route;
|
||||
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; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user