graphql function

Future graphql({
  1. required ExecuteCommandFunction exec,
  2. required String query,
})

Implementation

Future<dynamic> graphql({
  required ExecuteCommandFunction exec,
  required String query,
}) async {
  final out = await exec(ExecuteCommandInput(
    command: "fig",
    args: [
      "_",
      "request",
      "--route",
      "/graphql",
      "--method",
      "POST",
      "--body",
      jsonEncode({"query": query}),
    ],
  ));

  return jsonDecode(out.stdout)['data'];
}