feat(wxapi): 新增视频号小店获取留资组件、获取留资组件直播推广记录等接口

This commit is contained in:
Fu Diwei 2024-04-29 21:59:24 +08:00
parent cf55f66d18
commit 0127123659
9 changed files with 280 additions and 0 deletions

View File

@ -4108,6 +4108,52 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsLeadsGetLeadsRequestIdResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// <para>异步调用 [POST] /channels/leads/get_leads_component_promote_record 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developers.weixin.qq.com/doc/channels/API/leads/get_leads_component_promote_record.html ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ChannelsLeadsGetLeadsComponentPromoteRecordResponse> ExecuteChannelsLeadsGetLeadsComponentPromoteRecordAsync(this WechatApiClient client, Models.ChannelsLeadsGetLeadsComponentPromoteRecordRequest 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", "leads", "get_leads_component_promote_record")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsLeadsGetLeadsComponentPromoteRecordResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// <para>异步调用 [POST] /channels/leads/get_leads_component_id 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developers.weixin.qq.com/doc/channels/API/leads/get_leads_component_id.html ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ChannelsLeadsGetLeadsComponentIdResponse> ExecuteChannelsLeadsGetLeadsComponentIdAsync(this WechatApiClient client, Models.ChannelsLeadsGetLeadsComponentIdRequest 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", "leads", "get_leads_component_id")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsLeadsGetLeadsComponentIdResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
#endregion
}
}

View File

@ -0,0 +1,15 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/leads/get_leads_component_id 接口的请求。</para>
/// </summary>
public class ChannelsLeadsGetLeadsComponentIdRequest : WechatApiRequest, IInferable<ChannelsLeadsGetLeadsComponentIdRequest, ChannelsLeadsGetLeadsComponentIdResponse>
{
/// <summary>
/// 获取或设置翻页标记。
/// </summary>
[Newtonsoft.Json.JsonProperty("last_buffer")]
[System.Text.Json.Serialization.JsonPropertyName("last_buffer")]
public string? Cursor { get; set; }
}
}

View File

@ -0,0 +1,56 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/leads/get_leads_component_id 接口的响应。</para>
/// </summary>
public class ChannelsLeadsGetLeadsComponentIdResponse : WechatApiResponse
{
public static class Types
{
public class LeadsComponent
{
/// <summary>
/// 获取或设置留资组件 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("leads_component_id")]
[System.Text.Json.Serialization.JsonPropertyName("leads_component_id")]
public string LeadsComponentId { get; set; } = default!;
/// <summary>
/// 获取或设置留资组件标题。
/// </summary>
[Newtonsoft.Json.JsonProperty("leads_description")]
[System.Text.Json.Serialization.JsonPropertyName("leads_description")]
public string Description { 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("item")]
[System.Text.Json.Serialization.JsonPropertyName("item")]
public Types.LeadsComponent[] LeadsComponentList { 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,36 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/leads/get_leads_component_promote_record 接口的请求。</para>
/// </summary>
public class ChannelsLeadsGetLeadsComponentPromoteRecordRequest : WechatApiRequest, IInferable<ChannelsLeadsGetLeadsComponentPromoteRecordRequest, ChannelsLeadsGetLeadsComponentPromoteRecordResponse>
{
/// <summary>
/// 获取或设置留资组件 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("leads_component_id")]
[System.Text.Json.Serialization.JsonPropertyName("leads_component_id")]
public string LeadsComponentId { get; set; } = string.Empty;
/// <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,88 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/leads/get_leads_component_promote_record 接口的响应。</para>
/// </summary>
public class ChannelsLeadsGetLeadsComponentPromoteRecordResponse : WechatApiResponse
{
public static class Types
{
public class RecordData
{
/// <summary>
/// 获取或设置主播昵称。
/// </summary>
[Newtonsoft.Json.JsonProperty("anchor_nickname")]
[System.Text.Json.Serialization.JsonPropertyName("anchor_nickname")]
public string AnchorNickname { get; set; } = default!;
/// <summary>
/// 获取或设置直播描述。
/// </summary>
[Newtonsoft.Json.JsonProperty("live_description")]
[System.Text.Json.Serialization.JsonPropertyName("live_description")]
public string LiveDescription { 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>
/// 获取或设置曝光 UV。
/// </summary>
[Newtonsoft.Json.JsonProperty("exposure_uv")]
[System.Text.Json.Serialization.JsonPropertyName("exposure_uv")]
[System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)]
public int ExposureUV { get; set; }
/// <summary>
/// 获取或设置点击 UV。
/// </summary>
[Newtonsoft.Json.JsonProperty("click_uv")]
[System.Text.Json.Serialization.JsonPropertyName("click_uv")]
[System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)]
public int ClickUV { get; set; }
/// <summary>
/// 获取或设置曝光点击率。
/// </summary>
[Newtonsoft.Json.JsonProperty("exposure_click_rate")]
[System.Text.Json.Serialization.JsonPropertyName("exposure_click_rate")]
[System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)]
public decimal ExposureClickRate { get; set; }
/// <summary>
/// 获取或设置留资人数。
/// </summary>
[Newtonsoft.Json.JsonProperty("leads_num")]
[System.Text.Json.Serialization.JsonPropertyName("leads_num")]
[System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)]
public int LeadsNumber { get; set; }
}
}
/// <summary>
/// 获取或设置推广记录列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("record_data")]
[System.Text.Json.Serialization.JsonPropertyName("record_data")]
public Types.RecordData[] RecordDataList { 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,13 @@
{
"errcode": 0,
"errmsg": "ok",
"item": [
{
"leads_component_id": "18881222222",
"leads_description": "xxx的直播",
"status": 4
}
],
"last_buffer": "EB4YAg=",
"continue_flag": true
}

View File

@ -0,0 +1,6 @@
{
"leads_component_id": "100234056999000000",
"start_time": 0,
"end_time": 1668676968,
"last_buffer": "EB4YAg"
}

View File

@ -0,0 +1,17 @@
{
"errcode": 0,
"errmsg": "ok",
"record_data": [
{
"anchor_nickname": "xxx",
"live_description": "xxx",
"live_start_time": 1688393984,
"exposure_uv": "6960",
"click_uv": "233",
"exposure_click_rate": 0.0334,
"leads_num": "64"
}
],
"last_buffer": "EB4YAg=",
"continue_flag": true
}