4 SMSAPI C# client may be used by *SMSAPI.pl* and *SMSAPI.com* clients.
6 ## How to pick a service?
8 ### *SMSAPI.IO* (default)
11 var smsApi = new SMSApi.Api.SMSFactory(client);
13 var smsApi = new SMSApi.Api.SMSFactory(client, ProxyAddress.SmsApiIo);
19 var smsApi = new SMSApi.Api.SMSFactory(client, ProxyAddress.SmsApiPl);
25 var smsApi = new SMSApi.Api.SMSFactory(client, ProxyAddress.SmsApiCom);
34 SMSApi.Api.IClient client = new SMSApi.Api.ClientOAuth("token");
36 var smsApi = new SMSApi.Api.SMSFactory(client);
37 // for SMSAPI.com clients:
38 // var smsApi = new SMSApi.Api.SMSFactory(client, ProxyAddress.SmsApiCom);
42 .SetText("test message")
44 .SetSender("Test") //Sender name
47 System.Console.WriteLine("Send: " + result.Count);
49 string[] ids = new string[result.Count];
51 for (int i = 0, l = 0; i < result.List.Count; i++)
53 if (!result.List[i].isError())
55 if (!result.List[i].isFinal())
57 ids[l] = result.List[i].ID;
63 System.Console.WriteLine("Get:");
69 foreach (var status in result.List)
71 System.Console.WriteLine("ID: " + status.ID + " Number: " + status.Number + " Points:" + status.Points + " Status:" + status.Status + " IDx: " + status.IDx);
74 catch (SMSApi.Api.ActionException e)
79 System.Console.WriteLine(e.Message);
81 catch (SMSApi.Api.ClientException e)
84 * Error codes (list available in smsapi docs). Example:
85 * 101 Invalid authorization info
86 * 102 Invalid username or password
87 * 103 Insufficient credits on Your account
88 * 104 No such template
89 * 105 Wrong IP address (for IP filter turned on)
90 * 110 Action not allowed for your account
92 System.Console.WriteLine(e.Message);
94 catch (SMSApi.Api.HostException e)
98 * SMSApi.Api.HostException.E_JSON_DECODE - problem with parsing data
100 System.Console.WriteLine(e.Message);
102 catch (SMSApi.Api.ProxyException e)
104 // communication problem between client and sever
105 System.Console.WriteLine(e.Message);
111 * C# >= 3.5 + System.Runtime.Serialization, System.ServiceModel.Web
115 [Apache 2.0 License](https://github.com/smsapi/smsapi-php-client/blob/master/LICENSE)