-
Notifications
You must be signed in to change notification settings - Fork 37
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it would be beneficial to have a run
command that would make the HTTP call to the graphql endpoint with the specified query?
744f140
to
78d4079
Compare
No, this is purposely client agnostic so it can be used with wasm and native code, i.e. seed on the front-end and reqwest on the backend. |
8a6a2a7
to
c9cc4c0
Compare
Add a new crate, `iml-graphql-queries` that serves as a simple client query builder. It has no dependency on transport and can be used in both wasm and native contexts. Signed-off-by: Joe Grund <jgrund@whamcloud.io>
c9cc4c0
to
f33e5d9
Compare
Signed-off-by: Joe Grund <jgrund@whamcloud.io>
Might need a helper to decode the responses. Like serde_json::from_value(resp.get("data").unwrap().get("createSnapshot").unwrap().clone()) |
Yeah, I'll try to do that in a follow-on |
Went ahead and implemented response support as well: Here's how I'm creating a request in seed: snapshot::create::build(&model.fs_name, &model.name, model.comment.as_ref(), Some(model.barrier));
let req = fetch::Request::graphql_query(&query);
orders.perform_cmd(req.fetch_json_data(|x| Msg::SnapshotCreateResp(x))); and here's how the response looks like in SnapshotCreateResp(fetch::ResponseDataResult<Response<snapshot::create::Resp>>) Will probably write a seed helper to collapse the nesting of that response, but that can be in another patch. |
Add a new crate,
iml-graphql-queries
that serves as a simple clientquery builder.
It has no dependency on transport and can be used in both wasm and
native contexts.
Signed-off-by: Joe Grund jgrund@whamcloud.io
This change is![Reviewable](https://camo.githubusercontent.com/1541c4039185914e83657d3683ec25920c672c6c5c7ab4240ee7bff601adec0b/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)