Example #1
0
        /// <summary>
        /// Constructor for a boost.
        /// </summary>
        /// <param name="factualId">factualId this boost is performed on.</param>
        /// <param name="query">factualId this boost is performed on.</param>
        /// <param name="user">factualId this boost is performed on.</param>
        public Boost(string factualId, Query query, Metadata user)
            : this(factualId)
        {
            string[] querySearchArray = query.ToUrlQuery().Split('=', '&');
            for (int i = 0; i < querySearchArray.Length; i++)
              if (querySearchArray[i] == Constants.SEARCH && i + 1 < querySearchArray.Length && !string.IsNullOrWhiteSpace(querySearchArray[i + 1]))
                Search(querySearchArray[i + 1]);

            string[] queryUserArray = user.ToUrlQuery().Split('=', '&');
            for (int i = 0; i < queryUserArray.Length; i++)
              if (queryUserArray[i] == Constants.USER && i + 1 < queryUserArray.Length && !string.IsNullOrWhiteSpace(queryUserArray[i + 1]))
                User(queryUserArray[i + 1]);
        }
        private string FlagCustom(string root, string flagType, String preferredFactualId, List <String> fields, Metadata metadata)
        {
            var postData = "problem=" + flagType + "&" + metadata.ToUrlQuery();

            if (preferredFactualId != null)
            {
                postData += "&preferred=" + preferredFactualId;
            }

            if (fields != null && fields.Count > 0)
            {
                postData += "&fields=" + HttpUtility.UrlEncode(JsonConvert.SerializeObject(fields));
            }

            return(RequestPost(root, postData, ""));
        }
Example #3
0
        /// <summary>
        /// Constructor for a boost.
        /// </summary>
        /// <param name="factualId">factualId this boost is performed on.</param>
        /// <param name="query">factualId this boost is performed on.</param>
        /// <param name="user">factualId this boost is performed on.</param>
        public Boost(string factualId, Query query, Metadata user)
            : this(factualId)
        {
            string[] querySearchArray = query.ToUrlQuery().Split('=', '&');
            for (int i = 0; i < querySearchArray.Length; i++)
            {
                if (querySearchArray[i] == Constants.SEARCH && i + 1 < querySearchArray.Length && !string.IsNullOrWhiteSpace(querySearchArray[i + 1]))
                {
                    Search(querySearchArray[i + 1]);
                }
            }

            string[] queryUserArray = user.ToUrlQuery().Split('=', '&');
            for (int i = 0; i < queryUserArray.Length; i++)
            {
                if (queryUserArray[i] == Constants.USER && i + 1 < queryUserArray.Length && !string.IsNullOrWhiteSpace(queryUserArray[i + 1]))
                {
                    User(queryUserArray[i + 1]);
                }
            }
        }
Example #4
0
 private string SubmitCustom(string root, Submit submit, Metadata metadata)
 {
     var postData = submit.ToUrlQuery() + "&" + metadata.ToUrlQuery();
     return RequestPost(root + "?" + postData, "");
 }
Example #5
0
 public string FlagCustom(string root, string flagType, Metadata metadata)
 {
     var postData = "problem=" + flagType + "&" + metadata.ToUrlQuery();
     return RequestPost(root + "?" + postData, "");
 }
 private string ClearCustom(string root, Clear clear, Metadata metadata)
 {
     var postData = clear.ToUrlQuery() + "&" + metadata.ToUrlQuery();
     return RequestPost(root, postData, "");
 }
        private string FlagCustom(string root, string flagType, String preferredFactualId, List<String> fields, Metadata metadata)
        {
            var postData = "problem=" + flagType + "&" + metadata.ToUrlQuery();

            if (preferredFactualId != null)
            {
                postData += "&preferred=" + preferredFactualId;
            }

            if (fields != null && fields.Count > 0)
            {
                postData += "&fields=" + HttpUtility.UrlEncode(JsonConvert.SerializeObject(fields));
            }

            return RequestPost(root, postData, "");
        }
        private string ClearCustom(string root, Clear clear, Metadata metadata)
        {
            var postData = clear.ToUrlQuery() + "&" + metadata.ToUrlQuery();

            return(RequestPost(root, postData, ""));
        }
        private string SubmitCustom(string root, Submit submit, Metadata metadata)
        {
            var postData = submit.ToUrlQuery() + "&" + metadata.ToUrlQuery();

            return(RequestPost(root, postData, ""));
        }
Example #10
0
        private string FlagCustom(string root, string flagType, Metadata metadata)
        {
            var postData = "problem=" + flagType + "&" + metadata.ToUrlQuery();

            return(RequestPost(root, postData, ""));
        }