executeTransaction method

Future executeTransaction(
  1. {List<String> exclusive,
  2. List<String> write,
  3. List<String> read,
  4. String action,
  5. dynamic params,
  6. bool allowImplicit,
  7. int lockTimeout,
  8. int maxTransactionSize,
  9. bool waitForSync}
)

Implementation

Future<dynamic> executeTransaction({
  List<String> exclusive,
  List<String> write,
  List<String> read,
  String action,
  dynamic params,
  bool allowImplicit,
  int lockTimeout,
  int maxTransactionSize,
  bool waitForSync,
}) async {
  if (action == null) throw ArgumentError.notNull('action');
  if (write == null) throw ArgumentError.notNull('write');
  final resp = await _connection.request(
    method: 'POST',
    path: '/_api/transaction',
    body: {
      'collections': {
        if (exclusive != null) 'exclusive': exclusive,
        if (write != null) 'write': write,
        if (read != null) 'read': read,
      },
      if (action != null) 'action': action,
      if (params != null) 'params': params,
      if (allowImplicit != null) 'allowImplicit': allowImplicit,
      if (lockTimeout != null) 'lockTimeout': lockTimeout,
      if (maxTransactionSize != null)
        'maxTransactionSize': maxTransactionSize,
      if (waitForSync != null) 'waitForSync': waitForSync,
    },
  );
  return resp.body['result'];
}