Skip to content

Commit d031e72

Browse files
committed
feat(wxapi): 新增微信小店联盟带货机构分发优惠券给其他机构相关接口
1 parent 94d09e6 commit d031e72

14 files changed

Lines changed: 239 additions & 2 deletions

src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6286,6 +6286,52 @@ public static class WechatApiClientExecuteChannelsExtensions
62866286

62876287
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsECPromoterGetCouponPromoterShareLinkResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
62886288
}
6289+
6290+
/// <summary>
6291+
/// <para>异步调用 [POST] /channels/ec/promoter/set_coupon_to_headsupplier 接口。</para>
6292+
/// <para>
6293+
/// REF: <br/>
6294+
/// <![CDATA[ https://developers.weixin.qq.com/doc/store/leagueheadsupplier/api/sharer/coupon/api_set_coupon_to_headsupplier.html ]]>
6295+
/// </para>
6296+
/// </summary>
6297+
/// <param name="client"></param>
6298+
/// <param name="request"></param>
6299+
/// <param name="cancellationToken"></param>
6300+
/// <returns></returns>
6301+
public static async Task<Models.ChannelsECPromoterSetCouponToHeadSupplierResponse> ExecuteChannelsECPromoterSetCouponToHeadSupplierAsync(this WechatApiClient client, Models.ChannelsECPromoterSetCouponToHeadSupplierRequest request, CancellationToken cancellationToken = default)
6302+
{
6303+
if (client is null) throw new ArgumentNullException(nameof(client));
6304+
if (request is null) throw new ArgumentNullException(nameof(request));
6305+
6306+
IFlurlRequest flurlReq = client
6307+
.CreateFlurlRequest(request, HttpMethod.Post, "channels", "ec", "promoter", "set_coupon_to_headsupplier")
6308+
.SetQueryParam("access_token", request.AccessToken);
6309+
6310+
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsECPromoterSetCouponToHeadSupplierResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
6311+
}
6312+
6313+
/// <summary>
6314+
/// <para>异步调用 [POST] /channels/ec/promoter/get_coupon_to_headsupplier 接口。</para>
6315+
/// <para>
6316+
/// REF: <br/>
6317+
/// <![CDATA[ https://developers.weixin.qq.com/doc/store/leagueheadsupplier/api/sharer/coupon/api_get_coupon_to_headsupplier.html ]]>
6318+
/// </para>
6319+
/// </summary>
6320+
/// <param name="client"></param>
6321+
/// <param name="request"></param>
6322+
/// <param name="cancellationToken"></param>
6323+
/// <returns></returns>
6324+
public static async Task<Models.ChannelsECPromoterGetCouponToHeadSupplierResponse> ExecuteChannelsECPromoterGetCouponToHeadSupplierAsync(this WechatApiClient client, Models.ChannelsECPromoterGetCouponToHeadSupplierRequest request, CancellationToken cancellationToken = default)
6325+
{
6326+
if (client is null) throw new ArgumentNullException(nameof(client));
6327+
if (request is null) throw new ArgumentNullException(nameof(request));
6328+
6329+
IFlurlRequest flurlReq = client
6330+
.CreateFlurlRequest(request, HttpMethod.Post, "channels", "ec", "promoter", "get_coupon_to_headsupplier")
6331+
.SetQueryParam("access_token", request.AccessToken);
6332+
6333+
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsECPromoterGetCouponToHeadSupplierResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
6334+
}
62896335
#endregion
62906336

62916337
#region ECPromoter/Feed

src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCooperativeCouponListRequest.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,20 @@ public class ChannelsECPromoterGetCooperativeCouponListRequest : WechatApiReques
1212
[System.Text.Json.Serialization.JsonPropertyName("shop_appid")]
1313
public string? ShopAppId { get; set; }
1414

15+
/// <summary>
16+
/// 获取或设置是否来源于其他机构。
17+
/// </summary>
18+
[Newtonsoft.Json.JsonProperty("is_from_head_supplier")]
19+
[System.Text.Json.Serialization.JsonPropertyName("is_from_head_supplier")]
20+
public bool? IsFromHeadSupplier { get; set; }
21+
22+
/// <summary>
23+
/// 获取或设置来源的机构 AppId。
24+
/// </summary>
25+
[Newtonsoft.Json.JsonProperty("from_head_supplier_appid")]
26+
[System.Text.Json.Serialization.JsonPropertyName("from_head_supplier_appid")]
27+
public string? FromHeadSupplierAppId { get; set; }
28+
1529
/// <summary>
1630
/// 获取或设置分页每页数量。
1731
/// <para>默认值:10</para>

src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCooperativeCouponListResponse.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,22 @@ public class ChannelsECPromoterGetCooperativeCouponListResponse : WechatApiRespo
77
{
88
public static class Types
99
{
10-
public class Coupon : ChannelsECPromoterGetPublicCouponListResponse.Types.Coupon
10+
public class Coupon
1111
{
12+
/// <summary>
13+
/// 获取或设置券 ID。
14+
/// </summary>
15+
[Newtonsoft.Json.JsonProperty("coupon_id")]
16+
[System.Text.Json.Serialization.JsonPropertyName("coupon_id")]
17+
[System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)]
18+
public long CouponId { get; set; }
19+
20+
/// <summary>
21+
/// 获取或设置来源的机构 AppId。
22+
/// </summary>
23+
[Newtonsoft.Json.JsonProperty("from_head_supplier_appid")]
24+
[System.Text.Json.Serialization.JsonPropertyName("from_head_supplier_appid")]
25+
public string? FromHeadSupplierAppId { get; set; }
1226
}
1327
}
1428

src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCouponDetailRequest.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Models
55
/// </summary>
66
public class ChannelsECPromoterGetCouponDetailRequest : WechatApiRequest, IInferable<ChannelsECPromoterGetCouponDetailRequest, ChannelsECPromoterGetCouponDetailResponse>
77
{
8+
/// <summary>
9+
/// 获取或设置来源的机构 AppId。
10+
/// </summary>
11+
[Newtonsoft.Json.JsonProperty("from_head_supplier_appid")]
12+
[System.Text.Json.Serialization.JsonPropertyName("from_head_supplier_appid")]
13+
public string? FromHeadSupplierAppId { get; set; }
14+
815
/// <summary>
916
/// 获取或设置券 ID。
1017
/// </summary>

src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCouponPromoterShareLinkRequest.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ public class ChannelsECPromoterGetCouponPromoterShareLinkRequest : WechatApiRequ
1212
[System.Text.Json.Serialization.JsonPropertyName("sharer_appid")]
1313
public string? SharerAppId { get; set; }
1414

15+
/// <summary>
16+
/// 获取或设置来源的机构 AppId。
17+
/// </summary>
18+
[Newtonsoft.Json.JsonProperty("from_head_supplier_appid")]
19+
[System.Text.Json.Serialization.JsonPropertyName("from_head_supplier_appid")]
20+
public string? FromHeadSupplierAppId { get; set; }
21+
1522
/// <summary>
1623
/// 获取或设置券 ID。
1724
/// </summary>

src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterGetCouponShortLinkRequest.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ public class ChannelsECPromoterGetCouponShortLinkRequest : WechatApiRequest, IIn
1212
[System.Text.Json.Serialization.JsonPropertyName("sharer_appid")]
1313
public string? SharerAppId { get; set; }
1414

15+
/// <summary>
16+
/// 获取或设置来源的机构 AppId。
17+
/// </summary>
18+
[Newtonsoft.Json.JsonProperty("from_head_supplier_appid")]
19+
[System.Text.Json.Serialization.JsonPropertyName("from_head_supplier_appid")]
20+
public string? FromHeadSupplierAppId { get; set; }
21+
1522
/// <summary>
1623
/// 获取或设置券 ID。
1724
/// </summary>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
2+
{
3+
/// <summary>
4+
/// <para>表示 [POST] /channels/ec/promoter/get_coupon_to_headsupplier 接口的请求。</para>
5+
/// </summary>
6+
public class ChannelsECPromoterGetCouponToHeadSupplierRequest : WechatApiRequest, IInferable<ChannelsECPromoterGetCouponToHeadSupplierRequest, ChannelsECPromoterGetCouponToHeadSupplierResponse>
7+
{
8+
/// <summary>
9+
/// 获取或设置接收的机构 AppId。
10+
/// </summary>
11+
[Newtonsoft.Json.JsonProperty("to_head_supplier_appid")]
12+
[System.Text.Json.Serialization.JsonPropertyName("to_head_supplier_appid")]
13+
public string ToHeadSupplierAppId { get; set; } = string.Empty;
14+
15+
/// <summary>
16+
/// 获取或设置分页每页数量。
17+
/// <para>默认值:10</para>
18+
/// </summary>
19+
[Newtonsoft.Json.JsonProperty("limit")]
20+
[System.Text.Json.Serialization.JsonPropertyName("limit")]
21+
public int Limit { get; set; }
22+
23+
/// <summary>
24+
/// 获取或设置分页游标。
25+
/// </summary>
26+
[Newtonsoft.Json.JsonProperty("page_context")]
27+
[System.Text.Json.Serialization.JsonPropertyName("page_context")]
28+
public string? Cursor { get; set; }
29+
}
30+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
2+
{
3+
/// <summary>
4+
/// <para>表示 [POST] /channels/ec/promoter/get_coupon_to_headsupplier 接口的响应。</para>
5+
/// </summary>
6+
public class ChannelsECPromoterGetCouponToHeadSupplierResponse : WechatApiResponse
7+
{
8+
public static class Types
9+
{
10+
public class Coupon
11+
{
12+
/// <summary>
13+
/// 获取或设置券 ID。
14+
/// </summary>
15+
[Newtonsoft.Json.JsonProperty("coupon_id")]
16+
[System.Text.Json.Serialization.JsonPropertyName("coupon_id")]
17+
[System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)]
18+
public long CouponId { get; set; }
19+
20+
/// <summary>
21+
/// 获取或设置接收的机构 AppId。
22+
/// </summary>
23+
[Newtonsoft.Json.JsonProperty("to_head_supplier_appid")]
24+
[System.Text.Json.Serialization.JsonPropertyName("to_head_supplier_appid")]
25+
public string ToHeadSupplierAppId { get; set; } = default!;
26+
27+
/// <summary>
28+
/// 获取或设置发放时间戳。
29+
/// </summary>
30+
[Newtonsoft.Json.JsonProperty("give_time")]
31+
[System.Text.Json.Serialization.JsonPropertyName("give_time")]
32+
public long GiveTimestamp { get; set; }
33+
}
34+
}
35+
36+
/// <summary>
37+
/// 获取或设置券列表。
38+
/// </summary>
39+
[Newtonsoft.Json.JsonProperty("list")]
40+
[System.Text.Json.Serialization.JsonPropertyName("list")]
41+
public Types.Coupon[] CouponList { get; set; } = default!;
42+
43+
/// <summary>
44+
/// 获取或设置总数量。
45+
/// </summary>
46+
[Newtonsoft.Json.JsonProperty("total_count")]
47+
[System.Text.Json.Serialization.JsonPropertyName("total_count")]
48+
public int TotalCount { get; set; }
49+
50+
/// <summary>
51+
/// 获取或设置翻页标记。
52+
/// </summary>
53+
[Newtonsoft.Json.JsonProperty("page_context")]
54+
[System.Text.Json.Serialization.JsonPropertyName("page_context")]
55+
public string? NextCursor { get; set; }
56+
}
57+
}

src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECPromoter/Coupon/ChannelsECPromoterGetPublicCouponListResponse.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class Coupon
1515
[Newtonsoft.Json.JsonProperty("coupon_id")]
1616
[System.Text.Json.Serialization.JsonPropertyName("coupon_id")]
1717
[System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)]
18-
public long CouponId { get; set; }
18+
public long CouponId { get; set; }
1919
}
2020
}
2121

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
2+
{
3+
/// <summary>
4+
/// <para>表示 [POST] /channels/ec/promoter/set_coupon_to_headsupplier 接口的请求。</para>
5+
/// </summary>
6+
public class ChannelsECPromoterSetCouponToHeadSupplierRequest : WechatApiRequest, IInferable<ChannelsECPromoterSetCouponToHeadSupplierRequest, ChannelsECPromoterSetCouponToHeadSupplierResponse>
7+
{
8+
/// <summary>
9+
/// 获取或设置接收的机构 AppId。
10+
/// </summary>
11+
[Newtonsoft.Json.JsonProperty("to_head_supplier_appid")]
12+
[System.Text.Json.Serialization.JsonPropertyName("to_head_supplier_appid")]
13+
public string ToHeadSupplierAppId { get; set; } = string.Empty;
14+
15+
/// <summary>
16+
/// 获取或设置券 ID。
17+
/// </summary>
18+
[Newtonsoft.Json.JsonProperty("coupon_id")]
19+
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.Common.TextualNumberConverter))]
20+
[System.Text.Json.Serialization.JsonPropertyName("coupon_id")]
21+
[System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString | System.Text.Json.Serialization.JsonNumberHandling.WriteAsString)]
22+
public long CouponId { get; set; }
23+
}
24+
}

0 commit comments

Comments
 (0)