2020-11-06 03:54:08 +00:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
2020-11-06 04:10:18 +00:00
|
|
|
using System;
|
2020-11-06 03:54:08 +00:00
|
|
|
|
|
|
|
namespace osu.Game.Online.API.Requests
|
|
|
|
{
|
|
|
|
public class GetUsersRequest : APIRequest<GetUsersResponse>
|
|
|
|
{
|
|
|
|
private readonly int[] userIds;
|
|
|
|
|
2020-11-06 04:10:18 +00:00
|
|
|
private const int max_ids_per_request = 50;
|
|
|
|
|
2020-11-06 03:54:08 +00:00
|
|
|
public GetUsersRequest(int[] userIds)
|
|
|
|
{
|
2020-11-06 04:10:18 +00:00
|
|
|
if (userIds.Length > max_ids_per_request)
|
|
|
|
throw new ArgumentException($"{nameof(GetUsersRequest)} calls only support up to {max_ids_per_request} IDs at once");
|
|
|
|
|
2020-11-06 03:54:08 +00:00
|
|
|
this.userIds = userIds;
|
|
|
|
}
|
|
|
|
|
2020-11-09 03:23:29 +00:00
|
|
|
protected override string Target => "users/?ids[]=" + string.Join("&ids[]=", userIds);
|
2020-11-06 03:54:08 +00:00
|
|
|
}
|
|
|
|
}
|