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 InputEncryptedChat struct {
ChatID int
AccessHash int64
}
const InputEncryptedChatTypeID = 0xf141b5e1
var (
_ bin .Encoder = &InputEncryptedChat {}
_ bin .Decoder = &InputEncryptedChat {}
_ bin .BareEncoder = &InputEncryptedChat {}
_ bin .BareDecoder = &InputEncryptedChat {}
)
func (i *InputEncryptedChat ) Zero () bool {
if i == nil {
return true
}
if !(i .ChatID == 0 ) {
return false
}
if !(i .AccessHash == 0 ) {
return false
}
return true
}
func (i *InputEncryptedChat ) String () string {
if i == nil {
return "InputEncryptedChat(nil)"
}
type Alias InputEncryptedChat
return fmt .Sprintf ("InputEncryptedChat%+v" , Alias (*i ))
}
func (i *InputEncryptedChat ) FillFrom (from interface {
GetChatID () (value int )
GetAccessHash () (value int64 )
}) {
i .ChatID = from .GetChatID ()
i .AccessHash = from .GetAccessHash ()
}
func (*InputEncryptedChat ) TypeID () uint32 {
return InputEncryptedChatTypeID
}
func (*InputEncryptedChat ) TypeName () string {
return "inputEncryptedChat"
}
func (i *InputEncryptedChat ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputEncryptedChat" ,
ID : InputEncryptedChatTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ChatID" ,
SchemaName : "chat_id" ,
},
{
Name : "AccessHash" ,
SchemaName : "access_hash" ,
},
}
return typ
}
func (i *InputEncryptedChat ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputEncryptedChat#f141b5e1 as nil" )
}
b .PutID (InputEncryptedChatTypeID )
return i .EncodeBare (b )
}
func (i *InputEncryptedChat ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputEncryptedChat#f141b5e1 as nil" )
}
b .PutInt (i .ChatID )
b .PutLong (i .AccessHash )
return nil
}
func (i *InputEncryptedChat ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputEncryptedChat#f141b5e1 to nil" )
}
if err := b .ConsumeID (InputEncryptedChatTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputEncryptedChat#f141b5e1: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputEncryptedChat ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputEncryptedChat#f141b5e1 to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode inputEncryptedChat#f141b5e1: field chat_id: %w" , err )
}
i .ChatID = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode inputEncryptedChat#f141b5e1: field access_hash: %w" , err )
}
i .AccessHash = value
}
return nil
}
func (i *InputEncryptedChat ) GetChatID () (value int ) {
if i == nil {
return
}
return i .ChatID
}
func (i *InputEncryptedChat ) GetAccessHash () (value int64 ) {
if i == nil {
return
}
return i .AccessHash
}
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 .