protected static T Search <T>(string entity, string query, int limit = 25, int offset = 0, params string[] inc) where T : MetadataWrapper
        {
            if (query == null)
            {
                throw new ArgumentNullException(string.Format(Localization.Messages.RequiredAttributeException, "query"));
            }

            return
                (WebRequestHelper.Get <T>(
                     WebRequestHelper.CreateSearchTemplate(entity, query, limit, offset,
                                                           CreateIncludeQuery(inc)), withoutMetadata: false));
        }
Exemple #2
0
        /// <summary>
        /// Sends a search request to the webservice.
        /// </summary>
        /// <typeparam name="T">Any type derived from <see cref="Entity"/>.</typeparam>
        /// <param name="entity">The name of the XML entity to search for.</param>
        /// <param name="query">The query string.</param>
        /// <param name="limit">The number of items to return (default = 25).</param>
        /// <param name="offset">The offset to the items list (enables paging, default = 0).</param>
        /// <returns></returns>
        protected async static Task <T> SearchAsync <T>(string entity, string query, int limit = 25, int offset = 0) where T : MetadataWrapper
        {
            if (string.IsNullOrEmpty(entity))
            {
                throw new ArgumentException(string.Format(Resources.Messages.MissingParameter, "entity"));
            }

            if (string.IsNullOrEmpty(query))
            {
                throw new ArgumentException(string.Format(Resources.Messages.MissingParameter, "query"));
            }

            return(await WebRequestHelper.GetAsync <T>(WebRequestHelper.CreateSearchTemplate(entity,
                                                                                             query, limit, offset), withoutMetadata : false));
        }