// Copyright (c) ppy Pty Ltd . 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 { /// /// 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 or is not null). /// /// For silence handling, a should be provided as soon as a message is received by the client. /// From that point forward, should be preferred after the first /// arrives in a response from the ack request. Specifying both parameters will prioritise the latter. /// public class ChatAckRequest : APIRequest { public long? SinceMessageId; public uint? SinceSilenceId; protected override WebRequest CreateWebRequest() { var req = base.CreateWebRequest(); req.Method = HttpMethod.Post; if (SinceMessageId != null) req.AddParameter(@"since", SinceMessageId.ToString()); if (SinceSilenceId != null) req.AddParameter(@"history_since", SinceSilenceId.Value.ToString()); return req; } protected override string Target => "chat/ack"; } }