Trait extrahop::ApiResponse [] [src]

pub trait ApiResponse: Sized {
    fn validate_status(self) -> Result<Response>;
    fn deserialize<T: Deserialize>(self) -> Result<T>;

    fn validate_and_read<T: Deserialize>(self) -> Result<T> { ... }
}

Validator and deserializer for REST API responses.

Required Methods

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

Attempts to parse the response as JSON into T.

Provided Methods

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

Implementors