graphRequest method

Future<StrapiResponse> graphRequest(
  1. String queryString, {
  2. int maxTimeOutInMillis = 15000,
})

do a graph request to the strapi server, pass the queryString mostly generated using, StrapiCollectionQuery or StrapiModelQuery, maxTimeOutInMillis for the request can be set, returns a StrapiResponse which will contain graph response map in its body throws StrapiResponseException if request is failed

Implementation

Future<StrapiResponse> graphRequest(String queryString,
    {int maxTimeOutInMillis = 15000}) async {
  if (verbose) {
    sPrint("strapi query string: \n$queryString");
  }
  final response = await request(
    "/graphql",
    method: "POST",
    body: {"query": "{$queryString}"},
    maxTimeOutInMillis: maxTimeOutInMillis,
  );
  if (response.failed) {
    throw StrapiResponseException(
        "Graph request failed for collection ", response);
  }
  return response;
}