Struct octocat_rs::github::http::HttpClient
source · pub struct HttpClient { /* private fields */ }
Expand description
An implementer of the Requester
trait. This is all most users will need,
however it may be helpful to look at the trait implementation details here
if you’re writing your own implementation.
Implementations§
source§impl HttpClient
impl HttpClient
sourcepub fn new(auth: Option<Authorization>, user_agent: Option<String>) -> Self
pub fn new(auth: Option<Authorization>, user_agent: Option<String>) -> Self
Creates a new HttpClient
.
sourcepub fn set_auth(&mut self, auth: Authorization)
pub fn set_auth(&mut self, auth: Authorization)
Updates the authorization used by the current client.
Trait Implementations§
source§impl Requester for HttpClient
impl Requester for HttpClient
source§fn raw_req<'life0, 'life1, 'async_trait, T, V>(
&'life0 self,
url: EndPoints,
query: Option<&'life1 T>,
body: Option<V>
) -> Pin<Box<dyn Future<Output = Result<String, GithubRestError>> + Send + 'async_trait>>where
T: Serialize + ?Sized + Send + Sync + 'async_trait,
V: Into<Self::Body> + Send + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn raw_req<'life0, 'life1, 'async_trait, T, V>( &'life0 self, url: EndPoints, query: Option<&'life1 T>, body: Option<V> ) -> Pin<Box<dyn Future<Output = Result<String, GithubRestError>> + Send + 'async_trait>>where T: Serialize + ?Sized + Send + Sync + 'async_trait, V: Into<Self::Body> + Send + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Returns the API response as a String
.
source§fn req<'life0, 'life1, 'async_trait, T, V, A>(
&'life0 self,
url: EndPoints,
query: Option<&'life1 T>,
body: Option<V>
) -> Pin<Box<dyn Future<Output = Result<A, GithubRestError>> + Send + 'async_trait>>where
T: Serialize + ?Sized + Send + Sync + 'async_trait,
V: Into<Self::Body> + Send + 'async_trait,
A: 'async_trait + DeserializeOwned,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn req<'life0, 'life1, 'async_trait, T, V, A>( &'life0 self, url: EndPoints, query: Option<&'life1 T>, body: Option<V> ) -> Pin<Box<dyn Future<Output = Result<A, GithubRestError>> + Send + 'async_trait>>where T: Serialize + ?Sized + Send + Sync + 'async_trait, V: Into<Self::Body> + Send + 'async_trait, A: 'async_trait + DeserializeOwned, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
A function for performing HTTP requests utilizing the EndPoints
enum.
Usage example:
HttpClient::new_none()
.req::<GetCommitsBody, String, Commits>(
EndPoints::GetReposownerrepoCommits("octocat-rs".to_owned(), "octocat-rs".to_owned()),
None,
None,
)
.await;
type Body = Body
Auto 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