Skip to content

Instantly share code, notes, and snippets.

@bjartwolf
Created December 15, 2014 18:17
Show Gist options
  • Save bjartwolf/c3e235842e83f3c0ee14 to your computer and use it in GitHub Desktop.
Save bjartwolf/c3e235842e83f3c0ee14 to your computer and use it in GitHub Desktop.
smsservice.fs
namespace FDK.SmsSender
open PSWinCom.Gateway.Client;
open SmsTypes;
type ISmsService = abstract member SendSms: FdkSms -> SmsStatus
type Sender = string
type SmsService(sender: Sender, client: IGatewayClient) =
interface ISmsService with
member this.SendSms fdkSms=
let receiverNumber, body = fdkSms
let sms = new Sms(ReceiverNumber = receiverNumber, SenderNumber = sender, Text = body );
let messages:list<Message> = [sms]
try
let response = client.Send(Seq.toList messages)
// We only send one SMS so we only care about the first result
let result = List.head (List.ofSeq response.Results)
Response result
with
| ex -> Error ex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment