using System;
namespace EmbedIO.Routing
{
partial class RoutingModuleExtensions
{
///
/// Adds a handler to a .
///
/// The on which this method is called.
/// A constant representing the HTTP method
/// to associate with , or
/// if can handle all HTTP methods.
/// The route to match URL paths against.
/// if
/// is a base route; if
/// is a terminal (non-base) route.
/// A callback used to handle matching contexts.
/// with the handler added.
/// is .
///
/// is .
/// - or -
/// is .
///
/// is not a valid route.
///
public static RoutingModule Handle(this RoutingModule @this, HttpVerbs verb, string route, bool isBaseRoute, RouteHandlerCallback handler)
{
@this.Add(verb, RouteMatcher.Parse(route, isBaseRoute), handler);
return @this;
}
///
/// Adds a synchronous handler to a .
///
/// The on which this method is called.
/// A constant representing the HTTP method
/// to associate with , or
/// if can handle all HTTP methods.
/// The route to match URL paths against.
/// if
/// is a base route; if
/// is a terminal (non-base) route.
/// A callback used to handle matching contexts.
/// with the handler added.
/// is .
///
/// is .
/// - or -
/// is .
///
/// is not a valid route.
///
public static RoutingModule Handle(this RoutingModule @this, HttpVerbs verb, string route, bool isBaseRoute, SyncRouteHandlerCallback handler)
{
@this.Add(verb, RouteMatcher.Parse(route, isBaseRoute), handler);
return @this;
}
///
/// Associates all requests matching a route to a handler.
///
/// The on which this method is called.
/// The route to match URL paths against.
/// if
/// is a base route; if
/// is a terminal (non-base) route.
/// A callback used to handle matching contexts.
/// with the handler added.
/// is .
///
/// is .
/// - or -
/// is .
///
/// is not a valid route.
public static RoutingModule OnAny(this RoutingModule @this, string route, bool isBaseRoute, RouteHandlerCallback handler)
{
@this.Add(HttpVerbs.Any, RouteMatcher.Parse(route, isBaseRoute), handler);
return @this;
}
///
/// Associates all requests matching a route to a synchronous handler.
///
/// The on which this method is called.
/// The route to match URL paths against.
/// if
/// is a base route; if
/// is a terminal (non-base) route.
/// A callback used to handle matching contexts.
/// with the handler added.
/// is .
///
/// is .
/// - or -
/// is .
///
/// is not a valid route.
public static RoutingModule OnAny(this RoutingModule @this, string route, bool isBaseRoute, SyncRouteHandlerCallback handler)
{
@this.Add(HttpVerbs.Any, RouteMatcher.Parse(route, isBaseRoute), handler);
return @this;
}
///
/// Associates DELETE requests matching a route to a handler.
///
/// The on which this method is called.
/// The route to match URL paths against.
/// if
/// is a base route; if
/// is a terminal (non-base) route.
/// A callback used to handle matching contexts.
/// with the handler added.
/// is .
///
/// is .
/// - or -
/// is .
///
/// is not a valid route.
public static RoutingModule OnDelete(this RoutingModule @this, string route, bool isBaseRoute, RouteHandlerCallback handler)
{
@this.Add(HttpVerbs.Delete, RouteMatcher.Parse(route, isBaseRoute), handler);
return @this;
}
///
/// Associates DELETE requests matching a route to a synchronous handler.
///
/// The on which this method is called.
/// The route to match URL paths against.
/// if
/// is a base route; if
/// is a terminal (non-base) route.
/// A callback used to handle matching contexts.
/// with the handler added.
/// is .
///
/// is .
/// - or -
/// is .
///
/// is not a valid route.
public static RoutingModule OnDelete(this RoutingModule @this, string route, bool isBaseRoute, SyncRouteHandlerCallback handler)
{
@this.Add(HttpVerbs.Delete, RouteMatcher.Parse(route, isBaseRoute), handler);
return @this;
}
///
/// Associates GET requests matching a route to a handler.
///
/// The on which this method is called.
/// The route to match URL paths against.
/// if
/// is a base route; if
/// is a terminal (non-base) route.
/// A callback used to handle matching contexts.
/// with the handler added.
/// is .
///
/// is .
/// - or -
/// is .
///
/// is not a valid route.
public static RoutingModule OnGet(this RoutingModule @this, string route, bool isBaseRoute, RouteHandlerCallback handler)
{
@this.Add(HttpVerbs.Get, RouteMatcher.Parse(route, isBaseRoute), handler);
return @this;
}
///
/// Associates GET requests matching a route to a synchronous handler.
///
/// The on which this method is called.
/// The route to match URL paths against.
/// if
/// is a base route; if
/// is a terminal (non-base) route.
/// A callback used to handle matching contexts.
/// with the handler added.
/// is .
///
/// is .
/// - or -
/// is .
///
/// is not a valid route.
public static RoutingModule OnGet(this RoutingModule @this, string route, bool isBaseRoute, SyncRouteHandlerCallback handler)
{
@this.Add(HttpVerbs.Get, RouteMatcher.Parse(route, isBaseRoute), handler);
return @this;
}
///
/// Associates HEAD requests matching a route to a handler.
///
/// The on which this method is called.
/// The route to match URL paths against.
/// if
/// is a base route; if
/// is a terminal (non-base) route.
/// A callback used to handle matching contexts.
/// with the handler added.
/// is .
///
/// is .
/// - or -
/// is .
///
/// is not a valid route.
public static RoutingModule OnHead(this RoutingModule @this, string route, bool isBaseRoute, RouteHandlerCallback handler)
{
@this.Add(HttpVerbs.Head, RouteMatcher.Parse(route, isBaseRoute), handler);
return @this;
}
///
/// Associates HEAD requests matching a route to a synchronous handler.
///
/// The on which this method is called.
/// The route to match URL paths against.
/// if
/// is a base route; if
/// is a terminal (non-base) route.
/// A callback used to handle matching contexts.
/// with the handler added.
/// is .
///
/// is .
/// - or -
/// is .
///
/// is not a valid route.
public static RoutingModule OnHead(this RoutingModule @this, string route, bool isBaseRoute, SyncRouteHandlerCallback handler)
{
@this.Add(HttpVerbs.Head, RouteMatcher.Parse(route, isBaseRoute), handler);
return @this;
}
///
/// Associates OPTIONS requests matching a route to a handler.
///
/// The on which this method is called.
/// The route to match URL paths against.
/// if
/// is a base route; if
/// is a terminal (non-base) route.
/// A callback used to handle matching contexts.
/// with the handler added.
/// is .
///
/// is .
/// - or -
/// is .
///
/// is not a valid route.
public static RoutingModule OnOptions(this RoutingModule @this, string route, bool isBaseRoute, RouteHandlerCallback handler)
{
@this.Add(HttpVerbs.Options, RouteMatcher.Parse(route, isBaseRoute), handler);
return @this;
}
///
/// Associates OPTIONS requests matching a route to a synchronous handler.
///
/// The on which this method is called.
/// The route to match URL paths against.
/// if
/// is a base route; if
/// is a terminal (non-base) route.
/// A callback used to handle matching contexts.
/// with the handler added.
/// is .
///
/// is .
/// - or -
/// is .
///
/// is not a valid route.
public static RoutingModule OnOptions(this RoutingModule @this, string route, bool isBaseRoute, SyncRouteHandlerCallback handler)
{
@this.Add(HttpVerbs.Options, RouteMatcher.Parse(route, isBaseRoute), handler);
return @this;
}
///
/// Associates PATCH requests matching a route to a handler.
///
/// The on which this method is called.
/// The route to match URL paths against.
/// if
/// is a base route; if
/// is a terminal (non-base) route.
/// A callback used to handle matching contexts.
/// with the handler added.
/// is .
///
/// is .
/// - or -
/// is .
///
/// is not a valid route.
public static RoutingModule OnPatch(this RoutingModule @this, string route, bool isBaseRoute, RouteHandlerCallback handler)
{
@this.Add(HttpVerbs.Patch, RouteMatcher.Parse(route, isBaseRoute), handler);
return @this;
}
///
/// Associates PATCH requests matching a route to a synchronous handler.
///
/// The on which this method is called.
/// The route to match URL paths against.
/// if
/// is a base route; if
/// is a terminal (non-base) route.
/// A callback used to handle matching contexts.
/// with the handler added.
/// is .
///
/// is .
/// - or -
/// is .
///
/// is not a valid route.
public static RoutingModule OnPatch(this RoutingModule @this, string route, bool isBaseRoute, SyncRouteHandlerCallback handler)
{
@this.Add(HttpVerbs.Patch, RouteMatcher.Parse(route, isBaseRoute), handler);
return @this;
}
///
/// Associates POST requests matching a route to a handler.
///
/// The on which this method is called.
/// The route to match URL paths against.
/// if
/// is a base route; if
/// is a terminal (non-base) route.
/// A callback used to handle matching contexts.
/// with the handler added.
/// is .
///
/// is .
/// - or -
/// is .
///
/// is not a valid route.
public static RoutingModule OnPost(this RoutingModule @this, string route, bool isBaseRoute, RouteHandlerCallback handler)
{
@this.Add(HttpVerbs.Post, RouteMatcher.Parse(route, isBaseRoute), handler);
return @this;
}
///
/// Associates POST requests matching a route to a synchronous handler.
///
/// The on which this method is called.
/// The route to match URL paths against.
/// if
/// is a base route; if
/// is a terminal (non-base) route.
/// A callback used to handle matching contexts.
/// with the handler added.
/// is .
///
/// is .
/// - or -
/// is .
///
/// is not a valid route.
public static RoutingModule OnPost(this RoutingModule @this, string route, bool isBaseRoute, SyncRouteHandlerCallback handler)
{
@this.Add(HttpVerbs.Post, RouteMatcher.Parse(route, isBaseRoute), handler);
return @this;
}
///
/// Associates PUT requests matching a route to a handler.
///
/// The on which this method is called.
/// The route to match URL paths against.
/// if
/// is a base route; if
/// is a terminal (non-base) route.
/// A callback used to handle matching contexts.
/// with the handler added.
/// is .
///
/// is .
/// - or -
/// is .
///
/// is not a valid route.
public static RoutingModule OnPut(this RoutingModule @this, string route, bool isBaseRoute, RouteHandlerCallback handler)
{
@this.Add(HttpVerbs.Put, RouteMatcher.Parse(route, isBaseRoute), handler);
return @this;
}
///
/// Associates PUT requests matching a route to a synchronous handler.
///
/// The on which this method is called.
/// The route to match URL paths against.
/// if
/// is a base route; if
/// is a terminal (non-base) route.
/// A callback used to handle matching contexts.
/// with the handler added.
/// is .
///
/// is .
/// - or -
/// is .
///
/// is not a valid route.
public static RoutingModule OnPut(this RoutingModule @this, string route, bool isBaseRoute, SyncRouteHandlerCallback handler)
{
@this.Add(HttpVerbs.Put, RouteMatcher.Parse(route, isBaseRoute), handler);
return @this;
}
}
}