1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-18 08:12:55 +08:00
osu-lazer/osu.Game/Online/Multiplayer/GetRoomsRequest.cs

39 lines
1.2 KiB
C#
Raw Normal View History

// 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;
2020-07-10 18:54:09 +08:00
using Humanizer;
using osu.Framework.IO.Network;
using osu.Game.Online.API;
using osu.Game.Screens.Multi.Lounge.Components;
namespace osu.Game.Online.Multiplayer
{
public class GetRoomsRequest : APIRequest<List<Room>>
{
private readonly RoomStatusFilter statusFilter;
private readonly RoomCategoryFilter categoryFilter;
public GetRoomsRequest(RoomStatusFilter statusFilter, RoomCategoryFilter categoryFilter)
{
this.statusFilter = statusFilter;
this.categoryFilter = categoryFilter;
}
protected override WebRequest CreateWebRequest()
{
var req = base.CreateWebRequest();
2019-04-01 11:44:46 +08:00
2020-07-10 18:54:09 +08:00
if (statusFilter != RoomStatusFilter.Open)
req.AddParameter("mode", statusFilter.ToString().Underscore().ToLowerInvariant());
if (categoryFilter != RoomCategoryFilter.Any)
req.AddParameter("category", categoryFilter.ToString().Underscore().ToLowerInvariant());
return req;
}
protected override string Target => "rooms";
}
}