applyWrites method

Future<XRPCResponse<EmptyData>> applyWrites({
  1. required List<BatchAction> actions,
  2. bool? validate,
  3. String? swapCommitCid,
})

Implementation

Future<core.XRPCResponse<core.EmptyData>> applyWrites({
  required List<BatchAction> actions,
  bool? validate,
  String? swapCommitCid,
}) async =>
    await _ctx.post(
      ns.comAtprotoRepoApplyWrites,
      body: {
        'repo': _ctx.session?.did,
        'writes': actions
            .map((e) => e.when(
                  create: (data) => data.toJson(),
                  update: (data) => data.toJson(),
                  delete: (data) => {
                    core.objectType: data.type,
                    'collection': data.uri.collection,
                    'rkey': data.uri.rkey,
                  },
                ))
            .toList(),
        'validate': validate,
        'swapCommit': swapCommitCid,
      },
    );