2020-11-06 11:54:08 +08: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 12:10:18 +08:00
|
|
|
using System;
|
2020-11-06 11:54:08 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Online.API.Requests
|
|
|
|
{
|
|
|
|
public class GetUsersRequest : APIRequest<GetUsersResponse>
|
|
|
|
{
|
2022-12-22 18:10:33 +08:00
|
|
|
public readonly int[] UserIds;
|
2020-11-06 11:54:08 +08:00
|
|
|
|
2020-11-06 12:10:18 +08:00
|
|
|
private const int max_ids_per_request = 50;
|
|
|
|
|
2020-11-06 11:54:08 +08:00
|
|
|
public GetUsersRequest(int[] userIds)
|
|
|
|
{
|
2020-11-06 12:10:18 +08: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");
|
|
|
|
|
2022-12-22 18:10:33 +08:00
|
|
|
UserIds = userIds;
|
2020-11-06 11:54:08 +08:00
|
|
|
}
|
|
|
|
|
2022-12-22 18:10:33 +08:00
|
|
|
protected override string Target => "users/?ids[]=" + string.Join("&ids[]=", UserIds);
|
2020-11-06 11:54:08 +08:00
|
|
|
}
|
|
|
|
}
|