forked from plivo/plivo-examples-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlivoMessage.cs
33 lines (31 loc) · 1.05 KB
/
PlivoMessage.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System;
using System.Collections.Generic;
using System.Reflection;
using RestSharp;
using Plivo.API;
namespace PlivoMessage
{
class Program
{
static void Main(string[] args)
{
RestAPI plivo = new RestAPI("XXXXXXXXXXXXXXXXXXXXXXX", "YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY");
IRestResponse<MessageResponse> resp = plivo.send_message(new Dictionary<string, string>()
{
{ "src", "11212121211" },
{ "dst", "12212121211" },
{ "text", "Hi, text from Plivo." },
{ "url", "http://some.domain/receivestatus/" },
{ "method", "GET" }
});
if (resp.Data != null)
{
PropertyInfo[] proplist = resp.Data.GetType().GetProperties();
foreach (PropertyInfo property in proplist)
Console.WriteLine("{0}: {1}", property.Name, property.GetValue(resp.Data, null));
}
else
Console.WriteLine(resp.ErrorMessage);
}
}
}