public async Task <object> AcceptConnection(EmailParam model) { _apiClient.BaseUrl = new Uri(_configuration["EmailServiceUrl"]); var apiRequest = new ApiRequest("", RequestMethod.POST) { RequestFormat = DataFormat.Json }; apiRequest.AddBody(new EmailApiModel() { EmailType = "EduHubConnection", SystemUserId = model.SystemUserId, Payload = model.Payload, Recipient = model.Recipient, TemplateName = "Mentifi_ConnectionActive" }); var response = await _apiClient.ExecuteAsync <object>(apiRequest); if (response.IsSuccessful) { return(model); } _logger.LogError(response.ErrorException, response.ErrorMessage, null); throw new ApplicationException(response.ErrorMessage); }
public async Task <object> Send(Hub3cFirebase model) { _apiClient.BaseUrl = new Uri(_config.GetSection("Hub3cFirebase")["Url"]); var apiRequest = new ApiRequest("", RequestMethod.POST) { RequestFormat = DataFormat.Json }; _apiClient.Authenticator = new FcmAuthenticator(_config.GetSection("Hub3cFirebase")["Token"]); apiRequest.AddBody(model); var resultAsync = await _apiClient.ExecuteAsync <object>(apiRequest); if (resultAsync.IsSuccessful) { return(resultAsync.Data); } throw new ApplicationException(resultAsync.ErrorMessage); }