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 MessagesSentEncryptedMessage struct {
Date int
}
const MessagesSentEncryptedMessageTypeID = 0x560f8935
func (s MessagesSentEncryptedMessage ) construct () MessagesSentEncryptedMessageClass { return &s }
var (
_ bin .Encoder = &MessagesSentEncryptedMessage {}
_ bin .Decoder = &MessagesSentEncryptedMessage {}
_ bin .BareEncoder = &MessagesSentEncryptedMessage {}
_ bin .BareDecoder = &MessagesSentEncryptedMessage {}
_ MessagesSentEncryptedMessageClass = &MessagesSentEncryptedMessage {}
)
func (s *MessagesSentEncryptedMessage ) Zero () bool {
if s == nil {
return true
}
if !(s .Date == 0 ) {
return false
}
return true
}
func (s *MessagesSentEncryptedMessage ) String () string {
if s == nil {
return "MessagesSentEncryptedMessage(nil)"
}
type Alias MessagesSentEncryptedMessage
return fmt .Sprintf ("MessagesSentEncryptedMessage%+v" , Alias (*s ))
}
func (s *MessagesSentEncryptedMessage ) FillFrom (from interface {
GetDate () (value int )
}) {
s .Date = from .GetDate ()
}
func (*MessagesSentEncryptedMessage ) TypeID () uint32 {
return MessagesSentEncryptedMessageTypeID
}
func (*MessagesSentEncryptedMessage ) TypeName () string {
return "messages.sentEncryptedMessage"
}
func (s *MessagesSentEncryptedMessage ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.sentEncryptedMessage" ,
ID : MessagesSentEncryptedMessageTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Date" ,
SchemaName : "date" ,
},
}
return typ
}
func (s *MessagesSentEncryptedMessage ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.sentEncryptedMessage#560f8935 as nil" )
}
b .PutID (MessagesSentEncryptedMessageTypeID )
return s .EncodeBare (b )
}
func (s *MessagesSentEncryptedMessage ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.sentEncryptedMessage#560f8935 as nil" )
}
b .PutInt (s .Date )
return nil
}
func (s *MessagesSentEncryptedMessage ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.sentEncryptedMessage#560f8935 to nil" )
}
if err := b .ConsumeID (MessagesSentEncryptedMessageTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.sentEncryptedMessage#560f8935: %w" , err )
}
return s .DecodeBare (b )
}
func (s *MessagesSentEncryptedMessage ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.sentEncryptedMessage#560f8935 to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.sentEncryptedMessage#560f8935: field date: %w" , err )
}
s .Date = value
}
return nil
}
func (s *MessagesSentEncryptedMessage ) GetDate () (value int ) {
if s == nil {
return
}
return s .Date
}
type MessagesSentEncryptedFile struct {
Date int
File EncryptedFileClass
}
const MessagesSentEncryptedFileTypeID = 0x9493ff32
func (s MessagesSentEncryptedFile ) construct () MessagesSentEncryptedMessageClass { return &s }
var (
_ bin .Encoder = &MessagesSentEncryptedFile {}
_ bin .Decoder = &MessagesSentEncryptedFile {}
_ bin .BareEncoder = &MessagesSentEncryptedFile {}
_ bin .BareDecoder = &MessagesSentEncryptedFile {}
_ MessagesSentEncryptedMessageClass = &MessagesSentEncryptedFile {}
)
func (s *MessagesSentEncryptedFile ) Zero () bool {
if s == nil {
return true
}
if !(s .Date == 0 ) {
return false
}
if !(s .File == nil ) {
return false
}
return true
}
func (s *MessagesSentEncryptedFile ) String () string {
if s == nil {
return "MessagesSentEncryptedFile(nil)"
}
type Alias MessagesSentEncryptedFile
return fmt .Sprintf ("MessagesSentEncryptedFile%+v" , Alias (*s ))
}
func (s *MessagesSentEncryptedFile ) FillFrom (from interface {
GetDate () (value int )
GetFile () (value EncryptedFileClass )
}) {
s .Date = from .GetDate ()
s .File = from .GetFile ()
}
func (*MessagesSentEncryptedFile ) TypeID () uint32 {
return MessagesSentEncryptedFileTypeID
}
func (*MessagesSentEncryptedFile ) TypeName () string {
return "messages.sentEncryptedFile"
}
func (s *MessagesSentEncryptedFile ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.sentEncryptedFile" ,
ID : MessagesSentEncryptedFileTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Date" ,
SchemaName : "date" ,
},
{
Name : "File" ,
SchemaName : "file" ,
},
}
return typ
}
func (s *MessagesSentEncryptedFile ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.sentEncryptedFile#9493ff32 as nil" )
}
b .PutID (MessagesSentEncryptedFileTypeID )
return s .EncodeBare (b )
}
func (s *MessagesSentEncryptedFile ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.sentEncryptedFile#9493ff32 as nil" )
}
b .PutInt (s .Date )
if s .File == nil {
return fmt .Errorf ("unable to encode messages.sentEncryptedFile#9493ff32: field file is nil" )
}
if err := s .File .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.sentEncryptedFile#9493ff32: field file: %w" , err )
}
return nil
}
func (s *MessagesSentEncryptedFile ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.sentEncryptedFile#9493ff32 to nil" )
}
if err := b .ConsumeID (MessagesSentEncryptedFileTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.sentEncryptedFile#9493ff32: %w" , err )
}
return s .DecodeBare (b )
}
func (s *MessagesSentEncryptedFile ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.sentEncryptedFile#9493ff32 to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.sentEncryptedFile#9493ff32: field date: %w" , err )
}
s .Date = value
}
{
value , err := DecodeEncryptedFile (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.sentEncryptedFile#9493ff32: field file: %w" , err )
}
s .File = value
}
return nil
}
func (s *MessagesSentEncryptedFile ) GetDate () (value int ) {
if s == nil {
return
}
return s .Date
}
func (s *MessagesSentEncryptedFile ) GetFile () (value EncryptedFileClass ) {
if s == nil {
return
}
return s .File
}
const MessagesSentEncryptedMessageClassName = "messages.SentEncryptedMessage"
type MessagesSentEncryptedMessageClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () MessagesSentEncryptedMessageClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
GetDate () (value int )
}
func DecodeMessagesSentEncryptedMessage (buf *bin .Buffer ) (MessagesSentEncryptedMessageClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case MessagesSentEncryptedMessageTypeID :
v := MessagesSentEncryptedMessage {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MessagesSentEncryptedMessageClass: %w" , err )
}
return &v , nil
case MessagesSentEncryptedFileTypeID :
v := MessagesSentEncryptedFile {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MessagesSentEncryptedMessageClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode MessagesSentEncryptedMessageClass: %w" , bin .NewUnexpectedID (id ))
}
}
type MessagesSentEncryptedMessageBox struct {
SentEncryptedMessage MessagesSentEncryptedMessageClass
}
func (b *MessagesSentEncryptedMessageBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode MessagesSentEncryptedMessageBox to nil" )
}
v , err := DecodeMessagesSentEncryptedMessage (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .SentEncryptedMessage = v
return nil
}
func (b *MessagesSentEncryptedMessageBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .SentEncryptedMessage == nil {
return fmt .Errorf ("unable to encode MessagesSentEncryptedMessageClass as nil" )
}
return b .SentEncryptedMessage .Encode (buf )
}
The pages are generated with Golds v0.6.7 . (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 @Go100and1 (reachable from the left QR code) to get the latest news of Golds .