pub struct ResponseBody<T> {
pub data: Option<T>,
pub errors: Vec<Error>,
}
Expand description
A response to a GraphQL request.
As specified in the section 7. Response of the GraphQL specification.
Fields§
§data: Option<T>
The response will be the result of the execution of the requested operation.
If the operation was a query, this output will be an object of the query root operation type; if the operation was a mutation, this output will be an object of the mutation root operation type.
If an error was raised before execution begins, the data entry should not be present in the
result; If an error was raised during the execution that prevented a valid response, the
data entry in the response should be null
. In both cases the field will be set to None
.
errors: Vec<Error>
The errors entry in the response is a non-empty list of Error
raised during the request,
where each error is a map of data described by the error result specified in the section
7.1.2. Errors of the GraphQL specification.
Implementations§
Source§impl<T> ResponseBody<T>
impl<T> ResponseBody<T>
Sourcepub fn from_error(error: impl IntoError) -> Self
pub fn from_error(error: impl IntoError) -> Self
Create a new response body with the given error.