chat controller
parent
235b6b52cc
commit
5a649681e9
|
@ -0,0 +1,36 @@
|
|||
using Chatbot.Api.Application.Commands;
|
||||
using Chatbot.Api.Application.Queries;
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Chatbot.Api.Controllers
|
||||
{
|
||||
[Authorize]
|
||||
[ApiController]
|
||||
[Route("chat")]
|
||||
public class ChatController : ControllerBase
|
||||
{
|
||||
private readonly IMediator _mediator;
|
||||
|
||||
public ChatController(IMediator mediator)
|
||||
{
|
||||
_mediator = mediator;
|
||||
}
|
||||
|
||||
[HttpGet("initialize/{sessionId}")]
|
||||
public async Task<IActionResult> GetChat([FromRoute] GetChat.Query query)
|
||||
{
|
||||
var result = await _mediator.Send(query);
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
[HttpPost("message")]
|
||||
public async Task<IActionResult> SaveChatMessage([FromBody] SaveChatMessage saveChatMessage)
|
||||
{
|
||||
var result = await _mediator.Send(saveChatMessage);
|
||||
return Ok(result);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -32,18 +32,11 @@ namespace Chatbot.Api.Controllers
|
|||
return Ok(result);
|
||||
}
|
||||
|
||||
[HttpGet("initialize-session")]
|
||||
[HttpGet("initialize-session/{botName}/{externalId}/{clientApplication}/{userKey}")]
|
||||
public async Task<IActionResult> GetSession([FromRoute] GetSession.Query query)
|
||||
{
|
||||
var result = await _mediator.Send(query);
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
[HttpGet("initialize-chat")]
|
||||
public async Task<IActionResult> GetChat([FromRoute] GetChat.Query query)
|
||||
{
|
||||
var result = await _mediator.Send(query);
|
||||
return Ok(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue