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 MessagesDhConfigNotModified struct {
Random []byte
}
const MessagesDhConfigNotModifiedTypeID = 0xc0e24635
func (d MessagesDhConfigNotModified ) construct () MessagesDhConfigClass { return &d }
var (
_ bin .Encoder = &MessagesDhConfigNotModified {}
_ bin .Decoder = &MessagesDhConfigNotModified {}
_ bin .BareEncoder = &MessagesDhConfigNotModified {}
_ bin .BareDecoder = &MessagesDhConfigNotModified {}
_ MessagesDhConfigClass = &MessagesDhConfigNotModified {}
)
func (d *MessagesDhConfigNotModified ) Zero () bool {
if d == nil {
return true
}
if !(d .Random == nil ) {
return false
}
return true
}
func (d *MessagesDhConfigNotModified ) String () string {
if d == nil {
return "MessagesDhConfigNotModified(nil)"
}
type Alias MessagesDhConfigNotModified
return fmt .Sprintf ("MessagesDhConfigNotModified%+v" , Alias (*d ))
}
func (d *MessagesDhConfigNotModified ) FillFrom (from interface {
GetRandom () (value []byte )
}) {
d .Random = from .GetRandom ()
}
func (*MessagesDhConfigNotModified ) TypeID () uint32 {
return MessagesDhConfigNotModifiedTypeID
}
func (*MessagesDhConfigNotModified ) TypeName () string {
return "messages.dhConfigNotModified"
}
func (d *MessagesDhConfigNotModified ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.dhConfigNotModified" ,
ID : MessagesDhConfigNotModifiedTypeID ,
}
if d == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Random" ,
SchemaName : "random" ,
},
}
return typ
}
func (d *MessagesDhConfigNotModified ) Encode (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't encode messages.dhConfigNotModified#c0e24635 as nil" )
}
b .PutID (MessagesDhConfigNotModifiedTypeID )
return d .EncodeBare (b )
}
func (d *MessagesDhConfigNotModified ) EncodeBare (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't encode messages.dhConfigNotModified#c0e24635 as nil" )
}
b .PutBytes (d .Random )
return nil
}
func (d *MessagesDhConfigNotModified ) Decode (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't decode messages.dhConfigNotModified#c0e24635 to nil" )
}
if err := b .ConsumeID (MessagesDhConfigNotModifiedTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.dhConfigNotModified#c0e24635: %w" , err )
}
return d .DecodeBare (b )
}
func (d *MessagesDhConfigNotModified ) DecodeBare (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't decode messages.dhConfigNotModified#c0e24635 to nil" )
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode messages.dhConfigNotModified#c0e24635: field random: %w" , err )
}
d .Random = value
}
return nil
}
func (d *MessagesDhConfigNotModified ) GetRandom () (value []byte ) {
if d == nil {
return
}
return d .Random
}
type MessagesDhConfig struct {
G int
P []byte
Version int
Random []byte
}
const MessagesDhConfigTypeID = 0x2c221edd
func (d MessagesDhConfig ) construct () MessagesDhConfigClass { return &d }
var (
_ bin .Encoder = &MessagesDhConfig {}
_ bin .Decoder = &MessagesDhConfig {}
_ bin .BareEncoder = &MessagesDhConfig {}
_ bin .BareDecoder = &MessagesDhConfig {}
_ MessagesDhConfigClass = &MessagesDhConfig {}
)
func (d *MessagesDhConfig ) Zero () bool {
if d == nil {
return true
}
if !(d .G == 0 ) {
return false
}
if !(d .P == nil ) {
return false
}
if !(d .Version == 0 ) {
return false
}
if !(d .Random == nil ) {
return false
}
return true
}
func (d *MessagesDhConfig ) String () string {
if d == nil {
return "MessagesDhConfig(nil)"
}
type Alias MessagesDhConfig
return fmt .Sprintf ("MessagesDhConfig%+v" , Alias (*d ))
}
func (d *MessagesDhConfig ) FillFrom (from interface {
GetG () (value int )
GetP () (value []byte )
GetVersion () (value int )
GetRandom () (value []byte )
}) {
d .G = from .GetG ()
d .P = from .GetP ()
d .Version = from .GetVersion ()
d .Random = from .GetRandom ()
}
func (*MessagesDhConfig ) TypeID () uint32 {
return MessagesDhConfigTypeID
}
func (*MessagesDhConfig ) TypeName () string {
return "messages.dhConfig"
}
func (d *MessagesDhConfig ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.dhConfig" ,
ID : MessagesDhConfigTypeID ,
}
if d == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "G" ,
SchemaName : "g" ,
},
{
Name : "P" ,
SchemaName : "p" ,
},
{
Name : "Version" ,
SchemaName : "version" ,
},
{
Name : "Random" ,
SchemaName : "random" ,
},
}
return typ
}
func (d *MessagesDhConfig ) Encode (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't encode messages.dhConfig#2c221edd as nil" )
}
b .PutID (MessagesDhConfigTypeID )
return d .EncodeBare (b )
}
func (d *MessagesDhConfig ) EncodeBare (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't encode messages.dhConfig#2c221edd as nil" )
}
b .PutInt (d .G )
b .PutBytes (d .P )
b .PutInt (d .Version )
b .PutBytes (d .Random )
return nil
}
func (d *MessagesDhConfig ) Decode (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't decode messages.dhConfig#2c221edd to nil" )
}
if err := b .ConsumeID (MessagesDhConfigTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.dhConfig#2c221edd: %w" , err )
}
return d .DecodeBare (b )
}
func (d *MessagesDhConfig ) DecodeBare (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't decode messages.dhConfig#2c221edd to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.dhConfig#2c221edd: field g: %w" , err )
}
d .G = value
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode messages.dhConfig#2c221edd: field p: %w" , err )
}
d .P = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.dhConfig#2c221edd: field version: %w" , err )
}
d .Version = value
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode messages.dhConfig#2c221edd: field random: %w" , err )
}
d .Random = value
}
return nil
}
func (d *MessagesDhConfig ) GetG () (value int ) {
if d == nil {
return
}
return d .G
}
func (d *MessagesDhConfig ) GetP () (value []byte ) {
if d == nil {
return
}
return d .P
}
func (d *MessagesDhConfig ) GetVersion () (value int ) {
if d == nil {
return
}
return d .Version
}
func (d *MessagesDhConfig ) GetRandom () (value []byte ) {
if d == nil {
return
}
return d .Random
}
const MessagesDhConfigClassName = "messages.DhConfig"
type MessagesDhConfigClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () MessagesDhConfigClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
GetRandom () (value []byte )
AsModified () (*MessagesDhConfig , bool )
}
func (d *MessagesDhConfigNotModified ) AsModified () (*MessagesDhConfig , bool ) {
return nil , false
}
func (d *MessagesDhConfig ) AsModified () (*MessagesDhConfig , bool ) {
return d , true
}
func DecodeMessagesDhConfig (buf *bin .Buffer ) (MessagesDhConfigClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case MessagesDhConfigNotModifiedTypeID :
v := MessagesDhConfigNotModified {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MessagesDhConfigClass: %w" , err )
}
return &v , nil
case MessagesDhConfigTypeID :
v := MessagesDhConfig {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MessagesDhConfigClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode MessagesDhConfigClass: %w" , bin .NewUnexpectedID (id ))
}
}
type MessagesDhConfigBox struct {
DhConfig MessagesDhConfigClass
}
func (b *MessagesDhConfigBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode MessagesDhConfigBox to nil" )
}
v , err := DecodeMessagesDhConfig (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .DhConfig = v
return nil
}
func (b *MessagesDhConfigBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .DhConfig == nil {
return fmt .Errorf ("unable to encode MessagesDhConfigClass as nil" )
}
return b .DhConfig .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 .