コード例 #1
0
ファイル: HTTP.cs プロジェクト: msbg93/clickatell-csharp
        /// <summary>
        /// Extract Message Charge from web response
        /// </summary>
        /// <param name="response"></param>
        /// <param name="apiMessageId"></param>
        /// <returns></returns>
        /// <example>Raw response - apiMsgId: 7cc7f93f441819406a6c839564eb89f7 charge: 0 status: 001</example>
        private static MessageCharge GetMessageChargeFromResponse(string response, string apiMessageId)
        {
            var messageCharge = new MessageCharge();

            if (response.Contains("charge:"))
            {
                messageCharge.APIMessageID = apiMessageId;
                messageCharge.Charge       = int.Parse(response.Substring(response.IndexOf("charge:") + 7, response.IndexOf("status:") - (response.IndexOf("charge:") + 7)));
            }

            return(messageCharge);
        }
コード例 #2
0
        public void MessageCharge(string[] APIMessageID)
        {
            //getMessageCharge
            MessageChargeResponse messageChargeResponse = _apiClient.GetMessageCharge(new APIMessageRequest(APIMessageID));

            for (int i = 0; i < messageChargeResponse.MessageCharges.Length; i += 1)
            {
                MessageCharge messageCharge = new MessageCharge();
                messageCharge = messageChargeResponse.MessageCharges[i];
                Response.Write("messageCharge:" + i.ToString() + "<br/>"
                               + "messageCharge.APIMessageID : " + messageCharge.APIMessageID + "<br/>"
                               + "messageCharge.Charge.ToString(): " + messageCharge.Charge.ToString() + "<br/><br/>");
            }
        }