danieleades / monzo-lib

monzo API client library, in pure rust
16 stars 4 forks source link

Retrieving transactions returns 400 error #13

Closed BreD1810 closed 3 years ago

BreD1810 commented 3 years ago

When I try to retrieve a list of transactions, I receive an error:

let client = Client::new("ACCESS_TOKEN");
let accounts = client.accounts().await?;
let account_id = &accounts[0].id;

let transactions = client
    .transactions(account_id)
    .since(Utc::now() - Duration::days(7))
    .send()
    .await?;

This prints to the console

Error: Client(400)

I did notice that in version 0.2.1 more information is provided with the same example:

response.body: "{\"code\":\"bad_request.missing_param.account_id\",\"message\":\"The field \'account_id\' is required\",\"retryable\":{}}\n"
Error: Client(400)

fixed by #14

BreD1810 commented 3 years ago

I have implemented a workaround on this branch (with an extra commit to add some things to Transaction).

I'm quite new to rust so I'm not too sure how complete that implementation is for opening a PR.

danieleades commented 3 years ago

Hi @BreD1810, thanks for the report!

First of all, are you still seeing this issue in the 0.3.0 release? I've made quite a lot of changes and it could be that this is already resolved.

Don't be afraid to post half-baked implementations as draft pull requests! It's a great way to discuss code and get guidance

BreD1810 commented 3 years ago

The first example is using 0.3.0 - it's the same except the printing of the response.body.

I've opened a draft PR for this issue (#14).