From bef247e6d7228ba7984b78d52f9e289f2e426cb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C5=81abno?= Date: Tue, 17 Dec 2024 16:09:12 +0000 Subject: [PATCH] Sms fallback -> vms example --- examples/sms/SmsWithVmsFallback.cs | 31 ++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 examples/sms/SmsWithVmsFallback.cs diff --git a/examples/sms/SmsWithVmsFallback.cs b/examples/sms/SmsWithVmsFallback.cs new file mode 100644 index 0000000..75793c7 --- /dev/null +++ b/examples/sms/SmsWithVmsFallback.cs @@ -0,0 +1,31 @@ +using SMSApi.Api; +using SMSApi.Api.Action; +using SMSApi.Api.Response; + +var client = new ClientOAuth("token"); +var features = new Features(client); + +const string recipient = "48322320667"; +const string message = "message"; + +var sendResult = features.SMS() + .ActionSend(recipient, message) + .WithFallback(SMSSend.SmsFallbacks.Vms) + .Execute(); + +Console.WriteLine($"SMS sent count: {sendResult.Count}"); //no sms sent +Console.WriteLine($"Fallback sent count: {sendResult.Fallbacks?.Count ?? 0}"); //fallbacks count + +foreach (var sendResultFallback in sendResult.Fallbacks ?? new()) +{ + Console.WriteLine($"Fallback type: {sendResultFallback.Key}"); //fallback type + Console.WriteLine($"Fallbacks of type sent: {sendResultFallback.Value.Count}"); //fallbacks count + + sendResultFallback.Value.List.ForEach(fallback => + { + Console.WriteLine($"Fallback id: {fallback.Id}"); + Console.WriteLine(fallback.Idx); + Console.WriteLine(fallback.Points); + Console.WriteLine(fallback.DateSent); + }); +}