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:
parent
db6d980623
commit
16ffedde8a
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user