Skip to main content
replaced http://stackapps.com/ with https://stackapps.com/
Source Link

If you look at my other question over heremy other question over here, I figured out that by specifying min&max I can get a basic "exact match" feature working for user name searches. The main problem is that StackOverflow.Net doesn't support string min and max parameters. I've added the following overloads to my own copy of UserMethods.cs:

If you look at my other question over here, I figured out that by specifying min&max I can get a basic "exact match" feature working for user name searches. The main problem is that StackOverflow.Net doesn't support string min and max parameters. I've added the following overloads to my own copy of UserMethods.cs:

If you look at my other question over here, I figured out that by specifying min&max I can get a basic "exact match" feature working for user name searches. The main problem is that StackOverflow.Net doesn't support string min and max parameters. I've added the following overloads to my own copy of UserMethods.cs:

Source Link
codeka
  • 536
  • 3
  • 10

Feature Request

If you look at my other question over here, I figured out that by specifying min&max I can get a basic "exact match" feature working for user name searches. The main problem is that StackOverflow.Net doesn't support string min and max parameters. I've added the following overloads to my own copy of UserMethods.cs:

public virtual IPagedList<User> GetUsers(string min, string max, UserSort sortBy = UserSort.Reputation, SortDirection sortDirection = SortDirection.Descending, int? page = null, int? pageSize = null, string filter = null, DateTime? fromDate = null, DateTime? toDate = null)
{
    var response = MakeRequest<UserResponse>("users", null, new
    {
        key = apiKey,
        page = page ?? null,
        pagesize = pageSize ?? null,
        filter = filter,
        sort = sortBy.ToString().ToLower(),
        order = GetSortDirection(sortDirection),
        fromdate = fromDate.HasValue ? (long?)fromDate.Value.ToUnixTime() : null,
        todate = toDate.HasValue ? (long?)toDate.Value.ToUnixTime() : null,
        min = min ?? null,
        max = max ?? null
    });
    return new PagedList<User>(response.Users, response);
}

public virtual IPagedList<User> GetUsers(IEnumerable<int> userIds, string min, string max, UserSort sortBy = UserSort.Reputation, SortDirection sortDirection = SortDirection.Descending, int? page = null, int? pageSize = null, string filter = null, DateTime? fromDate = null, DateTime? toDate = null)
{
    var response = MakeRequest<UserResponse>("users", new string[] { userIds.Vectorize() }, new
    {
        key = apiKey,
        page = page ?? null,
        pagesize = pageSize ?? null,
        filter = filter,
        sort = sortBy.ToString().ToLower(),
        order = GetSortDirection(sortDirection),
        fromdate = fromDate.HasValue ? (long?)fromDate.Value.ToUnixTime() : null,
        todate = toDate.HasValue ? (long?)toDate.Value.ToUnixTime() : null,
        min = min ?? null,
        max = max ?? null
    });
    return new PagedList<User>(response.Users, response);
}

Note in this overload, I had to make min and max not take default values (otherwise the overload resolution got confused if you didn't specify either of them). Not sure if that's the best way, but it works for me :)