gmosx / kraken-sdk-rust

A Rust SDK for working with Kraken APIs
Apache License 2.0
23 stars 14 forks source link

Send() and execute() method #5

Closed Oyabi closed 2 years ago

Oyabi commented 2 years ago

Hello,

Can you explain why you're using send() and execute() method on api struct ? Why 2 method and not just one ? It seem that send() simply call execute(). I'm new to rust, something must elude me.

gmosx commented 2 years ago

It offers more flexibility.

Since execute() is generic you can pass any type of object to deserialize the response to, e.g. you could deserialize to a HashMap instead of the 'default' response for each API call. Or you could use a custom struct with only the fields you are interested in. Does this make sense?

Oyabi commented 2 years ago

Oh ok I get it now. Thank you very much.

gmosx commented 2 years ago

I will add this as a FAQ to the README file.