Struct kraapi::client::KrakenClient[][src]

pub struct KrakenClient { /* fields omitted */ }

Asynchronous HTTP client implementation sending instances of KrakenInput to the Kraken servers

Implementations

impl KrakenClient[src]

pub fn new(key: &str, secret: &str) -> Self[src]

Construct a new KrakenClient instance

KrakenInput instances will be passed into the client and the fully parsed data will be returned

Note

If only calling public endpoints, passing empty string literals for key and secret is acceptable. However, trying to call a private endpoint with empty credentials will panic. If needing to call both public and private endpoints, a single authenticated client will suffice but unique clients can be used as well

pub fn set_url(&mut self, url: &str)[src]

Set the base url where requests will be sent. Not currently useful as Kraken only has one REST API

Defaults to https://api.kraken.com

pub fn set_version(&mut self, version: &str)[src]

Set the API version number as defined by Kraken

Defaults to 0

pub fn set_auth(&mut self, key: &str, secret: &str)[src]

Assign new credentials for this KrakenClient

pub fn url(&self) -> &String[src]

Returns the current base url that this client will send requests to

pub fn version(&self) -> &String[src]

Returns the current API version that this client is using

pub async fn request<'a, T>(&self, input: &KrakenInput) -> KrakenResult<T> where
    T: Output + DeserializeOwned
[src]

Make a request to the desired API endpoint by passing a fully constructed KrakenInput

Note

The types of the input and the output must match otherwise the parsing will fail

For instance: if input is constructed from a KITicker instance, then T must be KOTicker

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.