internal List <Conversation> GetAllConversations() { Dictionary <String, String> firstparameters = new Dictionary <string, string> { { "per_page", "60" } }; List <Conversation> result = new List <Conversation> { }; logger.Debug("Requesting all conversations from intercom."); Conversations conversations = conversationsClient.ListAll(firstparameters); int currentPage = conversations.pages.page; int lastPage = conversations.pages.total_pages; result.AddRange(conversations.conversations); foreach (var conversation in conversations.conversations) { logger.Trace(conversation.id); } logger.Debug("Received page " + currentPage + " out of " + lastPage + "."); while (currentPage++ != lastPage) { Dictionary <String, String> parameters = new Dictionary <string, string> { { "page", currentPage.ToString() }, { "per_page", "60" } }; conversations = conversationsClient.ListAll(parameters); result.AddRange(conversations.conversations); foreach (var conversation in conversations.conversations) { logger.Trace(conversation.id); } logger.Debug("Received page " + currentPage + " out of " + lastPage + "."); } return(result); }
public void ListAll_WithNullParameters_ThrowException() { Assert.Throws <ArgumentNullException>(() => conversationsClient.ListAll(null)); }