Example #1
0
        /// <summary>
        /// this method get user credit
        /// </summary>
        /// <param name="tokenKey"> <see cref="Token"/> </param>
        /// <returns>returns an object of <see cref="CreditResponse"/></returns>
        public CreditResponse GetCredit(string tokenKey)
        {
            try
            {
                string url = "http://restfulsms.com/api/credit";

                var parameters = new Dictionary <string, string>();
                parameters.Add("x-sms-ir-secure-token", tokenKey);

                HttpRequestFactory = () => new HttpGetRequest();
                var httpRequest = HttpRequestFactory();
                var rawResponse = httpRequest.Execute(new HttpObject()
                {
                    Url = url
                }, parameters);

                //HttpExecuter exec = new HttpGet();
                //var tokenResult = exec.Execute(new HttpObject() { Url = url }, parameters);

                CreditResponse res = rawResponse.Deserialize <CreditResponse>();
                if (res != null && res.IsSuccessful == true)
                {
                    return(res);
                }
            }
            catch (Exception ex)
            {
                return(null);
            }
            return(null);
        }
Example #2
0
        public static void SendCommonSms(string cellNumber, string message)
        {
            var token = new Token().GetToken("db67a48dbe57332ec63980c", "rushwebSmsApi");

            SmsIrRestful.MessageSend messageSend = new SmsIrRestful.MessageSend();

            var res = messageSend.Send(token, new SmsIrRestful.MessageSendObject()
            {
                MobileNumbers = new List <string>()
                {
                    cellNumber
                }.ToArray(),
                Messages = new List <string>()
                {
                    message
                }.ToArray(),
                LineNumber               = "30002101001187",
                SendDateTime             = null,
                CanContinueInCaseOfError = false
            });

            SmsIrRestful.Credit         credit         = new SmsIrRestful.Credit();
            SmsIrRestful.CreditResponse creditResponse = new SmsIrRestful.CreditResponse();
        }
Example #3
0
        public static void SendCommonSms(string cellNumber, string message)
        {
            var token = new Token().GetToken("c34c137660319581a9c21376", "123qwe!@#QWE");

            SmsIrRestful.MessageSend messageSend = new SmsIrRestful.MessageSend();

            var res = messageSend.Send(token, new SmsIrRestful.MessageSendObject()
            {
                MobileNumbers = new List <string>()
                {
                    cellNumber
                }.ToArray(),
                Messages = new List <string>()
                {
                    message
                }.ToArray(),
                LineNumber               = "30002101000785",
                SendDateTime             = null,
                CanContinueInCaseOfError = false
            });

            SmsIrRestful.Credit         credit         = new SmsIrRestful.Credit();
            SmsIrRestful.CreditResponse creditResponse = new SmsIrRestful.CreditResponse();
        }
Example #4
0
        public void SendCommonSms(string cellNumber, string message)
        {
            var token = new Token().GetToken("773e6490afdaeccca1206490", "123qwe!@#QWE");

            SmsIrRestful.MessageSend messageSend = new SmsIrRestful.MessageSend();

            var res = messageSend.Send(token, new SmsIrRestful.MessageSendObject()
            {
                MobileNumbers = new List <string>()
                {
                    cellNumber
                }.ToArray(),
                Messages = new List <string>()
                {
                    message
                }.ToArray(),
                LineNumber               = "30004747475709",
                SendDateTime             = null,
                CanContinueInCaseOfError = false
            });

            SmsIrRestful.Credit         credit         = new SmsIrRestful.Credit();
            SmsIrRestful.CreditResponse creditResponse = new SmsIrRestful.CreditResponse();
        }