示例#1
0
        /// <summary>
        /// Get users in the network, with optional filters.
        /// </summary>
        /// <param name="page">The page.</param>
        /// <param name="letter">The letter.</param>
        /// <param name="sort">The sort.</param>
        /// <param name="reverse">True to return results in reverse order.</param>
        /// <returns>The <see cref="IQueryable{User}"/>.</returns>
        public async Task<IQueryable<UserFullInfo>> Get(int page = Config.DefaultPageNo, string letter = "", UserQuerySort sort = UserQuerySort.NoSort, bool reverse = false)
        {
            var query = new UserQuery(page, letter, sort, reverse, false, false, false);
            var url = this.GetFinalUrl(string.Format("{0}.json", Endpoints.Users), query.SerializeQueryString());
            var result = await this.Client.GetAsync<UserFullInfo[]>(url);

            return result.Content.AsQueryable();
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UserQuery"/> class.
        /// </summary>
        /// <param name="page">The page.</param>
        /// <param name="letter">The letter.</param>
        /// <param name="sort">The sort.</param>
        /// <param name="reverse">True to return results in reverse order.</param>
        /// <param name="includeFollowed">True to include followed users.</param>
        /// <param name="includeSubscribedTags">True to include subscribed tags.</param>
        /// <param name="includeGroups">True to include group memberships.</param>
        public UserQuery(
            int page,
            string letter,
            UserQuerySort sort,
            bool reverse,
            bool includeFollowed,
            bool includeSubscribedTags,
            bool includeGroups)
        {
            if (page > 0 &&
                page != Config.DefaultPageNo)
            {
                this.Page = page;
            }

            if (!string.IsNullOrEmpty(letter))
            {
                this.Letter = letter;
            }

            if (sort != UserQuerySort.NoSort)
            {
                this.Sort_By = sort;
            }

            if (reverse)
            {
                this.Reverse = true;
            }

            if (includeFollowed)
            {
                this.Include_Followed_Users = true;
            }

            if (includeSubscribedTags)
            {
                this.Include_Followed_Tags = true;
            }

            if (includeGroups)
            {
                this.Include_Group_Memberships = true;
            }
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UserQuery"/> class.
        /// </summary>
        /// <param name="page">The page.</param>
        /// <param name="letter">The letter.</param>
        /// <param name="sort">The sort.</param>
        /// <param name="reverse">True to return results in reverse order.</param>
        /// <param name="includeFollowed">True to include followed users.</param>
        /// <param name="includeSubscribedTags">True to include subscribed tags.</param>
        /// <param name="includeGroups">True to include group memberships.</param>
        public UserQuery(
            int page,
            string letter,
            UserQuerySort sort,
            bool reverse,
            bool includeFollowed,
            bool includeSubscribedTags,
            bool includeGroups)
        {
            if (page > 0
                && page != Config.DefaultPageNo)
            {
                this.Page = page;
            }

            if (!string.IsNullOrEmpty(letter))
            {
                this.Letter = letter;
            }

            if (sort != UserQuerySort.NoSort)
            {
                this.Sort_By = sort;
            }

            if (reverse)
            {
                this.Reverse = true;
            }

            if (includeFollowed)
            {
                this.Include_Followed_Users = true;
            }

            if (includeSubscribedTags)
            {
                this.Include_Followed_Tags = true;
            }

            if (includeGroups)
            {
                this.Include_Group_Memberships = true;
            }
        }
示例#4
0
        /// <summary>
        /// Get users in the network, with optional filters.
        /// </summary>
        /// <param name="page">The page.</param>
        /// <param name="letter">The letter.</param>
        /// <param name="sort">The sort.</param>
        /// <param name="reverse">True to return results in reverse order.</param>
        /// <returns>The <see cref="IQueryable{User}"/>.</returns>
        public async Task <IQueryable <UserFullInfo> > Get(int page = Config.DefaultPageNo, string letter = "", UserQuerySort sort = UserQuerySort.NoSort, bool reverse = false)
        {
            var query  = new UserQuery(page, letter, sort, reverse, false, false, false);
            var url    = this.GetFinalUrl(string.Format("{0}.json", Endpoints.Users), query.SerializeQueryString());
            var result = await this.Client.GetAsync <UserFullInfo[]>(url);

            return(result.Content.AsQueryable());
        }