1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 09:07:25 +08:00

Add year parameter to GetNewsRequest

This commit is contained in:
Andrei Zavatski 2021-05-19 15:17:57 +03:00
parent db6d980623
commit 16ffedde8a
2 changed files with 8 additions and 2 deletions

View File

@ -8,10 +8,12 @@ namespace osu.Game.Online.API.Requests
{
public class GetNewsRequest : APIRequest<GetNewsResponse>
{
private readonly int year;
private readonly Cursor cursor;
public GetNewsRequest(Cursor cursor = null)
public GetNewsRequest(int year = 0, Cursor cursor = null)
{
this.year = year;
this.cursor = cursor;
}
@ -19,6 +21,10 @@ namespace osu.Game.Online.API.Requests
{
var req = base.CreateWebRequest();
req.AddCursor(cursor);
if (year != 0)
req.AddParameter("year", year.ToString());
return req;
}

View File

@ -74,7 +74,7 @@ namespace osu.Game.Overlays.News.Displays
{
request?.Cancel();
request = new GetNewsRequest(lastCursor);
request = new GetNewsRequest(cursor: lastCursor);
request.Success += response => Schedule(() => onSuccess(response));
api.PerformAsync(request);
}