···3634363436353635 return nil
36363636}
36373637+func (t *ChatPinnedRecord) MarshalCBOR(w io.Writer) error {
36383638+ if t == nil {
36393639+ _, err := w.Write(cbg.CborNull)
36403640+ return err
36413641+ }
36423642+36433643+ cw := cbg.NewCborWriter(w)
36443644+ fieldCount := 5
36453645+36463646+ if t.ExpiresAt == nil {
36473647+ fieldCount--
36483648+ }
36493649+36503650+ if t.PinnedBy == nil {
36513651+ fieldCount--
36523652+ }
36533653+36543654+ if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
36553655+ return err
36563656+ }
36573657+36583658+ // t.LexiconTypeID (string) (string)
36593659+ if len("$type") > 1000000 {
36603660+ return xerrors.Errorf("Value in field \"$type\" was too long")
36613661+ }
36623662+36633663+ if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
36643664+ return err
36653665+ }
36663666+ if _, err := cw.WriteString(string("$type")); err != nil {
36673667+ return err
36683668+ }
36693669+36703670+ if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("place.stream.chat.pinnedRecord"))); err != nil {
36713671+ return err
36723672+ }
36733673+ if _, err := cw.WriteString(string("place.stream.chat.pinnedRecord")); err != nil {
36743674+ return err
36753675+ }
36763676+36773677+ // t.PinnedBy (string) (string)
36783678+ if t.PinnedBy != nil {
36793679+36803680+ if len("pinnedBy") > 1000000 {
36813681+ return xerrors.Errorf("Value in field \"pinnedBy\" was too long")
36823682+ }
36833683+36843684+ if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("pinnedBy"))); err != nil {
36853685+ return err
36863686+ }
36873687+ if _, err := cw.WriteString(string("pinnedBy")); err != nil {
36883688+ return err
36893689+ }
36903690+36913691+ if t.PinnedBy == nil {
36923692+ if _, err := cw.Write(cbg.CborNull); err != nil {
36933693+ return err
36943694+ }
36953695+ } else {
36963696+ if len(*t.PinnedBy) > 1000000 {
36973697+ return xerrors.Errorf("Value in field t.PinnedBy was too long")
36983698+ }
36993699+37003700+ if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.PinnedBy))); err != nil {
37013701+ return err
37023702+ }
37033703+ if _, err := cw.WriteString(string(*t.PinnedBy)); err != nil {
37043704+ return err
37053705+ }
37063706+ }
37073707+ }
37083708+37093709+ // t.CreatedAt (string) (string)
37103710+ if len("createdAt") > 1000000 {
37113711+ return xerrors.Errorf("Value in field \"createdAt\" was too long")
37123712+ }
37133713+37143714+ if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
37153715+ return err
37163716+ }
37173717+ if _, err := cw.WriteString(string("createdAt")); err != nil {
37183718+ return err
37193719+ }
37203720+37213721+ if len(t.CreatedAt) > 1000000 {
37223722+ return xerrors.Errorf("Value in field t.CreatedAt was too long")
37233723+ }
37243724+37253725+ if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil {
37263726+ return err
37273727+ }
37283728+ if _, err := cw.WriteString(string(t.CreatedAt)); err != nil {
37293729+ return err
37303730+ }
37313731+37323732+ // t.ExpiresAt (string) (string)
37333733+ if t.ExpiresAt != nil {
37343734+37353735+ if len("expiresAt") > 1000000 {
37363736+ return xerrors.Errorf("Value in field \"expiresAt\" was too long")
37373737+ }
37383738+37393739+ if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("expiresAt"))); err != nil {
37403740+ return err
37413741+ }
37423742+ if _, err := cw.WriteString(string("expiresAt")); err != nil {
37433743+ return err
37443744+ }
37453745+37463746+ if t.ExpiresAt == nil {
37473747+ if _, err := cw.Write(cbg.CborNull); err != nil {
37483748+ return err
37493749+ }
37503750+ } else {
37513751+ if len(*t.ExpiresAt) > 1000000 {
37523752+ return xerrors.Errorf("Value in field t.ExpiresAt was too long")
37533753+ }
37543754+37553755+ if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.ExpiresAt))); err != nil {
37563756+ return err
37573757+ }
37583758+ if _, err := cw.WriteString(string(*t.ExpiresAt)); err != nil {
37593759+ return err
37603760+ }
37613761+ }
37623762+ }
37633763+37643764+ // t.PinnedMessage (string) (string)
37653765+ if len("pinnedMessage") > 1000000 {
37663766+ return xerrors.Errorf("Value in field \"pinnedMessage\" was too long")
37673767+ }
37683768+37693769+ if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("pinnedMessage"))); err != nil {
37703770+ return err
37713771+ }
37723772+ if _, err := cw.WriteString(string("pinnedMessage")); err != nil {
37733773+ return err
37743774+ }
37753775+37763776+ if len(t.PinnedMessage) > 1000000 {
37773777+ return xerrors.Errorf("Value in field t.PinnedMessage was too long")
37783778+ }
37793779+37803780+ if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.PinnedMessage))); err != nil {
37813781+ return err
37823782+ }
37833783+ if _, err := cw.WriteString(string(t.PinnedMessage)); err != nil {
37843784+ return err
37853785+ }
37863786+ return nil
37873787+}
37883788+37893789+func (t *ChatPinnedRecord) UnmarshalCBOR(r io.Reader) (err error) {
37903790+ *t = ChatPinnedRecord{}
37913791+37923792+ cr := cbg.NewCborReader(r)
37933793+37943794+ maj, extra, err := cr.ReadHeader()
37953795+ if err != nil {
37963796+ return err
37973797+ }
37983798+ defer func() {
37993799+ if err == io.EOF {
38003800+ err = io.ErrUnexpectedEOF
38013801+ }
38023802+ }()
38033803+38043804+ if maj != cbg.MajMap {
38053805+ return fmt.Errorf("cbor input should be of type map")
38063806+ }
38073807+38083808+ if extra > cbg.MaxLength {
38093809+ return fmt.Errorf("ChatPinnedRecord: map struct too large (%d)", extra)
38103810+ }
38113811+38123812+ n := extra
38133813+38143814+ nameBuf := make([]byte, 13)
38153815+ for i := uint64(0); i < n; i++ {
38163816+ nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
38173817+ if err != nil {
38183818+ return err
38193819+ }
38203820+38213821+ if !ok {
38223822+ // Field doesn't exist on this type, so ignore it
38233823+ if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
38243824+ return err
38253825+ }
38263826+ continue
38273827+ }
38283828+38293829+ switch string(nameBuf[:nameLen]) {
38303830+ // t.LexiconTypeID (string) (string)
38313831+ case "$type":
38323832+38333833+ {
38343834+ sval, err := cbg.ReadStringWithMax(cr, 1000000)
38353835+ if err != nil {
38363836+ return err
38373837+ }
38383838+38393839+ t.LexiconTypeID = string(sval)
38403840+ }
38413841+ // t.PinnedBy (string) (string)
38423842+ case "pinnedBy":
38433843+38443844+ {
38453845+ b, err := cr.ReadByte()
38463846+ if err != nil {
38473847+ return err
38483848+ }
38493849+ if b != cbg.CborNull[0] {
38503850+ if err := cr.UnreadByte(); err != nil {
38513851+ return err
38523852+ }
38533853+38543854+ sval, err := cbg.ReadStringWithMax(cr, 1000000)
38553855+ if err != nil {
38563856+ return err
38573857+ }
38583858+38593859+ t.PinnedBy = (*string)(&sval)
38603860+ }
38613861+ }
38623862+ // t.CreatedAt (string) (string)
38633863+ case "createdAt":
38643864+38653865+ {
38663866+ sval, err := cbg.ReadStringWithMax(cr, 1000000)
38673867+ if err != nil {
38683868+ return err
38693869+ }
38703870+38713871+ t.CreatedAt = string(sval)
38723872+ }
38733873+ // t.ExpiresAt (string) (string)
38743874+ case "expiresAt":
38753875+38763876+ {
38773877+ b, err := cr.ReadByte()
38783878+ if err != nil {
38793879+ return err
38803880+ }
38813881+ if b != cbg.CborNull[0] {
38823882+ if err := cr.UnreadByte(); err != nil {
38833883+ return err
38843884+ }
38853885+38863886+ sval, err := cbg.ReadStringWithMax(cr, 1000000)
38873887+ if err != nil {
38883888+ return err
38893889+ }
38903890+38913891+ t.ExpiresAt = (*string)(&sval)
38923892+ }
38933893+ }
38943894+ // t.PinnedMessage (string) (string)
38953895+ case "pinnedMessage":
38963896+38973897+ {
38983898+ sval, err := cbg.ReadStringWithMax(cr, 1000000)
38993899+ if err != nil {
39003900+ return err
39013901+ }
39023902+39033903+ t.PinnedMessage = string(sval)
39043904+ }
39053905+39063906+ default:
39073907+ // Field doesn't exist on this type, so ignore it
39083908+ if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
39093909+ return err
39103910+ }
39113911+ }
39123912+ }
39133913+39143914+ return nil
39153915+}
36373916func (t *MultistreamTarget) MarshalCBOR(w io.Writer) error {
36383917 if t == nil {
36393918 _, err := w.Write(cbg.CborNull)
+13
pkg/streamplace/chatdefs.go
···5454 return nil
5555 }
5656}
5757+5858+// ChatDefs_PinnedRecordView is a "pinnedRecordView" in the place.stream.chat.defs schema.
5959+//
6060+// View of a pinned chat record with hydrated message data.
6161+type ChatDefs_PinnedRecordView struct {
6262+ LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.chat.defs#pinnedRecordView"`
6363+ Cid string `json:"cid" cborgen:"cid"`
6464+ IndexedAt string `json:"indexedAt" cborgen:"indexedAt"`
6565+ Message *ChatDefs_MessageView `json:"message,omitempty" cborgen:"message,omitempty"`
6666+ PinnedBy *ChatProfile `json:"pinnedBy,omitempty" cborgen:"pinnedBy,omitempty"`
6767+ Record *ChatPinnedRecord `json:"record" cborgen:"record"`
6868+ Uri string `json:"uri" cborgen:"uri"`
6969+}
+25
pkg/streamplace/chatpinnedRecord.go
···11+// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
22+33+// Lexicon schema: place.stream.chat.pinnedRecord
44+55+package streamplace
66+77+import (
88+ lexutil "github.com/bluesky-social/indigo/lex/util"
99+)
1010+1111+func init() {
1212+ lexutil.RegisterType("place.stream.chat.pinnedRecord", &ChatPinnedRecord{})
1313+}
1414+1515+type ChatPinnedRecord struct {
1616+ LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.chat.pinnedRecord"`
1717+ // createdAt: When this pin was created.
1818+ CreatedAt string `json:"createdAt" cborgen:"createdAt"`
1919+ // expiresAt: Optional expiration time. If set, the pin is considered inactive after this time.
2020+ ExpiresAt *string `json:"expiresAt,omitempty" cborgen:"expiresAt,omitempty"`
2121+ // pinnedBy: DID of the user who pinned the message.
2222+ PinnedBy *string `json:"pinnedBy,omitempty" cborgen:"pinnedBy,omitempty"`
2323+ // pinnedMessage: AT-URI of the pinned chat message.
2424+ PinnedMessage string `json:"pinnedMessage" cborgen:"pinnedMessage"`
2525+}
+39
pkg/streamplace/moderationcreatePin.go
···11+// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
22+33+// Lexicon schema: place.stream.moderation.createPin
44+55+package streamplace
66+77+import (
88+ "context"
99+1010+ lexutil "github.com/bluesky-social/indigo/lex/util"
1111+)
1212+1313+// ModerationCreatePin_Input is the input argument to a place.stream.moderation.createPin call.
1414+type ModerationCreatePin_Input struct {
1515+ // expiresAt: Optional expiration time for this pin.
1616+ ExpiresAt *string `json:"expiresAt,omitempty" cborgen:"expiresAt,omitempty"`
1717+ // messageUri: The AT-URI of the chat message to pin.
1818+ MessageUri string `json:"messageUri" cborgen:"messageUri"`
1919+ // streamer: The DID of the streamer.
2020+ Streamer string `json:"streamer" cborgen:"streamer"`
2121+}
2222+2323+// ModerationCreatePin_Output is the output of a place.stream.moderation.createPin call.
2424+type ModerationCreatePin_Output struct {
2525+ // cid: The CID of the created pinned record.
2626+ Cid string `json:"cid" cborgen:"cid"`
2727+ // uri: The AT-URI of the created pinned record.
2828+ Uri string `json:"uri" cborgen:"uri"`
2929+}
3030+3131+// ModerationCreatePin calls the XRPC method "place.stream.moderation.createPin".
3232+func ModerationCreatePin(ctx context.Context, c lexutil.LexClient, input *ModerationCreatePin_Input) (*ModerationCreatePin_Output, error) {
3333+ var out ModerationCreatePin_Output
3434+ if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "place.stream.moderation.createPin", nil, input, &out); err != nil {
3535+ return nil, err
3636+ }
3737+3838+ return &out, nil
3939+}
+33
pkg/streamplace/moderationdeletePin.go
···11+// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
22+33+// Lexicon schema: place.stream.moderation.deletePin
44+55+package streamplace
66+77+import (
88+ "context"
99+1010+ lexutil "github.com/bluesky-social/indigo/lex/util"
1111+)
1212+1313+// ModerationDeletePin_Input is the input argument to a place.stream.moderation.deletePin call.
1414+type ModerationDeletePin_Input struct {
1515+ // pinUri: The AT-URI of the pinned record to delete.
1616+ PinUri string `json:"pinUri" cborgen:"pinUri"`
1717+ // streamer: The DID of the streamer.
1818+ Streamer string `json:"streamer" cborgen:"streamer"`
1919+}
2020+2121+// ModerationDeletePin_Output is the output of a place.stream.moderation.deletePin call.
2222+type ModerationDeletePin_Output struct {
2323+}
2424+2525+// ModerationDeletePin calls the XRPC method "place.stream.moderation.deletePin".
2626+func ModerationDeletePin(ctx context.Context, c lexutil.LexClient, input *ModerationDeletePin_Input) (*ModerationDeletePin_Output, error) {
2727+ var out ModerationDeletePin_Output
2828+ if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "place.stream.moderation.deletePin", nil, input, &out); err != nil {
2929+ return nil, err
3030+ }
3131+3232+ return &out, nil
3333+}