Ejemplo n.º 1
0
        public static ArrayList GetNumbers(FlowrouteNumbersAndMessagingClient client)
        {
            ArrayList return_list = new ArrayList();

            // List all phone numbers in our account paging through them 1 at a time
            //  If you have several phone numbers, change the 'limit' variable below
            //  This example is intended to show how to page through a list of resources

            int?limit  = 100;
            int?offset = 0;

            int?startsWith = null;
            int?endsWith   = null;
            int?contains   = null;

            // User the Numbers Controller from our Client
            NumbersController numbers = client.Numbers;

            do
            {
                dynamic number_data = numbers.GetAccountPhoneNumbers(startsWith, endsWith, contains, limit, offset);

                // Iterate through each number item
                foreach (var item in number_data.data)
                {
                    Console.WriteLine("---------------------------\nPhone Number Record:\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 = number_data.links;
                if (links.next != null)
                {
                    // more data to pull
                    offset += limit;
                }
                else
                {
                    break;   // no more data
                }
            }while (true);

            Console.WriteLine("Processing Complete");
            return(return_list);
        }