mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 16:59:53 +09:00
Add API methods to perform requests out-of-queue
This commit is contained in:
@ -7,6 +7,7 @@ using System.Diagnostics;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
@ -198,6 +199,22 @@ namespace osu.Game.Online.API
|
||||
}
|
||||
}
|
||||
|
||||
public void Perform(APIRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
request.Perform(this);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// todo: fix exception handling
|
||||
request.Fail(e);
|
||||
}
|
||||
}
|
||||
|
||||
public Task PerformAsync(APIRequest request) =>
|
||||
Task.Factory.StartNew(() => Perform(request), TaskCreationOptions.LongRunning);
|
||||
|
||||
public void Login(string username, string password)
|
||||
{
|
||||
Debug.Assert(State == APIState.Offline);
|
||||
|
Reference in New Issue
Block a user