pub struct PredictApiClient { /* private fields */ }Expand description
Thin REST wrapper around Predict’s OpenAPI surface (BNB Chain).
Most methods return serde_json::Value intentionally to keep it resilient
to API/schema drift while we stabilize integration.
Connection pooling: HTTP/2 with keep-alive, 16 idle conns per host.
Implementations§
Source§impl PredictApiClient
impl PredictApiClient
pub fn new_mainnet(api_key: impl Into<String>) -> Result<Self>
pub fn new_testnet() -> Result<Self>
pub fn new( base: impl Into<String>, api_key: Option<String>, jwt: Option<String>, ) -> Result<Self>
pub fn with_jwt(self, jwt: impl Into<String>) -> Self
pub fn set_jwt(&mut self, jwt: impl Into<String>)
pub fn clear_jwt(&mut self)
pub fn has_jwt(&self) -> bool
pub async fn auth_message(&self) -> Result<Value>
pub async fn auth( &self, signer: &str, message: &str, signature: &str, ) -> Result<Value>
pub async fn create_order(&self, body: Value) -> Result<Value>
pub async fn list_orders(&self, query: &[(&str, String)]) -> Result<Value>
pub async fn remove_orders(&self, body: Value) -> Result<Value>
pub async fn get_order(&self, hash: &str) -> Result<Value>
pub async fn get_order_matches(&self, query: &[(&str, String)]) -> Result<Value>
pub async fn list_markets(&self, query: &[(&str, String)]) -> Result<Value>
pub async fn get_market(&self, id: i64) -> Result<Value>
pub async fn get_market_stats(&self, id: i64) -> Result<Value>
pub async fn get_market_last_sale(&self, id: i64) -> Result<Value>
pub async fn get_market_orderbook(&self, id: i64) -> Result<Value>
pub async fn get_market_timeseries( &self, id: i64, query: &[(&str, String)], ) -> Result<Value>
pub async fn get_market_timeseries_latest(&self, id: i64) -> Result<Value>
pub async fn list_categories(&self, query: &[(&str, String)]) -> Result<Value>
pub async fn get_category(&self, slug: &str) -> Result<Value>
pub async fn get_category_stats(&self, id: i64) -> Result<Value>
pub async fn list_positions(&self, query: &[(&str, String)]) -> Result<Value>
pub async fn list_positions_for_address( &self, address: &str, query: &[(&str, String)], ) -> Result<Value>
pub async fn account(&self) -> Result<Value>
pub async fn set_referral(&self, code: &str) -> Result<Value>
pub async fn account_activity(&self, query: &[(&str, String)]) -> Result<Value>
pub async fn oauth_finalize(&self, body: Value) -> Result<Value>
pub async fn oauth_orders(&self, body: Value) -> Result<Value>
pub async fn oauth_create_order(&self, body: Value) -> Result<Value>
pub async fn oauth_cancel_order(&self, body: Value) -> Result<Value>
pub async fn oauth_positions(&self, body: Value) -> Result<Value>
pub async fn search(&self, query: &[(&str, String)]) -> Result<Value>
pub async fn yield_pending(&self, query: &[(&str, String)]) -> Result<Value>
pub async fn raw_get( &self, path: &str, query: &[(&str, String)], require_jwt: bool, ) -> Result<RawApiResponse>
pub async fn raw_post( &self, path: &str, query: &[(&str, String)], body: Value, require_jwt: bool, ) -> Result<RawApiResponse>
Trait Implementations§
Source§impl Clone for PredictApiClient
impl Clone for PredictApiClient
Source§fn clone(&self) -> PredictApiClient
fn clone(&self) -> PredictApiClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PredictApiClient
impl !RefUnwindSafe for PredictApiClient
impl Send for PredictApiClient
impl Sync for PredictApiClient
impl Unpin for PredictApiClient
impl UnsafeUnpin for PredictApiClient
impl !UnwindSafe for PredictApiClient
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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>
Converts
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>
Converts
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