pub struct BaseEndpoint { /* private fields */ }Expand description
Base endpoint for API requests.
Implementations§
Source§impl BaseEndpoint
impl BaseEndpoint
Sourcepub fn new(
client: Client,
base_url: String,
auth_manager: Arc<AuthManager>,
) -> Self
pub fn new( client: Client, base_url: String, auth_manager: Arc<AuthManager>, ) -> Self
Create a new base endpoint.
Sourcepub fn request<T>(&self, method: Method, path: &str) -> RequestBuilderwhere
T: DeserializeOwned,
pub fn request<T>(&self, method: Method, path: &str) -> RequestBuilderwhere
T: DeserializeOwned,
Build a request to the API.
Sourcepub async fn send_request<T>(&self, request: RequestBuilder) -> WebullResult<T>where
T: DeserializeOwned + Clone,
pub async fn send_request<T>(&self, request: RequestBuilder) -> WebullResult<T>where
T: DeserializeOwned + Clone,
Send a request to the API and parse the response.
Sourcepub async fn authenticate_request(
&self,
request: RequestBuilder,
) -> WebullResult<RequestBuilder>
pub async fn authenticate_request( &self, request: RequestBuilder, ) -> WebullResult<RequestBuilder>
Add authentication headers to a request.
Sourcepub async fn get<T>(&self, path: &str) -> WebullResult<T>
pub async fn get<T>(&self, path: &str) -> WebullResult<T>
Send a GET request to the API.
Sourcepub async fn post<T, B>(&self, path: &str, body: &B) -> WebullResult<T>
pub async fn post<T, B>(&self, path: &str, body: &B) -> WebullResult<T>
Send a POST request to the API.
Sourcepub async fn put<T, B>(&self, path: &str, body: &B) -> WebullResult<T>
pub async fn put<T, B>(&self, path: &str, body: &B) -> WebullResult<T>
Send a PUT request to the API.
Sourcepub async fn delete<T>(&self, path: &str) -> WebullResult<T>
pub async fn delete<T>(&self, path: &str) -> WebullResult<T>
Send a DELETE request to the API.
Auto Trait Implementations§
impl Freeze for BaseEndpoint
impl !RefUnwindSafe for BaseEndpoint
impl Send for BaseEndpoint
impl Sync for BaseEndpoint
impl Unpin for BaseEndpoint
impl !UnwindSafe for BaseEndpoint
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