createRecord method

Future<XRPCResponse<CreateRecordOutput>> createRecord({
  1. String? repo,
  2. required NSID collection,
  3. String? rkey,
  4. bool? validate,
  5. required Map<String, dynamic> record,
  6. String? swapCommit,
  7. Map<String, String>? $unknown,
  8. Map<String, String>? $headers,
  9. PostClient? $client,
})

Create a single new repository record. Requires auth, implemented by PDS.

https://atprotodart.com/docs/lexicons/com/atproto/repo/createRecord

Implementation

Future<XRPCResponse<CreateRecordOutput>> createRecord({
  String? repo,
  required NSID collection,
  String? rkey,
  bool? validate,
  required Map<String, dynamic> record,
  String? swapCommit,
  Map<String, String>? $unknown,
  Map<String, String>? $headers,
  PostClient? $client,
}) async =>
    await _ctx.post<CreateRecordOutput>(
      ns.comAtprotoRepoCreateRecord,
      headers: $headers,
      body: {
        'repo': repo ?? _ctx.repo,
        'collection': collection.toString(),
        if (rkey != null) 'rkey': rkey,
        if (validate != null) 'validate': validate,
        'record': record,
        if (swapCommit != null) 'swapCommit': swapCommit,
        ...?$unknown,
      },
      to: const CreateRecordOutputConverter().fromJson,
      client: $client,
    );