-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathProgram.cs
46 lines (39 loc) · 1.14 KB
/
Program.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
34
35
36
37
38
39
40
41
42
43
44
45
46
using ScgApi;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace list_contacts
{
class Program
{
static void ListContacts(SessionOptions opts)
{
using (var session = new Session(opts))
{
var res = Contact.Resource(session);
foreach (var contact in res.List())
{
Console.WriteLine("Contact id {0}, mdn {1}",
contact.Id, contact.PrimaryMdn);
}
}
}
static void Main(string[] args)
{
Console.WriteLine("Usage: list_contacts [auth-file] [api-url]");
var opts = new SessionOptions();
if (args.Length > 0)
opts.AuthFilePath = args[0];
if (args.Length > 1)
opts.BaseUrl = args[1];
try
{
ListContacts(opts);
}
catch (Exception ex)
{
Console.WriteLine("Failed: {0}", ex.ToString());
}
}
}
}