pub struct Client { /* private fields */ }
Expand description
A Client
is the entity used by clients of this module for
interacting with the Alpaca API.
Implementations§
source§impl Client
impl Client
sourcepub fn builder() -> Builder
pub fn builder() -> Builder
Instantiate a new Builder
which allows for creating a customized Client
.
sourcepub fn new(api_info: ApiInfo) -> Self
pub fn new(api_info: ApiInfo) -> Self
Create a new Client
using the given key ID and secret for
connecting to the API.
sourcepub fn issue<R>(
&self,
input: &R::Input
) -> impl Future<Output = Result<R::Output, RequestError<R::Error>>> + '_where
R: Endpoint,
pub fn issue<R>( &self, input: &R::Input ) -> impl Future<Output = Result<R::Output, RequestError<R::Error>>> + '_where R: Endpoint,
Create and issue a request and decode the response.
sourcepub async fn subscribe<S>(&self) -> Result<(S::Stream, S::Subscription), Error>where
S: Subscribable<Input = ApiInfo>,
pub async fn subscribe<S>(&self) -> Result<(S::Stream, S::Subscription), Error>where S: Subscribable<Input = ApiInfo>,
Subscribe to the given subscribable in order to receive updates.
Notes
- this method is only a short-hand for
S::connect
that supplies the client’sApiInfo
object to the call; if yourSubscribable
requires a different input then invoke itsconnect
method yourself