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