using NikSms.Library.Net.WebApi;
using NikSms.Library.Net.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NikSMSDeveloper
{
public class NikSmsApiV2Client
{
private readonly PublicApiV2 service;
public NikSmsApiV2Client(string username, string password)
{
service = new PublicApiV2(username, password);
}
public async Task<ApiV2SendGroupResult> SendGroup(string senderNumber, List<string> recipients, string message, DateTime? sendDate, List<long> localIds)
{
var result = await service.SendGroup(senderNumber, recipients, message, sendDate, localIds);
switch (result.Status)
{
case LibOperationResultStatus.Success:
return result.Data;
case LibOperationResultStatus.InvalidModel:
throw new Exception("Some required inputs are misssing...");
case LibOperationResultStatus.UnAuthorized:
throw new Exception("Some thing is wrong with your account (call support!)");
case LibOperationResultStatus.Failed:
throw new Exception("Ooops its our fault!");
default:
throw new Exception("You sould not be here... :D");
}
}
}
}