Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
1.8 kB · 57 lines
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758// Code generated by glex; DO NOT EDIT.
// Lexicon schema: place.stream.chat.pinnedRecord
package placestream
import ( "encoding/json" "io"
glex "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen")
func init() { glex.RegisterType("place.stream.chat.pinnedRecord", &ChatPinnedRecord{})}
// Record pinning a chat message for prominent display.type ChatPinnedRecord struct { LexiconTypeID string `json:"$type,omitempty"` // createdAt: When this pin was created. CreatedAt string `json:"createdAt"` // expiresAt: Optional expiration time. If set, the pin is considered inactive after this time. ExpiresAt *string `json:"expiresAt,omitempty"` // pinnedBy: DID of the user who pinned the message. PinnedBy *string `json:"pinnedBy,omitempty"` // pinnedMessage: AT-URI of the pinned chat message. PinnedMessage string `json:"pinnedMessage"`}
// RecordTypeID implements glex.Record.func (t *ChatPinnedRecord) RecordTypeID() string { return "place.stream.chat.pinnedRecord" }
// MarshalJSON stamps the $type field, like MarshalCBOR does. The value// receiver operates on a copy, so the record is never mutated and both// ChatPinnedRecord and *ChatPinnedRecord marshal with $type.func (t ChatPinnedRecord) MarshalJSON() ([]byte, error) { t.LexiconTypeID = "place.stream.chat.pinnedRecord" type alias ChatPinnedRecord return json.Marshal((alias)(t))}
func (t *ChatPinnedRecord) 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 = "place.stream.chat.pinnedRecord" return glex.MarshalCBOR(w, &cp)}
func (t *ChatPinnedRecord) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t)}