Exemple #1
0
 private IPagedList<User> GetUsers(UserOptions options, string[] urlParameters)
 {
     var response = MakeRequest<UserResponse>("users", urlParameters, new
     {
         key = apiKey,
         page = options.Page ?? null,
         pagesize = options.PageSize ?? null,
         filter = options.Filter,
         sort = options.SortBy.ToString().ToLower(),
         order = GetSortDirection(options.SortDirection),
         fromdate = options.FromDate.HasValue ? (long?)options.FromDate.Value.ToUnixTime() : null,
         todate = options.ToDate.HasValue ? (long?)options.ToDate.Value.ToUnixTime() : null,
         min = options.Min ?? null,
         max = options.Max ?? null
     });
     return new PagedList<User>(response.Users, response);
 }
Exemple #2
0
 public virtual void GetUserMentions(IEnumerable <int> userIds, Action <IPagedList <Comment> > onSuccess, Action <ApiException> onError, UserOptions options)
 {
     MakeRequest <CommentResponse>("users", new string[] { userIds.Vectorize(), "mentioned" }, new
     {
         key      = apiKey,
         page     = options.Page ?? null,
         pagesize = options.PageSize ?? null,
         filter   = options.Filter,
         sort     = options.SortBy.ToString().ToLower(),
         order    = GetSortDirection(options.SortDirection),
         fromdate = options.FromDate.HasValue ? (long?)options.FromDate.Value.ToUnixTime() : null,
         todate   = options.ToDate.HasValue ? (long?)options.ToDate.Value.ToUnixTime() : null,
         min      = options.Min ?? null,
         max      = options.Max ?? null
     }, (items) => onSuccess(new PagedList <Comment>(items.Comments, items)), onError);
 }
Exemple #3
0
 public virtual void GetUserMentions(int userId, Action <IPagedList <Comment> > onSuccess, Action <ApiException> onError, UserOptions options)
 {
     GetUserMentions(new int[] { userId }, onSuccess, onError, options);
 }
Exemple #4
0
 public virtual void GetUsers(IEnumerable <int> userIds, Action <IPagedList <User> > onSuccess, Action <ApiException> onError, UserOptions options)
 {
     GetUsers(onSuccess, onError, new string[] { userIds.Vectorize() }, options);
 }
Exemple #5
0
 public virtual void GetUsers(Action <IPagedList <User> > onSuccess, Action <ApiException> onError, UserOptions options)
 {
     GetUsers(onSuccess, onError, null, options);
 }
Exemple #6
0
 private void GetUsers(Action <IPagedList <User> > onSuccess, Action <ApiException> onError, string[] urlParameters, UserOptions options)
 {
     MakeRequest <UserResponse>("users", urlParameters, new
     {
         key      = apiKey,
         page     = options.Page ?? null,
         pagesize = options.PageSize ?? null,
         filter   = options.Filter,
         sort     = options.SortBy.ToString().ToLower(),
         order    = GetSortDirection(options.SortDirection),
         fromdate = options.FromDate.HasValue ? (long?)options.FromDate.Value.ToUnixTime() : null,
         todate   = options.ToDate.HasValue ? (long?)options.ToDate.Value.ToUnixTime() : null,
         min      = options.Min ?? null,
         max      = options.Max ?? null
     }, (items) => onSuccess(new PagedList <User>(items.Users, items)), onError);
 }
Exemple #7
0
 public virtual IPagedList<User> GetUsers(IEnumerable<int> userIds, UserOptions options)
 {
     return GetUsers(options, new string[] { userIds.Vectorize() });
 }
Exemple #8
0
 public virtual IPagedList<User> GetModerators(UserOptions options)
 {
     return GetUsers(options, new string[] { "moderators" });
 }
Exemple #9
0
 public virtual IPagedList<User> GetUsers(UserOptions options)
 {
     return GetUsers(options, null);
 }