mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 06:36:31 +09:00
Add and consume multi-lookup API endpoint
This commit is contained in:
19
osu.Game/Online/API/Requests/GetUsersRequest.cs
Normal file
19
osu.Game/Online/API/Requests/GetUsersRequest.cs
Normal file
@ -0,0 +1,19 @@
|
||||
// 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.
|
||||
|
||||
using System.Linq;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public class GetUsersRequest : APIRequest<GetUsersResponse>
|
||||
{
|
||||
private readonly int[] userIds;
|
||||
|
||||
public GetUsersRequest(int[] userIds)
|
||||
{
|
||||
this.userIds = userIds;
|
||||
}
|
||||
|
||||
protected override string Target => $@"users/?{userIds.Select(u => $"ids[]={u}&").Aggregate((a, b) => a + b)}";
|
||||
}
|
||||
}
|
15
osu.Game/Online/API/Requests/GetUsersResponse.cs
Normal file
15
osu.Game/Online/API/Requests/GetUsersResponse.cs
Normal file
@ -0,0 +1,15 @@
|
||||
// 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.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public class GetUsersResponse : ResponseWithCursor
|
||||
{
|
||||
[JsonProperty("users")]
|
||||
public List<User> Users;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user