Added reference project
This commit is contained in:
17
ref/Net/Rest/CompletedRequestEventArgs.cs
Normal file
17
ref/Net/Rest/CompletedRequestEventArgs.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace Discord.Net.Rest
|
||||
{
|
||||
public class CompletedRequestEventArgs : RequestEventArgs
|
||||
{
|
||||
public object Response { get; set; }
|
||||
public string ResponseJson { get; set; }
|
||||
public double Milliseconds { get; set; }
|
||||
|
||||
public CompletedRequestEventArgs(IRestRequest request, object response, string responseJson, double milliseconds)
|
||||
: base(request)
|
||||
{
|
||||
Response = response;
|
||||
ResponseJson = responseJson;
|
||||
Milliseconds = milliseconds;
|
||||
}
|
||||
}
|
||||
}
|
||||
23
ref/Net/Rest/IRestRequest.cs
Normal file
23
ref/Net/Rest/IRestRequest.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
namespace Discord.Net.Rest
|
||||
{
|
||||
public interface IRestRequest
|
||||
{
|
||||
string Method { get; }
|
||||
string Endpoint { get; }
|
||||
object Payload { get; }
|
||||
}
|
||||
public interface IRestRequest<ResponseT> : IRestRequest
|
||||
where ResponseT : class
|
||||
{
|
||||
}
|
||||
|
||||
public interface IRestFileRequest : IRestRequest
|
||||
{
|
||||
string Filename { get; }
|
||||
Stream Stream { get; }
|
||||
}
|
||||
public interface IRestFileRequest<ResponseT> : IRestFileRequest, IRestRequest<Message>
|
||||
where ResponseT : class
|
||||
{
|
||||
}
|
||||
}
|
||||
12
ref/Net/Rest/RequestEventArgs.cs
Normal file
12
ref/Net/Rest/RequestEventArgs.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
|
||||
namespace Discord.Net.Rest
|
||||
{
|
||||
public class RequestEventArgs : EventArgs
|
||||
{
|
||||
public IRestRequest Request { get; set; }
|
||||
public bool Cancel { get; set; }
|
||||
|
||||
public RequestEventArgs(IRestRequest request) { }
|
||||
}
|
||||
}
|
||||
25
ref/Net/Rest/RestClient.cs
Normal file
25
ref/Net/Rest/RestClient.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Discord.Net.Rest
|
||||
{
|
||||
public abstract partial class RestClient
|
||||
{
|
||||
public event EventHandler<RequestEventArgs> SendingRequest = delegate { };
|
||||
public event EventHandler<CompletedRequestEventArgs> SentRequest = delegate { };
|
||||
|
||||
public CancellationToken CancelToken { get; set; }
|
||||
public string Token { get; set; }
|
||||
|
||||
public Task<ResponseT> Send<ResponseT>(IRestRequest<ResponseT> request)
|
||||
where ResponseT : class
|
||||
=> null;
|
||||
public Task Send(IRestRequest request) => null;
|
||||
|
||||
public Task<ResponseT> Send<ResponseT>(IRestFileRequest<ResponseT> request)
|
||||
where ResponseT : class
|
||||
=> null;
|
||||
public Task Send(IRestFileRequest request) => null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user