7a04f298d2
- update to latest telegram layer - remove some references to fields in tg.Entities that don't exist in the schema - originally added here: https://github.com/beeper/td/commit/820929062a2ba0104397bc01235ab58a9cff780e - referenced here - https://github.com/mautrix/telegramgo/commit/124f0967ed195b5a380c9bd02e170ada9710dde3 - https://github.com/mautrix/telegramgo/commit/4205047aab2e0639217148b5d125bfaab668bd8e
194 lines
4.3 KiB
Go
Generated
194 lines
4.3 KiB
Go
Generated
// Code generated by gotdgen, DO NOT EDIT.
|
|
|
|
package tg
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"fmt"
|
|
"sort"
|
|
"strings"
|
|
|
|
"go.uber.org/multierr"
|
|
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/bin"
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/tdjson"
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/tdp"
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/tgerr"
|
|
)
|
|
|
|
// No-op definition for keeping imports.
|
|
var (
|
|
_ = bin.Buffer{}
|
|
_ = context.Background()
|
|
_ = fmt.Stringer(nil)
|
|
_ = strings.Builder{}
|
|
_ = errors.Is
|
|
_ = multierr.AppendInto
|
|
_ = sort.Ints
|
|
_ = tdp.Format
|
|
_ = tgerr.Error{}
|
|
_ = tdjson.Encoder{}
|
|
)
|
|
|
|
// MessageReportOption represents TL type `messageReportOption#7903e3d9`.
|
|
// Report menu option
|
|
//
|
|
// See https://core.telegram.org/constructor/messageReportOption for reference.
|
|
type MessageReportOption struct {
|
|
// Option title
|
|
Text string
|
|
// Option identifier: if the user selects this option, re-invoke messages.report¹,
|
|
// passing this option to option
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/method/messages.report
|
|
Option []byte
|
|
}
|
|
|
|
// MessageReportOptionTypeID is TL type id of MessageReportOption.
|
|
const MessageReportOptionTypeID = 0x7903e3d9
|
|
|
|
// Ensuring interfaces in compile-time for MessageReportOption.
|
|
var (
|
|
_ bin.Encoder = &MessageReportOption{}
|
|
_ bin.Decoder = &MessageReportOption{}
|
|
_ bin.BareEncoder = &MessageReportOption{}
|
|
_ bin.BareDecoder = &MessageReportOption{}
|
|
)
|
|
|
|
func (m *MessageReportOption) Zero() bool {
|
|
if m == nil {
|
|
return true
|
|
}
|
|
if !(m.Text == "") {
|
|
return false
|
|
}
|
|
if !(m.Option == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (m *MessageReportOption) String() string {
|
|
if m == nil {
|
|
return "MessageReportOption(nil)"
|
|
}
|
|
type Alias MessageReportOption
|
|
return fmt.Sprintf("MessageReportOption%+v", Alias(*m))
|
|
}
|
|
|
|
// FillFrom fills MessageReportOption from given interface.
|
|
func (m *MessageReportOption) FillFrom(from interface {
|
|
GetText() (value string)
|
|
GetOption() (value []byte)
|
|
}) {
|
|
m.Text = from.GetText()
|
|
m.Option = from.GetOption()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*MessageReportOption) TypeID() uint32 {
|
|
return MessageReportOptionTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*MessageReportOption) TypeName() string {
|
|
return "messageReportOption"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (m *MessageReportOption) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "messageReportOption",
|
|
ID: MessageReportOptionTypeID,
|
|
}
|
|
if m == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Text",
|
|
SchemaName: "text",
|
|
},
|
|
{
|
|
Name: "Option",
|
|
SchemaName: "option",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (m *MessageReportOption) Encode(b *bin.Buffer) error {
|
|
if m == nil {
|
|
return fmt.Errorf("can't encode messageReportOption#7903e3d9 as nil")
|
|
}
|
|
b.PutID(MessageReportOptionTypeID)
|
|
return m.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (m *MessageReportOption) EncodeBare(b *bin.Buffer) error {
|
|
if m == nil {
|
|
return fmt.Errorf("can't encode messageReportOption#7903e3d9 as nil")
|
|
}
|
|
b.PutString(m.Text)
|
|
b.PutBytes(m.Option)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (m *MessageReportOption) Decode(b *bin.Buffer) error {
|
|
if m == nil {
|
|
return fmt.Errorf("can't decode messageReportOption#7903e3d9 to nil")
|
|
}
|
|
if err := b.ConsumeID(MessageReportOptionTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode messageReportOption#7903e3d9: %w", err)
|
|
}
|
|
return m.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (m *MessageReportOption) DecodeBare(b *bin.Buffer) error {
|
|
if m == nil {
|
|
return fmt.Errorf("can't decode messageReportOption#7903e3d9 to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode messageReportOption#7903e3d9: field text: %w", err)
|
|
}
|
|
m.Text = value
|
|
}
|
|
{
|
|
value, err := b.Bytes()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode messageReportOption#7903e3d9: field option: %w", err)
|
|
}
|
|
m.Option = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetText returns value of Text field.
|
|
func (m *MessageReportOption) GetText() (value string) {
|
|
if m == nil {
|
|
return
|
|
}
|
|
return m.Text
|
|
}
|
|
|
|
// GetOption returns value of Option field.
|
|
func (m *MessageReportOption) GetOption() (value []byte) {
|
|
if m == nil {
|
|
return
|
|
}
|
|
return m.Option
|
|
}
|