public bool DeleteTopic(string topicName, bool forceDeletion = false)
        {
            MessagingRequest request = new MessagingRequest("topics/{topicName}", Method.DELETE);
            request.AddUrlSegment("topicName", topicName);
            request.HttpStatusSuccessCodes.Add(202);
            request.HttpStatusExceptionMap.Add(404, typeof(TopicNotFoundException));
            request.HttpStatusExceptionMap.Add(409, typeof(TopicHasSubscriptionsException));

            if (forceDeletion) {
                request.AddParameter("force", "true", ParameterType.GetOrPost);
            }

            ApiResponse response = client.Execute<ApiResponse>(request);

            return true;
        }
        public TopicList GetTopicList(IEnumerable<string> tagList, bool populateSubscriptions = false)
        {
            TopicList topicList = new TopicList();
            MessagingRequest request = new MessagingRequest("topics");
            request.HttpStatusSuccessCodes.Add(200);

            if (tagList != null) {
                request.AddParameter("tags", new TagList(tagList).ToString(","));
            }

            EntityListResponse<TopicResponse> topicListResponse =
                client.Execute<EntityListResponse<TopicResponse>>(request);

            foreach (TopicResponse tmpTopic in topicListResponse.items) {
                Topic topic = new Topic(tmpTopic.name);

                if (tmpTopic.tags != null) {
                    topic.Tags = new TagList(tmpTopic.tags);
                }

                if (populateSubscriptions) {
                    topic.Subscriptions = GetTopicSubscriptionList(topic);
                }

                topicList.Add(topic);
            }

            return topicList;
        }
        public MessageList PopMessages(string queueName, int maxMessages = 1)
        {
            if (maxMessages <= 0 || maxMessages > Queue.MaxMessagesPerPop) {
                throw new ArgumentOutOfRangeException("maxMessages");
            }

            MessageList messages = new MessageList();

            MessagingRequest request = new MessagingRequest("queues/{queueName}/messages", Method.GET);
            request.AddUrlSegment("queueName", queueName);
            request.AddParameter("batch", maxMessages, ParameterType.GetOrPost);
            request.HttpStatusSuccessCodes.Add(200);
            request.HttpStatusExceptionMap.Add(404, typeof(QueueNotFoundException));

            MessageListResponse response = client.Execute<MessageListResponse>(request);

            response.items.ForEach(delegate(MessageResponse tmpMessage)
            {
                Message message = new Message();
                message.ID = tmpMessage.id;
                message.Body = tmpMessage.body;
                message.SetInitialEntryTime(tmpMessage.initial_entry_time);
                message.VisibilityDelay = tmpMessage.visibility_delay;
                message.VisibilityInterval = tmpMessage.visibility_interval;

                if (tmpMessage.fields != null) {
                    message.Fields = new FieldList(tmpMessage.fields);
                }

                messages.Add(message);
            });

            return messages;
        }
        public QueueList GetQueueList(IEnumerable<string> tagList)
        {
            QueueList queueList = new QueueList();
            MessagingRequest request = new MessagingRequest("queues");
            request.HttpStatusSuccessCodes.Add(200);

            if (tagList != null) {
                request.AddParameter("tags", new TagList(tagList).ToString(","));
            }

            EntityListResponse<QueueResponse> queueListResponse =
                client.Execute<EntityListResponse<QueueResponse>>(request);

            foreach (QueueResponse tmpQueue in queueListResponse.items) {
                Queue queue = new Queue(tmpQueue.name);
                queue.Expiration = tmpQueue.expiration;
                queue.VisibilityInterval = tmpQueue.visibility_interval;
                queue.Tags = new TagList(tmpQueue.tags);

                queueList.Add(queue);
            }

            return queueList;
        }