private void WriteActionParms(HipChatConnection connection, IEnumerable<KeyValuePair<string, string>> actionParms )
        {
            if (!actionParms.Any() || connection.Method.ToUpper() == "GET")
                return;

            var request = connection.GetRequest();

            var queryStringHelper = new QueryStringHelper();

            foreach (var kvPair in actionParms)
            {
                queryStringHelper.Add(kvPair.Key, HttpUtility.UrlEncode(kvPair.Value));
            }

            var postString = queryStringHelper.PostStringValue;
            var bytes = System.Text.Encoding.UTF8.GetBytes(postString);

            request.ContentType = "application/x-www-form-urlencoded";
            request.UserAgent = "HipChat API Client";
            request.ContentLength = bytes.Length;

            var requestStream = request.GetRequestStream();
            requestStream.Write(bytes, 0, bytes.Length);
            requestStream.Close();
        }
        public String BuildQueryString()
        {
            var helper = new QueryStringHelper();
            helper.Add("format", _responseFormat.ToString().ToLower());

            helper.Add("auth_token", _apiKey);

            foreach (var key in _actionParms)
            {
                helper.Add(key.Key, key.Value);
            }

            return helper.HtmlStringValue;
        }
 public void Setup()
 {
     _queryStringHelper = new QueryStringHelper();
     _context = new HipChatContext(_baseApiUrl, _apiKey, ActionKey.ListUsers,new Dictionary<string, string>());
 }