diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs index fd9d73bb..aec40d22 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs @@ -5408,6 +5408,31 @@ namespace SKIT.FlurlHttpClient.Wechat.Api } #endregion + #region ECProduct/ExternalProduct + /// + /// 异步调用 [POST] /channels/ec/product/externalproductmapping 接口。 + /// + /// REF:
+ /// + ///
+ ///
+ /// + /// + /// + /// + public static async Task ExecuteChannelsECProductCategoryExternalProductMappingAsync(this WechatApiClient client, Models.ChannelsECProductCategoryExternalProductMappingRequest 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", "externalproductmapping") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendFlurlRequestAsJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false); + } + #endregion + #region ECProduct/Gift /// /// 异步调用 [POST] /channels/ec/product/gift/add 接口。 diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECProduct/ExternalProduct/ChannelsECProductCategoryExternalProductMappingRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECProduct/ExternalProduct/ChannelsECProductCategoryExternalProductMappingRequest.cs new file mode 100644 index 00000000..afab1eb6 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECProduct/ExternalProduct/ChannelsECProductCategoryExternalProductMappingRequest.cs @@ -0,0 +1,36 @@ +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /channels/ec/product/externalproductmapping 接口的请求。 + /// + public class ChannelsECProductCategoryExternalProductMappingRequest : WechatApiRequest, IInferable + { + /// + /// 获取或设置商品类目 ID。 + /// + [Newtonsoft.Json.JsonProperty("cat_id")] + [System.Text.Json.Serialization.JsonPropertyName("cat_id")] + public long CategoryId { get; set; } + + /// + /// 获取或设置外部商品属性键。 + /// + [Newtonsoft.Json.JsonProperty("external_attribute_name")] + [System.Text.Json.Serialization.JsonPropertyName("external_attribute_name")] + public string? ExternalAttributeName { get; set; } + + /// + /// 获取或设置外部商品属性值。 + /// + [Newtonsoft.Json.JsonProperty("external_attribute_value")] + [System.Text.Json.Serialization.JsonPropertyName("external_attribute_value")] + public string? ExternalAttributeValue { get; set; } + + /// + /// 获取或设置外部商品类目名称。 + /// + [Newtonsoft.Json.JsonProperty("external_category_name")] + [System.Text.Json.Serialization.JsonPropertyName("external_category_name")] + public string? ExternalCategoryName { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECProduct/ExternalProduct/ChannelsECProductCategoryExternalProductMappingResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECProduct/ExternalProduct/ChannelsECProductCategoryExternalProductMappingResponse.cs new file mode 100644 index 00000000..158cff44 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECProduct/ExternalProduct/ChannelsECProductCategoryExternalProductMappingResponse.cs @@ -0,0 +1,36 @@ +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /channels/ec/product/externalproductmapping 接口的响应。 + /// + public class ChannelsECProductCategoryExternalProductMappingResponse : WechatApiResponse + { + /// + /// 获取或设置外部商品属性键。 + /// + [Newtonsoft.Json.JsonProperty("external_attribute_name")] + [System.Text.Json.Serialization.JsonPropertyName("external_attribute_name")] + public string? ExternalAttributeName { get; set; } + + /// + /// 获取或设置外部商品属性值。 + /// + [Newtonsoft.Json.JsonProperty("external_attribute_value")] + [System.Text.Json.Serialization.JsonPropertyName("external_attribute_value")] + public string? ExternalAttributeValue { get; set; } + + /// + /// 获取或设置内部商品属性键。 + /// + [Newtonsoft.Json.JsonProperty("internal_attribute_name")] + [System.Text.Json.Serialization.JsonPropertyName("internal_attribute_name")] + public string? InternalAttributeName { get; set; } + + /// + /// 获取或设置内部商品属性值列表。 + /// + [Newtonsoft.Json.JsonProperty("internal_attribute_value")] + [System.Text.Json.Serialization.JsonPropertyName("internal_attribute_value")] + public string[]? InternalAttributeValueList { get; set; } + } +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECProduct/ExternalProduct/ChannelsECProductCategoryExternalProductMappingRequest.json b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECProduct/ExternalProduct/ChannelsECProductCategoryExternalProductMappingRequest.json new file mode 100644 index 00000000..ca56bf6d --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECProduct/ExternalProduct/ChannelsECProductCategoryExternalProductMappingRequest.json @@ -0,0 +1,6 @@ +{ + "cat_id": 6261, + "external_attribute_name": "帮面材质", + "external_attribute_value": "塑胶", + "external_category_name": "母婴:童鞋:雨鞋" +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECProduct/ExternalProduct/ChannelsECProductCategoryExternalProductMappingResponse.json b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECProduct/ExternalProduct/ChannelsECProductCategoryExternalProductMappingResponse.json new file mode 100644 index 00000000..cd7308fa --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECProduct/ExternalProduct/ChannelsECProductCategoryExternalProductMappingResponse.json @@ -0,0 +1,8 @@ +{ + "errcode": 0, + "errmsg": "ok", + "external_attribute_name": "帮面材质", + "external_attribute_value": "塑胶", + "internal_attribute_name": "鞋面材质", + "internal_attribute_value": [ "塑胶" ] +}