mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 14:52:55 +08:00
Add new API requests
This commit is contained in:
parent
4127aaa988
commit
6cca3a3dc8
21
osu.Game/Online/API/Requests/ChatAckRequest.cs
Normal file
21
osu.Game/Online/API/Requests/ChatAckRequest.cs
Normal file
@ -0,0 +1,21 @@
|
||||
// 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
|
||||
{
|
||||
public class ChatAckRequest : APIRequest<ChatAckResponse>
|
||||
{
|
||||
protected override WebRequest CreateWebRequest()
|
||||
{
|
||||
var req = base.CreateWebRequest();
|
||||
req.Method = HttpMethod.Post;
|
||||
return req;
|
||||
}
|
||||
|
||||
protected override string Target => "chat/ack";
|
||||
}
|
||||
}
|
12
osu.Game/Online/API/Requests/GetNotificationsRequest.cs
Normal file
12
osu.Game/Online/API/Requests/GetNotificationsRequest.cs
Normal file
@ -0,0 +1,12 @@
|
||||
// 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 osu.Game.Online.API.Requests.Responses;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public class GetNotificationsRequest : APIRequest<APINotificationsBundle>
|
||||
{
|
||||
protected override string Target => "notifications";
|
||||
}
|
||||
}
|
37
osu.Game/Online/API/Requests/Responses/APINotification.cs
Normal file
37
osu.Game/Online/API/Requests/Responses/APINotification.cs
Normal file
@ -0,0 +1,37 @@
|
||||
// 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;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace osu.Game.Online.API.Requests.Responses
|
||||
{
|
||||
[JsonObject(MemberSerialization.OptIn)]
|
||||
public class APINotification
|
||||
{
|
||||
[JsonProperty("id")]
|
||||
public long Id { get; set; }
|
||||
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; } = null!;
|
||||
|
||||
[JsonProperty("created_at")]
|
||||
public DateTimeOffset? CreatedAt { get; set; }
|
||||
|
||||
[JsonProperty("object_type")]
|
||||
public string ObjectType { get; set; } = null!;
|
||||
|
||||
[JsonProperty("object_id")]
|
||||
public string ObjectId { get; set; } = null!;
|
||||
|
||||
[JsonProperty("source_user_id")]
|
||||
public long? SourceUserId { get; set; }
|
||||
|
||||
[JsonProperty("is_read")]
|
||||
public bool IsRead { get; set; }
|
||||
|
||||
[JsonProperty("details")]
|
||||
public Dictionary<string, string>? Details { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
// 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 Newtonsoft.Json;
|
||||
|
||||
namespace osu.Game.Online.API.Requests.Responses
|
||||
{
|
||||
[JsonObject(MemberSerialization.OptIn)]
|
||||
public class APINotificationsBundle
|
||||
{
|
||||
[JsonProperty("has_more")]
|
||||
public bool HasMore { get; set; }
|
||||
|
||||
[JsonProperty("notifications")]
|
||||
public APINotification[] Notifications { get; set; } = null!;
|
||||
|
||||
[JsonProperty("notification_endpoint")]
|
||||
public string Endpoint { get; set; } = null!;
|
||||
}
|
||||
}
|
15
osu.Game/Online/API/Requests/Responses/ChatAckResponse.cs
Normal file
15
osu.Game/Online/API/Requests/Responses/ChatAckResponse.cs
Normal file
@ -0,0 +1,15 @@
|
||||
// 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.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace osu.Game.Online.API.Requests.Responses
|
||||
{
|
||||
[JsonObject(MemberSerialization.OptIn)]
|
||||
public class ChatAckResponse
|
||||
{
|
||||
[JsonProperty("silences")]
|
||||
public List<ChatSilence> Silences { get; set; } = null!;
|
||||
}
|
||||
}
|
17
osu.Game/Online/API/Requests/Responses/ChatSilence.cs
Normal file
17
osu.Game/Online/API/Requests/Responses/ChatSilence.cs
Normal file
@ -0,0 +1,17 @@
|
||||
// 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 Newtonsoft.Json;
|
||||
|
||||
namespace osu.Game.Online.API.Requests.Responses
|
||||
{
|
||||
[JsonObject(MemberSerialization.OptIn)]
|
||||
public class ChatSilence
|
||||
{
|
||||
[JsonProperty("id")]
|
||||
public uint Id { get; set; }
|
||||
|
||||
[JsonProperty("user_id")]
|
||||
public uint UserId { get; set; }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user