// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.moderation.createPin package placestream import ( "context" "io" glex "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" ) type ModerationCreatePin_Input struct { LexiconTypeID string `json:"$type,omitempty"` // expiresAt: Optional expiration time for this pin. ExpiresAt *string `json:"expiresAt,omitempty"` // messageUri: The AT-URI of the chat message to pin. MessageUri string `json:"messageUri"` // streamer: The DID of the streamer. Streamer string `json:"streamer"` } // RecordTypeID implements glex.Record. func (t *ModerationCreatePin_Input) RecordTypeID() string { return "place.stream.moderation.createPin" } func (t *ModerationCreatePin_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 = "place.stream.moderation.createPin" return glex.MarshalCBOR(w, &cp) } func (t *ModerationCreatePin_Input) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t) } type ModerationCreatePin_Output struct { LexiconTypeID string `json:"$type,omitempty"` // cid: The CID of the created pinned record. Cid string `json:"cid"` // uri: The AT-URI of the created pinned record. Uri string `json:"uri"` } // RecordTypeID implements glex.Record. func (t *ModerationCreatePin_Output) RecordTypeID() string { return "place.stream.moderation.createPin" } func (t *ModerationCreatePin_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 = "place.stream.moderation.createPin" return glex.MarshalCBOR(w, &cp) } func (t *ModerationCreatePin_Output) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t) } // ModerationCreatePin calls the XRPC method "place.stream.moderation.createPin". // // Pin a chat message on behalf of a streamer. Requires 'message.pin' permission. Creates a place.stream.chat.pinnedRecord in the streamer's repo, replacing any existing pin. func ModerationCreatePin(ctx context.Context, c glex.LexClient, input *ModerationCreatePin_Input) (*ModerationCreatePin_Output, error) { var out ModerationCreatePin_Output if err := c.LexDo(ctx, glex.Procedure, "application/json", "place.stream.moderation.createPin", nil, input, &out); err != nil { return nil, err } return &out, nil }