1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-18 17:32:55 +08:00
osu-lazer/osu.Game/Online/API/Requests/ChatAckRequest.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

40 lines
1.6 KiB
C#
Raw Normal View History

2022-10-27 13:55:24 +08:00
// 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.Net.Http;
using osu.Framework.IO.Network;
using osu.Game.Online.API.Requests.Responses;
namespace osu.Game.Online.API.Requests
{
2022-11-12 22:35:21 +08:00
/// <summary>
/// A request which should be sent occasionally while interested in chat and online state.
///
/// This will:
/// - Mark the user as "online" (for 10 minutes since the last invocation).
/// - Return any silences since the last invocation (if either <see cref="SinceMessageId"/> or <see cref="SinceSilenceId"/> is not null).
///
/// For silence handling, a <see cref="SinceMessageId"/> should be provided as soon as a message is received by the client.
/// From that point forward, <see cref="SinceSilenceId"/> should be preferred after the first <see cref="ChatSilence"/>
/// arrives in a response from the ack request. Specifying both parameters will prioritise the latter.
/// </summary>
2022-10-27 13:55:24 +08:00
public class ChatAckRequest : APIRequest<ChatAckResponse>
{
public long? SinceMessageId;
2022-11-02 16:13:14 +08:00
public uint? SinceSilenceId;
2022-10-27 13:55:24 +08:00
protected override WebRequest CreateWebRequest()
{
var req = base.CreateWebRequest();
req.Method = HttpMethod.Post;
if (SinceMessageId != null)
req.AddParameter(@"since", SinceMessageId.ToString());
2022-11-02 16:13:14 +08:00
if (SinceSilenceId != null)
req.AddParameter(@"history_since", SinceSilenceId.Value.ToString());
2022-10-27 13:55:24 +08:00
return req;
}
protected override string Target => "chat/ack";
}
}