laravel-bittrex icon indicating copy to clipboard operation
laravel-bittrex copied to clipboard

Return object instead of array

Open rpijpers opened this issue 7 years ago • 1 comments

Pepijn,

Why does the function nonPublicRequest return an associative array? I think most developers prefer an object instead. Are you willing to merge a pull request which makes this possible (with backward-compatibiliy)?

rpijpers avatar Sep 06 '17 19:09 rpijpers

@rpijpers

Agreed! Sure, I'm willing to accept a pull request for this. :) I suggest the following change (out of the top of my head):

  • Add an extra config option return_type. Valid settings could be: "object" or "array".
  • This config option, which defaults to "array", is passed to the Client constructor, along with the other config options. BittrexManager will need to be updated.
  • all returning methods (nonPublicRequest, public) must interpret this config option, and return accordingly (toggle 2nd parameter of json_decode).

Is this what you had in mind ? If you can think of something better, do let me know.

maybe it's better to pass in an array as a third argument, which would override any "default" config options?

pepijnolivier avatar Sep 06 '17 19:09 pepijnolivier