-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
127 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
...ExtendedSDK/Webcast/Extensions/DouyinMicroAppWebcastClientExecuteWebcastMateExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using System; | ||
using System.Net.Http; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Flurl.Http; | ||
|
||
namespace SKIT.FlurlHttpClient.ByteDance.MicroApp.ExtendedSDK.Webcast | ||
{ | ||
public static class DouyinMicroAppWebcastClientExecuteWebcastMateExtensions | ||
{ | ||
/// <summary> | ||
/// <para>异步调用 [POST] /webcastmate/info 接口。</para> | ||
/// <para> | ||
/// REF: <br/> | ||
/// <![CDATA[ https://developer.open-douyin.com/docs/resource/zh-CN/interaction/develop/server/live/webcastinfo ]]> | ||
/// </para> | ||
/// </summary> | ||
/// <param name="client"></param> | ||
/// <param name="request"></param> | ||
/// <param name="cancellationToken"></param> | ||
/// <returns></returns> | ||
public static async Task<Models.WebcastWebcastMateInfoResponse> ExecuteWebcastWebcastMateInfoAsync(this DouyinMicroAppWebcastClient client, Models.WebcastWebcastMateInfoRequest 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, "webcastmate", "info") | ||
.WithHeader("X-Token", request.AccessToken); | ||
|
||
return await client.SendFlurlRequestAsJsonAsync<Models.WebcastWebcastMateInfoResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...yteDance.MicroApp/ExtendedSDK/Webcast/Models/WebcastMate/WebcastWebcastMateInfoRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
namespace SKIT.FlurlHttpClient.ByteDance.MicroApp.ExtendedSDK.Webcast.Models | ||
{ | ||
/// <summary> | ||
/// <para>表示 [POST] /webcastmate/info 接口的请求。</para> | ||
/// </summary> | ||
public class WebcastWebcastMateInfoRequest : DouyinMicroAppWebcastRequest | ||
{ | ||
/// <summary> | ||
/// 获取或设置直播伴侣 Token。 | ||
/// </summary> | ||
[Newtonsoft.Json.JsonProperty("token")] | ||
[System.Text.Json.Serialization.JsonPropertyName("token")] | ||
public string WebcastMateToken { get; set; } = string.Empty; | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
...teDance.MicroApp/ExtendedSDK/Webcast/Models/WebcastMate/WebcastWebcastMateInfoResponse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
namespace SKIT.FlurlHttpClient.ByteDance.MicroApp.ExtendedSDK.Webcast.Models | ||
{ | ||
/// <summary> | ||
/// <para>表示 [POST] /webcastmate/info 接口的响应。</para> | ||
/// </summary> | ||
public class WebcastWebcastMateInfoResponse : DouyinMicroAppWebcastResponse | ||
{ | ||
public static class Types | ||
{ | ||
public class Data | ||
{ | ||
public static class Types | ||
{ | ||
public class LiveInfo | ||
{ | ||
/// <summary> | ||
/// 获取或设置直播间 ID。 | ||
/// </summary> | ||
[Newtonsoft.Json.JsonProperty("room_id")] | ||
[System.Text.Json.Serialization.JsonPropertyName("room_id")] | ||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.Common.NumericalStringReadOnlyConverter))] | ||
public string RoomId { get; set; } = default!; | ||
|
||
/// <summary> | ||
/// 获取或设置主播的 OpenId。 | ||
/// </summary> | ||
[Newtonsoft.Json.JsonProperty("anchor_open_id")] | ||
[System.Text.Json.Serialization.JsonPropertyName("anchor_open_id")] | ||
public string AnchorOpenId { get; set; } = default!; | ||
|
||
/// <summary> | ||
/// 获取或设置主播的昵称。 | ||
/// </summary> | ||
[Newtonsoft.Json.JsonProperty("nick_name")] | ||
[System.Text.Json.Serialization.JsonPropertyName("nick_name")] | ||
public string AnchorNickname { get; set; } = default!; | ||
|
||
/// <summary> | ||
/// 获取或设置主播的头像 URL。 | ||
/// </summary> | ||
[Newtonsoft.Json.JsonProperty("avatar_url")] | ||
[System.Text.Json.Serialization.JsonPropertyName("avatar_url")] | ||
public string AnchorAvatarUrl { get; set; } = default!; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// 获取或设置直播信息。 | ||
/// </summary> | ||
[Newtonsoft.Json.JsonProperty("info")] | ||
[System.Text.Json.Serialization.JsonPropertyName("info")] | ||
public Types.LiveInfo LiveInfo { get; set; } = default!; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// 获取或设置返回数据。 | ||
/// </summary> | ||
[Newtonsoft.Json.JsonProperty("data")] | ||
[System.Text.Json.Serialization.JsonPropertyName("data")] | ||
public Types.Data Data { get; set; } = default!; | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
...ce.MicroApp.UnitTests/ModelSamples/Webcast/WebcastMate/WebcastWebcastMateInfoRequest.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"token": "pJKr395h6O5x2ykBjgrBIxnuot8nn62djr70EocUFXtiN1s9VpsHHuEPdZYKHVJFzftyIOb8lj9i0lrLnUhQsK55pT8shfX98qGuUBO7PSKoIVRq6tWMRdsjPVw=" | ||
} |
10 changes: 10 additions & 0 deletions
10
...e.MicroApp.UnitTests/ModelSamples/Webcast/WebcastMate/WebcastWebcastMateInfoResponse.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"data": { | ||
"info": { | ||
"room_id": 7214015683695250235, | ||
"anchor_open_id": "_000oJIu6APhomK7KIBGqSYm5XYPxCJB_xxx", | ||
"avatar_url": "https://p11.douyinpic.com/aweme/720x720/aweme-avatar/tos-cn-avt-0015_973c31e8055f78a41d3f7de3def9821d.jpeg?from=3067671334", | ||
"nick_name": "xxx" | ||
} | ||
} | ||
} |