/// <summary> /// Get users who belong to a group. /// </summary> /// <param name="id">The group id.</param> /// <param name="page">The page.</param> /// <returns>The <see cref="IQueryable{User}"/>.</returns> public async Task<IQueryable<UserFullInfo>> GetByGroupId(long id, int page = Config.DefaultPageNo) { var query = new UserQuery(page, string.Empty, UserQuerySort.NoSort, false, false, false, false); var url = this.GetFinalUrl(string.Format("{0}/in_group/{1}.json", Endpoints.Users, id), query.SerializeQueryString()); var result = await this.Client.GetAsync<GroupUser>(url); return result.Content.Users.AsQueryable(); }
/// <summary> /// Get a user by his/her id. /// </summary> /// <param name="id">The id.</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> /// <returns>The <see cref="User"/>.</returns> public async Task<UserFullInfo> GetById(long id, bool includeFollowed = false, bool includeSubscribedTags = false, bool includeGroups = false) { var query = new UserQuery(0, string.Empty, UserQuerySort.NoSort, false, includeFollowed, includeSubscribedTags, includeGroups); var url = this.GetFinalUrl(string.Format("{0}/{1}.json", Endpoints.Users, id), query.SerializeQueryString()); var result = await this.Client.GetAsync<UserFullInfo>(url); return result.Content; }
/// <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(); }
/// <summary> /// Get a user by his/her email. /// </summary> /// <param name="email">The email.</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> /// <returns>The <see cref="User"/>.</returns> public async Task<UserFullInfo> GetByEmail(string email, bool includeFollowed = false, bool includeSubscribedTags = false, bool includeGroups = false) { var query = new UserQuery(0, string.Empty, UserQuerySort.NoSort, false, includeFollowed, includeSubscribedTags, includeGroups); var url = this.GetFinalUrl(string.Format("{0}/by_email.json?email={1}", Endpoints.Users, email), query.SerializeQueryString()); var result = await this.Client.GetAsync<UserFullInfo[]>(url); return result.Content.FirstOrDefault(); }