Slooce.NET
1.0.0
使用您的环境配置创建一个新的Slooceapi。
using Slooce.NET;
...
var slooceApi = new SlooceApi(new SlooceConfig("slooceurl", "sloocepassword"));
注册用户(确保用户编号包括国家代码)
var registerResponse = await api.RegisterUserAsync("15555555555", "yourkeyword");
//check result
Console.WriteLine($"Register response: {registerResponse.Result}");
发送文字
var textResponse = await api.SendMtMessageAsync("15555555555", "yourkeyword", "Hellow world");
//check result
Console.WriteLine($"Text response: {textResponse.Result}");
完成后处理API。
slooceApi.Dispose();
SlooceApi类用于其Web请求的支持HttpClient ,因此您应该在整个应用程序中使用一个SlooceApi 。缓存HTTPCLCCLIENT时, SlooceApi也已经处理了DNS刷新问题。
SlooceApi应产生最小垃圾,并尽可能使用缓存。