Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
3.0 kB · 87 lines
Go
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788// Code generated by glex; DO NOT EDIT.
// Lexicon schema: com.atproto.repo.putRecord
package comatproto
import ( "context" "io"
glex "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen")
type RepoPutRecord_Input struct { LexiconTypeID string `json:"$type,omitempty"` // collection: The NSID of the record collection. Collection string `json:"collection"` // record: The record to write. 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"` // swapCommit: Compare and swap with the previous commit by CID. SwapCommit *string `json:"swapCommit,omitempty"` // swapRecord: Compare and swap with the previous record by CID. WARNING: nullable and optional field; may cause problems with golang implementation SwapRecord *string `json:"swapRecord,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 *RepoPutRecord_Input) RecordTypeID() string { return "com.atproto.repo.putRecord" }
func (t *RepoPutRecord_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.putRecord" return glex.MarshalCBOR(w, &cp)}
func (t *RepoPutRecord_Input) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t)}
type RepoPutRecord_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 *RepoPutRecord_Output) RecordTypeID() string { return "com.atproto.repo.putRecord" }
func (t *RepoPutRecord_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.putRecord" return glex.MarshalCBOR(w, &cp)}
func (t *RepoPutRecord_Output) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t)}
// RepoPutRecord calls the XRPC method "com.atproto.repo.putRecord".//// Write a repository record, creating or updating it as needed. Requires auth, implemented by PDS.func RepoPutRecord(ctx context.Context, c glex.LexClient, input *RepoPutRecord_Input) (*RepoPutRecord_Output, error) { var out RepoPutRecord_Output
if err := c.LexDo(ctx, glex.Procedure, "application/json", "com.atproto.repo.putRecord", nil, input, &out); err != nil { return nil, err } return &out, nil}