mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-12-29 18:04:42 +08:00
feat(wxapi): 新增微信小店合作账号小程序相关接口接口
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 EVENT.cooperation_shop_order 事件的数据。</para>
|
||||
/// <para>
|
||||
/// REF: <br/>
|
||||
/// <![CDATA[ https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/cooperation_shop/order_callback.html ]]>
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public class CooperationShopOrderEvent : WechatApiEvent
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class EventData
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置店铺 AppId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("shop_appid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("shop_appid")]
|
||||
[System.Xml.Serialization.XmlElement("shop_appid")]
|
||||
public string ShopAppId { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置订单 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("order_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("order_id")]
|
||||
[System.Xml.Serialization.XmlElement("order_id")]
|
||||
public string OrderId { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置事件参数。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("EventData")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("EventData")]
|
||||
[System.Xml.Serialization.XmlElement("EventData")]
|
||||
public Types.EventData EventData { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
@@ -1060,6 +1060,100 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ECCooperation
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /channels/ec/cooperation/shop/list 接口。</para>
|
||||
/// <para>
|
||||
/// REF: <br/>
|
||||
/// <![CDATA[ https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/cooperation_shop/list_shop.html ]]>
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.ChannelsECCooperationShopListResponse> ExecuteChannelsECCooperationShopListAsync(this WechatApiClient client, Models.ChannelsECCooperationShopListRequest 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", "cooperation", "shop", "list")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsECCooperationShopListResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /channels/ec/cooperation/product/list 接口。</para>
|
||||
/// <para>
|
||||
/// REF: <br/>
|
||||
/// <![CDATA[ https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/cooperation_shop/list_cooperation_shop_product.html ]]>
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.ChannelsECCooperationProductListResponse> ExecuteChannelsECCooperationProductListAsync(this WechatApiClient client, Models.ChannelsECCooperationProductListRequest 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", "cooperation", "product", "list")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsECCooperationProductListResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /channels/ec/cooperation/product/get 接口。</para>
|
||||
/// <para>
|
||||
/// REF: <br/>
|
||||
/// <![CDATA[ https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/cooperation_shop/get_product.html ]]>
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.ChannelsECCooperationProductGetResponse> ExecuteChannelsECCooperationProductGetAsync(this WechatApiClient client, Models.ChannelsECCooperationProductGetRequest 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", "cooperation", "product", "get")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsECCooperationProductGetResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /channels/ec/cooperation/order/get 接口。</para>
|
||||
/// <para>
|
||||
/// REF: <br/>
|
||||
/// <![CDATA[ https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/cooperation_shop/get_order.html ]]>
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.ChannelsECCooperationOrderGetResponse> ExecuteChannelsECCooperationOrderGetAsync(this WechatApiClient client, Models.ChannelsECCooperationOrderGetRequest 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", "cooperation", "order", "get")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsECCooperationOrderGetResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ECCoupon
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /channels/ec/coupon/create 接口。</para>
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /channels/ec/cooperation/order/get 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class ChannelsECCooperationOrderGetRequest : WechatApiRequest, IInferable<ChannelsECCooperationOrderGetRequest, ChannelsECCooperationOrderGetResponse>
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置店铺 AppId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("shop_appid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("shop_appid")]
|
||||
public string ShopAppId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置订单 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("order_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("order_id")]
|
||||
public string OrderId { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /channels/ec/cooperation/order/get 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class ChannelsECCooperationOrderGetResponse : WechatApiResponse
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Order
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class OrderDetail
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Product : ChannelsECOrderGetResponse.Types.Order.Types.OrderDetail.Types.Product
|
||||
{
|
||||
}
|
||||
|
||||
public class Amount : ChannelsECOrderGetResponse.Types.Order.Types.OrderDetail.Types.Amount
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商品列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("product_infos")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("product_infos")]
|
||||
public Types.Product[] ProductList { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置金额信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("price_info")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("price_info")]
|
||||
public Types.Amount Amount { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置订单详细信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("order_detail")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("order_detail")]
|
||||
public Types.OrderDetail OrderDetail { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置下单用户 OpenId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("openid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("openid")]
|
||||
public string OpenId { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置下单用户 UnionId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("unionid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("unionid")]
|
||||
public string? UnionId { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置订单信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("order")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("order")]
|
||||
public Types.Order Order { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /channels/ec/cooperation/product/get 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class ChannelsECCooperationProductGetRequest : WechatApiRequest, IInferable<ChannelsECCooperationProductGetRequest, ChannelsECCooperationProductGetResponse>
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置店铺 AppId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("shop_appid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("shop_appid")]
|
||||
public string ShopAppId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商品 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("product_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("product_id")]
|
||||
public long ProductId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /channels/ec/cooperation/product/get 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class ChannelsECCooperationProductGetResponse : WechatApiResponse
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Product
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置商品 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("product_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("product_id")]
|
||||
[System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)]
|
||||
public long ProductId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商品标题。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("title")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("title")]
|
||||
public string Title { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置图片 URL 列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("img_urls")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("img_urls")]
|
||||
public string[] ImageUrlList { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置最低价格(单位:分)。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("min_price")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("min_price")]
|
||||
public int MinPrice { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商品信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("product")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("product")]
|
||||
public Types.Product Product { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /channels/ec/cooperation/product/list 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class ChannelsECCooperationProductListRequest : WechatApiRequest, IInferable<ChannelsECCooperationProductListRequest, ChannelsECCooperationProductListResponse>
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置店铺 AppId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("shop_appid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("shop_appid")]
|
||||
public string ShopAppId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置分页每页页数。
|
||||
/// <para>默认值:10</para>
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("page_size")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("page_size")]
|
||||
public int Limit { get; set; } = 10;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置翻页标记。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("next_key")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("next_key")]
|
||||
public string? Cursor { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /channels/ec/cooperation/product/list 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class ChannelsECCooperationProductListResponse : WechatApiResponse
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Product
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置商品 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("product_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("product_id")]
|
||||
[System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)]
|
||||
public long ProductId { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商品列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("products")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("products")]
|
||||
public Types.Product[] ProductList { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置总数量。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("total_num")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("total_num")]
|
||||
public int TotalCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置翻页标记。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("next_key")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("next_key")]
|
||||
public string? NextCursor { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /channels/ec/cooperation/shop/list 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class ChannelsECCooperationShopListRequest : WechatApiRequest, IInferable<ChannelsECCooperationShopListRequest, ChannelsECCooperationShopListResponse>
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /channels/ec/cooperation/shop/list 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class ChannelsECCooperationShopListResponse : WechatApiResponse
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Shop
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置店铺 AppId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("appid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("appid")]
|
||||
public string AppId { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置店铺名称。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("nickname")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("nickname")]
|
||||
public string Nickname { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置绑定状态。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("status")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("status")]
|
||||
public int Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置绑定时间毫秒级时间戳。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("bind_time")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("bind_time")]
|
||||
public long? BindTimeMilliseconds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置解绑时间毫秒级时间戳。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("unbind_time")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("unbind_time")]
|
||||
public long? UnbindTimeMilliseconds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置取消时间毫秒级时间戳。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("cancel_time")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("cancel_time")]
|
||||
public long? CancelTimeMilliseconds { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置店铺列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("shop_list")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("shop_list")]
|
||||
public Types.Shop[] ShopList { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user