Exemplo n.º 1
0
        /// <summary>
        /// Create a saved search.
        /// </summary>
        /// <param name="search">A name used to describe this search and a combination of search conditions, as described in the documentation.</param>
        /// <returns>The ID of the new search.</returns>
        /// <remarks>Http400 if the search is invalid.</remarks>
        public int CreateSavedSearch(CreateSearch search)
        {
            var request = new RestRequest(Method.POST);
            request.Resource = "/{accountId}/searches";
            request.RequestFormat = DataFormat.Json;
            request.JsonSerializer = new EmmaJsonSerializer();

            request.AddBody(search);

            return Execute<int>(request);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Update a saved search. No parameters are required, but either the name or criteria parameter must be present for an update to occur.
        /// </summary>
        /// <param name="searchId">Search identifier</param>
        /// <param name="search">A name used to describe this search and/or a combination of search conditions, as described in the documentation.</param>
        /// <returns>True if the update was successful</returns>
        /// <remarks>Http404 if the search does not exist. Http400 if the search criteria is invalid.</remarks>
        public bool UpdateSavedSearch(string searchId, CreateSearch search)
        {
            var request = new RestRequest(Method.PUT);
            request.Resource = "/{accountId}/searches/{searchId}";
            request.AddUrlSegment("searchId", searchId);
            request.RequestFormat = DataFormat.Json;
            request.JsonSerializer = new EmmaJsonSerializer();

            request.AddBody(search);

            return Execute<bool>(request);
        }