33 lines
1.2 KiB
C#
33 lines
1.2 KiB
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using Chtn.CSharp.SDK.Core;
|
|
using Chtn.CSharp.SDK.Models.Call;
|
|
|
|
namespace Chtn.CSharp.SDK.Services
|
|
{
|
|
public interface IBroadcastService
|
|
{
|
|
Task<StreamRegistry> GetData(GetRtmpDataReq req);
|
|
Task CreateService(CreateServerReq req);
|
|
Task JoinWebSocketRoom(BroadcastJoinWsRoomReq req);
|
|
}
|
|
|
|
public class BroadcastServiceProvider : IBroadcastService
|
|
{
|
|
private readonly ApiClient _apiClient;
|
|
|
|
public BroadcastServiceProvider(ApiClient apiClient)
|
|
{
|
|
_apiClient = apiClient ?? throw new ArgumentNullException(nameof(apiClient));
|
|
}
|
|
|
|
public async Task<StreamRegistry> GetData(GetRtmpDataReq req) =>
|
|
await _apiClient.PostAsync<GetRtmpDataReq, StreamRegistry>("network/channel/rtmpData", req);
|
|
public async Task CreateService(CreateServerReq req) =>
|
|
await _apiClient.PostAsync<CreateServerReq, object>("network/channel/createServer", req);
|
|
|
|
public async Task JoinWebSocketRoom(BroadcastJoinWsRoomReq req) =>
|
|
await _apiClient.PostAsync<BroadcastJoinWsRoomReq, object>("v2/network/channel/joinWebSocketRoom", req);
|
|
}
|
|
}
|