diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs index 6c2cdfd3..cd288bea 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs @@ -5571,6 +5571,29 @@ namespace SKIT.FlurlHttpClient.Wechat.Api return await client.SendFlurlRequestAsJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false); } + + /// + /// 异步调用 [POST] /channels/ec/product/categoryprecheck 接口。 + /// + /// REF:
+ /// + ///
+ ///
+ /// + /// + /// + /// + public static async Task ExecuteChannelsECProductCategoryPrecheckAsync(this WechatApiClient client, Models.ChannelsECProductCategoryPrecheckRequest 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 + .CreateFlurlRequest(request, HttpMethod.Post, "channels", "ec", "product", "categoryprecheck") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendFlurlRequestAsJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false); + } #endregion #region ECProduct/ExternalProduct diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECProduct/Category/ChannelsECProductCategoryPrecheckRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECProduct/Category/ChannelsECProductCategoryPrecheckRequest.cs new file mode 100644 index 00000000..f1b90008 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECProduct/Category/ChannelsECProductCategoryPrecheckRequest.cs @@ -0,0 +1,15 @@ +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /channels/ec/product/categoryprecheck 接口的请求。 + /// + public class ChannelsECProductCategoryPrecheckRequest : WechatApiRequest, IInferable + { + /// + /// 获取或设置商品类目 ID。 + /// + [Newtonsoft.Json.JsonProperty("cat_id")] + [System.Text.Json.Serialization.JsonPropertyName("cat_id")] + public long? CategoryId { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECProduct/Category/ChannelsECProductCategoryPrecheckResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECProduct/Category/ChannelsECProductCategoryPrecheckResponse.cs new file mode 100644 index 00000000..6a21bae3 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECProduct/Category/ChannelsECProductCategoryPrecheckResponse.cs @@ -0,0 +1,22 @@ +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /channels/ec/product/categoryprecheck 接口的响应。 + /// + public class ChannelsECProductCategoryPrecheckResponse : WechatApiResponse + { + /// + /// 获取或设置是否类目全部校验通过。 + /// + [Newtonsoft.Json.JsonProperty("all_pass")] + [System.Text.Json.Serialization.JsonPropertyName("all_pass")] + public bool IsAllPass { get; set; } + + /// + /// 获取或设置校验不通过的原因列表。 + /// + [Newtonsoft.Json.JsonProperty("fail_reasons")] + [System.Text.Json.Serialization.JsonPropertyName("fail_reasons")] + public string[]? FailReasonList { get; set; } + } +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECProduct/Category/ChannelsECProductCategoryPrecheckRequest.json b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECProduct/Category/ChannelsECProductCategoryPrecheckRequest.json new file mode 100644 index 00000000..b0cb3f7a --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECProduct/Category/ChannelsECProductCategoryPrecheckRequest.json @@ -0,0 +1,3 @@ +{ + "cat_id": 6261 +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECProduct/Category/ChannelsECProductCategoryPrecheckResponse.json b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECProduct/Category/ChannelsECProductCategoryPrecheckResponse.json new file mode 100644 index 00000000..dc3cdfbd --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECProduct/Category/ChannelsECProductCategoryPrecheckResponse.json @@ -0,0 +1,6 @@ +{ + "errcode": 0, + "errmsg": "ok", + "all_pass": true, + "fail_reasons": [] +}