-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathIApiClient.cs
More file actions
49 lines (46 loc) · 2.32 KB
/
IApiClient.cs
File metadata and controls
49 lines (46 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using Binance.API.Csharp.Client.Models.Enums;
using Binance.API.Csharp.Client.Models.WebSocket;
using System;
using System.Threading.Tasks;
using WebSocketSharp;
using static Binance.API.Csharp.Client.Domain.Abstract.ApiClientAbstract;
namespace Binance.API.Csharp.Client.Domain.Interfaces
{
public interface IApiClient
{
/// <summary>
/// Calls API Methods.
/// </summary>
/// <typeparam name="T">Type to which the response content will be converted.</typeparam>
/// <param name="method">HTTPMethod (POST-GET-PUT-DELETE)</param>
/// <param name="endpoint">Url endpoing.</param>
/// <param name="isSigned">Specifies if the request needs a signature.</param>
/// <param name="parameters">Request parameters.</param>
/// <returns></returns>
Task<T> CallAsync<T>(ApiMethod method, string endpoint, bool isSigned = false, string parameters = null);
/// <summary>
/// Connects to a Websocket endpoint.
/// </summary>
/// <typeparam name="T">Type used to parsed the response message.</typeparam>
/// <param name="parameters">Paremeters to send to the Websocket.</param>
/// <param name="messageDelegate">Deletage to callback after receive a message.</param>
/// <param name="useCustomParser">Specifies if needs to use a custom parser for the response message.</param>
WebSocket ConnectToWebSocket<T>(
string parameters,
MessageHandler<T> messageDelegate,
Action<CloseEventArgs> onClose,
bool useCustomParser = false);
/// <summary>
/// Connects to a UserData Websocket endpoint.
/// </summary>
/// <param name="parameters">Paremeters to send to the Websocket.</param>
/// <param name="accountHandler">Deletage to callback after receive a account info message.</param>
/// <param name="tradeHandler">Deletage to callback after receive a trade message.</param>
/// <param name="orderHandler">Deletage to callback after receive a order message.</param>
WebSocket ConnectToUserDataWebSocket(string parameters,
MessageHandler<AccountUpdatedMessage> accountHandler,
MessageHandler<OrderOrTradeUpdatedMessage> tradeHandler,
MessageHandler<OrderOrTradeUpdatedMessage> orderHandler,
Action<CloseEventArgs> onClose);
}
}