implement CallService and WebRTC access support
This commit is contained in:
29
Services/CallServiceMethods.cs
Normal file
29
Services/CallServiceMethods.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Chtn.CSharp.SDK.Core;
|
||||
using Chtn.CSharp.SDK.Models.Call;
|
||||
|
||||
namespace Chtn.CSharp.SDK.Services
|
||||
{
|
||||
public interface ICallService
|
||||
{
|
||||
Task InviteToCall(InviteToCallReq req);
|
||||
Task<GetRTCAccessResp> GetRTCAccess(GetRTCAccessReq req);
|
||||
}
|
||||
|
||||
public class CallServiceProvider: ICallService
|
||||
{
|
||||
private readonly ApiClient _apiClient;
|
||||
|
||||
public CallServiceProvider(ApiClient apiClient)
|
||||
{
|
||||
_apiClient = apiClient ?? throw new ArgumentNullException(nameof(apiClient));
|
||||
}
|
||||
|
||||
public async Task InviteToCall(InviteToCallReq req) =>
|
||||
await _apiClient.PostAsync<InviteToCallReq, object>("v2/chat/rtcInvite", req);
|
||||
|
||||
public async Task<GetRTCAccessResp> GetRTCAccess(GetRTCAccessReq req) =>
|
||||
await _apiClient.PostAsync<GetRTCAccessReq, GetRTCAccessResp>("v2/chat/getRTCAccess", req);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user