Struct longport_httpcli::HttpClient
source · pub struct HttpClient { /* private fields */ }Expand description
LongPort HTTP client
Implementations§
source§impl HttpClient
impl HttpClient
sourcepub fn new(config: HttpClientConfig) -> Self
pub fn new(config: HttpClientConfig) -> Self
Create a new HttpClient
sourcepub fn from_env() -> Result<Self, HttpClientError>
pub fn from_env() -> Result<Self, HttpClientError>
Create a new HttpClient from the given environment variables
Variables
- LONGPORT_APP_KEY
- LONGPORT_APP_SECRET
- LONGPORT_ACCESS_TOKEN
- LONGPORT_HTTP_URL
sourcepub fn request(
&self,
method: Method,
path: impl Into<String>
) -> RequestBuilder<(), (), ()>
pub fn request( &self, method: Method, path: impl Into<String> ) -> RequestBuilder<(), (), ()>
Create a new request builder
sourcepub async fn get_otp(&self) -> HttpClientResult<String>
pub async fn get_otp(&self) -> HttpClientResult<String>
Get the socket OTP(One Time Password)
Reference: https://open.longportapp.com/en/docs/socket-token-api
sourcepub async fn get_otp_v2(&self) -> HttpClientResult<String>
pub async fn get_otp_v2(&self) -> HttpClientResult<String>
Get the socket OTP v2(One Time Password)
Reference: https://open.longportapp.com/en/docs/socket-token-api
Trait Implementations§
source§impl Clone for HttpClient
impl Clone for HttpClient
source§fn clone(&self) -> HttpClient
fn clone(&self) -> HttpClient
Returns a copy 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 !RefUnwindSafe for HttpClient
impl Send for HttpClient
impl Sync for HttpClient
impl Unpin for HttpClient
impl !UnwindSafe for HttpClient
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