1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-23 08:07:26 +08:00
osu-lazer/osu.Game/Online/API/Requests/GetMessagesRequest.cs

37 lines
1.1 KiB
C#
Raw Normal View History

2016-08-31 18:49:34 +08:00
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using osu.Framework.IO.Network;
2016-08-31 19:16:05 +08:00
using osu.Game.Online.Chat;
2016-08-31 18:49:34 +08:00
namespace osu.Game.Online.API.Requests
{
internal class GetMessagesRequest : APIRequest<List<Message>>
{
List<Channel> channels;
long? since;
public GetMessagesRequest(List<Channel> channels, long? sinceId)
{
this.channels = channels;
this.since = sinceId;
}
protected override WebRequest CreateWebRequest()
{
string channelString = string.Empty;
foreach (Channel c in channels)
channelString += c.Id + ",";
channelString = channelString.TrimEnd(',');
var req = base.CreateWebRequest();
req.AddParameter(@"channels", channelString);
if (since.HasValue) req.AddParameter(@"since", since.Value.ToString());
return req;
}
protected override string Target => @"chat/messages";
}
}