From da06daf7763fa1ecc89f97d3e350bf0299d6fa34 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Mon, 25 Nov 2024 14:13:34 +0100 Subject: [PATCH] =?UTF-8?q?refactor(GtxMessagingService):=20Optionen=20f?= =?UTF-8?q?=C3=BCr=20generische=20und=20dynamische=20Antworttypen=20zur=20?= =?UTF-8?q?SendSmsAsync-Methode=20hinzugef=C3=BCgt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Contracts/IMessagingService.cs | 4 +++- .../Services/GTXMessagingService.cs | 9 ++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/EnvelopeGenerator.Application/Contracts/IMessagingService.cs b/EnvelopeGenerator.Application/Contracts/IMessagingService.cs index ff84a5f5..09048206 100644 --- a/EnvelopeGenerator.Application/Contracts/IMessagingService.cs +++ b/EnvelopeGenerator.Application/Contracts/IMessagingService.cs @@ -2,6 +2,8 @@ { public interface IMessagingService { - public Task SendSmsAsync(string recipient, string message); + public Task SendSmsAsync(string recipient, string message); + + public Task SendSmsAsync(string recipient, string message); } } \ No newline at end of file diff --git a/EnvelopeGenerator.Application/Services/GTXMessagingService.cs b/EnvelopeGenerator.Application/Services/GTXMessagingService.cs index 12208a6d..407d5908 100644 --- a/EnvelopeGenerator.Application/Services/GTXMessagingService.cs +++ b/EnvelopeGenerator.Application/Services/GTXMessagingService.cs @@ -1,4 +1,5 @@ using DigitalData.Core.Abstractions.Client; +using DigitalData.Core.Client; using EnvelopeGenerator.Application.Configurations.GtxMessaging; using EnvelopeGenerator.Application.Contracts; using Microsoft.Extensions.Options; @@ -17,12 +18,14 @@ namespace EnvelopeGenerator.Application.Services _smsParams = smsParamsOptions.Value; } - public async Task SendSmsAsync(string recipient, string message) + public Task SendSmsAsync(string recipient, string message) => SendSmsAsync(recipient: recipient, message: message); + + public async Task SendSmsAsync(string recipient, string message) { - await _smsClient.FetchAsync(queryParams: new Dictionary() { + return await _smsClient.FetchAsync(queryParams: new Dictionary() { { _smsParams.RecipientQueryParamName, recipient }, { _smsParams.MessageQueryParamName, message } - }); + }).ThenAsync(res => res.Json()); } } } \ No newline at end of file