diff --git a/BotSharp.Platform.Dialogflow/Controllers/AgentController.cs b/BotSharp.Platform.Dialogflow/Controllers/AgentController.cs index 30cf9777..c5623a7e 100644 --- a/BotSharp.Platform.Dialogflow/Controllers/AgentController.cs +++ b/BotSharp.Platform.Dialogflow/Controllers/AgentController.cs @@ -1,4 +1,6 @@ using BotSharp.Platform.Dialogflow.Models; +using BotSharp.Platform.Dialogflow.ViewModels; +using BotSharp.Platform.Models.Agents; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using System; @@ -32,7 +34,8 @@ namespace BotSharp.Platform.Dialogflow.Controllers /// /// [HttpPost("import")] - public async Task Import(IFormFile uploadedFile) + [ProducesResponseType(typeof(ImportedAgentViewModel), 200)] + public async Task Import(IFormFile uploadedFile) { if (uploadedFile == null || uploadedFile.Length == 0) { @@ -61,7 +64,13 @@ namespace BotSharp.Platform.Dialogflow.Controllers var agent = await builder.LoadAgentFromFile>(dest); await builder.SaveAgent(agent); - return Ok(agent.Id); + return Ok(new ImportedAgentViewModel + { + Id = agent.Id, + Name = agent.Name, + Description = agent.Description, + ClientAccessToken = agent.ClientAccessToken + }); } /// diff --git a/BotSharp.Platform.Models/Agents/ImportedAgentViewModel.cs b/BotSharp.Platform.Models/Agents/ImportedAgentViewModel.cs new file mode 100644 index 00000000..7c7a5da3 --- /dev/null +++ b/BotSharp.Platform.Models/Agents/ImportedAgentViewModel.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BotSharp.Platform.Models.Agents +{ + public class ImportedAgentViewModel + { + public string Id { get; set; } + + public string Name { get; set; } + + public string Description { get; set; } + + public string ClientAccessToken { get; set; } + } +} diff --git a/BotSharp.WebHost/SwaggerFileUploadOperation.cs b/BotSharp.WebHost/SwaggerFileUploadOperation.cs index 6d96a087..259faf34 100644 --- a/BotSharp.WebHost/SwaggerFileUploadOperation.cs +++ b/BotSharp.WebHost/SwaggerFileUploadOperation.cs @@ -11,7 +11,7 @@ namespace BotSharp.WebHost { public void Apply(Operation operation, OperationFilterContext context) { - if (operation.OperationId == "V1AgentImportPost") + if (operation.OperationId == "Import") { operation.Parameters.Clear();