pub struct HttpClientConfig { /* private fields */ }Expand description
Configuration options for Http client
Implementations§
Source§impl HttpClientConfig
impl HttpClientConfig
Sourcepub fn from_apikey(
app_key: impl Into<String>,
app_secret: impl Into<String>,
access_token: impl Into<String>,
) -> Self
pub fn from_apikey( app_key: impl Into<String>, app_secret: impl Into<String>, access_token: impl Into<String>, ) -> Self
Create a new HttpClientConfig using API Key authentication.
LONGBRIDGE_HTTP_URL is read from the environment (or .env file) and
applied automatically if set.
§Arguments
app_key- Application keyapp_secret- Application secret (used for request signing)access_token- Access token
Sourcepub fn from_oauth(oauth: OAuth) -> Self
pub fn from_oauth(oauth: OAuth) -> Self
Create a new HttpClientConfig for OAuth 2.0 authentication.
LONGBRIDGE_HTTP_URL is read from the environment (or .env file) and
applied automatically if set.
The OAuth client handles token lifecycle automatically, including
expiry checks and token refresh.
§Arguments
oauth- AnOAuthclient obtained fromlongbridge_oauth::OAuthBuilder
Sourcepub fn from_apikey_env() -> Result<Self, HttpClientError>
pub fn from_apikey_env() -> Result<Self, HttpClientError>
Create a new HttpClientConfig from environment variables (API Key
mode).
§Variables
LONGBRIDGE_APP_KEY- App key (required)LONGBRIDGE_APP_SECRET- App secret (required)LONGBRIDGE_ACCESS_TOKEN- Access token (required)LONGBRIDGE_HTTP_URL- HTTP endpoint URL (optional)
§Note
For OAuth 2.0 authentication, use
from_oauth instead.
Sourcepub fn http_url(self, url: impl Into<String>) -> Self
pub fn http_url(self, url: impl Into<String>) -> Self
Specifies the url of the OpenAPI server.
Default: https://openapi.longbridge.com NOTE: Usually you don’t need to change it.
Trait Implementations§
Source§impl Clone for HttpClientConfig
impl Clone for HttpClientConfig
Source§fn clone(&self) -> HttpClientConfig
fn clone(&self) -> HttpClientConfig
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 HttpClientConfig
impl !RefUnwindSafe for HttpClientConfig
impl Send for HttpClientConfig
impl Sync for HttpClientConfig
impl Unpin for HttpClientConfig
impl UnsafeUnpin for HttpClientConfig
impl !UnwindSafe for HttpClientConfig
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