kraken-api-client
kraken-api-client copied to clipboard
make response decoding optional
hi @butschster ,
First of all thanks for this lib, i find it quite useful and have been developping with it successfully.
I've been extending the classe on my own in order to allow retrieval of the exports as those requests retrieves binary files instead of json responses.
I think providing such feature could be useful and can myself commit to deliver such feature through a Pull request if you want to.
However if it is so i'd like to aknowledge first how you would see such implementation in the current code as sendRequest
and request
method are return-typed as array
.
I see two ways of implementation here :
1/ removing the array
return types from previously mentioned methods and adding an argument to those same methods as bool $decode = true
in order to allow user to specify which kind of response he wants to be retrieved.
2/ Adding methods specifically for those binary requests, either way by duplicating the original methods code without decoding it, or by refactoring the common code beetween the two methods, which mostly implies the preparation of the request ( l. 217-228 of the client class ), in a new specific method. This way would allow us to have a specific method that would explicitly return a GuzzleHttp\Psr7\Response
.