[−][src]Struct graphql_client::Response
The generic shape taken by the responses of GraphQL APIs.
This will generally be used with the ResponseData
struct from a derived module.
use graphql_client::Response; let body: Response<ResponseData> = serde_json::from_value(json!({ "data": { "users": [{"id": 13}], "dogs": [{"name": "Strelka"}], }, "errors": [], }))?; let expected: Response<ResponseData> = Response { data: Some(ResponseData { users: vec![User { id: 13 }], dogs: vec![Dog { name: "Strelka".to_owned() }], }), errors: Some(vec![]), }; assert_eq!(body, expected);
Fields
data: Option<Data>
The absent, partial or complete response data.
errors: Option<Vec<Error>>
The top-level errors returned by the server.
Trait Implementations
impl<Data: PartialEq> PartialEq<Response<Data>> for Response<Data>
[src]
impl<Data: Debug> Debug for Response<Data>
[src]
impl<Data> Serialize for Response<Data> where
Data: Serialize,
[src]
Data: Serialize,
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'de, Data> Deserialize<'de> for Response<Data> where
Data: Deserialize<'de>,
[src]
Data: Deserialize<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
Auto Trait Implementations
impl<Data> Send for Response<Data> where
Data: Send,
Data: Send,
impl<Data> Sync for Response<Data> where
Data: Sync,
Data: Sync,
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,