From 1d494910f16c4f5c559a22aa533a5e807fb7cca1 Mon Sep 17 00:00:00 2001 From: Fu Diwei Date: Mon, 29 Apr 2024 20:09:35 +0800 Subject: [PATCH] =?UTF-8?q?feat(wxapi):=20=E6=96=B0=E5=A2=9E=E8=A7=86?= =?UTF-8?q?=E9=A2=91=E5=8F=B7=E5=B0=8F=E5=BA=97=E5=88=86=E4=BA=AB=E5=91=98?= =?UTF-8?q?=E4=B8=93=E5=B1=9E=E5=95=86=E5=93=81=E9=93=BE=E6=8E=A5=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...echatApiClientExecuteChannelsExtensions.cs | 69 +++++++++++++++++++ .../ChannelsECSharerGetSharerListResponse.cs | 7 ++ ...elsECSharerGetSharerProductH5UrlRequest.cs | 22 ++++++ ...lsECSharerGetSharerProductH5UrlResponse.cs | 15 ++++ ...lsECSharerGetSharerProductQrcodeRequest.cs | 22 ++++++ ...sECSharerGetSharerProductQrcodeResponse.cs | 15 ++++ ...sECSharerGetSharerProductTagLinkRequest.cs | 22 ++++++ ...ECSharerGetSharerProductTagLinkResponse.cs | 15 ++++ .../ChannelsECSharerSearchSharerResponse.cs | 7 ++ ...ChannelsECSharerGetSharerListResponse.json | 3 +- ...sECSharerGetSharerProductH5UrlRequest.json | 4 ++ ...ECSharerGetSharerProductH5UrlResponse.json | 5 ++ ...ECSharerGetSharerProductQrcodeRequest.json | 4 ++ ...CSharerGetSharerProductQrcodeResponse.json | 5 ++ ...CSharerGetSharerProductTagLinkRequest.json | 4 ++ ...SharerGetSharerProductTagLinkResponse.json | 5 ++ .../ChannelsECSharerSearchSharerResponse.json | 3 +- 17 files changed, 225 insertions(+), 2 deletions(-) create mode 100644 src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECSharer/ChannelsECSharerGetSharerProductH5UrlRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECSharer/ChannelsECSharerGetSharerProductH5UrlResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECSharer/ChannelsECSharerGetSharerProductQrcodeRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECSharer/ChannelsECSharerGetSharerProductQrcodeResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECSharer/ChannelsECSharerGetSharerProductTagLinkRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECSharer/ChannelsECSharerGetSharerProductTagLinkResponse.cs create mode 100644 test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECSharer/ChannelsECSharerGetSharerProductH5UrlRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECSharer/ChannelsECSharerGetSharerProductH5UrlResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECSharer/ChannelsECSharerGetSharerProductQrcodeRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECSharer/ChannelsECSharerGetSharerProductQrcodeResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECSharer/ChannelsECSharerGetSharerProductTagLinkRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECSharer/ChannelsECSharerGetSharerProductTagLinkResponse.json diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs index 23ba7c40..abc96bfa 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs @@ -2427,6 +2427,75 @@ namespace SKIT.FlurlHttpClient.Wechat.Api return await client.SendFlurlRequestAsJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false); } + + /// + /// 异步调用 [POST] /channels/ec/sharer/get_sharer_product_h5url 接口。 + /// + /// REF:
+ /// + ///
+ ///
+ /// + /// + /// + /// + public static async Task ExecuteChannelsECSharerGetSharerProductH5UrlAsync(this WechatApiClient client, Models.ChannelsECSharerGetSharerProductH5UrlRequest 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", "sharer", "get_sharer_product_h5url") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendFlurlRequestAsJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /channels/ec/sharer/get_sharer_product_taglink 接口。 + /// + /// REF:
+ /// + ///
+ ///
+ /// + /// + /// + /// + public static async Task ExecuteChannelsECSharerGetSharerProductTagLinkAsync(this WechatApiClient client, Models.ChannelsECSharerGetSharerProductTagLinkRequest 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", "sharer", "get_sharer_product_taglink") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendFlurlRequestAsJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /channels/ec/sharer/get_sharer_product_qrcode 接口。 + /// + /// REF:
+ /// + ///
+ ///
+ /// + /// + /// + /// + public static async Task ExecuteChannelsECSharerGetSharerProductQrcodeAsync(this WechatApiClient client, Models.ChannelsECSharerGetSharerProductQrcodeRequest 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", "sharer", "get_sharer_product_qrcode") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendFlurlRequestAsJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } #endregion #region ECVip diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECSharer/ChannelsECSharerGetSharerListResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECSharer/ChannelsECSharerGetSharerListResponse.cs index 75970493..77b0dbfa 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECSharer/ChannelsECSharerGetSharerListResponse.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECSharer/ChannelsECSharerGetSharerListResponse.cs @@ -16,6 +16,13 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Models [System.Text.Json.Serialization.JsonPropertyName("openid")] public string OpenId { get; set; } = default!; + /// + /// 获取或设置分享员 UnionId。 + /// + [Newtonsoft.Json.JsonProperty("unionid")] + [System.Text.Json.Serialization.JsonPropertyName("unionid")] + public string? UnionId { get; set; } + /// /// 获取或设置分享员昵称。 /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECSharer/ChannelsECSharerGetSharerProductH5UrlRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECSharer/ChannelsECSharerGetSharerProductH5UrlRequest.cs new file mode 100644 index 00000000..7eb2d60a --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECSharer/ChannelsECSharerGetSharerProductH5UrlRequest.cs @@ -0,0 +1,22 @@ +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /channels/ec/sharer/get_sharer_product_h5url 接口的请求。 + /// + public class ChannelsECSharerGetSharerProductH5UrlRequest : WechatApiRequest, IInferable + { + /// + /// 获取或设置分享员 OpenId。 + /// + [Newtonsoft.Json.JsonProperty("openid")] + [System.Text.Json.Serialization.JsonPropertyName("openid")] + public string OpenId { get; set; } = string.Empty; + + /// + /// 获取或设置商品 ID。 + /// + [Newtonsoft.Json.JsonProperty("product_id")] + [System.Text.Json.Serialization.JsonPropertyName("product_id")] + public long ProductId { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECSharer/ChannelsECSharerGetSharerProductH5UrlResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECSharer/ChannelsECSharerGetSharerProductH5UrlResponse.cs new file mode 100644 index 00000000..61a2df88 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECSharer/ChannelsECSharerGetSharerProductH5UrlResponse.cs @@ -0,0 +1,15 @@ +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /channels/ec/sharer/get_sharer_product_h5url 接口的响应。 + /// + public class ChannelsECSharerGetSharerProductH5UrlResponse : WechatApiResponse + { + /// + /// 获取或设置商品 H5 短链。 + /// + [Newtonsoft.Json.JsonProperty("product_h5url")] + [System.Text.Json.Serialization.JsonPropertyName("product_h5url")] + public string ProductH5Url { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECSharer/ChannelsECSharerGetSharerProductQrcodeRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECSharer/ChannelsECSharerGetSharerProductQrcodeRequest.cs new file mode 100644 index 00000000..8451b7b7 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECSharer/ChannelsECSharerGetSharerProductQrcodeRequest.cs @@ -0,0 +1,22 @@ +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /channels/ec/sharer/get_sharer_product_qrcode 接口的请求。 + /// + public class ChannelsECSharerGetSharerProductQrcodeRequest : WechatApiRequest, IInferable + { + /// + /// 获取或设置分享员 OpenId。 + /// + [Newtonsoft.Json.JsonProperty("openid")] + [System.Text.Json.Serialization.JsonPropertyName("openid")] + public string OpenId { get; set; } = string.Empty; + + /// + /// 获取或设置商品 ID。 + /// + [Newtonsoft.Json.JsonProperty("product_id")] + [System.Text.Json.Serialization.JsonPropertyName("product_id")] + public long ProductId { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECSharer/ChannelsECSharerGetSharerProductQrcodeResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECSharer/ChannelsECSharerGetSharerProductQrcodeResponse.cs new file mode 100644 index 00000000..ea11307d --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECSharer/ChannelsECSharerGetSharerProductQrcodeResponse.cs @@ -0,0 +1,15 @@ +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /channels/ec/sharer/get_sharer_product_qrcode 接口的响应。 + /// + public class ChannelsECSharerGetSharerProductQrcodeResponse : WechatApiResponse + { + /// + /// 获取或设置商品二维码链接。 + /// + [Newtonsoft.Json.JsonProperty("product_qrcode")] + [System.Text.Json.Serialization.JsonPropertyName("product_qrcode")] + public string ProductQrcode { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECSharer/ChannelsECSharerGetSharerProductTagLinkRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECSharer/ChannelsECSharerGetSharerProductTagLinkRequest.cs new file mode 100644 index 00000000..17f5489a --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECSharer/ChannelsECSharerGetSharerProductTagLinkRequest.cs @@ -0,0 +1,22 @@ +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /channels/ec/sharer/get_sharer_product_taglink 接口的请求。 + /// + public class ChannelsECSharerGetSharerProductTagLinkRequest : WechatApiRequest, IInferable + { + /// + /// 获取或设置分享员 OpenId。 + /// + [Newtonsoft.Json.JsonProperty("openid")] + [System.Text.Json.Serialization.JsonPropertyName("openid")] + public string OpenId { get; set; } = string.Empty; + + /// + /// 获取或设置商品 ID。 + /// + [Newtonsoft.Json.JsonProperty("product_id")] + [System.Text.Json.Serialization.JsonPropertyName("product_id")] + public long ProductId { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECSharer/ChannelsECSharerGetSharerProductTagLinkResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECSharer/ChannelsECSharerGetSharerProductTagLinkResponse.cs new file mode 100644 index 00000000..df11884d --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECSharer/ChannelsECSharerGetSharerProductTagLinkResponse.cs @@ -0,0 +1,15 @@ +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /channels/ec/sharer/get_sharer_product_taglink 接口的响应。 + /// + public class ChannelsECSharerGetSharerProductTagLinkResponse : WechatApiResponse + { + /// + /// 获取或设置商品微信口令。 + /// + [Newtonsoft.Json.JsonProperty("product_taglink")] + [System.Text.Json.Serialization.JsonPropertyName("product_taglink")] + public string ProductTagLink { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECSharer/ChannelsECSharerSearchSharerResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECSharer/ChannelsECSharerSearchSharerResponse.cs index 7fa82aab..f696f375 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECSharer/ChannelsECSharerSearchSharerResponse.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECSharer/ChannelsECSharerSearchSharerResponse.cs @@ -12,6 +12,13 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Models [System.Text.Json.Serialization.JsonPropertyName("openid")] public string OpenId { get; set; } = default!; + /// + /// 获取或设置分享员 UnionId。 + /// + [Newtonsoft.Json.JsonProperty("unionid")] + [System.Text.Json.Serialization.JsonPropertyName("unionid")] + public string? UnionId { get; set; } + /// /// 获取或设置分享员昵称。 /// diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECSharer/ChannelsECSharerGetSharerListResponse.json b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECSharer/ChannelsECSharerGetSharerListResponse.json index 9a8b0172..a2be6f2f 100644 --- a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECSharer/ChannelsECSharerGetSharerListResponse.json +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECSharer/ChannelsECSharerGetSharerListResponse.json @@ -6,7 +6,8 @@ "openid": "OPENID", "nickname": "NICKNAME", "bind_time": 1624082155, - "sharer_type": 0 + "sharer_type": 0, + "unionid": "UNIONID" } ] } diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECSharer/ChannelsECSharerGetSharerProductH5UrlRequest.json b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECSharer/ChannelsECSharerGetSharerProductH5UrlRequest.json new file mode 100644 index 00000000..92e8815b --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECSharer/ChannelsECSharerGetSharerProductH5UrlRequest.json @@ -0,0 +1,4 @@ +{ + "openid": "OPENID", + "product_id": "324545" +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECSharer/ChannelsECSharerGetSharerProductH5UrlResponse.json b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECSharer/ChannelsECSharerGetSharerProductH5UrlResponse.json new file mode 100644 index 00000000..1c63b7b5 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECSharer/ChannelsECSharerGetSharerProductH5UrlResponse.json @@ -0,0 +1,5 @@ +{ + "errcode": 0, + "errmsg": "ok", + "product_h5url": "https://channels.weixin.qq.com/shop/a/xsgVVZtSGpqwd45" +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECSharer/ChannelsECSharerGetSharerProductQrcodeRequest.json b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECSharer/ChannelsECSharerGetSharerProductQrcodeRequest.json new file mode 100644 index 00000000..92e8815b --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECSharer/ChannelsECSharerGetSharerProductQrcodeRequest.json @@ -0,0 +1,4 @@ +{ + "openid": "OPENID", + "product_id": "324545" +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECSharer/ChannelsECSharerGetSharerProductQrcodeResponse.json b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECSharer/ChannelsECSharerGetSharerProductQrcodeResponse.json new file mode 100644 index 00000000..b5fad612 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECSharer/ChannelsECSharerGetSharerProductQrcodeResponse.json @@ -0,0 +1,5 @@ +{ + "errcode": 0, + "errmsg": "ok", + "product_qrcode": "https://store.mp.video.tencent-cloud.com/161/20304/snscosdownload/SH/reserved/642a2b730001a542dbe0b846bcc4b00b002000a1000f4f50" +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECSharer/ChannelsECSharerGetSharerProductTagLinkRequest.json b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECSharer/ChannelsECSharerGetSharerProductTagLinkRequest.json new file mode 100644 index 00000000..92e8815b --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECSharer/ChannelsECSharerGetSharerProductTagLinkRequest.json @@ -0,0 +1,4 @@ +{ + "openid": "OPENID", + "product_id": "324545" +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECSharer/ChannelsECSharerGetSharerProductTagLinkResponse.json b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECSharer/ChannelsECSharerGetSharerProductTagLinkResponse.json new file mode 100644 index 00000000..84463a91 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECSharer/ChannelsECSharerGetSharerProductTagLinkResponse.json @@ -0,0 +1,5 @@ +{ + "errcode": 0, + "errmsg": "ok", + "product_taglink": "#视频号小店://视频号小店/jMv2lqYonCP1qqv" +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECSharer/ChannelsECSharerSearchSharerResponse.json b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECSharer/ChannelsECSharerSearchSharerResponse.json index 0b84e4e1..39b2c9c6 100644 --- a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECSharer/ChannelsECSharerSearchSharerResponse.json +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECSharer/ChannelsECSharerSearchSharerResponse.json @@ -4,5 +4,6 @@ "openid": "OPENID", "nickname": "NICKNAME", "bind_time": 1624082155, - "sharer_type": 0 + "sharer_type": 0, + "unionid": "UNIONID" }