pub async fn exec_with_result<E>(
client: &impl Client,
endpoint: E,
) -> Result<E::Response, ClientError>where
E: Endpoint,
Expand description
Executes an Endpoint and returns the result.
The result from the executed endpoint has a few operations performed on it:
- Any potential API error responses from the execution are searched for and, if found, converted to a ClientError::APIError
- All other errors are mapped from rustify::errors::ClientError to ClientError::RestClientError
- An empty content body from the execution is rejected and a ClientError::ResponseEmptyError is returned instead
- The enclosing EndpointResult is stripped off and any warnings found in the result are logged
- An empty
data
field in the EndpointResult is rejected and a ClientError::ResponseDataEmptyError is returned instead - The value from the enclosed
data
field is returned along with any propagated errors.