feat(wxapi): 新增视频号助手留资服务直播数据相关接口

This commit is contained in:
Fu Diwei 2024-04-29 22:16:50 +08:00
parent 0127123659
commit 348df3d996
12 changed files with 411 additions and 0 deletions

View File

@ -4039,6 +4039,77 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
}
#endregion
#region FinderLive
/// <summary>
/// <para>异步调用 [POST] /channels/finderlive/get_finder_attr_by_appid 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developers.weixin.qq.com/doc/channels/API/live/get_finder_attr_by_appid.html ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ChannelsFinderLiveGetFinderAttributeByAppIdResponse> ExecuteChannelsFinderLiveGetFinderAttributeByAppIdAsync(this WechatApiClient client, Models.ChannelsFinderLiveGetFinderAttributeByAppIdRequest 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", "finderlive", "get_finder_attr_by_appid")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsFinderLiveGetFinderAttributeByAppIdResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// <para>异步调用 [POST] /channels/finderlive/get_finder_live_data_list 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developers.weixin.qq.com/doc/channels/API/live/get_finder_live_data_list.html ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ChannelsFinderLiveGetFinderLiveDataListResponse> ExecuteChannelsFinderLiveGetFinderLiveDataListAsync(this WechatApiClient client, Models.ChannelsFinderLiveGetFinderLiveDataListRequest 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", "finderlive", "get_finder_live_data_list")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsFinderLiveGetFinderLiveDataListResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// <para>异步调用 [POST] /channels/finderlive/get_finder_live_leads_data 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developers.weixin.qq.com/doc/channels/API/live/get_finder_live_leads_data.html ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ChannelsFinderLiveGetFinderLeadsDataListResponse> ExecuteChannelsFinderLiveGetFinderLeadsDataListAsync(this WechatApiClient client, Models.ChannelsFinderLiveGetFinderLeadsDataListRequest 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", "finderlive", "get_finder_live_leads_data")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsFinderLiveGetFinderLeadsDataListResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
#endregion
#region Leads
/// <summary>
/// <para>异步调用 [POST] /channels/leads/get_leads_info_by_component_id 接口。</para>

View File

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

View File

@ -0,0 +1,42 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/finderlive/get_finder_attr_by_appid 接口的响应。</para>
/// </summary>
public class ChannelsFinderLiveGetFinderAttributeByAppIdResponse : WechatApiResponse
{
public static class Types
{
public class FinderAttribute
{
/// <summary>
/// 获取或设置视频号唯一标识。
/// </summary>
[Newtonsoft.Json.JsonProperty("uniq_id")]
[System.Text.Json.Serialization.JsonPropertyName("uniq_id")]
public string UniqueId { 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("fans_count")]
[System.Text.Json.Serialization.JsonPropertyName("fans_count")]
public int FansCount { get; set; }
}
}
/// <summary>
/// 获取或设置视频号信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("finder_attr")]
[System.Text.Json.Serialization.JsonPropertyName("finder_attr")]
public Types.FinderAttribute FinderAttribute { get; set; } = default!;
}
}

View File

@ -0,0 +1,29 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/finderlive/get_finder_live_leads_data 接口的请求。</para>
/// </summary>
public class ChannelsFinderLiveGetFinderLeadsDataListRequest : WechatApiRequest, IInferable<ChannelsFinderLiveGetFinderLeadsDataListRequest, ChannelsFinderLiveGetFinderLeadsDataListResponse>
{
/// <summary>
/// 获取或设置查询范围的开始时间戳。
/// </summary>
[Newtonsoft.Json.JsonProperty("start_time")]
[System.Text.Json.Serialization.JsonPropertyName("start_time")]
public long? StartTimestamp { get; set; }
/// <summary>
/// 获取或设置查询范围的结束时间戳。
/// </summary>
[Newtonsoft.Json.JsonProperty("end_time")]
[System.Text.Json.Serialization.JsonPropertyName("end_time")]
public long? EndTimestamp { get; set; }
/// <summary>
/// 获取或设置来源类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("source_type")]
[System.Text.Json.Serialization.JsonPropertyName("source_type")]
public int? SourceType { get; set; }
}
}

View File

@ -0,0 +1,42 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/finderlive/get_finder_live_leads_data 接口的响应。</para>
/// </summary>
public class ChannelsFinderLiveGetFinderLeadsDataListResponse : WechatApiResponse
{
public static class Types
{
public class LeadsData
{
/// <summary>
/// 获取或设置组件类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("component_type")]
[System.Text.Json.Serialization.JsonPropertyName("component_type")]
public int ComponentType { get; set; }
/// <summary>
/// 获取或设置流量来源。
/// </summary>
[Newtonsoft.Json.JsonProperty("traffic_type")]
[System.Text.Json.Serialization.JsonPropertyName("traffic_type")]
public int TrafficType { get; set; }
/// <summary>
/// 获取或设置留资条数。
/// </summary>
[Newtonsoft.Json.JsonProperty("leads_count")]
[System.Text.Json.Serialization.JsonPropertyName("leads_count")]
public int LeadsCount { get; set; }
}
}
/// <summary>
/// 获取或设置留资数据列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("item")]
[System.Text.Json.Serialization.JsonPropertyName("item")]
public Types.LeadsData[] LeadsDataList { get; set; } = default!;
}
}

View File

@ -0,0 +1,29 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/finderlive/get_finder_live_data_list 接口的请求。</para>
/// </summary>
public class ChannelsFinderLiveGetFinderLiveDataListRequest : WechatApiRequest, IInferable<ChannelsFinderLiveGetFinderLiveDataListRequest, ChannelsFinderLiveGetFinderLiveDataListResponse>
{
/// <summary>
/// 获取或设置查询范围的开始时间戳。
/// </summary>
[Newtonsoft.Json.JsonProperty("start_time")]
[System.Text.Json.Serialization.JsonPropertyName("start_time")]
public long? StartTimestamp { get; set; }
/// <summary>
/// 获取或设置查询范围的结束时间戳。
/// </summary>
[Newtonsoft.Json.JsonProperty("end_time")]
[System.Text.Json.Serialization.JsonPropertyName("end_time")]
public long? EndTimestamp { get; set; }
/// <summary>
/// 获取或设置翻页标记。
/// </summary>
[Newtonsoft.Json.JsonProperty("last_buffer")]
[System.Text.Json.Serialization.JsonPropertyName("last_buffer")]
public string? Cursor { get; set; }
}
}

View File

@ -0,0 +1,112 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/finderlive/get_finder_live_data_list 接口的响应。</para>
/// </summary>
public class ChannelsFinderLiveGetFinderLiveDataListResponse : WechatApiResponse
{
public static class Types
{
public class LiveData
{
/// <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("live_start_time")]
[System.Text.Json.Serialization.JsonPropertyName("live_start_time")]
public long LiveStartTimestamp { get; set; }
/// <summary>
/// 获取或设置直播时长(单位:秒)。
/// </summary>
[Newtonsoft.Json.JsonProperty("live_duration_in_seconds")]
[System.Text.Json.Serialization.JsonPropertyName("live_duration_in_seconds")]
public int LiveDuration { get; set; }
/// <summary>
/// 获取或设置观看人数。
/// </summary>
[Newtonsoft.Json.JsonProperty("total_audience_count")]
[System.Text.Json.Serialization.JsonPropertyName("total_audience_count")]
public int TotalAudienceCount { get; set; }
/// <summary>
/// 获取或设置喝彩次数。
/// </summary>
[Newtonsoft.Json.JsonProperty("total_cheer_count")]
[System.Text.Json.Serialization.JsonPropertyName("total_cheer_count")]
public int TotalCheerCount { get; set; }
/// <summary>
/// 获取或设置分享次数。
/// </summary>
[Newtonsoft.Json.JsonProperty("forward_count")]
[System.Text.Json.Serialization.JsonPropertyName("forward_count")]
public int ForwardCount { get; set; }
/// <summary>
/// 获取或设置评论条数。
/// </summary>
[Newtonsoft.Json.JsonProperty("total_comment_count")]
[System.Text.Json.Serialization.JsonPropertyName("total_comment_count")]
public int CommentCount { get; set; }
/// <summary>
/// 获取或设置人均观看时长(单位:秒)。
/// </summary>
[Newtonsoft.Json.JsonProperty("audiences_avg_seconds")]
[System.Text.Json.Serialization.JsonPropertyName("audiences_avg_seconds")]
public int AudiencesAverageSeconds { get; set; }
/// <summary>
/// 获取或设置最高在线人数。
/// </summary>
[Newtonsoft.Json.JsonProperty("max_online_count")]
[System.Text.Json.Serialization.JsonPropertyName("max_online_count")]
public int MaxOnlineCount { get; set; }
/// <summary>
/// 获取或设置新增粉丝数。
/// </summary>
[Newtonsoft.Json.JsonProperty("new_follow_count")]
[System.Text.Json.Serialization.JsonPropertyName("new_follow_count")]
public int NewFollowCount { get; set; }
/// <summary>
/// 获取或设置公众号新增粉丝数。
/// </summary>
[Newtonsoft.Json.JsonProperty("new_follow_count_biz")]
[System.Text.Json.Serialization.JsonPropertyName("new_follow_count_biz")]
public int NewFollowBusinessCount { get; set; }
}
}
/// <summary>
/// 获取或设置直播数据列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("item")]
[System.Text.Json.Serialization.JsonPropertyName("item")]
public Types.LiveData[] LiveDataList { get; set; } = default!;
/// <summary>
/// 获取或设置是否还有更多。
/// </summary>
[Newtonsoft.Json.JsonProperty("continue_flag")]
[System.Text.Json.Serialization.JsonPropertyName("continue_flag")]
public bool HasMore { get; set; }
/// <summary>
/// 获取或设置翻页标记。
/// </summary>
[Newtonsoft.Json.JsonProperty("last_buffer")]
[System.Text.Json.Serialization.JsonPropertyName("last_buffer")]
public string? NextCursor { get; set; }
}
}

View File

@ -0,0 +1,9 @@
{
"errcode": 0,
"errmsg": "ok",
"finder_attr": {
"uniq_id": "sphxxxx",
"nickname": "xxxx",
"fans_count": 4
}
}

View File

@ -0,0 +1,6 @@
{
"start_time": 1694142436,
"end_time": 1694228836,
"source_type": 0
}

View File

@ -0,0 +1,36 @@
{
"errcode": 0,
"errmsg": "ok",
"item": [
{
"component_type": 0,
"traffic_type": 0,
"leads_count": 1000
},
{
"component_type": 0,
"traffic_type": 1,
"leads_count": 1000
},
{
"component_type": 1,
"traffic_type": 0,
"leads_count": 1000
},
{
"component_type": 1,
"traffic_type": 1,
"leads_count": 1000
},
{
"component_type": 2,
"traffic_type": 0,
"leads_count": 1000
},
{
"component_type": 2,
"traffic_type": 1,
"leads_count": 1000
}
]
}

View File

@ -0,0 +1,5 @@
{
"start_time": 1694142436,
"end_time": 1694228836,
"last_buffer": "EB4YAg"
}

View File

@ -0,0 +1,21 @@
{
"errcode": 0,
"errmsg": "ok",
"item": [
{
"export_id": "18881222222",
"live_start_time": 1694142436,
"live_duration_in_seconds": 3600,
"total_audience_count": 10000,
"total_cheer_count": 1000000,
"forward_count": 1000,
"total_comment_count": 10000,
"audiences_avg_seconds": 600,
"max_online_count": 200,
"new_follow_count": 10,
"new_follow_count_biz": 0
}
],
"last_buffer": "EB4YAg=",
"continue_flag": true
}