2018-08-27 12:59:47 +00:00
|
|
|
|
using Swashbuckle.AspNetCore.Swagger;
|
|
|
|
|
|
using Swashbuckle.AspNetCore.SwaggerGen;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
2018-08-27 14:14:20 +00:00
|
|
|
|
using System.Linq;
|
2018-08-27 12:59:47 +00:00
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
|
|
namespace BotSharp.WebHost
|
|
|
|
|
|
{
|
|
|
|
|
|
public class SwaggerFileUploadOperation : IOperationFilter
|
|
|
|
|
|
{
|
|
|
|
|
|
public void Apply(Operation operation, OperationFilterContext context)
|
|
|
|
|
|
{
|
2018-08-27 21:04:00 +00:00
|
|
|
|
if (operation.OperationId == "V1AgentRestorePost")
|
2018-08-27 12:59:47 +00:00
|
|
|
|
{
|
|
|
|
|
|
operation.Parameters.Clear();
|
2018-08-27 14:14:20 +00:00
|
|
|
|
|
2018-08-27 12:59:47 +00:00
|
|
|
|
operation.Parameters.Add(new NonBodyParameter
|
|
|
|
|
|
{
|
|
|
|
|
|
Name = "uploadedFile",
|
|
|
|
|
|
In = "formData",
|
2018-08-27 21:04:00 +00:00
|
|
|
|
Description = "Upload Zip File, meta.json is the extra data for customized function.",
|
2018-08-27 12:59:47 +00:00
|
|
|
|
Required = true,
|
|
|
|
|
|
Type = "file"
|
|
|
|
|
|
});
|
|
|
|
|
|
operation.Consumes.Add("multipart/form-data");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|