using System; using System.Threading.Tasks; using Chtn.CSharp.SDK.Models.Auth; using Chtn.CSharp.SDK.Core; namespace Chtn.CSharp.SDK.Services { public interface IAuthService { Task GetAuthMethods(GetAuthMethodsReq req); Task OtpSendCode(OtpPleSendCodeReq req); Task OtpVerifyCode(OtpPleVerifyCodeReq req); Task LoginPasswordAuth(LoginPasswordAuthReq req); Task IsUsernameUsed(UnameUsageReq req); Task IsEmailUsed(EmailUsageReq req); Task PleSendVCode(PleSendVCodeReq req); Task PleVerifyCode(PleVerifyCodeReq req); Task FinishPLEAccount(FinishPleAccountReq req); Task LoginWithGoogle(LoginWithGoogleReq req); Task LoginWithApple(LoginWithAppleReq req); Task Register(RegisterReq req); Task ResetPassword(ResetPasswordReq req); Task VerifyResetCode(VerifyPasswordResetReq req); } public class AuthServiceProvider : IAuthService { private readonly ApiClient _apiClient; public AuthServiceProvider(ApiClient apiClient) { _apiClient = apiClient; } public async Task GetAuthMethods(GetAuthMethodsReq req) => await _apiClient.PostAsync("auth/get-auth-methods", req); public async Task OtpSendCode(OtpPleSendCodeReq req) => await _apiClient.PostAsync("auth/otp-send-code", req); public async Task OtpVerifyCode(OtpPleVerifyCodeReq req) => await _apiClient.PostAsync("auth/otp-verify-code", req); public async Task LoginPasswordAuth(LoginPasswordAuthReq req) => await _apiClient.PostAsync("auth/login-password-auth", req); public async Task IsUsernameUsed(UnameUsageReq req) => await _apiClient.PostAsync("auth/is-username-used", req); public async Task IsEmailUsed(EmailUsageReq req) => await _apiClient.PostAsync("auth/is-email-used", req); public async Task PleSendVCode(PleSendVCodeReq req) => await _apiClient.PostAsync("auth/ple-send-vcode", req); public async Task PleVerifyCode(PleVerifyCodeReq req) => await _apiClient.PostAsync("auth/ple-verify-code", req); public async Task FinishPLEAccount(FinishPleAccountReq req) => await _apiClient.PostAsync("auth/finish-ple-account", req); public async Task LoginWithGoogle(LoginWithGoogleReq req) => await _apiClient.PostAsync("auth/login-with-google", req); public async Task LoginWithApple(LoginWithAppleReq req) => await _apiClient.PostAsync("auth/login-with-apple", req); public async Task Register(RegisterReq req) => await _apiClient.PostAsync("auth/register", req); public async Task ResetPassword(ResetPasswordReq req) => await _apiClient.PostAsync("auth/reset-password", req); public async Task VerifyResetCode(VerifyPasswordResetReq req) => await _apiClient.PostAsync("auth/verify-reset-code", req); } }