mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-09-20 18:48:10 +08:00
feat(wxapi): 新增视频号小店物流公司虚拟号码相关接口
This commit is contained in:
@@ -1567,6 +1567,68 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
|||||||
#endregion
|
#endregion
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region ECLogistics
|
||||||
|
/// <summary>
|
||||||
|
/// <para>异步调用 [POST] /channels/ec/logistics/phonenumberpool/get 接口。</para>
|
||||||
|
/// <para>REF: https://developers.weixin.qq.com/doc/channels/API/logistics/delivery_virtual_number.html </para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="client"></param>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<Models.ChannelsECLogisticsPhoneNumberPoolGetResponse> ExecuteChannelsECLogisticsPhoneNumberPoolGetAsync(this WechatApiClient client, Models.ChannelsECLogisticsPhoneNumberPoolGetRequest 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, "channels", "ec", "logistics", "phonenumberpool", "get")
|
||||||
|
.SetQueryParam("access_token", request.AccessToken);
|
||||||
|
|
||||||
|
return await client.SendRequestWithJsonAsync<Models.ChannelsECLogisticsPhoneNumberPoolGetResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>异步调用 [POST] /channels/ec/logistics/phonenumber/get 接口。</para>
|
||||||
|
/// <para>REF: https://developers.weixin.qq.com/doc/channels/API/logistics/delivery_virtual_number_get.html </para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="client"></param>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<Models.ChannelsECLogisticsPhoneNumberGetResponse> ExecuteChannelsECLogisticsPhoneNumberGetAsync(this WechatApiClient client, Models.ChannelsECLogisticsPhoneNumberGetRequest 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, "channels", "ec", "logistics", "phonenumber", "get")
|
||||||
|
.SetQueryParam("access_token", request.AccessToken);
|
||||||
|
|
||||||
|
return await client.SendRequestWithJsonAsync<Models.ChannelsECLogisticsPhoneNumberGetResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>异步调用 [POST] /channels/ec/logistics/virtualnumber/get 接口。</para>
|
||||||
|
/// <para>REF: https://developers.weixin.qq.com/doc/channels/API/logistics/delivery_virtual_number_get_virtual.html </para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="client"></param>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<Models.ChannelsECLogisticsVirtualNumberGetResponse> ExecuteChannelsECLogisticsVirtualNumberGetAsync(this WechatApiClient client, Models.ChannelsECLogisticsVirtualNumberGetRequest 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, "channels", "ec", "logistics", "virtualnumber", "get")
|
||||||
|
.SetQueryParam("access_token", request.AccessToken);
|
||||||
|
|
||||||
|
return await client.SendRequestWithJsonAsync<Models.ChannelsECLogisticsVirtualNumberGetResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region ECSharer
|
#region ECSharer
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <para>异步调用 [POST] /channels/ec/sharer/bind 接口。</para>
|
/// <para>异步调用 [POST] /channels/ec/sharer/bind 接口。</para>
|
||||||
|
@@ -0,0 +1,22 @@
|
|||||||
|
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// <para>表示 [POST] /channels/ec/logistics/phonenumber/get 接口的请求。</para>
|
||||||
|
/// </summary>
|
||||||
|
public class ChannelsECLogisticsPhoneNumberGetRequest : WechatApiRequest, IInferable<ChannelsECLogisticsPhoneNumberGetRequest, ChannelsECLogisticsPhoneNumberGetResponse>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置运单号。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("waybill_id")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("waybill_id")]
|
||||||
|
public string WaybillId { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置虚拟号码。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("private_phone")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("private_phone")]
|
||||||
|
public string? VirtualPhoneNumber { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,15 @@
|
|||||||
|
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// <para>表示 [POST] /channels/ec/logistics/phonenumber/get 接口的响应。</para>
|
||||||
|
/// </summary>
|
||||||
|
public class ChannelsECLogisticsPhoneNumberGetResponse : WechatApiResponse
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置真实号码。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("phone")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("phone")]
|
||||||
|
public string PhoneNumber { get; set; } = default!;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,23 @@
|
|||||||
|
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// <para>表示 [POST] /channels/ec/logistics/phonenumberpool/get 接口的请求。</para>
|
||||||
|
/// </summary>
|
||||||
|
public class ChannelsECLogisticsPhoneNumberPoolGetRequest : WechatApiRequest, IInferable<ChannelsECLogisticsPhoneNumberPoolGetRequest, ChannelsECLogisticsPhoneNumberPoolGetResponse>
|
||||||
|
{
|
||||||
|
/// <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,36 @@
|
|||||||
|
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// <para>表示 [POST] /channels/ec/logistics/phonenumberpool/get 接口的响应。</para>
|
||||||
|
/// </summary>
|
||||||
|
public class ChannelsECLogisticsPhoneNumberPoolGetResponse : WechatApiResponse
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置虚拟号码列表。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("phonenumbers")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("phonenumbers")]
|
||||||
|
public string[] VirtualPhoneNumberList { 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("has_more")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("has_more")]
|
||||||
|
public bool HasMore { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置翻页标记。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("next_key")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("next_key")]
|
||||||
|
public string? NextCursor { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,15 @@
|
|||||||
|
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// <para>表示 [POST] /channels/ec/logistics/virtualnumber/get 接口的请求。</para>
|
||||||
|
/// </summary>
|
||||||
|
public class ChannelsECLogisticsVirtualNumberGetRequest : WechatApiRequest, IInferable<ChannelsECLogisticsVirtualNumberGetRequest, ChannelsECLogisticsVirtualNumberGetResponse>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置运单号。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("waybill_id")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("waybill_id")]
|
||||||
|
public string WaybillId { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,29 @@
|
|||||||
|
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// <para>表示 [POST] /channels/ec/logistics/virtualnumber/get 接口的响应。</para>
|
||||||
|
/// </summary>
|
||||||
|
public class ChannelsECLogisticsVirtualNumberGetResponse : WechatApiResponse
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置打码的真实号码。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("masked_real_phone")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("masked_real_phone")]
|
||||||
|
public string MaskedPhoneNumber { get; set; } = default!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置虚拟号码。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("main_phone")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("main_phone")]
|
||||||
|
public string VirtualPhoneNumber { get; set; } = default!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置完整虚拟号码。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("virtual_phone")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("virtual_phone")]
|
||||||
|
public string FullVirtualPhoneNumber { get; set; } = default!;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"waybill_id": "xxxxxx",
|
||||||
|
"private_phone": "xxxxxx"
|
||||||
|
}
|
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"errcode": 0,
|
||||||
|
"errmsg": "ok",
|
||||||
|
"phone": "xxxxx"
|
||||||
|
}
|
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"page_size": 10,
|
||||||
|
"next_key": "xxxx"
|
||||||
|
}
|
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"errcode": 0,
|
||||||
|
"errmsg": "ok",
|
||||||
|
"has_more": true,
|
||||||
|
"next_key": "xxxxx",
|
||||||
|
"total_num": 3000,
|
||||||
|
"phonenumbers": [ "xxxx", "xxxx" ]
|
||||||
|
}
|
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"waybill_id": "xxxx"
|
||||||
|
}
|
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"errcode": 0,
|
||||||
|
"errmsg": "ok",
|
||||||
|
"masked_real_phone": "123****8901",
|
||||||
|
"virtual_phone": "12345678901-1234",
|
||||||
|
"main_phone": "12345678901"
|
||||||
|
}
|
Reference in New Issue
Block a user