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.
|
|
|
|
|
2022-06-17 15:37:17 +08:00
|
|
|
#nullable disable
|
|
|
|
|
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>
|
|
|
|
{
|
|
|
|
private readonly int[] userIds;
|
|
|
|
|
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");
|
|
|
|
|
2020-11-06 11:54:08 +08:00
|
|
|
this.userIds = userIds;
|
|
|
|
}
|
|
|
|
|
2020-11-09 11:23:29 +08:00
|
|
|
protected override string Target => "users/?ids[]=" + string.Join("&ids[]=", userIds);
|
2020-11-06 11:54:08 +08:00
|
|
|
}
|
|
|
|
}
|