pub struct BinanceRawPapiHttpClient { /* private fields */ }Expand description
Raw HTTP client for the Binance Portfolio Margin REST API.
Implementations§
Source§impl BinanceRawPapiHttpClient
impl BinanceRawPapiHttpClient
Sourcepub fn http_client(&self) -> &HttpClient
pub fn http_client(&self) -> &HttpClient
Returns a reference to the underlying HTTP client.
Sourcepub const fn has_credentials(&self) -> bool
pub const fn has_credentials(&self) -> bool
Returns whether this client has complete signing credentials.
Sourcepub fn new(
environment: BinanceEnvironment,
api_key: Option<String>,
api_secret: Option<String>,
base_url_override: Option<String>,
recv_window: Option<u64>,
timeout_secs: Option<u64>,
proxy_url: Option<String>,
) -> BinancePapiHttpResult<Self>
pub fn new( environment: BinanceEnvironment, api_key: Option<String>, api_secret: Option<String>, base_url_override: Option<String>, recv_window: Option<u64>, timeout_secs: Option<u64>, proxy_url: Option<String>, ) -> BinancePapiHttpResult<Self>
Creates a new raw Binance Portfolio Margin HTTP client.
Binance documents only a production PAPI host and HMAC-SHA256 request signing, so testnet and demo environments and Ed25519 credentials are rejected before any connection is attempted.
§Errors
Returns an error if the environment has no PAPI host, the credentials use an unsupported signature scheme, credentials are incomplete, or the HTTP client fails to build.
Sourcepub async fn get<P, T>(
&self,
path: &str,
params: Option<&P>,
signed: bool,
use_order_quota: bool,
) -> BinancePapiHttpResult<T>
pub async fn get<P, T>( &self, path: &str, params: Option<&P>, signed: bool, use_order_quota: bool, ) -> BinancePapiHttpResult<T>
Performs a GET request and deserializes the response body.
§Errors
Returns an error if the request fails or response deserialization fails.
Sourcepub async fn post<P, T>(
&self,
path: &str,
params: Option<&P>,
signed: bool,
use_order_quota: bool,
) -> BinancePapiHttpResult<T>
pub async fn post<P, T>( &self, path: &str, params: Option<&P>, signed: bool, use_order_quota: bool, ) -> BinancePapiHttpResult<T>
Performs a POST request, signing the query when signed is true.
The request is sent exactly once: a timeout or ambiguous outcome must be resolved by the caller’s reconciliation rather than a local resubmission.
Every documented PAPI route carries its parameters in the query string; a request body is not part of the PAPI contract, and the signature covers the query only.
§Errors
Returns an error if the request fails or response deserialization fails.
Sourcepub async fn request_put<P, T>(
&self,
path: &str,
params: Option<&P>,
signed: bool,
use_order_quota: bool,
) -> BinancePapiHttpResult<T>
pub async fn request_put<P, T>( &self, path: &str, params: Option<&P>, signed: bool, use_order_quota: bool, ) -> BinancePapiHttpResult<T>
Performs a PUT request, signing the query when signed is true.
§Errors
Returns an error if the request fails or response deserialization fails.
Sourcepub async fn request_delete<P, T>(
&self,
path: &str,
params: Option<&P>,
signed: bool,
use_order_quota: bool,
) -> BinancePapiHttpResult<T>
pub async fn request_delete<P, T>( &self, path: &str, params: Option<&P>, signed: bool, use_order_quota: bool, ) -> BinancePapiHttpResult<T>
Performs a DELETE request, signing the query when signed is true.
The request is sent exactly once: a timeout or ambiguous outcome must be resolved by the caller’s reconciliation rather than a local resubmission.
§Errors
Returns an error if the request fails or response deserialization fails.
Trait Implementations§
Source§impl Clone for BinanceRawPapiHttpClient
impl Clone for BinanceRawPapiHttpClient
Auto Trait Implementations§
impl !Freeze for BinanceRawPapiHttpClient
impl !RefUnwindSafe for BinanceRawPapiHttpClient
impl !UnwindSafe for BinanceRawPapiHttpClient
impl Send for BinanceRawPapiHttpClient
impl Sync for BinanceRawPapiHttpClient
impl Unpin for BinanceRawPapiHttpClient
impl UnsafeUnpin for BinanceRawPapiHttpClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more