Skip to content

Commit

Permalink
Sms fallback -> vms example
Browse files Browse the repository at this point in the history
  • Loading branch information
jakublabno committed Dec 17, 2024
1 parent e2c47c9 commit bef247e
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions examples/sms/SmsWithVmsFallback.cs
Original file line number Diff line number Diff line change
@@ -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);
});
}

0 comments on commit bef247e

Please sign in to comment.