mirror of
https://github.com/ppy/osu.git
synced 2024-11-15 08:07:40 +08:00
37 lines
1.2 KiB
C#
37 lines
1.2 KiB
C#
// Copyright (c) 2007-2017 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;
|
|
using osu.Game.Online.Chat;
|
|
|
|
namespace osu.Game.Online.API.Requests
|
|
{
|
|
public class GetMessagesRequest : APIRequest<List<Message>>
|
|
{
|
|
private readonly List<Channel> channels;
|
|
private long? since;
|
|
|
|
public GetMessagesRequest(List<Channel> channels, long? sinceId)
|
|
{
|
|
this.channels = channels;
|
|
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";
|
|
}
|
|
} |