pub struct ROAClient { /* private fields */ }
Implementations§
Source§impl ROAClient
impl ROAClient
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>, uri: impl Into<String>) -> Self
pub fn request(self, method: impl Into<String>, uri: impl Into<String>) -> Self
Create a request with the method
and uri
.
Returns a Self
for send request.
Sourcepub fn get(self, uri: impl Into<String>) -> Self
pub fn get(self, uri: impl Into<String>) -> Self
Create a GET
request with the uri
.
Returns a Self
for send request.
Sourcepub fn post(self, uri: impl Into<String>) -> Self
pub fn post(self, uri: impl Into<String>) -> Self
Create a POST
request with the uri
.
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 body(self, body: impl Into<String>) -> Result<Self>
pub fn body(self, body: impl Into<String>) -> Result<Self>
Set body 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 project(self, project: impl Into<String>) -> Self
pub fn project(self, project: impl Into<String>) -> Self
Set project 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 ROAClient
impl RefUnwindSafe for ROAClient
impl Send for ROAClient
impl Sync for ROAClient
impl Unpin for ROAClient
impl UnwindSafe for ROAClient
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