chatbot/Chatbot.Api/Controllers/SystemController.cs

51 lines
1.4 KiB
C#
Raw Permalink Normal View History

2020-06-07 14:43:34 +03:00
using Chatbot.Api.Application.Commands;
using Chatbot.Api.Application.Queries;
2020-06-06 18:29:20 +03:00
using MediatR;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
namespace Chatbot.Api.Controllers
{
[Authorize]
[ApiController]
[Route("system")]
public class SystemController : ControllerBase
{
private readonly IMediator _mediator;
public SystemController(IMediator mediator)
{
_mediator = mediator;
}
[AllowAnonymous]
[HttpGet("ping")]
public IActionResult Ping()
{
return Ok("Chatbot api ping success.");
}
[HttpGet("bots")]
2020-06-06 19:21:40 +03:00
public async Task<IActionResult> GetBots([FromRoute] GetBots.Query query)
{
var result = await _mediator.Send(query);
return Ok(result);
}
2020-06-06 23:49:05 +03:00
[HttpGet("initialize-session/{botName}/{externalId}/{clientApplication}/{userKey}")]
2020-06-06 19:21:40 +03:00
public async Task<IActionResult> GetSession([FromRoute] GetSession.Query query)
{
var result = await _mediator.Send(query);
return Ok(result);
}
2020-06-07 14:43:34 +03:00
[HttpPost("test-logger")]
public async Task<IActionResult> CloseChat([FromBody] TestLogger closeChat)
{
var result = await _mediator.Send(closeChat);
return Ok(result);
}
2020-06-06 18:29:20 +03:00
}
}