Ohkthx / cbadv-rs

Coinbase Advanced API, written in Rust.
https://crates.io/crates/cbadv
MIT License
5 stars 6 forks source link

Fixes formatting of order_statuses in cbadv::order::ListOrdersParams.to_params(), which was causing cbadv::order::OrderAPI::get_bulk() to fail. #1

Closed Liftss closed 1 year ago

Liftss commented 1 year ago

Description

I've run into an error while using cbadv::order::OrderAPI::get_bulk(), with order statuses passed to its params. It was giving me an error message containing: "order_status": "EXPIRED,CANCELLED," is not a valid value".

Looking into the format of the request, it seemed correct as shown on the documentation here.

Looking a bit deeper it showed that they were formatting the request differently under the examples for different languages.

i.e instead of passing orders/historical/batch?order_status=CANCELLED,EXPIRED

the examples on the right passed in batch?order_status=CANCELLED&order_status=EXPIRED

Why this is the case I don't know.

Fixes

changed the formatting for order statuses in ListOrdersParams.to_params() to match up with batch?order_status=CANCELLED&order_status=EXPIRED.

Tests

I used different combinations of order statuses and it works as expected.

Ohkthx commented 1 year ago

I've noticed this inconsistency elsewhere in the API specifically when it comes to passing lists/vectors. This is a great catch and I appreciate the contribution! I am currently about to push a new update that changes to_params to to_string for all *Params objects. They will also be converted to have a *Query suffix instead of *Params so that it is more consistent and understood what their purpose is.