Closed shravan2x closed 5 years ago
Hi @shravan2x ,
That's correct. async
and .NET Core are not available for the Coinbase .NET/API client at the moment.
Perhaps you can bug @barmstrong to donate me some Bitcoin/Ethereum (or even better, free market orders on GDAX :smile_cat:) and I can put more effort into improving the Coinbase .NET/API client and bringing it up to date.
Otherwise, as I mentioned before, you'll need to send a PR if you want new features. I'd be willing to accept a PR for async
support; however, #25 should be done before #27.
Thanks, Brian
:collision: :dizzy: "Crashing, hit a wall. Right now I need a miracle..."
At this time, I'm juggling class and work and other things and will not be able to do this. However, I made a little utility that offers async support for the core methods, in case it helps anyone:
public class CoinbaseAsyncApi : CoinbaseApi
{
public CoinbaseAsyncApi(string apiKey, string apiSecret) : base(apiKey, apiSecret, false) { }
public async Task<CoinbaseResponse<TResponse>> SendRequestAsync<TResponse>(string endpoint, object body, Method httpMethod = Method.POST)
{
RestClient client = CreateClient();
IRestRequest req = CreateRequest(endpoint, httpMethod)
.AddJsonBody(body);
IRestResponse<CoinbaseResponse<TResponse>> resp = await client.ExecuteTaskAsync<CoinbaseResponse<TResponse>>(req);
return resp.Data;
}
public async Task<CoinbaseResponse<TResponse>> SendGetRequestAsync<TResponse>(string endpoint, params KeyValuePair<string, string>[] queryParams)
{
RestClient client = CreateClient();
IRestRequest req = CreateRequest(endpoint, Method.GET);
if (queryParams != null)
{
foreach (KeyValuePair<string, string> kvp in queryParams)
req.AddQueryParameter(kvp.Key, kvp.Value);
}
IRestResponse<CoinbaseResponse<TResponse>> resp = await client.ExecuteTaskAsync<CoinbaseResponse<TResponse>>(req);
return resp.Data;
}
}
I was unable to find async versions of methods in the library, am I missing them or has this not been added yet?