feat(openai): 新增词条相关接口

This commit is contained in:
Fu Diwei 2021-10-08 21:11:06 +08:00
parent 46353f749d
commit b98688662a
44 changed files with 1042 additions and 7 deletions

View File

@ -0,0 +1,109 @@
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Flurl;
using Flurl.Http;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI
{
public static class WechatOpenAIClientExecuteDictionaryExtensions
{
/// <summary>
/// <para>异步调用 [POST] /v2/dict/save 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/openapi/api/v2/dict/save.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.DictionarySaveResponse> ExecuteDictionarySaveAsync(this WechatOpenAIClient client, Models.DictionarySaveRequest request, CancellationToken cancellationToken = default)
{
if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request));
IFlurlRequest flurlReq = client
.CreateRequest(request, HttpMethod.Post, "v2", "dict", "save");
return await client.SendRequestWithJsonAsync<Models.DictionarySaveResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /v2/dict/get_list 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/openapi/api/v2/dict/get_list.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.DictionaryGetListResponse> ExecuteDictionaryGetListAsync(this WechatOpenAIClient client, Models.DictionaryGetListRequest request, CancellationToken cancellationToken = default)
{
if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request));
IFlurlRequest flurlReq = client
.CreateRequest(request, HttpMethod.Post, "v2", "dict", "get_list");
return await client.SendRequestWithJsonAsync<Models.DictionaryGetListResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /v2/dict/get_builtin_list 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/openapi/api/v2/dict/get_builtin_list.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.DictionaryGetBuiltinListResponse> ExecuteDictionaryGetBuiltinListAsync(this WechatOpenAIClient client, Models.DictionaryGetBuiltinListRequest request, CancellationToken cancellationToken = default)
{
if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request));
IFlurlRequest flurlReq = client
.CreateRequest(request, HttpMethod.Get, "v2", "dict", "get_builtin_list");
return await client.SendRequestWithJsonAsync<Models.DictionaryGetBuiltinListResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /v2/dict/get_all_list 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/openapi/api/v2/dict/get_all_list.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.DictionaryGetAllListResponse> ExecuteDictionaryGetAllListAsync(this WechatOpenAIClient client, Models.DictionaryGetAllListRequest request, CancellationToken cancellationToken = default)
{
if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request));
IFlurlRequest flurlReq = client
.CreateRequest(request, HttpMethod.Post, "v2", "dict", "get_all_list");
return await client.SendRequestWithJsonAsync<Models.DictionaryGetAllListResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /v2/dict/delete 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/openapi/api/v2/dict/delete.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.DictionaryDeleteResponse> ExecuteDictionaryDeleteAsync(this WechatOpenAIClient client, Models.DictionaryDeleteRequest request, CancellationToken cancellationToken = default)
{
if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request));
IFlurlRequest flurlReq = client
.CreateRequest(request, HttpMethod.Post, "v2", "dict", "delete");
return await client.SendRequestWithJsonAsync<Models.DictionaryDeleteResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
}
}

View File

@ -0,0 +1,109 @@
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Flurl;
using Flurl.Http;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI
{
public static class WechatOpenAIClientExecuteWordExtensions
{
/// <summary>
/// <para>异步调用 [POST] /v2/word/update/batch 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/openapi/api/v1/word/batch_update.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.WordUpdateBatchResponse> ExecuteWordUpdateBatchAsync(this WechatOpenAIClient client, Models.WordUpdateBatchRequest request, CancellationToken cancellationToken = default)
{
if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request));
IFlurlRequest flurlReq = client
.CreateRequest(request, HttpMethod.Post, "v2", "word", "update", "batch");
return await client.SendRequestWithJsonAsync<Models.WordUpdateBatchResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /v2/word/delete/batch 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/openapi/api/v1/word/batch_delete.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.WordDeleteBatchResponse> ExecuteWordDeleteBatchAsync(this WechatOpenAIClient client, Models.WordDeleteBatchRequest request, CancellationToken cancellationToken = default)
{
if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request));
IFlurlRequest flurlReq = client
.CreateRequest(request, HttpMethod.Post, "v2", "word", "delete", "batch");
return await client.SendRequestWithJsonAsync<Models.WordDeleteBatchResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /v2/word/import 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/openapi/api/v2/word/import.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.WordImportResponse> ExecuteWordImportAsync(this WechatOpenAIClient client, Models.WordImportRequest request, CancellationToken cancellationToken = default)
{
if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request));
IFlurlRequest flurlReq = client
.CreateRequest(request, HttpMethod.Post, "v2", "word", "import");
return await client.SendRequestWithJsonAsync<Models.WordImportResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /v2/word/import/json 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/openapi/api/v2/word/json_import.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.WordImportJsonResponse> ExecuteWordImportJsonAsync(this WechatOpenAIClient client, Models.WordImportJsonRequest request, CancellationToken cancellationToken = default)
{
if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request));
IFlurlRequest flurlReq = client
.CreateRequest(request, HttpMethod.Post, "v2", "word", "import", "json");
return await client.SendRequestWithJsonAsync<Models.WordImportJsonResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /v2/word/export 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/openapi/api/v2/word/export.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.WordExportResponse> ExecuteWordExportAsync(this WechatOpenAIClient client, Models.WordExportRequest request, CancellationToken cancellationToken = default)
{
if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request));
IFlurlRequest flurlReq = client
.CreateRequest(request, HttpMethod.Post, "v2", "word", "export");
return await client.SendRequestWithJsonAsync<Models.WordExportResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
}
}

View File

@ -10,28 +10,28 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
public static class Types
{
public class SkillIntent
public class Intent
{
/// <summary>
/// 获取或设置技能名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("skill")]
[System.Text.Json.Serialization.JsonPropertyName("skill")]
public string Skill { get; set; } = string.Empty;
public string SkillName { get; set; } = string.Empty;
/// <summary>
/// 获取或设置原来意图名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("old_intent")]
[System.Text.Json.Serialization.JsonPropertyName("old_intent")]
public string? OldIntent { get; set; }
public string? OldIntentName { get; set; }
/// <summary>
/// 获取或设置意图名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("intent")]
[System.Text.Json.Serialization.JsonPropertyName("intent")]
public string Intent { get; set; } = string.Empty;
public string IntentName { get; set; } = string.Empty;
/// <summary>
/// 获取或设置相似度。
@ -65,11 +65,11 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
}
/// <summary>
/// 获取或设置技能意图列表。
/// 获取或设置意图列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("data")]
[System.Text.Json.Serialization.JsonPropertyName("data")]
public IList<Types.SkillIntent> SkillIntentList { get; set; } = new List<Types.SkillIntent>();
public IList<Types.Intent> IntentList { get; set; } = new List<Types.Intent>();
/// <summary>
/// 获取或设置导入模式。

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v2/dict/delete 接口的请求。</para>
/// </summary>
public class DictionaryDeleteRequest : WechatOpenAIRequest
{
/// <summary>
/// 获取或设置词典 ID 列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("id_list")]
[System.Text.Json.Serialization.JsonPropertyName("id_list")]
public IList<long> DictionaryIdList { get; set; } = new List<long>();
}
}

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v2/dict/delete 接口的响应。</para>
/// </summary>
public class DictionaryDeleteResponse : WechatOpenAIResponse
{
}
}

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v2/dict/get_all_list 接口的请求。</para>
/// </summary>
public class DictionaryGetAllListRequest : WechatOpenAIRequest
{
}
}

View File

@ -0,0 +1,75 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v2/dict/get_all_list 接口的响应。</para>
/// </summary>
public class DictionaryGetAllListResponse : WechatOpenAIResponse<DictionaryGetAllListResponse.Types.Data>
{
public static class Types
{
public class Data
{
public static class Types
{
public class DictionaryItem
{
/// <summary>
/// 获取或设置词典 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("id")]
[System.Text.Json.Serialization.JsonPropertyName("id")]
public long? DictionaryId { get; set; }
/// <summary>
/// 获取或设置中文名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("name_ch")]
[System.Text.Json.Serialization.JsonPropertyName("name_ch")]
public string ChineseName { get; set; } = default!;
/// <summary>
/// 获取或设置英文名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("name_en")]
[System.Text.Json.Serialization.JsonPropertyName("name_en")]
public string EnglishName { get; set; } = default!;
}
public class DictionaryList
{
/// <summary>
/// 获取或设置词典列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("list")]
[System.Text.Json.Serialization.JsonPropertyName("list")]
public DictionaryItem[] Items { get; set; } = default!;
/// <summary>
/// 获取或设置词典总数量。
/// </summary>
[Newtonsoft.Json.JsonProperty("count")]
[System.Text.Json.Serialization.JsonPropertyName("count")]
public int TotalCount { get; set; }
}
}
/// <summary>
/// 获取或设置系统内置的词典列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("sys")]
[System.Text.Json.Serialization.JsonPropertyName("sys")]
public Types.DictionaryList BuiltinDictionaryList { get; set; } = default!;
/// <summary>
/// 获取或设置自定义的词典列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("user")]
[System.Text.Json.Serialization.JsonPropertyName("user")]
public Types.DictionaryList CustomDictionaryList { get; set; } = default!;
}
}
}
}

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [GET] /v2/dict/get_builtin_list 接口的请求。</para>
/// </summary>
public class DictionaryGetBuiltinListRequest : WechatOpenAIRequest
{
}
}

View File

@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [GET] /v2/dict/get_builtin_list 接口的响应。</para>
/// </summary>
public class DictionaryGetBuiltinListResponse : WechatOpenAIResponse<DictionaryGetBuiltinListResponse.Types.Data>
{
public static class Types
{
public class Data
{
public static class Types
{
public class Dictionary
{
/// <summary>
/// 获取或设置中文名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("name_ch")]
[System.Text.Json.Serialization.JsonPropertyName("name_ch")]
public string ChineseName { get; set; } = default!;
/// <summary>
/// 获取或设置英文名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("name_en")]
[System.Text.Json.Serialization.JsonPropertyName("name_en")]
public string EnglishName { get; set; } = default!;
}
}
/// <summary>
/// 获取或设置系统内置的词典列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("list")]
[System.Text.Json.Serialization.JsonPropertyName("list")]
public Types.Dictionary[] DictionaryList { get; set; } = default!;
/// <summary>
/// 获取或设置系统内置的词典总数量。
/// </summary>
[Newtonsoft.Json.JsonProperty("count")]
[System.Text.Json.Serialization.JsonPropertyName("count")]
public int TotalCount { get; set; }
}
}
}
}

View File

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v2/dict/get_list 接口的请求。</para>
/// </summary>
public class DictionaryGetListRequest : WechatOpenAIRequest
{
/// <summary>
/// 获取或设置关键词。
/// </summary>
[Newtonsoft.Json.JsonProperty("keyword")]
[System.Text.Json.Serialization.JsonPropertyName("keyword")]
public string? Keyword { get; set; }
/// <summary>
/// 获取或设置分页页数。
/// <para>默认值1</para>
/// </summary>
[Newtonsoft.Json.JsonProperty("page")]
[System.Text.Json.Serialization.JsonPropertyName("page")]
public int Page { get; set; } = 1;
/// <summary>
/// 获取或设置分页每页数量。
/// <para>默认值10</para>
/// </summary>
[Newtonsoft.Json.JsonProperty("size")]
[System.Text.Json.Serialization.JsonPropertyName("size")]
public int Limit { get; set; } = 10;
}
}

View File

@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v2/dict/get_list 接口的响应。</para>
/// </summary>
public class DictionaryGetListResponse : WechatOpenAIResponse<DictionaryGetListResponse.Types.Data>
{
public static class Types
{
public class Data
{
public static class Types
{
public class Dictionary
{
/// <summary>
/// 获取或设置词典 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("id")]
[System.Text.Json.Serialization.JsonPropertyName("id")]
public long DictionaryId { get; set; }
/// <summary>
/// 获取或设置中文名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("name_ch")]
[System.Text.Json.Serialization.JsonPropertyName("name_ch")]
public string ChineseName { get; set; } = default!;
/// <summary>
/// 获取或设置英文名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("name_en")]
[System.Text.Json.Serialization.JsonPropertyName("name_en")]
public string EnglishName { get; set; } = default!;
}
}
/// <summary>
/// 获取或设置词典列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("list")]
[System.Text.Json.Serialization.JsonPropertyName("list")]
public Types.Dictionary[] DictionaryList { get; set; } = default!;
/// <summary>
/// 获取或设置词典总数量。
/// </summary>
[Newtonsoft.Json.JsonProperty("count")]
[System.Text.Json.Serialization.JsonPropertyName("count")]
public int TotalCount { get; set; }
}
}
}
}

View File

@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v2/dict/save 接口的请求。</para>
/// </summary>
public class DictionarySaveRequest : WechatOpenAIRequest
{
public static class Types
{
public class Dictionary
{
/// <summary>
/// 获取或设置词典 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("id")]
[System.Text.Json.Serialization.JsonPropertyName("id")]
public long? DictionaryId { get; set; }
/// <summary>
/// 获取或设置中文名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("name_ch")]
[System.Text.Json.Serialization.JsonPropertyName("name_ch")]
public string ChineseName { get; set; } = string.Empty;
/// <summary>
/// 获取或设置英文名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("name_en")]
[System.Text.Json.Serialization.JsonPropertyName("name_en")]
public string? EnglishName { get; set; }
}
}
/// <summary>
/// 获取或设置词典列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("data")]
[System.Text.Json.Serialization.JsonPropertyName("data")]
public IList<Types.Dictionary> DictionaryList { get; set; } = new List<Types.Dictionary>();
}
}

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v2/dict/save 接口的响应。</para>
/// </summary>
public class DictionarySaveResponse : WechatOpenAIResponse
{
}
}

View File

@ -17,7 +17,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
/// </summary>
[Newtonsoft.Json.JsonProperty("intent_id")]
[System.Text.Json.Serialization.JsonPropertyName("intent_id")]
public long IntentId { get; set; }
public long? IntentId { get; set; }
/// <summary>
/// 获取或设置技能 ID。

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v2/word/delete/batch 接口的请求。</para>
/// </summary>
public class WordDeleteBatchRequest : WechatOpenAIRequest
{
/// <summary>
/// 获取或设置词条 ID 列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("id_list")]
[System.Text.Json.Serialization.JsonPropertyName("id_list")]
public IList<long> WordIdList { get; set; } = new List<long>();
}
}

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v2/word/delete/batch 接口的响应。</para>
/// </summary>
public class WordDeleteBatchResponse : WechatOpenAIResponse
{
}
}

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v2/word/export 接口的请求。</para>
/// </summary>
public class WordExportRequest : WechatOpenAIRequest
{
/// <summary>
/// 获取或设置词典 ID。与字段 <see cref="DictionaryName"/> 二选一。
/// </summary>
[Newtonsoft.Json.JsonProperty("dict_id")]
[System.Text.Json.Serialization.JsonPropertyName("dict_id")]
public long? DictionaryId { get; set; }
/// <summary>
/// 获取或设置词典名称。与字段 <see cref="DictionaryId"/> 二选一。
/// </summary>
[Newtonsoft.Json.JsonProperty("dict_name")]
[System.Text.Json.Serialization.JsonPropertyName("dict_name")]
public string? DictionaryName { get; set; }
}
}

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v2/word/export 接口的响应。</para>
/// </summary>
public class WordExportResponse : WechatOpenAIResponse<WordExportResponse.Types.Data>
{
public static class Types
{
public class Data
{
/// <summary>
/// 获取或设置异步任务 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("task_id")]
[System.Text.Json.Serialization.JsonPropertyName("task_id")]
public string TaskId { get; set; } = default!;
}
}
}
}

View File

@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v2/word/import/json 接口的请求。</para>
/// </summary>
public class WordImportJsonRequest : WechatOpenAIRequest
{
public static class Types
{
public class Word
{
/// <summary>
/// 获取或设置词条名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("word")]
[System.Text.Json.Serialization.JsonPropertyName("word")]
public string Name { get; set; } = string.Empty;
/// <summary>
/// 获取或设置权重范围01
/// </summary>
[Newtonsoft.Json.JsonProperty("weight")]
[System.Text.Json.Serialization.JsonPropertyName("weight")]
public double? Weight { get; set; }
/// <summary>
/// 获取或设置同义词列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("synonyms")]
[System.Text.Json.Serialization.JsonPropertyName("synonyms")]
public IList<string>? SynonymsList { get; set; }
}
}
/// <summary>
/// 获取或设置词条列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("data")]
[System.Text.Json.Serialization.JsonPropertyName("data")]
public IList<Types.Word> WordList { get; set; } = new List<Types.Word>();
/// <summary>
/// 获取或设置导入模式。
/// </summary>
[Newtonsoft.Json.JsonProperty("mode")]
[System.Text.Json.Serialization.JsonPropertyName("mode")]
public int Mode { get; set; }
/// <summary>
/// 获取或设置词典 ID。与字段 <see cref="DictionaryName"/> 二选一。
/// </summary>
[Newtonsoft.Json.JsonProperty("dict_id")]
[System.Text.Json.Serialization.JsonPropertyName("dict_id")]
public long? DictionaryId { get; set; }
/// <summary>
/// 获取或设置词典名称。与字段 <see cref="DictionaryId"/> 二选一。
/// </summary>
[Newtonsoft.Json.JsonProperty("dict_name")]
[System.Text.Json.Serialization.JsonPropertyName("dict_name")]
public string? DictionaryName { get; set; }
}
}

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v2/word/import/json 接口的响应。</para>
/// </summary>
public class WordImportJsonResponse : WechatOpenAIResponse<WordImportJsonResponse.Types.Data>
{
public static class Types
{
public class Data
{
/// <summary>
/// 获取或设置异步任务 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("task_id")]
[System.Text.Json.Serialization.JsonPropertyName("task_id")]
public string TaskId { get; set; } = default!;
}
}
}
}

View File

@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v2/word/import 接口的请求。</para>
/// </summary>
public class WordImportRequest : WechatOpenAIRequest
{
/// <summary>
/// 获取或设置上传的文件标识。与字段 <see cref="FileUrl"/> 二选一。
/// </summary>
[Newtonsoft.Json.JsonProperty("file_key")]
[System.Text.Json.Serialization.JsonPropertyName("file_key")]
public string? FileKey { get; set; }
/// <summary>
/// 获取或设置待上传文件 URL。与字段 <see cref="FileKey"/> 二选一。
/// </summary>
[Newtonsoft.Json.JsonProperty("file_uri")]
[System.Text.Json.Serialization.JsonPropertyName("file_uri")]
public string? FileUrl { get; set; }
/// <summary>
/// 获取或设置是否覆盖。
/// </summary>
[Newtonsoft.Json.JsonProperty("cover")]
[System.Text.Json.Serialization.JsonPropertyName("cover")]
public bool IsCover { get; set; }
/// <summary>
/// 获取或设置词典 ID。与字段 <see cref="DictionaryName"/> 二选一。
/// </summary>
[Newtonsoft.Json.JsonProperty("dict_id")]
[System.Text.Json.Serialization.JsonPropertyName("dict_id")]
public long? DictionaryId { get; set; }
/// <summary>
/// 获取或设置词典名称。与字段 <see cref="DictionaryId"/> 二选一。
/// </summary>
[Newtonsoft.Json.JsonProperty("dict_name")]
[System.Text.Json.Serialization.JsonPropertyName("dict_name")]
public string? DictionaryName { get; set; }
}
}

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v2/word/import 接口的响应。</para>
/// </summary>
public class WordImportResponse : WechatOpenAIResponse<WordImportResponse.Types.Data>
{
public static class Types
{
public class Data
{
/// <summary>
/// 获取或设置异步任务 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("task_id")]
[System.Text.Json.Serialization.JsonPropertyName("task_id")]
public string TaskId { get; set; } = default!;
}
}
}
}

View File

@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v2/word/update/batch 接口的请求。</para>
/// </summary>
public class WordUpdateBatchRequest : WechatOpenAIRequest
{
public static class Types
{
public class Word
{
/// <summary>
/// 获取或设置词条 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("id")]
[System.Text.Json.Serialization.JsonPropertyName("id")]
public long? WordId { get; set; }
/// <summary>
/// 获取或设置词条名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("name")]
[System.Text.Json.Serialization.JsonPropertyName("name")]
public string Name { get; set; } = string.Empty;
/// <summary>
/// 获取或设置权重范围01
/// </summary>
[Newtonsoft.Json.JsonProperty("weight")]
[System.Text.Json.Serialization.JsonPropertyName("weight")]
public double? Weight { get; set; }
/// <summary>
/// 获取或设置词条开关。
/// </summary>
[Newtonsoft.Json.JsonProperty("switch")]
[System.Text.Json.Serialization.JsonPropertyName("switch")]
public bool Switch { get; set; }
/// <summary>
/// 获取或设置同义词列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("synonyms")]
[System.Text.Json.Serialization.JsonPropertyName("synonyms")]
public IList<string>? SynonymsList { get; set; }
}
}
/// <summary>
/// 获取或设置词条列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("data")]
[System.Text.Json.Serialization.JsonPropertyName("data")]
public IList<Types.Word> WordList { get; set; } = new List<Types.Word>();
/// <summary>
/// 获取或设置词典 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("dict_id")]
[System.Text.Json.Serialization.JsonPropertyName("dict_id")]
public long DictionaryId { get; set; }
}
}

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v2/word/update/batch 接口的响应。</para>
/// </summary>
public class WordUpdateBatchResponse : WechatOpenAIResponse
{
}
}

View File

@ -0,0 +1,3 @@
{
"id_list": [ 1, 2, 3 ]
}

View File

@ -0,0 +1,5 @@
{
"code": 0,
"msg": "请求成功",
"request_id": "255i0ug8-l9q4-3801-44ft-w7csjn9e5142"
}

View File

@ -0,0 +1,32 @@
{
"code": 0,
"data": {
"sys": {
"count": 243,
"list": [
{
"id": 1,
"name_ch": "时间范围类",
"name_en": "$vd_time_range"
}
]
},
"user": {
"count": 19,
"list": [
{
"id": 100765,
"name_ch": "美美美",
"name_en": "mmm"
},
{
"id": 100783,
"name_ch": "测试重复词条",
"name_en": "testduplacte"
}
]
}
},
"msg": "",
"request_id": ""
}

View File

@ -0,0 +1,18 @@
{
"code": 0,
"data": {
"count": 2,
"list": [
{
"name_ch": "测试词典000411",
"name_en": "testDict000411"
},
{
"name_ch": "中文版但是",
"name_en": "fdfewf"
}
]
},
"msg": "请求成功",
"request_id": "255i0ug8-l9q4-3801-44ft-w7csjn9e5142"
}

View File

@ -0,0 +1,5 @@
{
"keyword": "",
"page": 1,
"size": 2
}

View File

@ -0,0 +1,20 @@
{
"code": 0,
"data": {
"count": 19,
"list": [
{
"id": 100765,
"name_ch": "美美美",
"name_en": "mmm"
},
{
"id": 100783,
"name_ch": "测试重复词条",
"name_en": "testduplacte"
}
]
},
"msg": "",
"request_id": ""
}

View File

@ -0,0 +1,14 @@
{
"data": [
{
"id": 1,
"name_en": "test1",
"name_ch": "测试1"
},
{
"id": 2,
"name_en": "test2",
"name_ch": "测试2"
}
]
}

View File

@ -0,0 +1,5 @@
{
"code": 0,
"msg": "请求成功",
"request_id": "255i0ug8-l9q4-3801-44ft-w7csjn9e5142"
}

View File

@ -0,0 +1,3 @@
{
"id_list": [ 1, 2, 3 ]
}

View File

@ -0,0 +1,5 @@
{
"code": 0,
"msg": "请求成功",
"request_id": "255i0ug8-l9q4-3801-44ft-w7csjn9e5142"
}

View File

@ -0,0 +1,3 @@
{
"dict_id": 1
}

View File

@ -0,0 +1,8 @@
{
"code": 0,
"msg": "请求成功",
"data": {
"task_id": "337cd9d9-210c-4a59-972e-1c8df8c18adb"
},
"request_id": "255i0ug8-l9q4-3801-44ft-w7csjn9e5142"
}

View File

@ -0,0 +1,10 @@
{
"mode": 0,
"dict_id": 1,
"data": [
{
"word": "AAA",
"synonyms": [ "AA", "A" ]
}
]
}

View File

@ -0,0 +1,8 @@
{
"code": 0,
"data": {
"task_id": "255i0ug8-l9q4-3801-44ft-w7csjn9e5142"
},
"msg": "",
"request_id": "255i0ug8-l9q4-3801-44ft-w7csjn9e5142"
}

View File

@ -0,0 +1,5 @@
{
"dict_id": 1,
"file_key": "fe48940d7310e79d6bf0a4aced56d522",
"cover": false
}

View File

@ -0,0 +1,8 @@
{
"code": 0,
"msg": "请求成功",
"data": {
"task_id": "337cd9d9-210c-4a59-972e-1c8df8c18adb"
},
"request_id": "255i0ug8-l9q4-3801-44ft-w7csjn9e5142"
}

View File

@ -0,0 +1,12 @@
{
"dict_id": 1,
"data": [
{
"id": 1,
"name": "test",
"weight": 0.8,
"switch": true,
"synonyms": [ "你好", "又是愉快第一天" ]
}
]
}

View File

@ -0,0 +1,5 @@
{
"code": 0,
"msg": "请求成功",
"request_id": "255i0ug8-l9q4-3801-44ft-w7csjn9e5142"
}