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應產生最小垃圾,並儘可能使用緩存。