Esempio n. 1
0
        private static JObject CheckAccepted(HttpWebResponse resp)
        {
            if (resp == null)
            {
                throw new System.Exception("Response returned null.");
            }

            if (resp.StatusCode != HttpStatusCode.Accepted)
            {
                throw new System.Exception(string.Format("Response return with a HTTP Code of {0} - {1}", resp.StatusCode, resp.StatusDescription));
            }

            return(resp.GetJObject());
        }
Esempio n. 2
0
        /// <summary>
        /// Call view cleanup for a database
        /// </summary>
        /// <returns>JSON success statement if the response code is Accepted</returns>
        public JObject ViewCleanup()
        {
            HttpWebResponse resp = GetRequest(databaseBaseUri + "/_view_cleanup").Post().Json().GetResponse();

            if (resp == null)
            {
                throw new System.Exception("Response returned null.");
            }

            if (resp.StatusCode != HttpStatusCode.Accepted)
            {
                throw new System.Exception("Response return with a HTTP Code of " + resp.StatusCode + " - " + resp.StatusDescription);
            }

            return(resp.GetJObject());
        }