pub struct AssetContext(/* private fields */);Expand description
Asset context
Implementations§
Source§impl AssetContext
impl AssetContext
Sourcepub async fn statements(
&self,
options: GetStatementListOptions,
) -> Result<GetStatementListResponse>
pub async fn statements( &self, options: GetStatementListOptions, ) -> Result<GetStatementListResponse>
Get statement data list
Path: GET /v1/statement/list
Sourcepub async fn statement_download_url(
&self,
options: GetStatementOptions,
) -> Result<GetStatementResponse>
pub async fn statement_download_url( &self, options: GetStatementOptions, ) -> Result<GetStatementResponse>
Get statement data download url
Path: GET /v1/statement/download
Sourcepub async fn bank_cards(&self) -> Result<Vec<BankCard>>
pub async fn bank_cards(&self) -> Result<Vec<BankCard>>
Get the linked bank cards, with their verification, binding and authorization (eDDA, bank securities account, FPS) status
AP accounts only: US data-center accounts get a region error.
Path: GET /v2/account/bank-cards
§Examples
use std::sync::Arc;
use longbridge::{Config, asset::AssetContext, oauth::OAuthBuilder};
let oauth = OAuthBuilder::new("your-client-id")
.build(|url| println!("Visit: {url}"))
.await?;
let config = Arc::new(Config::from_oauth(oauth));
let ctx = AssetContext::new(config);
for card in ctx.bank_cards().await? {
println!("{} {:?}", card.bank, card.status);
}Sourcepub async fn edda_applications(
&self,
card_id: impl Into<String>,
currency: impl Into<String>,
) -> Result<Vec<EddaApplication>>
pub async fn edda_applications( &self, card_id: impl Into<String>, currency: impl Into<String>, ) -> Result<Vec<EddaApplication>>
Get the eDDA authorization applications of a bank card in one currency
card_id is BankCard::id; currency is e.g. HKD or USD.
AP accounts only: US data-center accounts get a region error.
Path: GET /v1/account/edda-status
Sourcepub async fn stock_transfers_in(
&self,
options: impl Into<Option<GetStockTransfersInOptions>>,
) -> Result<StockTransferInResponse>
pub async fn stock_transfers_in( &self, options: impl Into<Option<GetStockTransfersInOptions>>, ) -> Result<StockTransferInResponse>
Get stock transfer-in applications (another broker → this account)
AP accounts only: US data-center accounts get a region error.
Path: GET /v1/account/stock-transfers/in
Sourcepub async fn stock_transfers_out(
&self,
options: impl Into<Option<GetStockTransfersOutOptions>>,
) -> Result<Vec<StockTransferOut>>
pub async fn stock_transfers_out( &self, options: impl Into<Option<GetStockTransfersOutOptions>>, ) -> Result<Vec<StockTransferOut>>
Get stock transfer-out applications (this account → another broker)
AP accounts only: US data-center accounts get a region error.
Path: GET /v1/account/stock-transfers/out
Sourcepub async fn reward_records(
&self,
options: impl Into<Option<GetRewardRecordsOptions>>,
) -> Result<RewardRecordsResponse>
pub async fn reward_records( &self, options: impl Into<Option<GetRewardRecordsOptions>>, ) -> Result<RewardRecordsResponse>
Get reward records from the reward center (cash, gifts, coupons, task rewards)
The route has no date filter: to find rewards in a time range, page through the records and filter on their times.
AP accounts only: US data-center accounts get a region error.
Path: GET /v1/account/rewards
Sourcepub async fn coupons(
&self,
options: impl Into<Option<GetCouponsOptions>>,
) -> Result<CouponsResponse>
pub async fn coupons( &self, options: impl Into<Option<GetCouponsOptions>>, ) -> Result<CouponsResponse>
Get coupons (reward cards)
By default lists the coupons that have not expired; see
GetCouponsOptions::expired. The pinned top_list / bottom_list
are repeated on every page.
AP accounts only: US data-center accounts get a region error.
Path: GET /v1/account/cards
Sourcepub async fn coupon_orders(
&self,
card_id: impl Into<String>,
order_type: CouponOrderType,
) -> Result<Vec<CouponOrder>>
pub async fn coupon_orders( &self, card_id: impl Into<String>, order_type: CouponOrderType, ) -> Result<Vec<CouponOrder>>
Get the orders a coupon was applied to
card_id is crate::asset::Coupon::card_id (32 hex characters, not a
bank card ID). The gateway rate-limits this route tightly per member, so
avoid calling it concurrently.
AP accounts only: US data-center accounts get a region error.
Path: GET /v1/account/card-orders
Sourcepub async fn deposits(
&self,
options: impl Into<Option<GetDepositsOptions>>,
) -> Result<DepositsResponse>
pub async fn deposits( &self, options: impl Into<Option<GetDepositsOptions>>, ) -> Result<DepositsResponse>
Get deposit records
The server’s total follows the page size rather than the record
count, so it is not returned; DepositsResponse::has_more reports
a full page instead. The page size is at most 20 and defaults to 20
(see GetDepositsOptions::size); it is always sent.
AP accounts only: US data-center accounts get a region error.
Path: GET /v1/account/deposits
Sourcepub async fn withdrawals(
&self,
options: impl Into<Option<GetWithdrawalsOptions>>,
) -> Result<WithdrawalsResponse>
pub async fn withdrawals( &self, options: impl Into<Option<GetWithdrawalsOptions>>, ) -> Result<WithdrawalsResponse>
Get withdrawal records
WithdrawalsResponse::has_more reports a full page. The page size
is at most 50 and defaults to 20 (see GetWithdrawalsOptions::size);
it is always sent.
AP accounts only: US data-center accounts get a region error.
Path: GET /v1/account/withdrawals
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for AssetContext
impl !UnwindSafe for AssetContext
impl Freeze for AssetContext
impl Send for AssetContext
impl Sync for AssetContext
impl Unpin for AssetContext
impl UnsafeUnpin for AssetContext
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