// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.badge.defs package placestream import ( "io" glex "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" ) // BadgeDefs_BadgeIssuanceView is a "badgeIssuanceView" in the place.stream.badge.defs schema. // // A resolved view of a badge issuance, including def fields for display. type BadgeDefs_BadgeIssuanceView struct { LexiconTypeID string `json:"$type,omitempty"` BadgeType string `json:"badgeType"` // description: Description from the badge definition. Description *string `json:"description,omitempty"` // imageUrl: Resolved image URL for the badge icon. ImageUrl *string `json:"imageUrl,omitempty"` // issuanceCid: CID of the place.stream.badge.issuance record. IssuanceCid *string `json:"issuanceCid,omitempty"` // issuanceUri: AT URI of the place.stream.badge.issuance record. IssuanceUri string `json:"issuanceUri"` // issuer: DID of the badge issuer. Issuer string `json:"issuer"` // name: Display name from the badge definition. Name *string `json:"name,omitempty"` // selected: Whether this badge is currently in the user's chat profile selection. Selected *bool `json:"selected,omitempty"` } // RecordTypeID implements glex.Record. func (t *BadgeDefs_BadgeIssuanceView) RecordTypeID() string { return "place.stream.badge.defs#badgeIssuanceView" } func (t *BadgeDefs_BadgeIssuanceView) 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.badge.defs#badgeIssuanceView" return glex.MarshalCBOR(w, &cp) } func (t *BadgeDefs_BadgeIssuanceView) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t) } // BadgeDefs_BadgeSlot is a "badgeSlot" in the place.stream.badge.defs schema. // // A display slot containing available issuance-based badges and which one (if any) is currently selected. type BadgeDefs_BadgeSlot struct { LexiconTypeID string `json:"$type,omitempty"` // available: All badges available for this slot. Available []BadgeDefs_BadgeIssuanceView `json:"available"` // selected: The currently selected badge in this slot, if any. Selected *BadgeDefs_BadgeIssuanceView `json:"selected,omitempty"` } // RecordTypeID implements glex.Record. func (t *BadgeDefs_BadgeSlot) RecordTypeID() string { return "place.stream.badge.defs#badgeSlot" } func (t *BadgeDefs_BadgeSlot) 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.badge.defs#badgeSlot" return glex.MarshalCBOR(w, &cp) } func (t *BadgeDefs_BadgeSlot) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t) } // BadgeDefs_BadgeView is a "badgeView" in the place.stream.badge.defs schema. // // View of a badge record, with fields resolved for display. If the DID in issuer is not the current streamplace node, the signature field shall be required. type BadgeDefs_BadgeView struct { LexiconTypeID string `json:"$type,omitempty"` BadgeType string `json:"badgeType"` // description: Description from the badge definition. Description *string `json:"description,omitempty"` // imageUrl: Resolved image URL for the badge icon. ImageUrl *string `json:"imageUrl,omitempty"` // issuer: DID of the badge issuer. Issuer string `json:"issuer"` // name: Display name from the badge definition. Name *string `json:"name,omitempty"` // recipient: DID of the badge recipient. Recipient string `json:"recipient"` // signature: TODO: Cryptographic signature of the badge (of a place.stream.key). Signature *string `json:"signature,omitempty"` } // RecordTypeID implements glex.Record. func (t *BadgeDefs_BadgeView) RecordTypeID() string { return "place.stream.badge.defs#badgeView" } func (t *BadgeDefs_BadgeView) 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.badge.defs#badgeView" return glex.MarshalCBOR(w, &cp) } func (t *BadgeDefs_BadgeView) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t) }