-
Notifications
You must be signed in to change notification settings - Fork 0
/
CsharpClientTest.cs
82 lines (75 loc) · 2.54 KB
/
CsharpClientTest.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
using Newtonsoft.Json;
using Yibai.Api;
using Yibai.Api.Common;
using Yibai.Api.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yibai
{
class Program
{
private const String serverUrl = "xxxxxxxxx";//修改为相应的api地址
private const String apikey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";//修改为您的apikey
public static YibaiClient client = new DefaultYibaiClient(serverUrl, apikey);
static void Main(string[] args)
{
TestSmsBatchSubmit();
Console.ReadLine();
TestSmsPullStatusReport();
Console.ReadLine();
TestSmsPullReplyMessage();
Console.ReadLine();
}
public static void TestSmsBatchSubmit()
{
try
{
List<SmsSubmit> smsSubmits = new List<SmsSubmit>();
SmsSubmit smsSubmit1 = new SmsSubmit("176xxxxxxxx", "【亿佰云通讯】您的验证码是:1234");
SmsSubmit smsSubmit2 = new SmsSubmit("136xxxxxxxx", "【亿佰云通讯】您的验证码是:5678");
smsSubmits.Add(smsSubmit1);
smsSubmits.Add(smsSubmit2);
Console.WriteLine(JsonConvert.SerializeObject(client.SmsBatchSubmit(smsSubmits)));
}
catch (YibaiApiException e)
{
Console.WriteLine("YibaiApiException, code: " + e.code + ", message: " + e.message);
}
catch(Exception e){
e.ToString();
}
}
public static void TestSmsPullStatusReport()
{
try
{
Console.WriteLine(JsonConvert.SerializeObject(client.SmsPullStatusReport()));
}
catch (YibaiApiException e)
{
Console.WriteLine("YibaiApiException, code: " + e.code + ", message: " + e.message);
}
catch(Exception e){
e.ToString();
}
}
public static void TestSmsPullReplyMessage()
{
try
{
Console.WriteLine(JsonConvert.SerializeObject(client.SmsPullReplyMessage()));
}
catch (YibaiApiException e)
{
Console.WriteLine("YibaiApiException, code: " + e.code + ", message: " + e.message);
}
catch (Exception e)
{
e.ToString();
}
}
}
}