1
0
mirror of https://github.com/JKorf/CryptoExchange.Net.git synced 2026-08-19 04:13:02 +00:00

Added code docs, added ContinueOnQueryResponse

This commit is contained in:
Jan Korf
2019-08-06 13:19:34 +02:00
parent 11016bc213
commit 780da53475
50 changed files with 2545 additions and 30 deletions
@@ -2,8 +2,18 @@
namespace CryptoExchange.Net.Interfaces
{
/// <summary>
/// Rate limiter interface
/// </summary>
public interface IRateLimiter
{
/// <summary>
/// Limit the request if needed
/// </summary>
/// <param name="client"></param>
/// <param name="url"></param>
/// <param name="limitBehaviour"></param>
/// <returns></returns>
CallResult<double> LimitRequest(RestClient client, string url, RateLimitingBehaviour limitBehaviour);
}
}
+42
View File
@@ -5,20 +5,62 @@ using System.Threading.Tasks;
namespace CryptoExchange.Net.Interfaces
{
/// <summary>
/// Request interface
/// </summary>
public interface IRequest
{
/// <summary>
/// The uri of the request
/// </summary>
Uri Uri { get; }
/// <summary>
/// The headers of the request
/// </summary>
WebHeaderCollection Headers { get; set; }
/// <summary>
/// The method of the request
/// </summary>
string Method { get; set; }
/// <summary>
/// The timeout of the request
/// </summary>
TimeSpan Timeout { get; set; }
/// <summary>
/// Set a proxy
/// </summary>
/// <param name="host"></param>
/// <param name="port"></param>
/// <param name="login"></param>
/// <param name="password"></param>
void SetProxy(string host, int port, string login, string password);
/// <summary>
/// Content type
/// </summary>
string ContentType { get; set; }
/// <summary>
/// String content
/// </summary>
string Content { get; set; }
/// <summary>
/// Accept
/// </summary>
string Accept { get; set; }
/// <summary>
/// Content length
/// </summary>
long ContentLength { get; set; }
/// <summary>
/// Get the request stream
/// </summary>
/// <returns></returns>
Task<Stream> GetRequestStream();
/// <summary>
/// Get the response object
/// </summary>
/// <returns></returns>
Task<IResponse> GetResponse();
}
}
@@ -1,7 +1,15 @@
namespace CryptoExchange.Net.Interfaces
{
/// <summary>
/// Request factory interface
/// </summary>
public interface IRequestFactory
{
/// <summary>
/// Create a request for an uri
/// </summary>
/// <param name="uri"></param>
/// <returns></returns>
IRequest Create(string uri);
}
}
@@ -5,11 +5,28 @@ using System.Net;
namespace CryptoExchange.Net.Interfaces
{
/// <summary>
/// Response object interface
/// </summary>
public interface IResponse
{
/// <summary>
/// The response status code
/// </summary>
HttpStatusCode StatusCode { get; }
/// <summary>
/// Get the response stream
/// </summary>
/// <returns></returns>
Stream GetResponseStream();
/// <summary>
/// Get the response headers
/// </summary>
/// <returns></returns>
IEnumerable<Tuple<string, string>> GetResponseHeaders();
/// <summary>
/// Close the response
/// </summary>
void Close();
}
}
@@ -5,30 +5,104 @@ using WebSocket4Net;
namespace CryptoExchange.Net.Interfaces
{
/// <summary>
/// Interface for websocket interaction
/// </summary>
public interface IWebsocket: IDisposable
{
/// <summary>
/// Websocket closed
/// </summary>
event Action OnClose;
/// <summary>
/// Websocket message received
/// </summary>
event Action<string> OnMessage;
/// <summary>
/// Websocket error
/// </summary>
event Action<Exception> OnError;
/// <summary>
/// Websocket opened
/// </summary>
event Action OnOpen;
/// <summary>
/// Id
/// </summary>
int Id { get; }
/// <summary>
/// Origin
/// </summary>
string Origin { get; set; }
/// <summary>
/// Reconnecting
/// </summary>
bool Reconnecting { get; set; }
/// <summary>
/// Handler for byte data
/// </summary>
Func<byte[], string> DataInterpreterBytes { get; set; }
/// <summary>
/// Handler for string data
/// </summary>
Func<string, string> DataInterpreterString { get; set; }
/// <summary>
/// Socket url
/// </summary>
string Url { get; }
/// <summary>
/// State
/// </summary>
WebSocketState SocketState { get; }
/// <summary>
/// Is closed
/// </summary>
bool IsClosed { get; }
/// <summary>
/// Is open
/// </summary>
bool IsOpen { get; }
/// <summary>
/// Should ping connecting
/// </summary>
bool PingConnection { get; set; }
/// <summary>
/// Interval of pinging
/// </summary>
TimeSpan PingInterval { get; set; }
/// <summary>
/// Supported ssl protocols
/// </summary>
SslProtocols SSLProtocols { get; set; }
/// <summary>
/// Timeout
/// </summary>
TimeSpan Timeout { get; set; }
/// <summary>
/// Connect the socket
/// </summary>
/// <returns></returns>
Task<bool> Connect();
/// <summary>
/// Send data
/// </summary>
/// <param name="data"></param>
void Send(string data);
/// <summary>
/// Reset socket
/// </summary>
void Reset();
/// <summary>
/// Close the connecting
/// </summary>
/// <returns></returns>
Task Close();
/// <summary>
/// Set proxy
/// </summary>
/// <param name="host"></param>
/// <param name="port"></param>
void SetProxy(string host, int port);
}
}
@@ -3,9 +3,26 @@ using CryptoExchange.Net.Logging;
namespace CryptoExchange.Net.Interfaces
{
/// <summary>
/// Websocket factory interface
/// </summary>
public interface IWebsocketFactory
{
/// <summary>
/// Create a websocket for an url
/// </summary>
/// <param name="log"></param>
/// <param name="url"></param>
/// <returns></returns>
IWebsocket CreateWebsocket(Log log, string url);
/// <summary>
/// Create a websocket for an url
/// </summary>
/// <param name="log"></param>
/// <param name="url"></param>
/// <param name="cookies"></param>
/// <param name="headers"></param>
/// <returns></returns>
IWebsocket CreateWebsocket(Log log, string url, IDictionary<string, string> cookies, IDictionary<string, string> headers);
}
}