Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
2.9 kB · 85 lines
Go
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586// Code generated by glex; DO NOT EDIT.
// Lexicon schema: com.atproto.repo.createRecord
package comatproto
import ( "context" "io"
glex "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen")
type RepoCreateRecord_Input struct { LexiconTypeID string `json:"$type,omitempty"` // collection: The NSID of the record collection. Collection string `json:"collection"` // record: The record itself. Must contain a $type field. Record *glex.LexiconTypeDecoder `json:"record"` // repo: The handle or DID of the repo (aka, current account). Repo string `json:"repo"` // rkey: The Record Key. Rkey *string `json:"rkey,omitempty"` // swapCommit: Compare and swap with the previous commit by CID. SwapCommit *string `json:"swapCommit,omitempty"` // 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. Validate *bool `json:"validate,omitempty"`}
// RecordTypeID implements glex.Record.func (t *RepoCreateRecord_Input) RecordTypeID() string { return "com.atproto.repo.createRecord" }
func (t *RepoCreateRecord_Input) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err } // stamp $type on a copy so marshal never mutates the record cp := *t cp.LexiconTypeID = "com.atproto.repo.createRecord" return glex.MarshalCBOR(w, &cp)}
func (t *RepoCreateRecord_Input) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t)}
type RepoCreateRecord_Output struct { LexiconTypeID string `json:"$type,omitempty"` Cid string `json:"cid"` Commit *RepoDefs_CommitMeta `json:"commit,omitempty"` Uri string `json:"uri"` ValidationStatus *string `json:"validationStatus,omitempty"`}
// RecordTypeID implements glex.Record.func (t *RepoCreateRecord_Output) RecordTypeID() string { return "com.atproto.repo.createRecord" }
func (t *RepoCreateRecord_Output) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err } // stamp $type on a copy so marshal never mutates the record cp := *t cp.LexiconTypeID = "com.atproto.repo.createRecord" return glex.MarshalCBOR(w, &cp)}
func (t *RepoCreateRecord_Output) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t)}
// RepoCreateRecord calls the XRPC method "com.atproto.repo.createRecord".//// Create a single new repository record. Requires auth, implemented by PDS.func RepoCreateRecord(ctx context.Context, c glex.LexClient, input *RepoCreateRecord_Input) (*RepoCreateRecord_Output, error) { var out RepoCreateRecord_Output
if err := c.LexDo(ctx, glex.Procedure, "application/json", "com.atproto.repo.createRecord", nil, input, &out); err != nil { return nil, err } return &out, nil}