···11+// Copied from indigo:api/atproto/repocreateRecords.go
22+33+package main
44+55+// schema: com.atproto.repo.createRecord
66+77+import (
88+ "context"
99+1010+ "github.com/bluesky-social/indigo/xrpc"
1111+)
1212+1313+// RepoDefs_CommitMeta is a "commitMeta" in the com.atproto.repo.defs schema.
1414+type RepoDefs_CommitMeta struct {
1515+ Cid string `json:"cid" cborgen:"cid"`
1616+ Rev string `json:"rev" cborgen:"rev"`
1717+}
1818+1919+// RepoCreateRecord_Input is the input argument to a com.atproto.repo.createRecord call.
2020+type RepoCreateRecord_Input struct {
2121+ // collection: The NSID of the record collection.
2222+ Collection string `json:"collection" cborgen:"collection"`
2323+ // record: The record itself. Must contain a $type field.
2424+ Record map[string]any `json:"record" cborgen:"record"`
2525+ // repo: The handle or DID of the repo (aka, current account).
2626+ Repo string `json:"repo" cborgen:"repo"`
2727+ // rkey: The Record Key.
2828+ Rkey *string `json:"rkey,omitempty" cborgen:"rkey,omitempty"`
2929+ // swapCommit: Compare and swap with the previous commit by CID.
3030+ SwapCommit *string `json:"swapCommit,omitempty" cborgen:"swapCommit,omitempty"`
3131+ // 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.
3232+ Validate *bool `json:"validate,omitempty" cborgen:"validate,omitempty"`
3333+}
3434+3535+// RepoCreateRecord_Output is the output of a com.atproto.repo.createRecord call.
3636+type RepoCreateRecord_Output struct {
3737+ Cid string `json:"cid" cborgen:"cid"`
3838+ Commit *RepoDefs_CommitMeta `json:"commit,omitempty" cborgen:"commit,omitempty"`
3939+ Uri string `json:"uri" cborgen:"uri"`
4040+ ValidationStatus *string `json:"validationStatus,omitempty" cborgen:"validationStatus,omitempty"`
4141+}
4242+4343+// RepoCreateRecord calls the XRPC method "com.atproto.repo.createRecord".
4444+func RepoCreateRecord(ctx context.Context, c *xrpc.Client, input *RepoCreateRecord_Input) (*RepoCreateRecord_Output, error) {
4545+ var out RepoCreateRecord_Output
4646+ if err := c.Do(ctx, xrpc.Procedure, "application/json", "com.atproto.repo.createRecord", nil, input, &out); err != nil {
4747+ return nil, err
4848+ }
4949+5050+ return &out, nil
5151+}
+47
cmd/goat/repoputRecord.go
···11+// Copied from indigo:api/atproto/repoputRecords.go
22+33+package main
44+55+// schema: com.atproto.repo.putRecord
66+77+import (
88+ "context"
99+1010+ "github.com/bluesky-social/indigo/xrpc"
1111+)
1212+1313+// RepoPutRecord_Input is the input argument to a com.atproto.repo.putRecord call.
1414+type RepoPutRecord_Input struct {
1515+ // collection: The NSID of the record collection.
1616+ Collection string `json:"collection" cborgen:"collection"`
1717+ // record: The record to write.
1818+ Record map[string]any `json:"record" cborgen:"record"`
1919+ // repo: The handle or DID of the repo (aka, current account).
2020+ Repo string `json:"repo" cborgen:"repo"`
2121+ // rkey: The Record Key.
2222+ Rkey string `json:"rkey" cborgen:"rkey"`
2323+ // swapCommit: Compare and swap with the previous commit by CID.
2424+ SwapCommit *string `json:"swapCommit,omitempty" cborgen:"swapCommit,omitempty"`
2525+ // swapRecord: Compare and swap with the previous record by CID. WARNING: nullable and optional field; may cause problems with golang implementation
2626+ SwapRecord *string `json:"swapRecord" cborgen:"swapRecord"`
2727+ // 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.
2828+ Validate *bool `json:"validate,omitempty" cborgen:"validate,omitempty"`
2929+}
3030+3131+// RepoPutRecord_Output is the output of a com.atproto.repo.putRecord call.
3232+type RepoPutRecord_Output struct {
3333+ Cid string `json:"cid" cborgen:"cid"`
3434+ Commit *RepoDefs_CommitMeta `json:"commit,omitempty" cborgen:"commit,omitempty"`
3535+ Uri string `json:"uri" cborgen:"uri"`
3636+ ValidationStatus *string `json:"validationStatus,omitempty" cborgen:"validationStatus,omitempty"`
3737+}
3838+3939+// RepoPutRecord calls the XRPC method "com.atproto.repo.putRecord".
4040+func RepoPutRecord(ctx context.Context, c *xrpc.Client, input *RepoPutRecord_Input) (*RepoPutRecord_Output, error) {
4141+ var out RepoPutRecord_Output
4242+ if err := c.Do(ctx, xrpc.Procedure, "application/json", "com.atproto.repo.putRecord", nil, input, &out); err != nil {
4343+ return nil, err
4444+ }
4545+4646+ return &out, nil
4747+}