forked from tangled.org/core
this repo has no description

add generated atproto lexicons for bild

Changed files
+241 -1
api
-1
.gitignore
···
.direnv/
tmp
-
bild
*.db
+23
api/bild/bildpublicKey.go
···
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
+
+
package bild
+
+
// schema: sh.bild.publicKey
+
+
import (
+
"github.com/bluesky-social/indigo/lex/util"
+
)
+
+
func init() {
+
util.RegisterType("sh.bild.publicKey", &PublicKey{})
+
} //
+
// RECORDTYPE: PublicKey
+
type PublicKey struct {
+
LexiconTypeID string `json:"$type,const=sh.bild.publicKey" cborgen:"$type,const=sh.bild.publicKey"`
+
// created: key upload timestamp
+
Created string `json:"created" cborgen:"created"`
+
// key: public key contents
+
Key string `json:"key" cborgen:"key"`
+
// name: human-readable name for this key
+
Name string `json:"name" cborgen:"name"`
+
}
+218
api/bild/cbor_gen.go
···
+
// Code generated by github.com/whyrusleeping/cbor-gen. DO NOT EDIT.
+
+
package bild
+
+
import (
+
"fmt"
+
"io"
+
"math"
+
"sort"
+
+
cid "github.com/ipfs/go-cid"
+
cbg "github.com/whyrusleeping/cbor-gen"
+
xerrors "golang.org/x/xerrors"
+
)
+
+
var _ = xerrors.Errorf
+
var _ = cid.Undef
+
var _ = math.E
+
var _ = sort.Sort
+
+
func (t *PublicKey) MarshalCBOR(w io.Writer) error {
+
if t == nil {
+
_, err := w.Write(cbg.CborNull)
+
return err
+
}
+
+
cw := cbg.NewCborWriter(w)
+
+
if _, err := cw.Write([]byte{164}); err != nil {
+
return err
+
}
+
+
// t.Key (string) (string)
+
if len("key") > 1000000 {
+
return xerrors.Errorf("Value in field \"key\" was too long")
+
}
+
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("key"))); err != nil {
+
return err
+
}
+
if _, err := cw.WriteString(string("key")); err != nil {
+
return err
+
}
+
+
if len(t.Key) > 1000000 {
+
return xerrors.Errorf("Value in field t.Key was too long")
+
}
+
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Key))); err != nil {
+
return err
+
}
+
if _, err := cw.WriteString(string(t.Key)); err != nil {
+
return err
+
}
+
+
// t.Name (string) (string)
+
if len("name") > 1000000 {
+
return xerrors.Errorf("Value in field \"name\" was too long")
+
}
+
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("name"))); err != nil {
+
return err
+
}
+
if _, err := cw.WriteString(string("name")); err != nil {
+
return err
+
}
+
+
if len(t.Name) > 1000000 {
+
return xerrors.Errorf("Value in field t.Name was too long")
+
}
+
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Name))); err != nil {
+
return err
+
}
+
if _, err := cw.WriteString(string(t.Name)); err != nil {
+
return err
+
}
+
+
// t.LexiconTypeID (string) (string)
+
if len("$type") > 1000000 {
+
return xerrors.Errorf("Value in field \"$type\" was too long")
+
}
+
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
+
return err
+
}
+
if _, err := cw.WriteString(string("$type")); err != nil {
+
return err
+
}
+
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.bild.publicKey"))); err != nil {
+
return err
+
}
+
if _, err := cw.WriteString(string("sh.bild.publicKey")); err != nil {
+
return err
+
}
+
+
// t.Created (string) (string)
+
if len("created") > 1000000 {
+
return xerrors.Errorf("Value in field \"created\" was too long")
+
}
+
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("created"))); err != nil {
+
return err
+
}
+
if _, err := cw.WriteString(string("created")); err != nil {
+
return err
+
}
+
+
if len(t.Created) > 1000000 {
+
return xerrors.Errorf("Value in field t.Created was too long")
+
}
+
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Created))); err != nil {
+
return err
+
}
+
if _, err := cw.WriteString(string(t.Created)); err != nil {
+
return err
+
}
+
return nil
+
}
+
+
func (t *PublicKey) UnmarshalCBOR(r io.Reader) (err error) {
+
*t = PublicKey{}
+
+
cr := cbg.NewCborReader(r)
+
+
maj, extra, err := cr.ReadHeader()
+
if err != nil {
+
return err
+
}
+
defer func() {
+
if err == io.EOF {
+
err = io.ErrUnexpectedEOF
+
}
+
}()
+
+
if maj != cbg.MajMap {
+
return fmt.Errorf("cbor input should be of type map")
+
}
+
+
if extra > cbg.MaxLength {
+
return fmt.Errorf("PublicKey: map struct too large (%d)", extra)
+
}
+
+
n := extra
+
+
nameBuf := make([]byte, 7)
+
for i := uint64(0); i < n; i++ {
+
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
+
if err != nil {
+
return err
+
}
+
+
if !ok {
+
// Field doesn't exist on this type, so ignore it
+
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
+
return err
+
}
+
continue
+
}
+
+
switch string(nameBuf[:nameLen]) {
+
// t.Key (string) (string)
+
case "key":
+
+
{
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
+
if err != nil {
+
return err
+
}
+
+
t.Key = string(sval)
+
}
+
// t.Name (string) (string)
+
case "name":
+
+
{
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
+
if err != nil {
+
return err
+
}
+
+
t.Name = string(sval)
+
}
+
// t.LexiconTypeID (string) (string)
+
case "$type":
+
+
{
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
+
if err != nil {
+
return err
+
}
+
+
t.LexiconTypeID = string(sval)
+
}
+
// t.Created (string) (string)
+
case "created":
+
+
{
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
+
if err != nil {
+
return err
+
}
+
+
t.Created = string(sval)
+
}
+
+
default:
+
// Field doesn't exist on this type, so ignore it
+
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
+
return err
+
}
+
}
+
}
+
+
return nil
+
}