diff --git a/docs/TikTokGlobal/Basic_ModelDefinition.md b/docs/TikTokGlobal/Basic_ModelDefinition.md index 90985fa8..7a94e19e 100644 --- a/docs/TikTokGlobal/Basic_ModelDefinition.md +++ b/docs/TikTokGlobal/Basic_ModelDefinition.md @@ -50,6 +50,7 @@ Naming Policies: - Query User Followers: `ResearchUserFollowers` - Query User Following: `ResearchUserFollowing` - Query User Reposted Videos: `ResearchUserRepostedVideos` + - Query Playlists: `ResearchPlaylistInfo` - Commercial Content - Query Ads: `ResearchAdlibAdQuery` - Query Advertisers: `ResearchAdlibAdvertiserQuery` diff --git a/src/SKIT.FlurlHttpClient.ByteDance.TikTokGlobal/Extensions/TikTokV2ClientExecuteResearchExtensions.cs b/src/SKIT.FlurlHttpClient.ByteDance.TikTokGlobal/Extensions/TikTokV2ClientExecuteResearchExtensions.cs index c6f66bb5..edd0a552 100644 --- a/src/SKIT.FlurlHttpClient.ByteDance.TikTokGlobal/Extensions/TikTokV2ClientExecuteResearchExtensions.cs +++ b/src/SKIT.FlurlHttpClient.ByteDance.TikTokGlobal/Extensions/TikTokV2ClientExecuteResearchExtensions.cs @@ -125,6 +125,30 @@ public static class TikTokV2ClientExecuteResearchExtensions } #endregion + #region Playlist + /// + /// 异步调用 [POST] /research/playlist/info/ 接口。 + /// + /// REF:
+ /// + ///
+ ///
+ /// + /// + /// + /// + public static async Task ExecuteResearchPlaylistInfoAsync(this TikTokV2Client client, Models.ResearchPlaylistInfoRequest 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, "research", "playlist", "info/"); + + return await client.SendFlurlRequestAsJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false); + } + #endregion + #region User /// /// 异步调用 [POST] /research/user/info/ 接口。 diff --git a/src/SKIT.FlurlHttpClient.ByteDance.TikTokGlobal/Models/Research/Playlist/ResearchPlaylistInfoRequest.cs b/src/SKIT.FlurlHttpClient.ByteDance.TikTokGlobal/Models/Research/Playlist/ResearchPlaylistInfoRequest.cs new file mode 100644 index 00000000..93c85be9 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.ByteDance.TikTokGlobal/Models/Research/Playlist/ResearchPlaylistInfoRequest.cs @@ -0,0 +1,22 @@ +namespace SKIT.FlurlHttpClient.ByteDance.TikTokGlobal.Models +{ + /// + /// 表示 [POST] /research/playlist/info/ 接口的请求。 + /// + public class ResearchPlaylistInfoRequest : TikTokV2Request + { + /// + /// 获取或设置播放列表 ID。 + /// + [Newtonsoft.Json.JsonProperty("playlist_id")] + [System.Text.Json.Serialization.JsonPropertyName("playlist_id")] + public long PlaylistId { get; set; } + + /// + /// 获取或设置分页游标。 + /// + [Newtonsoft.Json.JsonProperty("cursor")] + [System.Text.Json.Serialization.JsonPropertyName("cursor")] + public long? PageCursor { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.ByteDance.TikTokGlobal/Models/Research/Playlist/ResearchPlaylistInfoResponse.cs b/src/SKIT.FlurlHttpClient.ByteDance.TikTokGlobal/Models/Research/Playlist/ResearchPlaylistInfoResponse.cs new file mode 100644 index 00000000..c60b508c --- /dev/null +++ b/src/SKIT.FlurlHttpClient.ByteDance.TikTokGlobal/Models/Research/Playlist/ResearchPlaylistInfoResponse.cs @@ -0,0 +1,49 @@ +namespace SKIT.FlurlHttpClient.ByteDance.TikTokGlobal.Models +{ + /// + /// 表示 [POST] /research/playlist/info/ 接口的响应。 + /// + public class ResearchPlaylistInfoResponse : TikTokV2Response + { + public static class Types + { + public class Data + { + /// + /// 获取或设置播放列表 ID。 + /// + [Newtonsoft.Json.JsonProperty("playlist_id")] + [System.Text.Json.Serialization.JsonPropertyName("playlist_id")] + public long PlaylistId { get; set; } + + /// + /// 获取或设置播放列表名称。 + /// + [Newtonsoft.Json.JsonProperty("playlist_name")] + [System.Text.Json.Serialization.JsonPropertyName("playlist_name")] + public string PlaylistName { get; set; } = default!; + + /// + /// 获取或设置视频总数。 + /// + [Newtonsoft.Json.JsonProperty("playlist_item_total")] + [System.Text.Json.Serialization.JsonPropertyName("playlist_item_total")] + public int TotalItemCount { get; set; } + + /// + /// 获取或设置最后更新时间。 + /// + [Newtonsoft.Json.JsonProperty("playlist_last_updated")] + [System.Text.Json.Serialization.JsonPropertyName("playlist_last_updated")] + public long UpdateTimestamp { get; set; } + + /// + /// 获取或设置视频 ID 列表。 + /// + [Newtonsoft.Json.JsonProperty("playlist_video_ids")] + [System.Text.Json.Serialization.JsonPropertyName("playlist_video_ids")] + public long[]? VideoIdList { get; set; } + } + } + } +} diff --git a/test/SKIT.FlurlHttpClient.ByteDance.TikTokGlobal.UnitTests/ModelSamples/Research/Playlist/ResearchPlaylistInfoRequest.json b/test/SKIT.FlurlHttpClient.ByteDance.TikTokGlobal.UnitTests/ModelSamples/Research/Playlist/ResearchPlaylistInfoRequest.json new file mode 100644 index 00000000..1616f7f5 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.ByteDance.TikTokGlobal.UnitTests/ModelSamples/Research/Playlist/ResearchPlaylistInfoRequest.json @@ -0,0 +1,3 @@ +{ + "playlist_id": 1234534763387255595 +} diff --git a/test/SKIT.FlurlHttpClient.ByteDance.TikTokGlobal.UnitTests/ModelSamples/Research/Playlist/ResearchPlaylistInfoResponse.json b/test/SKIT.FlurlHttpClient.ByteDance.TikTokGlobal.UnitTests/ModelSamples/Research/Playlist/ResearchPlaylistInfoResponse.json new file mode 100644 index 00000000..697b7f3e --- /dev/null +++ b/test/SKIT.FlurlHttpClient.ByteDance.TikTokGlobal.UnitTests/ModelSamples/Research/Playlist/ResearchPlaylistInfoResponse.json @@ -0,0 +1,23 @@ +{ + "data": { + "playlist_id": 1234579763387255595, + "playlist_item_total": 4, + "playlist_last_updated": 1663620215, + "playlist_name": "Test playlist name", + "playlist_video_ids": [ + 12351810646859, + 7289561123404511, + 7274412345315375, + 12312311231231231, + 12312883434352176, + 71919242345289237, + 7190923438988788, + 71800659413240905 + ] + }, + "error": { + "code": "ok", + "message": "ok", + "log_id": "20240700200656033B747EC0C8DE33C94C" + } +}