-
Notifications
You must be signed in to change notification settings - Fork 2
/
Program.cs
53 lines (44 loc) · 1.44 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
47
48
49
50
51
52
53
using ScgApi;
using System;
using System.Threading.Tasks;
namespace check_message_request_state
{
class Program
{
static async Task CheckState(String messageRequestId, SessionOptions opts)
{
using (var session = new Session(opts))
{
var res = MessageRequest.Resource(session);
var mrq = await res.Get(messageRequestId);
Console.WriteLine("Message request {0} has state {1}",
mrq.Id, mrq.State);
foreach (var msg in res.ListMessages(mrq.Id))
{
Console.WriteLine(" Message {0} has state {1}",
msg.Id, msg.State);
}
}
}
static void Main(string[] args)
{
if (args.Length < 1)
{
Console.WriteLine("Usage: check_message_request_state request-id [auth-file] [api-url]");
return;
}
var opts = new SessionOptions();
if (args.Length > 1)
opts.AuthFilePath = args[1];
if (args.Length > 2)
opts.BaseUrl = args[2];
try
{
CheckState(args[0], opts).Wait();
} catch(Exception ex)
{
Console.WriteLine("Failed: {0}", ex.ToString());
}
}
}
}