package tg
import (
"context"
"errors"
"fmt"
"sort"
"strings"
"go.uber.org/multierr"
"github.com/gotd/td/bin"
"github.com/gotd/td/tdjson"
"github.com/gotd/td/tdp"
"github.com/gotd/td/tgerr"
)
var (
_ = bin .Buffer {}
_ = context .Background ()
_ = fmt .Stringer (nil )
_ = strings .Builder {}
_ = errors .Is
_ = multierr .AppendInto
_ = sort .Ints
_ = tdp .Format
_ = tgerr .Error {}
_ = tdjson .Encoder {}
)
type MessageReportOption struct {
Text string
Option []byte
}
const MessageReportOptionTypeID = 0x7903e3d9
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
}
func (m *MessageReportOption ) String () string {
if m == nil {
return "MessageReportOption(nil)"
}
type Alias MessageReportOption
return fmt .Sprintf ("MessageReportOption%+v" , Alias (*m ))
}
func (m *MessageReportOption ) FillFrom (from interface {
GetText () (value string )
GetOption () (value []byte )
}) {
m .Text = from .GetText ()
m .Option = from .GetOption ()
}
func (*MessageReportOption ) TypeID () uint32 {
return MessageReportOptionTypeID
}
func (*MessageReportOption ) TypeName () string {
return "messageReportOption"
}
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
}
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 )
}
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
}
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 )
}
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
}
func (m *MessageReportOption ) GetText () (value string ) {
if m == nil {
return
}
return m .Text
}
func (m *MessageReportOption ) GetOption () (value []byte ) {
if m == nil {
return
}
return m .Option
}
The pages are generated with Golds v0.8.4 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds .