Ejemplo n.º 1
0
        public static ArrayList GetMessages(FlowrouteNumbersAndMessagingClient client)
        {
            ArrayList return_list = new ArrayList();
            int?      limit       = 20;
            int?      offset      = 0;

            // Find all messages since January 1, 2017
            DateTime startDate = new DateTime(2017, 1, 1);
            DateTime?endDate   = null;

            do
            {
                MessagesController messages     = client.Messages;
                dynamic            message_data = messages.GetLookUpASetOfMessages(startDate, endDate, limit, offset);

                // Iterate through each number item
                foreach (var item in message_data.data)
                {
                    Console.WriteLine("---------------------------\nSMS MDR:\n");
                    Console.WriteLine("Attributes:{0}\nId:{1}\nLinks:{2}\nType:{3}\n", item.attributes, item.id, item.links, item.type);
                    return_list.Add((string)item.id);
                }

                // See if there is more data to process
                var links = message_data.links;
                if (links.next != null)
                {
                    // more data to pull
                    offset += limit;
                }
                else
                {
                    break;   // no more data
                }
            }while (true);
            return(return_list);
        }