1// Copied from indigo:api/atproto/repolistRecords.go
2
3package agnostic
4
5// schema: com.atproto.repo.getRecord
6
7import (
8 "context"
9 "encoding/json"
10
11 "github.com/bluesky-social/indigo/lex/util"
12)
13
14// RepoGetRecord_Output is the output of a com.atproto.repo.getRecord call.
15type RepoGetRecord_Output struct {
16 Cid *string `json:"cid,omitempty" cborgen:"cid,omitempty"`
17 Uri string `json:"uri" cborgen:"uri"`
18 // NOTE: changed from lex decoder to json.RawMessage
19 Value *json.RawMessage `json:"value" cborgen:"value"`
20}
21
22// RepoGetRecord calls the XRPC method "com.atproto.repo.getRecord".
23//
24// cid: The CID of the version of the record. If not specified, then return the most recent version.
25// collection: The NSID of the record collection.
26// repo: The handle or DID of the repo.
27// rkey: The Record Key.
28func RepoGetRecord(ctx context.Context, c util.LexClient, cid string, collection string, repo string, rkey string) (*RepoGetRecord_Output, error) {
29 var out RepoGetRecord_Output
30
31 params := map[string]interface{}{
32 "collection": collection,
33 "repo": repo,
34 "rkey": rkey,
35 }
36 if cid != "" {
37 params["cid"] = cid
38 }
39 if err := c.LexDo(ctx, util.Query, "", "com.atproto.repo.getRecord", params, nil, &out); err != nil {
40 return nil, err
41 }
42
43 return &out, nil
44}