Esempio n. 1
0
        /// <summary>
        /// Sends a browse 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 browse.</param>
        /// <param name="relatedEntity"></param>
        /// <param name="relatedEntityId"></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>
        /// <param name="inc">A list of entities to include (subqueries).</param>
        /// <returns></returns>
        protected async static Task <T> BrowseAsync <T>(string entity, string relatedEntity, string relatedEntityId, int limit, int offset, params string[] inc) where T : Entity
        {
            if (string.IsNullOrEmpty(entity))
            {
                throw new ArgumentException(string.Format(Resources.Messages.MissingParameter, "entity"));
            }

            return(await WebRequestHelper.GetAsync <T>(WebRequestHelper.CreateBrowseTemplate(entity,
                                                                                             relatedEntity, relatedEntityId, limit, offset, CreateIncludeQuery(inc)), withoutMetadata : false));
        }
Esempio n. 2
0
        protected static T Browse <T>(string entity, string relatedEntity, string relatedEntityId, int limit, int offset, params string[] inc) where T : Entity
        {
            if (entity == null)
            {
                throw new ArgumentNullException(string.Format(Localization.Messages.RequiredAttributeException, "entity"));
            }

            return
                (WebRequestHelper.Get <T>(
                     WebRequestHelper.CreateBrowseTemplate(entity, relatedEntity, relatedEntityId, limit, offset,
                                                           CreateIncludeQuery(inc)), withoutMetadata: false));
        }