synchronize ICallService with stateful implementation and resolve build errors

This commit is contained in:
2026-05-03 20:40:15 +02:00
parent e7e8f6b1a9
commit 14500fc07a
2 changed files with 45 additions and 29 deletions

45
Services/CallService.cs Normal file
View File

@@ -0,0 +1,45 @@
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();
Task<GetRTCAccessResp> GetRTCAccess();
}
public class CallService: ICallService
{
private readonly ApiClient _apiClient;
private readonly string _userId;
private readonly string _token;
public CallService(ApiClient apiClient, string userId, string token)
{
_apiClient = apiClient ?? throw new ArgumentNullException(nameof(apiClient));
_userId = userId;
_token = token;
}
public async Task InviteToCall()
{
var body = new
{
userid = _userId
};
await _apiClient.PostAsync<object, object>("v2/chat/rtcInvite", body);
}
public async Task<GetRTCAccessResp> GetRTCAccess()
{
var body = new
{
userid = _userId
};
return await _apiClient.PostAsync<object, GetRTCAccessResp>("v2/chat/getRTCAccess", body);
}
}
}