Skip to content

Commit

Permalink
feat(wxapi): 新增微信小店合作账号小程序相关接口接口
Browse files Browse the repository at this point in the history
  • Loading branch information
fudiwei committed Nov 4, 2024
1 parent c50662b commit 57d28bc
Show file tree
Hide file tree
Showing 19 changed files with 610 additions and 43 deletions.
86 changes: 43 additions & 43 deletions docs/WechatApi/Basic_ModelDefinition.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,49 +64,49 @@

<summary>[展开查看]</summary>

| | 微信 API | 平台能力 | 备注 |
| :-: | :-----------------------------------: | :------: | :------------------: |
|| 接口调用凭证 | | |
|| OpenAPI 管理 | | |
|| 小程序登录 | | |
|| 用户信息 | | |
|| 小程序码于与小程序链接 | | |
|| 小程序客服 | | |
|| 消息相关 | | |
|| 小程序安全 | | |
|| 数据分析 | | |
|| 硬件设备 | | |
|| 运维中心 | | |
|| 插件管理 | | |
|| 云开发 | | |
|| 附近小程序 | | |
|| 图像处理与文字识别 | | |
|| 微信红包封面 | | |
|| 即时配送 | | |
|| 物流助手 | | |
|| 微信服务市场 | | |
|| 生物认证 | | |
|| 微信客服 | | |
| × | <del>广告</del> | | 异构协议,需独立模块 |
|| 小程序评价 | 行业能力 | |
|| 小程序评价 | 行业能力 | |
|| 微信学生身份快速验证 | 行业能力 | |
|| 微信物流服务 | 行业能力 | |
| × | <del>乘车码</del> | 行业能力 | _开发中_ |
|| 小程序 B2B 门店助手 | 行业能力 | |
|| 短剧小程序 | 行业能力 | |
| × | <del>小说小程序</del> | 行业能力 | _开发中_ |
|| 购物订单 | 商业能力 | |
|| 交易保障 | 商业能力 | |
|| 小程序推广员 | 商业能力 | |
|| 交易组件 | 商业能力 | |
|| 卡券 | 商业能力 | |
|| 小程序支付管理服务 | 商业能力 | |
|| 小程序发货信息管理服务 | 商业能力 | |
| × | <del>微信小店合作账号小程序接口</del> | 商业能力 | _开发中_ |
|| 多端能力 | 多端能力 | |
|| 服务市场 | 服务市场 | |
|| 城市服务 | 城市服务 | |
| | 微信 API | 平台能力 | 备注 |
| :-: | :------------------------: | :------: | :------------------: |
|| 接口调用凭证 | | |
|| OpenAPI 管理 | | |
|| 小程序登录 | | |
|| 用户信息 | | |
|| 小程序码于与小程序链接 | | |
|| 小程序客服 | | |
|| 消息相关 | | |
|| 小程序安全 | | |
|| 数据分析 | | |
|| 硬件设备 | | |
|| 运维中心 | | |
|| 插件管理 | | |
|| 云开发 | | |
|| 附近小程序 | | |
|| 图像处理与文字识别 | | |
|| 微信红包封面 | | |
|| 即时配送 | | |
|| 物流助手 | | |
|| 微信服务市场 | | |
|| 生物认证 | | |
|| 微信客服 | | |
| × | <del>广告</del> | | 异构协议,需独立模块 |
|| 小程序评价 | 行业能力 | |
|| 小程序评价 | 行业能力 | |
|| 微信学生身份快速验证 | 行业能力 | |
|| 微信物流服务 | 行业能力 | |
| × | <del>乘车码</del> | 行业能力 | _开发中_ |
|| 小程序 B2B 门店助手 | 行业能力 | |
|| 短剧小程序 | 行业能力 | |
| × | <del>小说小程序</del> | 行业能力 | _开发中_ |
|| 购物订单 | 商业能力 | |
|| 交易保障 | 商业能力 | |
|| 小程序推广员 | 商业能力 | |
|| 交易组件 | 商业能力 | |
|| 卡券 | 商业能力 | |
|| 小程序支付管理服务 | 商业能力 | |
|| 小程序发货信息管理服务 | 商业能力 | |
| | 微信小店合作账号小程序接口 | 商业能力 | |
|| 多端能力 | 多端能力 | |
|| 服务市场 | 服务市场 | |
|| 城市服务 | 城市服务 | |

</details>

Expand Down
Original file line number Diff line number Diff line change
@@ -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!;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,100 @@ public static class WechatApiClientExecuteChannelsExtensions
}
#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>
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
@@ -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!;
}
}
Original file line number Diff line number Diff line change
@@ -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; }
}
}
Loading

0 comments on commit 57d28bc

Please sign in to comment.