feat(wxapi): 新增服务平台增值服务相关接口

This commit is contained in:
Fu Diwei 2022-02-28 22:10:11 +08:00
parent 30405cc55f
commit a39defdc23
16 changed files with 408 additions and 3 deletions

View File

@ -7,7 +7,7 @@
/// <para>https://developers.weixin.qq.com/minigame/dev/api-backend/open-api/sec-check/security.mediaCheckAsync.html </para>
/// <para>https://developers.weixin.qq.com/minigame/dev/api-backend/open-api/sec-check/security.mediaCheckAsync-v1.html </para>
/// </summary>
public class WxaMediaCheckEvent : WechatApiEvent, WechatApiEvent.Serialization.IJsonSerializable
public class WxaMediaCheckEvent : WechatApiEvent, WechatApiEvent.Serialization.IJsonSerializable, WechatApiEvent.Serialization.IXmlSerializable
{
public static class Types
{
@ -18,6 +18,7 @@
/// </summary>
[Newtonsoft.Json.JsonProperty("suggest")]
[System.Text.Json.Serialization.JsonPropertyName("suggest")]
[System.Xml.Serialization.XmlElement("suggest")]
public string SuggestType { get; set; } = default!;
/// <summary>
@ -25,6 +26,7 @@
/// </summary>
[Newtonsoft.Json.JsonProperty("label")]
[System.Text.Json.Serialization.JsonPropertyName("label")]
[System.Xml.Serialization.XmlElement("label")]
public int Label { get; set; }
}
@ -35,6 +37,7 @@
/// </summary>
[Newtonsoft.Json.JsonProperty("errcode")]
[System.Text.Json.Serialization.JsonPropertyName("errcode")]
[System.Xml.Serialization.XmlElement("errcode")]
public int ErrorCode { get; set; }
/// <summary>
@ -42,6 +45,7 @@
/// </summary>
[Newtonsoft.Json.JsonProperty("strategy")]
[System.Text.Json.Serialization.JsonPropertyName("strategy")]
[System.Xml.Serialization.XmlElement("strategy")]
public string Strategy { get; set; } = default!;
/// <summary>
@ -49,6 +53,7 @@
/// </summary>
[Newtonsoft.Json.JsonProperty("suggest")]
[System.Text.Json.Serialization.JsonPropertyName("suggest")]
[System.Xml.Serialization.XmlElement("suggest", IsNullable = true)]
public string? SuggestType { get; set; }
/// <summary>
@ -56,6 +61,7 @@
/// </summary>
[Newtonsoft.Json.JsonProperty("label")]
[System.Text.Json.Serialization.JsonPropertyName("label")]
[System.Xml.Serialization.XmlElement("label", IsNullable = true)]
public int? Label { get; set; }
/// <summary>
@ -63,6 +69,7 @@
/// </summary>
[Newtonsoft.Json.JsonProperty("prob")]
[System.Text.Json.Serialization.JsonPropertyName("prob")]
[System.Xml.Serialization.XmlElement("prob", IsNullable = true)]
public int? Probability { get; set; }
}
}
@ -74,6 +81,7 @@
[Newtonsoft.Json.JsonProperty("isrisky")]
[System.Text.Json.Serialization.JsonPropertyName("isrisky")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumericalBooleanConverter))]
[System.Xml.Serialization.XmlElement("isrisky")]
public bool IsRisky { get; set; }
/// <summary>
@ -81,6 +89,7 @@
/// </summary>
[Newtonsoft.Json.JsonProperty("extra_info_json")]
[System.Text.Json.Serialization.JsonPropertyName("extra_info_json")]
[System.Xml.Serialization.XmlElement("extra_info_json", IsNullable = true)]
public string? JsonExtra { get; set; }
/// <summary>
@ -88,6 +97,7 @@
/// </summary>
[Newtonsoft.Json.JsonProperty("appid")]
[System.Text.Json.Serialization.JsonPropertyName("appid")]
[System.Xml.Serialization.XmlElement("appid")]
public string AppId { get; set; } = default!;
/// <summary>
@ -95,6 +105,7 @@
/// </summary>
[Newtonsoft.Json.JsonProperty("trace_id")]
[System.Text.Json.Serialization.JsonPropertyName("trace_id")]
[System.Xml.Serialization.XmlElement("trace_id")]
public string TraceId { get; set; } = default!;
/// <summary>
@ -102,6 +113,7 @@
/// </summary>
[Newtonsoft.Json.JsonProperty("status_code")]
[System.Text.Json.Serialization.JsonPropertyName("status_code")]
[System.Xml.Serialization.XmlElement("status_code")]
public int StatusCode { get; set; }
/// <summary>
@ -109,6 +121,7 @@
/// </summary>
[Newtonsoft.Json.JsonProperty("version")]
[System.Text.Json.Serialization.JsonPropertyName("version")]
[System.Xml.Serialization.XmlElement("version", IsNullable = true)]
public int? Version { get; set; }
/// <summary>
@ -116,6 +129,7 @@
/// </summary>
[Newtonsoft.Json.JsonProperty("result")]
[System.Text.Json.Serialization.JsonPropertyName("result")]
[System.Xml.Serialization.XmlElement("result", IsNullable = true)]
public Types.Result? Result { get; set; }
/// <summary>
@ -123,6 +137,7 @@
/// </summary>
[Newtonsoft.Json.JsonProperty("detail")]
[System.Text.Json.Serialization.JsonPropertyName("detail")]
[System.Xml.Serialization.XmlElement("detail", IsNullable = true)]
public Types.Detail[]? DetailList { get; set; }
}
}

View File

@ -875,6 +875,66 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
return await client.SendRequestWithJsonAsync<Models.WxaServiceMarketRetrieveResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /wxa/servicemarket/service/get_service_buyer_list 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/oplatform/service_market/interface/value_added/servicemarket_get_service_buyer_list.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.WxaServiceMarketServiceGetServiceBuyerListResponse> ExecuteWxaServiceMarketServiceGetServiceBuyerListAsync(this WechatApiClient client, Models.WxaServiceMarketServiceGetServiceBuyerListRequest 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
.CreateRequest(request, HttpMethod.Post, "wxa", "servicemarket", "service", "get_service_buyer_list")
.SetQueryParam("access_token", request.ComponentAccessToken);
return await client.SendRequestWithJsonAsync<Models.WxaServiceMarketServiceGetServiceBuyerListResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /wxa/servicemarket/service/get_service_buyer 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/oplatform/service_market/interface/value_added/servicemarket_get_service_buyer.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.WxaServiceMarketServiceGetServiceBuyerResponse> ExecuteWxaServiceMarketServiceGetServiceBuyerAsync(this WechatApiClient client, Models.WxaServiceMarketServiceGetServiceBuyerRequest 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
.CreateRequest(request, HttpMethod.Post, "wxa", "servicemarket", "service", "get_service_buyer")
.SetQueryParam("access_token", request.ComponentAccessToken);
return await client.SendRequestWithJsonAsync<Models.WxaServiceMarketServiceGetServiceBuyerResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /wxa/servicemarket/get_paid_order_list 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/oplatform/service_market/interface/value_added/servicemarket_get_paid_order_list.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.WxaServiceMarketGetPaidOrderListResponse> ExecuteWxaServiceMarketGetPaidOrderListAsync(this WechatApiClient client, Models.WxaServiceMarketGetPaidOrderListRequest 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
.CreateRequest(request, HttpMethod.Post, "wxa", "servicemarket", "get_paid_order_list")
.SetQueryParam("access_token", request.ComponentAccessToken);
return await client.SendRequestWithJsonAsync<Models.WxaServiceMarketGetPaidOrderListResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
#endregion
#region ShortLink

View File

@ -13,7 +13,7 @@
public string Action { get; set; } = "apply";
/// <summary>
/// 获取或设置插件 Appid。
/// 获取或设置插件 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("plugin_appid")]
[System.Text.Json.Serialization.JsonPropertyName("plugin_appid")]

View File

@ -13,7 +13,7 @@
public string Action { get; set; } = "unbind";
/// <summary>
/// 获取或设置插件 Appid。
/// 获取或设置插件 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("plugin_appid")]
[System.Text.Json.Serialization.JsonPropertyName("plugin_appid")]

View File

@ -0,0 +1,44 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /wxa/servicemarket/get_paid_order_list 接口的请求。</para>
/// </summary>
public class WxaServiceMarketGetPaidOrderListRequest : WechatApiRequest, IInferable<WxaServiceMarketGetPaidOrderListRequest, WxaServiceMarketGetPaidOrderListResponse>
{
/// <summary>
/// 获取或设置第三方平台 AccessToken。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string ComponentAccessToken { get; set; } = string.Empty;
/// <summary>
/// 获取或设置小程序 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("appid")]
[System.Text.Json.Serialization.JsonPropertyName("appid")]
public string AppId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置服务 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("service_id")]
[System.Text.Json.Serialization.JsonPropertyName("service_id")]
public string ServiceId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置分页起始位置。
/// </summary>
[Newtonsoft.Json.JsonProperty("offset")]
[System.Text.Json.Serialization.JsonPropertyName("offset")]
public int Offset { get; set; }
/// <summary>
/// 获取或设置分页每页数量。
/// <para>默认值10</para>
/// </summary>
[Newtonsoft.Json.JsonProperty("limit")]
[System.Text.Json.Serialization.JsonPropertyName("limit")]
public int Limit { get; set; } = 10;
}
}

View File

@ -0,0 +1,56 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /wxa/servicemarket/get_paid_order_list 接口的响应。</para>
/// </summary>
public class WxaServiceMarketGetPaidOrderListResponse : WechatApiResponse
{
public static class Types
{
public class Order
{
/// <summary>
/// 获取或设置订单 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("order_id")]
[System.Text.Json.Serialization.JsonPropertyName("order_id")]
public long OrderId { get; set; }
/// <summary>
/// 获取或设置规格 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("specification_id")]
[System.Text.Json.Serialization.JsonPropertyName("specification_id")]
public string SpecificationId { get; set; } = default!;
/// <summary>
/// 获取或设置生效时间戳。
/// </summary>
[Newtonsoft.Json.JsonProperty("effective_time")]
[System.Text.Json.Serialization.JsonPropertyName("effective_time")]
public long EffectiveTimestamp { get; set; }
/// <summary>
/// 获取或设置过期时间戳。
/// </summary>
[Newtonsoft.Json.JsonProperty("expire_time")]
[System.Text.Json.Serialization.JsonPropertyName("expire_time")]
public long ExpireTimestamp { get; set; }
/// <summary>
/// 获取或设置订单总价(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("total_price")]
[System.Text.Json.Serialization.JsonPropertyName("total_price")]
public int? TotalFee { get; set; }
}
}
/// <summary>
/// 获取或设置订单列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("order_list")]
[System.Text.Json.Serialization.JsonPropertyName("order_list")]
public Types.Order[] OrderList { get; set; } = default!;
}
}

View File

@ -0,0 +1,37 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /wxa/servicemarket/service/get_service_buyer_list 接口的请求。</para>
/// </summary>
public class WxaServiceMarketServiceGetServiceBuyerListRequest : WechatApiRequest, IInferable<WxaServiceMarketServiceGetServiceBuyerListRequest, WxaServiceMarketServiceGetServiceBuyerListResponse>
{
/// <summary>
/// 获取或设置第三方平台 AccessToken。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string ComponentAccessToken { get; set; } = string.Empty;
/// <summary>
/// 获取或设置服务 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("service_id")]
[System.Text.Json.Serialization.JsonPropertyName("service_id")]
public string ServiceId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置分页起始位置。
/// </summary>
[Newtonsoft.Json.JsonProperty("offset")]
[System.Text.Json.Serialization.JsonPropertyName("offset")]
public int Offset { get; set; }
/// <summary>
/// 获取或设置分页每页数量。
/// <para>默认值10</para>
/// </summary>
[Newtonsoft.Json.JsonProperty("limit")]
[System.Text.Json.Serialization.JsonPropertyName("limit")]
public int Limit { get; set; } = 10;
}
}

View File

@ -0,0 +1,63 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /wxa/servicemarket/service/get_service_buyer_list 接口的响应。</para>
/// </summary>
public class WxaServiceMarketServiceGetServiceBuyerListResponse : WechatApiResponse
{
public static class Types
{
public class Buyer
{
public static class Types
{
public class Specification
{
/// <summary>
/// 获取或设置规格 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("specification_id")]
[System.Text.Json.Serialization.JsonPropertyName("specification_id")]
public string SpecificationId { get; set; } = default!;
/// <summary>
/// 获取或设置过期时间戳。
/// </summary>
[Newtonsoft.Json.JsonProperty("expire_time")]
[System.Text.Json.Serialization.JsonPropertyName("expire_time")]
public long ExpireTime { get; set; }
}
}
/// <summary>
/// 获取或设置小程序 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("appid")]
[System.Text.Json.Serialization.JsonPropertyName("appid")]
public string AppId { get; set; } = default!;
/// <summary>
/// 获取或设置服务 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("service_id")]
[System.Text.Json.Serialization.JsonPropertyName("service_id")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumericalStringReadOnlyConverter))]
public string ServiceId { get; set; } = default!;
/// <summary>
/// 获取或设置规格列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("spec_list")]
[System.Text.Json.Serialization.JsonPropertyName("spec_list")]
public Types.Specification[]? SpecificationList { get; set; }
}
}
/// <summary>
/// 获取或设置服务用户列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("buyer_list")]
[System.Text.Json.Serialization.JsonPropertyName("buyer_list")]
public Types.Buyer[] BuyerList { get; set; } = default!;
}
}

View File

@ -0,0 +1,29 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /wxa/servicemarket/service/get_service_buyer 接口的请求。</para>
/// </summary>
public class WxaServiceMarketServiceGetServiceBuyerRequest : WechatApiRequest, IInferable<WxaServiceMarketServiceGetServiceBuyerRequest, WxaServiceMarketServiceGetServiceBuyerResponse>
{
/// <summary>
/// 获取或设置第三方平台 AccessToken。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string ComponentAccessToken { get; set; } = string.Empty;
/// <summary>
/// 获取或设置小程序 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("appid")]
[System.Text.Json.Serialization.JsonPropertyName("appid")]
public string AppId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置服务 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("service_id")]
[System.Text.Json.Serialization.JsonPropertyName("service_id")]
public string ServiceId { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /wxa/servicemarket/service/get_service_buyer 接口的响应。</para>
/// </summary>
public class WxaServiceMarketServiceGetServiceBuyerResponse : WechatApiResponse
{
public static class Types
{
public class Buyer : WxaServiceMarketServiceGetServiceBuyerListResponse.Types.Buyer
{
}
}
/// <summary>
/// 获取或设置服务用户信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("buyer")]
[System.Text.Json.Serialization.JsonPropertyName("buyer")]
public Types.Buyer Buyer { get; set; } = default!;
}
}

View File

@ -0,0 +1,6 @@
{
"appid": "wx2333",
"service_id": "10000000005",
"offset": 0,
"limit": 20
}

View File

@ -0,0 +1,12 @@
{
"errcode": 0,
"errmsg": "ok",
"order_list": [
{
"order_id": 123,
"effective_time": 1640173379,
"expire_time": 1640259780,
"specification_id": "special"
}
]
}

View File

@ -0,0 +1,5 @@
{
"service_id": "10000000005",
"offset": 0,
"limit": 10
}

View File

@ -0,0 +1,34 @@
{
"errcode": 0,
"errmsg": "ok",
"buyer_list": [
{
"appid": "wxb24cc230ace685a3",
"service_id": 10000000005,
"spec_list": [
{
"expire_time": 1619010767,
"specification_id": "free"
},
{
"expire_time": 1637987028,
"specification_id": "pro"
}
]
},
{
"appid": "wxd30af6a6a77d8a32",
"service_id": 10000000005,
"spec_list": [
{
"expire_time": 1619010768,
"specification_id": "free"
},
{
"expire_time": 1637987029,
"specification_id": "pro"
}
]
}
]
}

View File

@ -0,0 +1,4 @@
{
"appid": "wxb24cc230ace685a3",
"service_id": "10000000005"
}

View File

@ -0,0 +1,18 @@
{
"errcode": 0,
"errmsg": "ok",
"buyer": {
"appid": "wxb24cc230ace685a3",
"service_id": 10000000005,
"spec_list": [
{
"expire_time": 1619010767,
"specification_id": "free"
},
{
"expire_time": 1637987028,
"specification_id": "pro"
}
]
}
}