示例#1
0
 public static Microsoft.AspNetCore.Builder.IEndpointConventionBuilder MapHub <THub>(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder builder, string pattern, System.Action <Microsoft.AspNetCore.Http.Connections.HttpConnectionDispatcherOptions> configureOptions) where THub : Microsoft.AspNetCore.SignalR.Hub
 {
     throw null;
 }
示例#2
0
 public static Microsoft.AspNetCore.Builder.IEndpointConventionBuilder MapHub <THub>(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder builder, string pattern) where THub : Microsoft.AspNetCore.SignalR.Hub
 {
     throw null;
 }
 public static Microsoft.AspNetCore.Builder.ConnectionEndpointRouteBuilder MapConnections(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string pattern, Microsoft.AspNetCore.Http.Connections.HttpConnectionDispatcherOptions options, System.Action <Microsoft.AspNetCore.Connections.IConnectionBuilder> configure) => throw null;
        public static void MapAPIEndpoints(Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints)
        {
            endpoints.MapGet("/api/ingredient/all", async(context) =>
            {
                if (!context.Request.Query.ContainsKey("page") ||
                    !int.TryParse(context.Request.Query["page"].ToString(), out int page))
                {
                    page = 0;
                }
                if (!context.Request.Query.ContainsKey("count") ||
                    !int.TryParse(context.Request.Query["count"].ToString(), out int count))
                {
                    count = 100;
                }
                using ApplicationDbContext ctx = new ApplicationDbContext();
                IngredientAPI api = new IngredientAPI();
                Models.Ingredient[] ingredients = await api.GetAll(new AuthenticationToken(), page, count);
                await context.Response.WriteAsJsonAsync(ingredients);
            }
                             );
            endpoints.MapGet("/api/ingredient/", async(context) =>
            {
                if (!context.Request.Query.ContainsKey("id") ||
                    !long.TryParse(context.Request.Query["id"].ToString(), out long id))
                {
                    await context.Response.WriteAsJsonAsync(new { ResponseCode = 404, Message = "Could not find an Ingredient with that ID." });
                }
                else
                {
                    IngredientAPI api = new IngredientAPI();
                    await context.Response.WriteAsJsonAsync(api.GetOne(new AuthenticationToken(), id));
                }
            });

            endpoints.MapGet("/api/ingredient/match", async(context) =>
            {
                if (!context.Request.Query.ContainsKey("partial"))
                {
                    await context.Response.WriteAsJsonAsync(new { ResponseCode = 400, Message = "No partial provided to match Ingredients with." });
                }
                else
                {
                    string partial            = context.Request.Query["partial"].ToString();
                    bool mustBeginWithPartial = !context.Request.Query.ContainsKey("starts");
                    if (!mustBeginWithPartial)
                    {
                        bool.TryParse(context.Request.Query["starts"].ToString(), out mustBeginWithPartial);
                    }
                    int count = DEFAULT_PARTIAL_MATCH_COUNT;
                    if (context.Request.Query.ContainsKey("count"))
                    { //count is optional, but, we won't support abusing it
                        if (!int.TryParse(context.Request.Query["count"], out count) || count > MAX_PARTIAl_MATCH_COUNT || count < 1)
                        {
                            await context.Response.WriteAsJsonAsync(new { ResponseCode = 400, Message = "Invalid Ingredient count specified in request." });
                        }
                    }

                    IngredientAPI api = new IngredientAPI();
                    await context.Response.WriteAsJsonAsync(api.GetMatches(new AuthenticationToken(), partial, mustBeginWithPartial, count));
                }
            });

            endpoints.MapPost("/api/ingredient", async context =>
            {
                if (!context.Request.Query.ContainsKey("name") ||
                    string.IsNullOrWhiteSpace(context.Request.Query["name"].ToString()))
                {
                    await context.Response.WriteAsJsonAsync(new { ResponseCode = 404, Message = "Could not create an Ingredient with no name." });
                }
                else
                {
                    var name          = context.Request.Query["name"].ToString();
                    IngredientAPI api = new IngredientAPI();
                    await context.Response.WriteAsJsonAsync(api.Create(new AuthenticationToken(), name));
                }
            });
        }
示例#5
0
 private static void MapExternalHubs(Microsoft.AspNetCore.Routing.IEndpointRouteBuilder routes)
 {
     // TODO: use reflection to identify Hubs in the StandardFeatures assembly and add them
     routes.MapHub <ChatRoomHub>("/hubs/chatroom");
 }
 public static Microsoft.AspNetCore.Builder.ConnectionEndpointRouteBuilder MapConnectionHandler <TConnectionHandler>(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string pattern) where TConnectionHandler : Microsoft.AspNetCore.Connections.ConnectionHandler => throw null;
 public static Microsoft.AspNetCore.Builder.IEndpointConventionBuilder MapFallbackToFile(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string pattern, string filePath, Microsoft.AspNetCore.Builder.StaticFileOptions options)
 {
     throw null;
 }
 public static Microsoft.AspNetCore.Builder.ComponentEndpointConventionBuilder MapBlazorHub <TComponent>(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string selector, System.Action <Microsoft.AspNetCore.Http.Connections.HttpConnectionDispatcherOptions> configureOptions) where TComponent : Microsoft.AspNetCore.Components.IComponent
 {
     throw null;
 }
 public static Microsoft.AspNetCore.Builder.IEndpointConventionBuilder MapFallbackToFile(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder routes, string filePath)
 {
     throw null;
 }
 public static Microsoft.AspNetCore.Builder.IEndpointConventionBuilder MapHealthChecks(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string pattern, Microsoft.AspNetCore.Diagnostics.HealthChecks.HealthCheckOptions options)
 {
     throw null;
 }
 public static Microsoft.AspNetCore.Builder.ComponentEndpointConventionBuilder MapBlazorHub(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints)
 {
     throw null;
 }
 public static Microsoft.AspNetCore.Builder.IEndpointConventionBuilder MapWebPubSubHub <THub>(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string path) where THub : Microsoft.Azure.WebPubSub.AspNetCore.WebPubSubHub
 {
     throw null;
 }
示例#13
0
 public static void AddEndpoints(Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints)
 {
     endpoints.MapGrpcService <GreeterService>();
 }
 public static Microsoft.AspNetCore.Builder.ComponentEndpointConventionBuilder MapBlazorHub(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, System.Type componentType, string selector, string path)
 {
     throw null;
 }
 public static Microsoft.AspNetCore.Builder.IEndpointConventionBuilder MapConnections(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder builder, string pattern, System.Action <Microsoft.AspNetCore.Connections.IConnectionBuilder> configure)
 {
     throw null;
 }
 public static Microsoft.AspNetCore.Builder.ComponentEndpointConventionBuilder MapBlazorHub(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, System.Type componentType, string selector, string path, System.Action <Microsoft.AspNetCore.Http.Connections.HttpConnectionDispatcherOptions> configureOptions)
 {
     throw null;
 }
 public static Microsoft.AspNetCore.Builder.ConnectionEndpointRouteBuilder MapConnectionHandler <TConnectionHandler>(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string pattern, System.Action <Microsoft.AspNetCore.Http.Connections.HttpConnectionDispatcherOptions> configureOptions) where TConnectionHandler : Microsoft.AspNetCore.Connections.ConnectionHandler => throw null;
 public static Microsoft.AspNetCore.Builder.ComponentEndpointConventionBuilder MapBlazorHub <TComponent>(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string selector, string path) where TComponent : Microsoft.AspNetCore.Components.IComponent
 {
     throw null;
 }
 public static Microsoft.AspNetCore.Builder.IEndpointConventionBuilder MapHealthChecks(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder builder, string pattern)
 {
     throw null;
 }