batchRequest function

Future<ParseResponse> batchRequest(
  1. List requests,
  2. List<ParseObject> objects, {
  3. ParseClient? client,
  4. bool? debug,
})

Implementation

Future<ParseResponse> batchRequest(
    List<dynamic> requests, List<ParseObject> objects,
    {ParseClient? client, bool? debug}) async {
  debug = isDebugEnabled(objectLevelDebug: debug);
  client = client ??
      ParseCoreData().clientCreator(
          sendSessionId: ParseCoreData().autoSendSessionId,
          securityContext: ParseCoreData().securityContext);
  try {
    final Uri url = getSanitisedUri(client, '/batch');
    final String body = json.encode(<String, dynamic>{'requests': requests});
    final ParseNetworkResponse result =
        await client.post(url.toString(), data: body);

    return handleResponse<ParseObject>(
        objects, result, ParseApiRQ.batch, debug, 'parse_utils');
  } on Exception catch (e) {
    return handleException(e, ParseApiRQ.batch, debug, 'parse_utils');
  }
}