pub struct RPClient { /* private fields */ }
Implementations§
Source§impl RPClient
impl RPClient
Sourcepub fn new(
access_key_id: impl Into<String>,
access_key_secret: impl Into<String>,
endpoint: impl Into<String>,
) -> Self
pub fn new( access_key_id: impl Into<String>, access_key_secret: impl Into<String>, endpoint: impl Into<String>, ) -> Self
Create a api client.
Sourcepub fn request(
self,
method: impl Into<String>,
action: impl Into<String>,
) -> Self
pub fn request( self, method: impl Into<String>, action: impl Into<String>, ) -> Self
Create a request with the method
and action
.
Returns a Self
for send request.
Sourcepub fn get(self, action: impl Into<String>) -> Self
pub fn get(self, action: impl Into<String>) -> Self
Create a GET
request with the action
.
Returns a Self
for send request.
Sourcepub fn post(self, action: impl Into<String>) -> Self
pub fn post(self, action: impl Into<String>) -> Self
Create a POST
request with the action
.
Returns a Self
for send request.
Sourcepub fn query<I, T>(self, queries: I) -> Self
pub fn query<I, T>(self, queries: I) -> Self
Set queries for request.
Returns a Self
for send request.
Sourcepub fn version(self, version: impl Into<String>) -> Self
pub fn version(self, version: impl Into<String>) -> Self
Set version for request.
Returns a Self
for send request.
Sourcepub fn header(self, headers: impl Into<HashMap<String, String>>) -> Result<Self>
pub fn header(self, headers: impl Into<HashMap<String, String>>) -> Result<Self>
Set header for request.
Returns a Self
for send request.
Sourcepub fn timeout(self, timeout: Duration) -> Self
pub fn timeout(self, timeout: Duration) -> Self
Set a timeout for connect, read and write operations of a Client
.
Default is no timeout.
Sourcepub async fn json<T: DeserializeOwned>(self) -> Result<T>
pub async fn json<T: DeserializeOwned>(self) -> Result<T>
Send a request to service. Try to deserialize the response body as JSON.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RPClient
impl RefUnwindSafe for RPClient
impl Send for RPClient
impl Sync for RPClient
impl Unpin for RPClient
impl UnwindSafe for RPClient
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