simple_operation/
simple-operation.rs

1use graphql_query_builder::{json, Builder, OperationType, SelectionSet};
2
3pub fn query() -> String {
4    let story = SelectionSet {
5        operation: "Story",
6        alias: None,
7        fields: Some(vec![SelectionSet {
8            operation: "likeCount",
9            alias: None,
10            fields: None,
11            arguments: None,
12            is_union: false,
13        }]),
14        arguments: None,
15        is_union: false,
16    };
17    let like_story = SelectionSet {
18        operation: "likeStory",
19        alias: None,
20        fields: Some(vec![story]),
21        arguments: json!({ "storyID": 12345 }),
22        is_union: false,
23    };
24    Builder::new(OperationType::Mutation, &like_story)
25}
26
27fn main() {
28    println!("{}", query());
29}