2017-02-07 04:59:30 +00:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
2016-08-31 10:49:34 +00:00
|
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using osu.Framework.IO.Network;
|
2016-08-31 11:16:05 +00:00
|
|
|
|
using osu.Game.Online.Chat;
|
2016-08-31 10:49:34 +00:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Online.API.Requests
|
|
|
|
|
{
|
2016-09-27 09:31:36 +00:00
|
|
|
|
public class GetMessagesRequest : APIRequest<List<Message>>
|
2016-08-31 10:49:34 +00:00
|
|
|
|
{
|
2017-03-23 04:41:50 +00:00
|
|
|
|
private readonly List<Channel> channels;
|
2017-03-07 01:59:19 +00:00
|
|
|
|
private long? since;
|
2016-08-31 10:49:34 +00:00
|
|
|
|
|
|
|
|
|
public GetMessagesRequest(List<Channel> channels, long? sinceId)
|
|
|
|
|
{
|
|
|
|
|
this.channels = channels;
|
2017-02-09 13:18:08 +00:00
|
|
|
|
since = sinceId;
|
2016-08-31 10:49:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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";
|
|
|
|
|
}
|
|
|
|
|
}
|