Struct kraapi::client::KrakenClient [−][src]
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]
T: Output + DeserializeOwned,
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
impl !RefUnwindSafe for KrakenClient
impl Send for KrakenClient
impl Sync for KrakenClient
impl Unpin for KrakenClient
impl !UnwindSafe for KrakenClient
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,