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 ?? _ctx.oAuthSession?.sub,
        'writes': actions
            .map((e) => e.when(
                  create: (data) => data.toJson(),
                  update: (data) => data.toJson(),
                  delete: (data) => {
                    core.objectType: data.type,
                    'collection': data.uri.collection.toString(),
                    'rkey': data.uri.rkey,
                  },
                ))
            .toList(),
        'validate': validate,
        'swapCommit': swapCommitCid,
      },
    );