コード例 #1
0
ファイル: Program.cs プロジェクト: Work-Stuff/TextMagic-Test
        static void Main(string[] args)
        {
            TextMagicClient textMagicClient = new TextMagicClient(Environment.GetEnvironmentVariable("TM_API_KEY"),
                                                                  Environment.GetEnvironmentVariable("TM_USER_NAME"));
            // textMagicClient.SendMessage("Hello World");
            GetAllMessagesResponse response = textMagicClient.GetAllOutboundMessages(new GetAllMessagesRequest("1", "10"));

            for (int i = 0; i < response.Messages.Count - 1; i++)
            {
                Console.WriteLine("Message {0} Status is: {1}", i + 1, GetMessageStatus(response.Messages[i]));
            }
            Console.ReadKey();
        }
コード例 #2
0
        public GetAllMessagesResponse GetAllOutboundMessages(GetAllMessagesRequest request)
        {
            MessagesResult         res      = client.GetMessages(int.Parse(request.Page), int.Parse(request.Limit));
            List <MessageResponse> messages = new List <MessageResponse>(res.Messages.Count);

            foreach (Message msg in res.Messages)
            {
                messages.Add(new MessageResponse(msg.Id, msg.Receiver, msg.MessageTime, (int)msg.Status, msg.Text, null, msg.Charset,
                                                 msg.FirstName, msg.LastName, msg.CountryId, msg.Sender, msg.Price, msg.PartsCount));
            }
            GetAllMessagesResponse response = new GetAllMessagesResponse(res.Limit, messages, res.Page, res.PageCount, res.Success);

            response.ResponseStatus = res.Success ? ResponseStatus._200 : ResponseStatus._500;
            return(response);
        }