Skip to content

Commit d39dba1

Browse files
committed
feat(tiktokshop): 新增获取客服统计数据接口
1 parent 6bddf75 commit d39dba1

5 files changed

Lines changed: 129 additions & 0 deletions

File tree

docs/TikTokGlobalShop/Basic_ModelDefinition.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ Notes: The following catalog is consistent with the catalog structure of [TikTok
135135
- Read Message: `CustomerServiceReadConversationMessage`
136136
- Get Agent Settings: `CustomerServiceGetAgentSettings`
137137
- Update Agent Settings: `CustomerServiceUpdateAgentSettings`
138+
- Get Customer Service Performance: `CustomerServiceGetPerformance`
138139
- Supply Chain
139140
- Confirm Package Shipment: `SupplyChainSyncPackages`
140141

src/SKIT.FlurlHttpClient.ByteDance.TikTokGlobalShop/Extensions/TikTokShopClientExecuteCustomerServiceExtensions.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,32 @@ public static class TikTokShopClientExecuteCustomerServiceExtensions
5757
}
5858
#endregion
5959

60+
#region Performance
61+
/// <summary>
62+
/// <para>异步调用 [GET] /customer_service/{version}/performance 接口。</para>
63+
/// <para>
64+
/// REF: <br/>
65+
/// <![CDATA[ https://partner.tiktokshop.com/docv2/page/66bec10859f0b0030018e518 ]]>
66+
/// </para>
67+
/// </summary>
68+
/// <param name="client"></param>
69+
/// <param name="request"></param>
70+
/// <param name="cancellationToken"></param>
71+
/// <returns></returns>
72+
public static async Task<Models.CustomerServiceGetPerformanceResponse> ExecuteCustomerServiceGetPerformanceAsync(this TikTokShopClient client, Models.CustomerServiceGetPerformanceRequest request, CancellationToken cancellationToken = default)
73+
{
74+
if (client is null) throw new ArgumentNullException(nameof(client));
75+
if (request is null) throw new ArgumentNullException(nameof(request));
76+
77+
IFlurlRequest flurlReq = client
78+
.CreateFlurlRequest(request, HttpMethod.Get, "customer_service", request.ApiVersion, "performance")
79+
.SetQueryParam("support_date_ge", request.SupportDateStringGreaterThan)
80+
.SetQueryParam("support_date_lt", request.SupportDateStringLessThan);
81+
82+
return await client.SendFlurlRequesAsJsontAsync<Models.CustomerServiceGetPerformanceResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
83+
}
84+
#endregion
85+
6086
/// <summary>
6187
/// <para>异步调用 [POST] /customer_service/{version}/conversations 接口。</para>
6288
/// <para>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
namespace SKIT.FlurlHttpClient.ByteDance.TikTokGlobalShop.Models
2+
{
3+
/// <summary>
4+
/// <para>表示 [GET] /customer_service/{version}/performance 接口的请求。</para>
5+
/// </summary>
6+
public class CustomerServiceGetPerformanceRequest : TikTokShopRequest
7+
{
8+
/// <summary>
9+
/// 获取或设置 API 版本号。
10+
/// <para>默认值:202407</para>
11+
/// </summary>
12+
[Newtonsoft.Json.JsonIgnore]
13+
[System.Text.Json.Serialization.JsonIgnore]
14+
public override int ApiVersion { get; set; } = 202407;
15+
16+
/// <summary>
17+
/// 获取或设置日期范围起始时间字符串(格式:yyyy-MM-dd)。
18+
/// </summary>
19+
[Newtonsoft.Json.JsonIgnore]
20+
[System.Text.Json.Serialization.JsonIgnore]
21+
public string? SupportDateStringGreaterThan { get; set; }
22+
23+
/// <summary>
24+
/// 获取或设置日期范围截止时间字符串(格式:yyyy-MM-dd)。
25+
/// </summary>
26+
[Newtonsoft.Json.JsonIgnore]
27+
[System.Text.Json.Serialization.JsonIgnore]
28+
public string? SupportDateStringLessThan { get; set; }
29+
}
30+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
namespace SKIT.FlurlHttpClient.ByteDance.TikTokGlobalShop.Models
2+
{
3+
/// <summary>
4+
/// <para>表示 [GET] /customer_service/{version}/performance 接口的响应。</para>
5+
/// </summary>
6+
public class CustomerServiceGetPerformanceResponse : TikTokShopResponse<CustomerServiceGetPerformanceResponse.Types.Data>
7+
{
8+
public static class Types
9+
{
10+
public class Data
11+
{
12+
public static class Types
13+
{
14+
public class Performance
15+
{
16+
/// <summary>
17+
/// 获取或设置会话数。
18+
/// </summary>
19+
[Newtonsoft.Json.JsonProperty("support_session_count")]
20+
[System.Text.Json.Serialization.JsonPropertyName("support_session_count")]
21+
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.Common.TextualNumberReadOnlyConverter))]
22+
public int SupportSessionCount { get; set; }
23+
24+
/// <summary>
25+
/// 获取或设置回复率(单位:百分数)。
26+
/// </summary>
27+
[Newtonsoft.Json.JsonProperty("response_percentage")]
28+
[System.Text.Json.Serialization.JsonPropertyName("response_percentage")]
29+
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.Common.TextualNumberReadOnlyConverter))]
30+
public decimal ResponsePercentage { get; set; }
31+
32+
/// <summary>
33+
/// 获取或设置客户满意率(单位:百分数)。
34+
/// </summary>
35+
[Newtonsoft.Json.JsonProperty("satisfaction_percentage")]
36+
[System.Text.Json.Serialization.JsonPropertyName("satisfaction_percentage")]
37+
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.Common.TextualNumberReadOnlyConverter))]
38+
public decimal SatisfactionPercentage { get; set; }
39+
40+
/// <summary>
41+
/// 获取或设置平均首次响应时间(单位:分钟)。
42+
/// </summary>
43+
[Newtonsoft.Json.JsonProperty("response_time_mins")]
44+
[System.Text.Json.Serialization.JsonPropertyName("response_time_mins")]
45+
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.Common.TextualNumberReadOnlyConverter))]
46+
public decimal AverageResponseTime { get; set; }
47+
}
48+
}
49+
50+
/// <summary>
51+
/// 获取或设置统计数据。
52+
/// </summary>
53+
[Newtonsoft.Json.JsonProperty("performance")]
54+
[System.Text.Json.Serialization.JsonPropertyName("performance")]
55+
public Types.Performance Performance { get; set; } = default!;
56+
}
57+
}
58+
}
59+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"code": 0,
3+
"data": {
4+
"performance": {
5+
"response_percentage": "93.4",
6+
"response_time_mins": "3.4",
7+
"satisfaction_percentage": "95.2",
8+
"support_session_count": 15
9+
}
10+
},
11+
"message": "Success",
12+
"request_id": "202203070749000101890810281E8C70B7"
13+
}

0 commit comments

Comments
 (0)