diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs index c2911aef..d847de46 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs @@ -6286,6 +6286,52 @@ namespace SKIT.FlurlHttpClient.Wechat.Api return await client.SendFlurlRequestAsJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false); } + + /// + /// 异步调用 [POST] /channels/ec/promoter/set_coupon_to_headsupplier 接口。 + /// + /// REF:
+ /// + ///
+ ///
+ /// + /// + /// + /// + public static async Task ExecuteChannelsECPromoterSetCouponToHeadSupplierAsync(this WechatApiClient client, Models.ChannelsECPromoterSetCouponToHeadSupplierRequest 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", "promoter", "set_coupon_to_headsupplier") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendFlurlRequestAsJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// 异步调用 [POST] /channels/ec/promoter/get_coupon_to_headsupplier 接口。 + /// + /// REF:
+ /// + ///
+ ///
+ /// + /// + /// + /// + public static async Task ExecuteChannelsECPromoterGetCouponToHeadSupplierAsync(this WechatApiClient client, Models.ChannelsECPromoterGetCouponToHeadSupplierRequest 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", "promoter", "get_coupon_to_headsupplier") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendFlurlRequestAsJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false); + } #endregion #region ECPromoter/Feed diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCooperativeCouponListRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCooperativeCouponListRequest.cs index 973b293a..8d69dd3c 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCooperativeCouponListRequest.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCooperativeCouponListRequest.cs @@ -12,6 +12,20 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Models [System.Text.Json.Serialization.JsonPropertyName("shop_appid")] public string? ShopAppId { get; set; } + /// + /// 获取或设置是否来源于其他机构。 + /// + [Newtonsoft.Json.JsonProperty("is_from_head_supplier")] + [System.Text.Json.Serialization.JsonPropertyName("is_from_head_supplier")] + public bool? IsFromHeadSupplier { get; set; } + + /// + /// 获取或设置来源的机构 AppId。 + /// + [Newtonsoft.Json.JsonProperty("from_head_supplier_appid")] + [System.Text.Json.Serialization.JsonPropertyName("from_head_supplier_appid")] + public string? FromHeadSupplierAppId { get; set; } + /// /// 获取或设置分页每页数量。 /// 默认值:10 diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCooperativeCouponListResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCooperativeCouponListResponse.cs index 1e64af28..0ef37c4a 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCooperativeCouponListResponse.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCooperativeCouponListResponse.cs @@ -7,8 +7,22 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Models { public static class Types { - public class Coupon : ChannelsECPromoterGetPublicCouponListResponse.Types.Coupon + public class Coupon { + /// + /// 获取或设置券 ID。 + /// + [Newtonsoft.Json.JsonProperty("coupon_id")] + [System.Text.Json.Serialization.JsonPropertyName("coupon_id")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public long CouponId { get; set; } + + /// + /// 获取或设置来源的机构 AppId。 + /// + [Newtonsoft.Json.JsonProperty("from_head_supplier_appid")] + [System.Text.Json.Serialization.JsonPropertyName("from_head_supplier_appid")] + public string? FromHeadSupplierAppId { get; set; } } } diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCouponDetailRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCouponDetailRequest.cs index 561742fa..88261462 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCouponDetailRequest.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCouponDetailRequest.cs @@ -5,6 +5,13 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Models /// public class ChannelsECPromoterGetCouponDetailRequest : WechatApiRequest, IInferable { + /// + /// 获取或设置来源的机构 AppId。 + /// + [Newtonsoft.Json.JsonProperty("from_head_supplier_appid")] + [System.Text.Json.Serialization.JsonPropertyName("from_head_supplier_appid")] + public string? FromHeadSupplierAppId { get; set; } + /// /// 获取或设置券 ID。 /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCouponPromoterShareLinkRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCouponPromoterShareLinkRequest.cs index bc5b2f31..c95215af 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCouponPromoterShareLinkRequest.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCouponPromoterShareLinkRequest.cs @@ -12,6 +12,13 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Models [System.Text.Json.Serialization.JsonPropertyName("sharer_appid")] public string? SharerAppId { get; set; } + /// + /// 获取或设置来源的机构 AppId。 + /// + [Newtonsoft.Json.JsonProperty("from_head_supplier_appid")] + [System.Text.Json.Serialization.JsonPropertyName("from_head_supplier_appid")] + public string? FromHeadSupplierAppId { get; set; } + /// /// 获取或设置券 ID。 /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCouponShortLinkRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCouponShortLinkRequest.cs index 3668c7f8..73860278 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCouponShortLinkRequest.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCouponShortLinkRequest.cs @@ -12,6 +12,13 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Models [System.Text.Json.Serialization.JsonPropertyName("sharer_appid")] public string? SharerAppId { get; set; } + /// + /// 获取或设置来源的机构 AppId。 + /// + [Newtonsoft.Json.JsonProperty("from_head_supplier_appid")] + [System.Text.Json.Serialization.JsonPropertyName("from_head_supplier_appid")] + public string? FromHeadSupplierAppId { get; set; } + /// /// 获取或设置券 ID。 /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCouponToHeadSupplierRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCouponToHeadSupplierRequest.cs new file mode 100644 index 00000000..f8912209 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCouponToHeadSupplierRequest.cs @@ -0,0 +1,30 @@ +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /channels/ec/promoter/get_coupon_to_headsupplier 接口的请求。 + /// + public class ChannelsECPromoterGetCouponToHeadSupplierRequest : WechatApiRequest, IInferable + { + /// + /// 获取或设置接收的机构 AppId。 + /// + [Newtonsoft.Json.JsonProperty("to_head_supplier_appid")] + [System.Text.Json.Serialization.JsonPropertyName("to_head_supplier_appid")] + public string ToHeadSupplierAppId { get; set; } = string.Empty; + + /// + /// 获取或设置分页每页数量。 + /// 默认值:10 + /// + [Newtonsoft.Json.JsonProperty("limit")] + [System.Text.Json.Serialization.JsonPropertyName("limit")] + public int Limit { get; set; } + + /// + /// 获取或设置分页游标。 + /// + [Newtonsoft.Json.JsonProperty("page_context")] + [System.Text.Json.Serialization.JsonPropertyName("page_context")] + public string? Cursor { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCouponToHeadSupplierResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCouponToHeadSupplierResponse.cs new file mode 100644 index 00000000..879f5102 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCouponToHeadSupplierResponse.cs @@ -0,0 +1,57 @@ +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /channels/ec/promoter/get_coupon_to_headsupplier 接口的响应。 + /// + public class ChannelsECPromoterGetCouponToHeadSupplierResponse : WechatApiResponse + { + public static class Types + { + public class Coupon + { + /// + /// 获取或设置券 ID。 + /// + [Newtonsoft.Json.JsonProperty("coupon_id")] + [System.Text.Json.Serialization.JsonPropertyName("coupon_id")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public long CouponId { get; set; } + + /// + /// 获取或设置接收的机构 AppId。 + /// + [Newtonsoft.Json.JsonProperty("to_head_supplier_appid")] + [System.Text.Json.Serialization.JsonPropertyName("to_head_supplier_appid")] + public string ToHeadSupplierAppId { get; set; } = default!; + + /// + /// 获取或设置发放时间戳。 + /// + [Newtonsoft.Json.JsonProperty("give_time")] + [System.Text.Json.Serialization.JsonPropertyName("give_time")] + public long GiveTimestamp { get; set; } + } + } + + /// + /// 获取或设置券列表。 + /// + [Newtonsoft.Json.JsonProperty("list")] + [System.Text.Json.Serialization.JsonPropertyName("list")] + public Types.Coupon[] CouponList { get; set; } = default!; + + /// + /// 获取或设置总数量。 + /// + [Newtonsoft.Json.JsonProperty("total_count")] + [System.Text.Json.Serialization.JsonPropertyName("total_count")] + public int TotalCount { get; set; } + + /// + /// 获取或设置翻页标记。 + /// + [Newtonsoft.Json.JsonProperty("page_context")] + [System.Text.Json.Serialization.JsonPropertyName("page_context")] + public string? NextCursor { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterGetPublicCouponListResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterGetPublicCouponListResponse.cs index 4a244b5c..5820b710 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterGetPublicCouponListResponse.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterGetPublicCouponListResponse.cs @@ -15,7 +15,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Models [Newtonsoft.Json.JsonProperty("coupon_id")] [System.Text.Json.Serialization.JsonPropertyName("coupon_id")] [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] - public long CouponId { get; set; } + public long CouponId { get; set; } } } diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterSetCouponToHeadSupplierRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterSetCouponToHeadSupplierRequest.cs new file mode 100644 index 00000000..a4ea68e2 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterSetCouponToHeadSupplierRequest.cs @@ -0,0 +1,24 @@ +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /channels/ec/promoter/set_coupon_to_headsupplier 接口的请求。 + /// + public class ChannelsECPromoterSetCouponToHeadSupplierRequest : WechatApiRequest, IInferable + { + /// + /// 获取或设置接收的机构 AppId。 + /// + [Newtonsoft.Json.JsonProperty("to_head_supplier_appid")] + [System.Text.Json.Serialization.JsonPropertyName("to_head_supplier_appid")] + public string ToHeadSupplierAppId { get; set; } = string.Empty; + + /// + /// 获取或设置券 ID。 + /// + [Newtonsoft.Json.JsonProperty("coupon_id")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.Common.TextualNumberConverter))] + [System.Text.Json.Serialization.JsonPropertyName("coupon_id")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString | System.Text.Json.Serialization.JsonNumberHandling.WriteAsString)] + public long CouponId { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterSetCouponToHeadSupplierResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterSetCouponToHeadSupplierResponse.cs new file mode 100644 index 00000000..89a01467 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterSetCouponToHeadSupplierResponse.cs @@ -0,0 +1,9 @@ +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /channels/ec/promoter/set_coupon_to_headsupplier 接口的响应。 + /// + public class ChannelsECPromoterSetCouponToHeadSupplierResponse : WechatApiResponse + { + } +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCouponToHeadSupplierRequest.json b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCouponToHeadSupplierRequest.json new file mode 100644 index 00000000..73ca6399 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCouponToHeadSupplierRequest.json @@ -0,0 +1,5 @@ +{ + "to_head_supplier_appid": "wxdfsdxxxxx", + "limit": 10, + "page_context": "CAEQARgfKj0AACcYl2AAABQBAgQAXFE1wJCeiAAA" +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCouponToHeadSupplierResponse.json b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCouponToHeadSupplierResponse.json new file mode 100644 index 00000000..53422367 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCouponToHeadSupplierResponse.json @@ -0,0 +1,13 @@ +{ + "errcode": 0, + "errmsg": "success", + "list": [ + { + "coupon_id": "23234", + "to_head_supplier_appid": "wxsdsdfsds", + "give_time": 1761767465 + } + ], + "page_context": "CAEQARgfKj0AACcYl2AAABQBAgQAXFE1wJCeiAAA", + "total_count": 100 +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECPromoter/Coupon/ChannelsECPromoterSetCouponToHeadSupplierRequest.json b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECPromoter/Coupon/ChannelsECPromoterSetCouponToHeadSupplierRequest.json new file mode 100644 index 00000000..dfae4bf3 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECPromoter/Coupon/ChannelsECPromoterSetCouponToHeadSupplierRequest.json @@ -0,0 +1,4 @@ +{ + "to_head_supplier_appid": "wxab1eaxxxxxx", + "coupon_id": "121432" +}