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]);
        }
 /// <summary>
 /// Flags a row as having been relocated, where its new location is an existing record,
 /// identified by preferredFactualid. If there is no record corresponding to the relocated
 /// business, use the submit API to update the record's address instead.
 /// </summary>
 /// <param name="tablename">the name of the table you wish to flag a duplicate for (e.g., "places")</param>
 /// <param name="factualId">>the factual id that is the relocated</param>
 /// <param name="preferredFactualId">the factual id that is preferred.</param>
 /// <param name="metadata">the metadata to send with information on this request</param>
 /// <returns></returns>
 public String FlagRelocated(string tablename, string factualId, String preferredFactualId, Metadata metadata)
 {
     return FlagCustom(UrlForFlag(tablename, factualId), "relocated", preferredFactualId, null, metadata);
 }
Example #3
0
 /// <summary>
 /// Runs a Submit input against the specified Factual table.
 /// </summary>
 /// <param name="tableName">the name of the table you wish to submit updates for (e.g., "places")</param>
 /// <param name="factualId">the factual id on which the submit is run</param>
 /// <param name="submit">the submit parameters to run against table</param>
 /// <param name="metadata">the metadata to send with information on this request</param>
 /// <returns>the response of running submit against Factual.</returns>
 public string Submit(string tableName, string factualId, Submit submit, Metadata metadata)
 {
     return(SubmitCustom("t/" + tableName + "/" + factualId + "/submit", submit, metadata));
 }
Example #4
0
 /// <summary>
 /// Runs a Submit input against the specified Factual table.
 /// </summary>
 /// <param name="tableName">the name of the table you wish to submit updates for (e.g., "places")</param>
 /// <param name="factualId">the factual id on which the submit is run</param>
 /// <param name="submit">the submit parameters to run against table</param>
 /// <param name="metadata">the metadata to send with information on this request</param>
 /// <returns>the response of running submit against Factual.</returns>
 public string Submit(string tableName, string factualId, Submit submit, Metadata metadata)
 {
     return SubmitCustom("t/" + tableName + "/" + factualId + "/submit", submit, metadata);
 }
Example #5
0
 /// <summary>
 /// Flags a row as problematic in the specified Factual table.
 /// </summary>
 /// <param name="tableName">the name of the table you wish to flag a duplicate for (e.g., "places")</param>
 /// <param name="factualId">the factual id that is the duplicate</param>
 /// <param name="metadata">the metadata to send with information on this request</param>
 /// <returns>the response from flagging a duplicate row.</returns>
 public string FlagOther(string tableName, string factualId, Metadata metadata)
 {
     return FlagCustom(UrlForFlag(tableName, factualId), "other", metadata);
 }
Example #6
0
 /// <summary>
 /// Flags a row as inappropriate in the specified Factual table.
 /// </summary>
 /// <param name="tableName">the name of the table you wish to flag a duplicate for (e.g., "places")</param>
 /// <param name="factualId">the factual id that is the duplicate</param>
 /// <param name="metadata">the metadata to send with information on this request</param>
 /// <returns>the response from flagging a duplicate row.</returns>
 public string FlagInappropriate(string tableName, string factualId, Metadata metadata)
 {
     return FlagCustom(UrlForFlag(tableName, factualId), "inappropriate", metadata);
 }
Example #7
0
 public string FlagCustom(string root, string flagType, Metadata metadata)
 {
     var postData = "problem=" + flagType + "&" + metadata.ToUrlQuery();
     return RequestPost(root + "?" + postData, "");
 }
 /// <summary>
 /// Flags a row as closed in the specified Factual table.
 /// </summary>
 /// <param name="tableName">the name of the table that contains the item you wish to flag as closed (e.g., "places")</param>
 /// <param name="factualId">the factual id of the item you wish to flag as closed</param>
 /// <param name="metadata">the metadata to send with information on this request</param>
 /// <returns>the response from flagging an item as closed.</returns>
 public string FlagClosed(string tableName, string factualId, Metadata metadata)
 {
     return FlagCustom(UrlForFlag(tableName, factualId), "closed", metadata);
 }
Example #9
0
 /// <summary>
 /// Flags a row as non-existent in the specified Factual table.
 /// </summary>
 /// <param name="tableName">the name of the table you wish to flag a duplicate for (e.g., "places")</param>
 /// <param name="factualId">the factual id that is the duplicate</param>
 /// <param name="metadata">the metadata to send with information on this request</param>
 /// <returns>the response from flagging a duplicate row.</returns>
 public string FlagNonExistent(string tableName, string factualId, Metadata metadata)
 {
     return(FlagCustom(UrlForFlag(tableName, factualId), "nonexistent", metadata));
 }
Example #10
0
 /// <summary>
 /// Flags a row as inappropriate in the specified Factual table.
 /// </summary>
 /// <param name="tableName">the name of the table you wish to flag a duplicate for (e.g., "places")</param>
 /// <param name="factualId">the factual id that is the duplicate</param>
 /// <param name="metadata">the metadata to send with information on this request</param>
 /// <returns>the response from flagging a duplicate row.</returns>
 public string FlagInappropriate(string tableName, string factualId, Metadata metadata)
 {
     return(FlagCustom(UrlForFlag(tableName, factualId), "inappropriate", metadata));
 }
Example #11
0
 /// <summary>
 /// Flags a row as a duplicate in the specified Factual table.
 /// </summary>
 /// <param name="tableName">the name of the table you wish to flag a duplicate for (e.g., "places")</param>
 /// <param name="factualId">the factual id that is the duplicate</param>
 /// <param name="metadata">the metadata to send with information on this request</param>
 /// <returns>the response from flagging a duplicate row.</returns>
 public string FlagDuplicate(string tableName, string factualId, Metadata metadata)
 {
     return(FlagCustom(UrlForFlag(tableName, factualId), "duplicate", metadata));
 }
Example #12
0
        private string ClearCustom(string root, Clear clear, Metadata metadata)
        {
            var postData = clear.ToUrlQuery() + "&" + metadata.ToUrlQuery();

            return(RequestPost(root, postData, ""));
        }
Example #13
0
 /// <summary>
 /// Runs a clear request of existing attributes on a Factual entity.
 /// </summary>
 /// <param name="tableName">the name of the table in which to clear attributes for an entity (e.g., "places")</param>
 /// <param name="factualId">the factual id on which the clear is run</param>
 /// <param name="clear">the clear parameters to run against entity</param>
 /// <param name="metadata">the metadata to send with information on this request</param>
 /// <returns>the response of running clear request on a Factual entity.</returns>
 public string Clear(string tableName, string factualId, Clear clear, Metadata metadata)
 {
     return(ClearCustom("t/" + tableName + "/" + factualId + "/clear", clear, metadata));
 }
Example #14
0
        private string SubmitCustom(string root, Submit submit, Metadata metadata)
        {
            var postData = submit.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, "");
        }
 /// <summary>
 /// Runs a clear request of existing attributes on a Factual entity.
 /// </summary>
 /// <param name="tableName">the name of the table in which to clear attributes for an entity (e.g., "places")</param>
 /// <param name="factualId">the factual id on which the clear is run</param>
 /// <param name="clear">the clear parameters to run against entity</param>
 /// <param name="metadata">the metadata to send with information on this request</param>
 /// <returns>the response of running clear request on a Factual entity.</returns>
 public string Clear(string tableName, string factualId, Clear clear, Metadata metadata)
 {
     return ClearCustom("t/" + tableName + "/" + factualId + "/clear", clear, metadata);
 }
Example #17
0
 /// <summary>
 /// Flags a row as spam in the specified Factual table.
 /// </summary>
 /// <param name="tableName">the name of the table you wish to flag a duplicate for (e.g., "places")</param>
 /// <param name="factualId">the factual id that is the duplicate</param>
 /// <param name="metadata">the metadata to send with information on this request</param>
 /// <returns>the response from flagging a duplicate row.</returns>
 public string FlagSpam(string tableName, string factualId, Metadata metadata)
 {
     return(FlagCustom(UrlForFlag(tableName, factualId), "spam", metadata));
 }
 private string ClearCustom(string root, Clear clear, Metadata metadata)
 {
     var postData = clear.ToUrlQuery() + "&" + metadata.ToUrlQuery();
     return RequestPost(root, postData, "");
 }
Example #19
0
 /// <summary>
 /// Flags a row as closed in the specified Factual table.
 /// </summary>
 /// <param name="tableName">the name of the table that contains the item you wish to flag as closed (e.g., "places")</param>
 /// <param name="factualId">the factual id of the item you wish to flag as closed</param>
 /// <param name="metadata">the metadata to send with information on this request</param>
 /// <returns>the response from flagging an item as closed.</returns>
 public string FlagClosed(string tableName, string factualId, Metadata metadata)
 {
     return(FlagCustom(UrlForFlag(tableName, factualId), "closed", metadata));
 }
Example #20
0
 /// <summary>
 /// Flags a row as a duplicate in the specified Factual table.
 /// </summary>
 /// <param name="tableName">the name of the table you wish to flag a duplicate for (e.g., "places")</param>
 /// <param name="factualId">the factual id that is the duplicate</param>
 /// <param name="metadata">the metadata to send with information on this request</param>
 /// <returns>the response from flagging a duplicate row.</returns>
 public string FlagDuplicate(string tableName, string factualId, Metadata metadata)
 {
     return FlagCustom(UrlForFlag(tableName, factualId), "duplicate", metadata);
 }
Example #21
0
 /// <summary>
 /// Flags a row as problematic in the specified Factual table.
 /// </summary>
 /// <param name="tableName">the name of the table you wish to flag a duplicate for (e.g., "places")</param>
 /// <param name="factualId">the factual id that is the duplicate</param>
 /// <param name="metadata">the metadata to send with information on this request</param>
 /// <returns>the response from flagging a duplicate row.</returns>
 public string FlagOther(string tableName, string factualId, Metadata metadata)
 {
     return(FlagCustom(UrlForFlag(tableName, factualId), "other", metadata));
 }
Example #22
0
 /// <summary>
 /// Flags a row as non-existent in the specified Factual table.
 /// </summary>
 /// <param name="tableName">the name of the table you wish to flag a duplicate for (e.g., "places")</param>
 /// <param name="factualId">the factual id that is the duplicate</param>
 /// <param name="metadata">the metadata to send with information on this request</param>
 /// <returns>the response from flagging a duplicate row.</returns>
 public string FlagNonExistent(string tableName, string factualId, Metadata metadata)
 {
     return FlagCustom(UrlForFlag(tableName, factualId), "nonexistent", metadata);
 }
Example #23
0
        private string FlagCustom(string root, string flagType, Metadata metadata)
        {
            var postData = "problem=" + flagType + "&" + metadata.ToUrlQuery();

            return(RequestPost(root, postData, ""));
        }
Example #24
0
 /// <summary>
 /// Flags a row as spam in the specified Factual table.
 /// </summary>
 /// <param name="tableName">the name of the table you wish to flag a duplicate for (e.g., "places")</param>
 /// <param name="factualId">the factual id that is the duplicate</param>
 /// <param name="metadata">the metadata to send with information on this request</param>
 /// <returns>the response from flagging a duplicate row.</returns>
 public string FlagSpam(string tableName, string factualId, Metadata metadata)
 {
     return FlagCustom(UrlForFlag(tableName, factualId), "spam", metadata);
 }
 /// <summary>
 /// Runs a boost post request of existing attributes on a Factual entity.
 /// </summary>
 /// <param name="tableName">the name of the table in which to boost attributes for an entity (e.g., "places").</param>
 /// <param name="factualId">the factual id on which the boost is run.</param>
 /// <param name="query">the row query to run against table.</param>
 /// <param name="user">the metadata which executes the boost.</param>
 /// <returns>the response of running boost post request on a Factual entity.</returns>
 public string Boost(string tableName, string factualId, Query query, Metadata user)
 {
     return Boost(tableName, new Boost(factualId, query, user));
 }
Example #26
0
 private string SubmitCustom(string root, Submit submit, Metadata metadata)
 {
     var postData = submit.ToUrlQuery() + "&" + metadata.ToUrlQuery();
     return RequestPost(root + "?" + postData, "");
 }
 /// <summary>
 /// Flags a row as inaccurate in the specified Factual table.
 /// </summary>
 /// <param name="tableName">the name of the table you wish to flag a duplicate for (e.g., "places")</param>
 /// <param name="factualId">the factual id that is the duplicate</param>
 /// <param name="fields">A List of fields(by name) which you know to contain inaccurate data,
 /// however for which you don't actually have the proper corrections. If you have actual corrections,
 /// please use the submit API to update the row.</param>
 /// <param name="metadata">the metadata to send with information on this request</param>
 /// <returns>the response from flagging a duplicate row.</returns>
 public string FlagInaccurate(string tableName, string factualId, List<String> fields, Metadata metadata)
 {
     return FlagCustom(UrlForFlag(tableName, factualId), "inaccurate", null, fields, metadata);
 }