Add entities and intents interface for Dialogflow mode.

This commit is contained in:
Oceania2018 2018-09-25 12:35:08 -05:00
parent 9c99580317
commit e20d7b48a3
5 changed files with 101 additions and 0 deletions

View file

@ -29,6 +29,11 @@
<param name="agentId"></param>
<returns></returns>
</member>
<member name="T:BotSharp.RestApi.Dialogflow.EntitiesController">
<summary>
The /entities endpoint is used to create, retrieve, update, and delete developer-defined entity objects.
</summary>
</member>
<member name="T:BotSharp.RestApi.Dialogflow.QueryController">
<summary>
Dialogflow mode query controller

View file

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace BotSharp.RestApi.Dialogflow
{
public class DialogflowAllEntityViewModel
{
public int Count { get; set; }
public string Id { get; set; }
public string Name { get; set; }
public string Preview { get; set; }
}
}

View file

@ -0,0 +1,24 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Text;
namespace BotSharp.RestApi.Dialogflow
{
#if DIALOGFLOW
/// <summary>
/// The /entities endpoint is used to create, retrieve, update, and delete developer-defined entity objects.
/// </summary>
[Authorize]
[Route("v1/[controller]")]
public class EntitiesController : ControllerBase
{
[HttpGet]
public IEnumerable<DialogflowAllEntityViewModel> All()
{
return new List<DialogflowAllEntityViewModel>();
}
}
#endif
}

View file

@ -0,0 +1,55 @@
using BotSharp.Core.Adapters.Dialogflow;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Text;
namespace BotSharp.RestApi.Dialogflow
{
#if DIALOGFLOW
/// <summary>
/// The /intents endpoint is used to create, retrieve, update, and delete intent objects.
/// </summary>
[Authorize]
[Route("v1/[controller]")]
public class IntentsController : ControllerBase
{
/// <summary>
/// Retrieves a list of all intents for the agent.
/// </summary>
/// <returns></returns>
[HttpGet]
public IEnumerable<DialogflowIntent> GetIntents()
{
return new List<DialogflowIntent>();
}
/// <summary>
/// The POST request creates a new intent. When a new intent is created via the API, the agent is trained with the new data.
/// </summary>
/// <returns></returns>
[HttpPost]
public string PostIntent([FromBody] DialogflowIntent intent)
{
return "";
}
/// <summary>
/// Retrieves the specified intent. {id} is the ID of the intent to retrieve.
/// </summary>
/// <returns></returns>
[HttpGet("{id}")]
public DialogflowIntent GetIntent()
{
return new DialogflowIntent();
}
[HttpPut("{id}")]
public bool PutIntent([FromBody] DialogflowIntent intent)
{
return true;
}
}
#endif
}

BIN
docs/static/logos/WechatQRCode.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB