[][src]Trait extrahop::ApiResponse

pub trait ApiResponse: Sized {
    fn validate_status(self) -> Result<Response>;
fn deserialize<T: DeserializeOwned>(self) -> Result<T>; fn validate_and_read<T: DeserializeOwned>(self) -> Result<T> { ... } }

Validator and deserializer for REST API responses.

Required methods

fn validate_status(self) -> Result<Response>

Checks if the status code returned was in the 2xx range. If so, returns the underlying response for further processing; otherwise returns an error.

fn deserialize<T: DeserializeOwned>(self) -> Result<T>

Attempts to parse the response as JSON into T.

Loading content...

Provided methods

fn validate_and_read<T: DeserializeOwned>(self) -> Result<T>

Validates the status code and attempts to deserialize into T in one step.

Loading content...

Implementations on Foreign Types

impl ApiResponse for Response[src]

impl ApiResponse for StdResult<Response, ReqwestError>[src]

Loading content...

Implementors

Loading content...