feat(wxapi): 新增视频号小店直播及预约相关接口

This commit is contained in:
Fu Diwei 2024-06-04 14:55:31 +08:00
parent add24e9ad3
commit dbe3716735
15 changed files with 359 additions and 0 deletions

View File

@ -898,6 +898,54 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
}
#endregion
#region ECFinderLive
/// <summary>
/// <para>异步调用 [POST] /channels/ec/finderlive/getfinderliverecordlist 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developers.weixin.qq.com/doc/channels/API/live/getfinderliverecordlist.html ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ECFinderLiveGetFinderLiveRecordListResponse> ExecuteECFinderLiveGetFinderLiveRecordListAsync(this WechatApiClient client, Models.ECFinderLiveGetFinderLiveRecordListRequest 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", "finderlive", "getfinderliverecordlist")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.ECFinderLiveGetFinderLiveRecordListResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// <para>异步调用 [POST] /channels/ec/finderlive/getfinderlivenoticerecordlist 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developers.weixin.qq.com/doc/channels/API/live/getfinderlivenoticerecordlist.html ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ECFinderLiveGetFinderLiveNoticeRecordListResponse> ExecuteECFinderLiveGetFinderLiveNoticeRecordListAsync(this WechatApiClient client, Models.ECFinderLiveGetFinderLiveNoticeRecordListRequest 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", "finderlive", "getfinderlivenoticerecordlist")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.ECFinderLiveGetFinderLiveNoticeRecordListResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
#endregion
#region ECFunds
/// <summary>
/// <para>异步调用 [POST] /channels/ec/funds/getbalance 接口。</para>
@ -3373,6 +3421,52 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsECSharerGetSharerProductQrcodeResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /channels/ec/sharer/get_shop_finder_live_notice_sharer_url 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developers.weixin.qq.com/doc/channels/API/sharer/promote_finder_notice.html ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ChannelsECSharerGetShopFinderLiveNoticeSharerUrlResponse> ExecuteChannelsECSharerGetShopFinderLiveNoticeSharerUrlAsync(this WechatApiClient client, Models.ChannelsECSharerGetShopFinderLiveNoticeSharerUrlRequest 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_shop_finder_live_notice_sharer_url")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsECSharerGetShopFinderLiveNoticeSharerUrlResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /channels/ec/sharer/get_shop_finder_live_sharer_url 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developers.weixin.qq.com/doc/channels/API/sharer/promote_finder_live.html ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ChannelsECSharerGetShopFinderLiveSharerUrlResponse> ExecuteChannelsECSharerGetShopFinderLiveSharerUrlAsync(this WechatApiClient client, Models.ChannelsECSharerGetShopFinderLiveSharerUrlRequest 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_shop_finder_live_sharer_url")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsECSharerGetShopFinderLiveSharerUrlResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
#endregion
#region ECVip

View File

@ -0,0 +1,9 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/finderlive/getfinderlivenoticerecordlist 接口的请求。</para>
/// </summary>
public class ECFinderLiveGetFinderLiveNoticeRecordListRequest : WechatApiRequest, IInferable<ECFinderLiveGetFinderLiveNoticeRecordListRequest, ECFinderLiveGetFinderLiveNoticeRecordListResponse>
{
}
}

View File

@ -0,0 +1,71 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/finderlive/getfinderlivenoticerecordlist 接口的响应。</para>
/// </summary>
public class ECFinderLiveGetFinderLiveNoticeRecordListResponse : WechatApiResponse
{
public static class Types
{
public class Notice
{
/// <summary>
/// 获取或设置直播预告 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("notice_id")]
[System.Text.Json.Serialization.JsonPropertyName("notice_id")]
public string NoticeId { 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("status_wording")]
[System.Text.Json.Serialization.JsonPropertyName("status_wording")]
public string StatusText { get; set; } = default!;
/// <summary>
/// 获取或设置直播开始时间戳。
/// </summary>
[Newtonsoft.Json.JsonProperty("start_time")]
[System.Text.Json.Serialization.JsonPropertyName("start_time")]
[System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)]
public long StartTimestamp { get; set; }
/// <summary>
/// 获取或设置预约描述。
/// </summary>
[Newtonsoft.Json.JsonProperty("description")]
[System.Text.Json.Serialization.JsonPropertyName("description")]
public string Description { get; set; } = default!;
/// <summary>
/// 获取或设置开播视频号昵称。
/// </summary>
[Newtonsoft.Json.JsonProperty("nickname")]
[System.Text.Json.Serialization.JsonPropertyName("nickname")]
public string Nickname { get; set; } = default!;
/// <summary>
/// 获取或设置开播视频号头像 URL。
/// </summary>
[Newtonsoft.Json.JsonProperty("head_url")]
[System.Text.Json.Serialization.JsonPropertyName("head_url")]
public string HeadImageUrl { get; set; } = default!;
}
}
/// <summary>
/// 获取或设置直播预告列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("live_notice_list")]
[System.Text.Json.Serialization.JsonPropertyName("live_notice_list")]
public Types.Notice[] NoticeList { get; set; } = default!;
}
}

View File

@ -0,0 +1,9 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/finderlive/getfinderliverecordlist 接口的请求。</para>
/// </summary>
public class ECFinderLiveGetFinderLiveRecordListRequest : WechatApiRequest, IInferable<ECFinderLiveGetFinderLiveRecordListRequest, ECFinderLiveGetFinderLiveRecordListResponse>
{
}
}

View File

@ -0,0 +1,56 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/finderlive/getfinderliverecordlist 接口的响应。</para>
/// </summary>
public class ECFinderLiveGetFinderLiveRecordListResponse : WechatApiResponse
{
public static class Types
{
public class Live
{
/// <summary>
/// 获取或设置直播 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("export_id")]
[System.Text.Json.Serialization.JsonPropertyName("export_id")]
public string ExportId { get; set; } = default!;
/// <summary>
/// 获取或设置直播描述。
/// </summary>
[Newtonsoft.Json.JsonProperty("description")]
[System.Text.Json.Serialization.JsonPropertyName("description")]
public string Description { get; set; } = default!;
/// <summary>
/// 获取或设置直播封面 URL。
/// </summary>
[Newtonsoft.Json.JsonProperty("cover_url")]
[System.Text.Json.Serialization.JsonPropertyName("cover_url")]
public string CoverUrl { get; set; } = default!;
/// <summary>
/// 获取或设置开播视频号昵称。
/// </summary>
[Newtonsoft.Json.JsonProperty("nickname")]
[System.Text.Json.Serialization.JsonPropertyName("nickname")]
public string Nickname { get; set; } = default!;
/// <summary>
/// 获取或设置开播视频号头像 URL。
/// </summary>
[Newtonsoft.Json.JsonProperty("head_url")]
[System.Text.Json.Serialization.JsonPropertyName("head_url")]
public string HeadImageUrl { get; set; } = default!;
}
}
/// <summary>
/// 获取或设置直播列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("live_list")]
[System.Text.Json.Serialization.JsonPropertyName("live_list")]
public Types.Live[] LiveList { get; set; } = default!;
}
}

View File

@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/sharer/get_shop_finder_live_notice_sharer_url 接口的请求。</para>
/// </summary>
public class ChannelsECSharerGetShopFinderLiveNoticeSharerUrlRequest : WechatApiRequest, IInferable<ChannelsECSharerGetShopFinderLiveNoticeSharerUrlRequest, ChannelsECSharerGetShopFinderLiveNoticeSharerUrlResponse>
{
/// <summary>
/// 获取或设置直播预告 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("notice_id")]
[System.Text.Json.Serialization.JsonPropertyName("notice_id")]
public string NoticeId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置视频号 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("finder_id")]
[System.Text.Json.Serialization.JsonPropertyName("finder_id")]
public string FinderId { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,15 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/sharer/get_shop_finder_live_notice_sharer_url 接口的响应。</para>
/// </summary>
public class ChannelsECSharerGetShopFinderLiveNoticeSharerUrlResponse : WechatApiResponse
{
/// <summary>
/// 获取或设置分享链接。
/// </summary>
[Newtonsoft.Json.JsonProperty("url")]
[System.Text.Json.Serialization.JsonPropertyName("url")]
public string Url { get; set; } = default!;
}
}

View File

@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/sharer/get_shop_finder_live_sharer_url 接口的请求。</para>
/// </summary>
public class ChannelsECSharerGetShopFinderLiveSharerUrlRequest : WechatApiRequest, IInferable<ChannelsECSharerGetShopFinderLiveSharerUrlRequest, ChannelsECSharerGetShopFinderLiveSharerUrlResponse>
{
/// <summary>
/// 获取或设置直播 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("export_id")]
[System.Text.Json.Serialization.JsonPropertyName("export_id")]
public string ExportId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置视频号 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("finder_id")]
[System.Text.Json.Serialization.JsonPropertyName("finder_id")]
public string FinderId { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,15 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/sharer/get_shop_finder_live_sharer_url 接口的响应。</para>
/// </summary>
public class ChannelsECSharerGetShopFinderLiveSharerUrlResponse : WechatApiResponse
{
/// <summary>
/// 获取或设置分享链接。
/// </summary>
[Newtonsoft.Json.JsonProperty("url")]
[System.Text.Json.Serialization.JsonPropertyName("url")]
public string Url { get; set; } = default!;
}
}

View File

@ -0,0 +1,15 @@
{
"errcode": "0",
"errmsg": "ok",
"live_notice_list": [
{
"notice_id": "直播预约id",
"status": 0,
"status_wording": "状态描述",
"start_time": "1234567890",
"description": "描述",
"nickname": "开播视频号昵称",
"head_url": "开播视频号头像"
}
]
}

View File

@ -0,0 +1,13 @@
{
"errcode": "0",
"errmsg": "ok",
"live_list": [
{
"export_id": "直播id",
"description": "描述",
"cover_url": "直播封面",
"nickname": "开播视频号昵称",
"head_url": "开播视频号头像"
}
]
}

View File

@ -0,0 +1,4 @@
{
"export_id": "XXXXXX",
"finder_id": "XXXXXX"
}

View File

@ -0,0 +1,5 @@
{
"errcode": "0",
"errmsg": "ok",
"url": "http"
}