1// Copied from indigo:api/atproto/repoputRecords.go
2
3package agnostic
4
5// schema: com.atproto.repo.putRecord
6
7import (
8 "context"
9
10 "github.com/bluesky-social/indigo/lex/util"
11)
12
13// RepoPutRecord_Input is the input argument to a com.atproto.repo.putRecord call.
14type RepoPutRecord_Input struct {
15 // collection: The NSID of the record collection.
16 Collection string `json:"collection" cborgen:"collection"`
17 // record: The record to write.
18 Record map[string]any `json:"record" cborgen:"record"`
19 // repo: The handle or DID of the repo (aka, current account).
20 Repo string `json:"repo" cborgen:"repo"`
21 // rkey: The Record Key.
22 Rkey string `json:"rkey" cborgen:"rkey"`
23 // swapCommit: Compare and swap with the previous commit by CID.
24 SwapCommit *string `json:"swapCommit,omitempty" cborgen:"swapCommit,omitempty"`
25 // swapRecord: Compare and swap with the previous record by CID. WARNING: nullable and optional field; may cause problems with golang implementation
26 SwapRecord *string `json:"swapRecord,omitempty" cborgen:"swapRecord,omitempty"`
27 // validate: Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons.
28 Validate *bool `json:"validate,omitempty" cborgen:"validate,omitempty"`
29}
30
31// RepoPutRecord_Output is the output of a com.atproto.repo.putRecord call.
32type RepoPutRecord_Output struct {
33 Cid string `json:"cid" cborgen:"cid"`
34 Commit *RepoDefs_CommitMeta `json:"commit,omitempty" cborgen:"commit,omitempty"`
35 Uri string `json:"uri" cborgen:"uri"`
36 ValidationStatus *string `json:"validationStatus,omitempty" cborgen:"validationStatus,omitempty"`
37}
38
39// RepoPutRecord calls the XRPC method "com.atproto.repo.putRecord".
40func RepoPutRecord(ctx context.Context, c util.LexClient, input *RepoPutRecord_Input) (*RepoPutRecord_Output, error) {
41 var out RepoPutRecord_Output
42 if err := c.LexDo(ctx, util.Procedure, "application/json", "com.atproto.repo.putRecord", nil, input, &out); err != nil {
43 return nil, err
44 }
45
46 return &out, nil
47}