Crate reqores

Source
Expand description

§reqores

Oversimplified http request/response abstraction layer for bot_any packages.

  • Simple, lightweight abstraction
  • Easily exchangeable client/server implementation

§Implementations

§Example

Define a new ClientRequest for your web API.

#[derive(Debug, Serialize, Deserialize)]
pub struct YourApiResponse { /* ... some fields ... */ }
 
pub struct YourApiCall;
 
impl ClientRequest for YourApiCall {
    type Response = YourApiResponse;
 
    fn url(&self) -> String {
        "https://example.com/api".to_string()
    }
 
    fn method(&self) -> HttpMethod {
        HttpMethod::Get
    }
}

Modules§

headers
Collections for common headers

Structs§

HttpStatusCodeParseError
The error type for parsing http status code
ServerResponse
The response made from the server.
ServerResponseBuilder
The utility builder for ServerResponse.

Enums§

HttpMethod
The enum representing http request method
HttpStatusCode
The enum representing http status code

Traits§

ClientRequest
A client request to send
ClientResponse
The response made from ClientRequest.
ServerRequest
The request accepted by the server.