update examples
This commit is contained in:
parent
e52cf7009b
commit
f66fc290fd
|
@ -1,31 +1,30 @@
|
|||
use graphql_query_builder::{Builder, InputValues, OperationType, SelectionSet};
|
||||
use std::collections::HashMap;
|
||||
use graphql_query_builder::{json, Builder, OperationType, SelectionSet};
|
||||
|
||||
pub fn query() -> String {
|
||||
let vec = vec![
|
||||
SelectionSet {
|
||||
operation: String::from("id"),
|
||||
operation: "id",
|
||||
alias: None,
|
||||
fields: None,
|
||||
arguments: None,
|
||||
is_union: false,
|
||||
},
|
||||
SelectionSet {
|
||||
operation: String::from("name"),
|
||||
operation: "name",
|
||||
alias: None,
|
||||
fields: None,
|
||||
arguments: None,
|
||||
is_union: false,
|
||||
},
|
||||
SelectionSet {
|
||||
operation: String::from("profilePic"),
|
||||
operation: "profilePic",
|
||||
alias: Some("smallPic"),
|
||||
fields: None,
|
||||
arguments: None,
|
||||
is_union: false,
|
||||
},
|
||||
SelectionSet {
|
||||
operation: String::from("profilePic"),
|
||||
operation: "profilePic",
|
||||
alias: Some("bigPic"),
|
||||
fields: None,
|
||||
arguments: None,
|
||||
|
@ -33,10 +32,10 @@ pub fn query() -> String {
|
|||
},
|
||||
];
|
||||
let user = SelectionSet {
|
||||
operation: String::from("user"),
|
||||
operation: "user",
|
||||
alias: None,
|
||||
fields: Some(vec),
|
||||
arguments: Some(HashMap::from([("id", InputValues::Int(4))])),
|
||||
arguments: json!({ "id": 4 }),
|
||||
is_union: false,
|
||||
};
|
||||
Builder::new(OperationType::Query, &user)
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
use graphql_query_builder::{Builder, InputValues, OperationType, SelectionSet};
|
||||
use std::collections::HashMap;
|
||||
use graphql_query_builder::{json, Builder, OperationType, SelectionSet};
|
||||
|
||||
pub fn query() -> String {
|
||||
let story = SelectionSet {
|
||||
operation: String::from("Story"),
|
||||
operation: "Story",
|
||||
alias: None,
|
||||
fields: Some(vec![SelectionSet {
|
||||
operation: "likeCount".to_string(),
|
||||
operation: "likeCount",
|
||||
alias: None,
|
||||
fields: None,
|
||||
arguments: None,
|
||||
|
@ -16,10 +15,10 @@ pub fn query() -> String {
|
|||
is_union: false,
|
||||
};
|
||||
let like_story = SelectionSet {
|
||||
operation: String::from("likeStory"),
|
||||
operation: "likeStory",
|
||||
alias: None,
|
||||
fields: Some(vec![story]),
|
||||
arguments: Some(HashMap::from([("storyID", InputValues::Int(12345))])),
|
||||
arguments: json!({ "storyID": 12345 }),
|
||||
is_union: false,
|
||||
};
|
||||
Builder::new(OperationType::Mutation, &like_story)
|
||||
|
|
Reference in New Issue