putRecord method

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

Write a repository record, creating or updating it as needed. Requires auth, implemented by PDS.

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

Implementation

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