package mt
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 PQInnerData struct {
Pq []byte
P []byte
Q []byte
Nonce bin .Int128
ServerNonce bin .Int128
NewNonce bin .Int256
}
const PQInnerDataTypeID = 0x83c95aec
func (p PQInnerData ) construct () PQInnerDataClass { return &p }
var (
_ bin .Encoder = &PQInnerData {}
_ bin .Decoder = &PQInnerData {}
_ bin .BareEncoder = &PQInnerData {}
_ bin .BareDecoder = &PQInnerData {}
_ PQInnerDataClass = &PQInnerData {}
)
func (p *PQInnerData ) Zero () bool {
if p == nil {
return true
}
if !(p .Pq == nil ) {
return false
}
if !(p .P == nil ) {
return false
}
if !(p .Q == nil ) {
return false
}
if !(p .Nonce == bin .Int128 {}) {
return false
}
if !(p .ServerNonce == bin .Int128 {}) {
return false
}
if !(p .NewNonce == bin .Int256 {}) {
return false
}
return true
}
func (p *PQInnerData ) String () string {
if p == nil {
return "PQInnerData(nil)"
}
type Alias PQInnerData
return fmt .Sprintf ("PQInnerData%+v" , Alias (*p ))
}
func (*PQInnerData ) TypeID () uint32 {
return PQInnerDataTypeID
}
func (*PQInnerData ) TypeName () string {
return "p_q_inner_data"
}
func (p *PQInnerData ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "p_q_inner_data" ,
ID : PQInnerDataTypeID ,
}
if p == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Pq" ,
SchemaName : "pq" ,
},
{
Name : "P" ,
SchemaName : "p" ,
},
{
Name : "Q" ,
SchemaName : "q" ,
},
{
Name : "Nonce" ,
SchemaName : "nonce" ,
},
{
Name : "ServerNonce" ,
SchemaName : "server_nonce" ,
},
{
Name : "NewNonce" ,
SchemaName : "new_nonce" ,
},
}
return typ
}
func (p *PQInnerData ) Encode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode p_q_inner_data#83c95aec as nil" )
}
b .PutID (PQInnerDataTypeID )
return p .EncodeBare (b )
}
func (p *PQInnerData ) EncodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode p_q_inner_data#83c95aec as nil" )
}
b .PutBytes (p .Pq )
b .PutBytes (p .P )
b .PutBytes (p .Q )
b .PutInt128 (p .Nonce )
b .PutInt128 (p .ServerNonce )
b .PutInt256 (p .NewNonce )
return nil
}
func (p *PQInnerData ) Decode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode p_q_inner_data#83c95aec to nil" )
}
if err := b .ConsumeID (PQInnerDataTypeID ); err != nil {
return fmt .Errorf ("unable to decode p_q_inner_data#83c95aec: %w" , err )
}
return p .DecodeBare (b )
}
func (p *PQInnerData ) DecodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode p_q_inner_data#83c95aec to nil" )
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode p_q_inner_data#83c95aec: field pq: %w" , err )
}
p .Pq = value
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode p_q_inner_data#83c95aec: field p: %w" , err )
}
p .P = value
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode p_q_inner_data#83c95aec: field q: %w" , err )
}
p .Q = value
}
{
value , err := b .Int128 ()
if err != nil {
return fmt .Errorf ("unable to decode p_q_inner_data#83c95aec: field nonce: %w" , err )
}
p .Nonce = value
}
{
value , err := b .Int128 ()
if err != nil {
return fmt .Errorf ("unable to decode p_q_inner_data#83c95aec: field server_nonce: %w" , err )
}
p .ServerNonce = value
}
{
value , err := b .Int256 ()
if err != nil {
return fmt .Errorf ("unable to decode p_q_inner_data#83c95aec: field new_nonce: %w" , err )
}
p .NewNonce = value
}
return nil
}
func (p *PQInnerData ) GetPq () (value []byte ) {
if p == nil {
return
}
return p .Pq
}
func (p *PQInnerData ) GetP () (value []byte ) {
if p == nil {
return
}
return p .P
}
func (p *PQInnerData ) GetQ () (value []byte ) {
if p == nil {
return
}
return p .Q
}
func (p *PQInnerData ) GetNonce () (value bin .Int128 ) {
if p == nil {
return
}
return p .Nonce
}
func (p *PQInnerData ) GetServerNonce () (value bin .Int128 ) {
if p == nil {
return
}
return p .ServerNonce
}
func (p *PQInnerData ) GetNewNonce () (value bin .Int256 ) {
if p == nil {
return
}
return p .NewNonce
}
type PQInnerDataDC struct {
Pq []byte
P []byte
Q []byte
Nonce bin .Int128
ServerNonce bin .Int128
NewNonce bin .Int256
DC int
}
const PQInnerDataDCTypeID = 0xa9f55f95
func (p PQInnerDataDC ) construct () PQInnerDataClass { return &p }
var (
_ bin .Encoder = &PQInnerDataDC {}
_ bin .Decoder = &PQInnerDataDC {}
_ bin .BareEncoder = &PQInnerDataDC {}
_ bin .BareDecoder = &PQInnerDataDC {}
_ PQInnerDataClass = &PQInnerDataDC {}
)
func (p *PQInnerDataDC ) Zero () bool {
if p == nil {
return true
}
if !(p .Pq == nil ) {
return false
}
if !(p .P == nil ) {
return false
}
if !(p .Q == nil ) {
return false
}
if !(p .Nonce == bin .Int128 {}) {
return false
}
if !(p .ServerNonce == bin .Int128 {}) {
return false
}
if !(p .NewNonce == bin .Int256 {}) {
return false
}
if !(p .DC == 0 ) {
return false
}
return true
}
func (p *PQInnerDataDC ) String () string {
if p == nil {
return "PQInnerDataDC(nil)"
}
type Alias PQInnerDataDC
return fmt .Sprintf ("PQInnerDataDC%+v" , Alias (*p ))
}
func (*PQInnerDataDC ) TypeID () uint32 {
return PQInnerDataDCTypeID
}
func (*PQInnerDataDC ) TypeName () string {
return "p_q_inner_data_dc"
}
func (p *PQInnerDataDC ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "p_q_inner_data_dc" ,
ID : PQInnerDataDCTypeID ,
}
if p == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Pq" ,
SchemaName : "pq" ,
},
{
Name : "P" ,
SchemaName : "p" ,
},
{
Name : "Q" ,
SchemaName : "q" ,
},
{
Name : "Nonce" ,
SchemaName : "nonce" ,
},
{
Name : "ServerNonce" ,
SchemaName : "server_nonce" ,
},
{
Name : "NewNonce" ,
SchemaName : "new_nonce" ,
},
{
Name : "DC" ,
SchemaName : "dc" ,
},
}
return typ
}
func (p *PQInnerDataDC ) Encode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode p_q_inner_data_dc#a9f55f95 as nil" )
}
b .PutID (PQInnerDataDCTypeID )
return p .EncodeBare (b )
}
func (p *PQInnerDataDC ) EncodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode p_q_inner_data_dc#a9f55f95 as nil" )
}
b .PutBytes (p .Pq )
b .PutBytes (p .P )
b .PutBytes (p .Q )
b .PutInt128 (p .Nonce )
b .PutInt128 (p .ServerNonce )
b .PutInt256 (p .NewNonce )
b .PutInt (p .DC )
return nil
}
func (p *PQInnerDataDC ) Decode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode p_q_inner_data_dc#a9f55f95 to nil" )
}
if err := b .ConsumeID (PQInnerDataDCTypeID ); err != nil {
return fmt .Errorf ("unable to decode p_q_inner_data_dc#a9f55f95: %w" , err )
}
return p .DecodeBare (b )
}
func (p *PQInnerDataDC ) DecodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode p_q_inner_data_dc#a9f55f95 to nil" )
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode p_q_inner_data_dc#a9f55f95: field pq: %w" , err )
}
p .Pq = value
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode p_q_inner_data_dc#a9f55f95: field p: %w" , err )
}
p .P = value
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode p_q_inner_data_dc#a9f55f95: field q: %w" , err )
}
p .Q = value
}
{
value , err := b .Int128 ()
if err != nil {
return fmt .Errorf ("unable to decode p_q_inner_data_dc#a9f55f95: field nonce: %w" , err )
}
p .Nonce = value
}
{
value , err := b .Int128 ()
if err != nil {
return fmt .Errorf ("unable to decode p_q_inner_data_dc#a9f55f95: field server_nonce: %w" , err )
}
p .ServerNonce = value
}
{
value , err := b .Int256 ()
if err != nil {
return fmt .Errorf ("unable to decode p_q_inner_data_dc#a9f55f95: field new_nonce: %w" , err )
}
p .NewNonce = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode p_q_inner_data_dc#a9f55f95: field dc: %w" , err )
}
p .DC = value
}
return nil
}
func (p *PQInnerDataDC ) GetPq () (value []byte ) {
if p == nil {
return
}
return p .Pq
}
func (p *PQInnerDataDC ) GetP () (value []byte ) {
if p == nil {
return
}
return p .P
}
func (p *PQInnerDataDC ) GetQ () (value []byte ) {
if p == nil {
return
}
return p .Q
}
func (p *PQInnerDataDC ) GetNonce () (value bin .Int128 ) {
if p == nil {
return
}
return p .Nonce
}
func (p *PQInnerDataDC ) GetServerNonce () (value bin .Int128 ) {
if p == nil {
return
}
return p .ServerNonce
}
func (p *PQInnerDataDC ) GetNewNonce () (value bin .Int256 ) {
if p == nil {
return
}
return p .NewNonce
}
func (p *PQInnerDataDC ) GetDC () (value int ) {
if p == nil {
return
}
return p .DC
}
type PQInnerDataTempDC struct {
Pq []byte
P []byte
Q []byte
Nonce bin .Int128
ServerNonce bin .Int128
NewNonce bin .Int256
DC int
ExpiresIn int
}
const PQInnerDataTempDCTypeID = 0x56fddf88
func (p PQInnerDataTempDC ) construct () PQInnerDataClass { return &p }
var (
_ bin .Encoder = &PQInnerDataTempDC {}
_ bin .Decoder = &PQInnerDataTempDC {}
_ bin .BareEncoder = &PQInnerDataTempDC {}
_ bin .BareDecoder = &PQInnerDataTempDC {}
_ PQInnerDataClass = &PQInnerDataTempDC {}
)
func (p *PQInnerDataTempDC ) Zero () bool {
if p == nil {
return true
}
if !(p .Pq == nil ) {
return false
}
if !(p .P == nil ) {
return false
}
if !(p .Q == nil ) {
return false
}
if !(p .Nonce == bin .Int128 {}) {
return false
}
if !(p .ServerNonce == bin .Int128 {}) {
return false
}
if !(p .NewNonce == bin .Int256 {}) {
return false
}
if !(p .DC == 0 ) {
return false
}
if !(p .ExpiresIn == 0 ) {
return false
}
return true
}
func (p *PQInnerDataTempDC ) String () string {
if p == nil {
return "PQInnerDataTempDC(nil)"
}
type Alias PQInnerDataTempDC
return fmt .Sprintf ("PQInnerDataTempDC%+v" , Alias (*p ))
}
func (*PQInnerDataTempDC ) TypeID () uint32 {
return PQInnerDataTempDCTypeID
}
func (*PQInnerDataTempDC ) TypeName () string {
return "p_q_inner_data_temp_dc"
}
func (p *PQInnerDataTempDC ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "p_q_inner_data_temp_dc" ,
ID : PQInnerDataTempDCTypeID ,
}
if p == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Pq" ,
SchemaName : "pq" ,
},
{
Name : "P" ,
SchemaName : "p" ,
},
{
Name : "Q" ,
SchemaName : "q" ,
},
{
Name : "Nonce" ,
SchemaName : "nonce" ,
},
{
Name : "ServerNonce" ,
SchemaName : "server_nonce" ,
},
{
Name : "NewNonce" ,
SchemaName : "new_nonce" ,
},
{
Name : "DC" ,
SchemaName : "dc" ,
},
{
Name : "ExpiresIn" ,
SchemaName : "expires_in" ,
},
}
return typ
}
func (p *PQInnerDataTempDC ) Encode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode p_q_inner_data_temp_dc#56fddf88 as nil" )
}
b .PutID (PQInnerDataTempDCTypeID )
return p .EncodeBare (b )
}
func (p *PQInnerDataTempDC ) EncodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode p_q_inner_data_temp_dc#56fddf88 as nil" )
}
b .PutBytes (p .Pq )
b .PutBytes (p .P )
b .PutBytes (p .Q )
b .PutInt128 (p .Nonce )
b .PutInt128 (p .ServerNonce )
b .PutInt256 (p .NewNonce )
b .PutInt (p .DC )
b .PutInt (p .ExpiresIn )
return nil
}
func (p *PQInnerDataTempDC ) Decode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode p_q_inner_data_temp_dc#56fddf88 to nil" )
}
if err := b .ConsumeID (PQInnerDataTempDCTypeID ); err != nil {
return fmt .Errorf ("unable to decode p_q_inner_data_temp_dc#56fddf88: %w" , err )
}
return p .DecodeBare (b )
}
func (p *PQInnerDataTempDC ) DecodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode p_q_inner_data_temp_dc#56fddf88 to nil" )
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode p_q_inner_data_temp_dc#56fddf88: field pq: %w" , err )
}
p .Pq = value
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode p_q_inner_data_temp_dc#56fddf88: field p: %w" , err )
}
p .P = value
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode p_q_inner_data_temp_dc#56fddf88: field q: %w" , err )
}
p .Q = value
}
{
value , err := b .Int128 ()
if err != nil {
return fmt .Errorf ("unable to decode p_q_inner_data_temp_dc#56fddf88: field nonce: %w" , err )
}
p .Nonce = value
}
{
value , err := b .Int128 ()
if err != nil {
return fmt .Errorf ("unable to decode p_q_inner_data_temp_dc#56fddf88: field server_nonce: %w" , err )
}
p .ServerNonce = value
}
{
value , err := b .Int256 ()
if err != nil {
return fmt .Errorf ("unable to decode p_q_inner_data_temp_dc#56fddf88: field new_nonce: %w" , err )
}
p .NewNonce = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode p_q_inner_data_temp_dc#56fddf88: field dc: %w" , err )
}
p .DC = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode p_q_inner_data_temp_dc#56fddf88: field expires_in: %w" , err )
}
p .ExpiresIn = value
}
return nil
}
func (p *PQInnerDataTempDC ) GetPq () (value []byte ) {
if p == nil {
return
}
return p .Pq
}
func (p *PQInnerDataTempDC ) GetP () (value []byte ) {
if p == nil {
return
}
return p .P
}
func (p *PQInnerDataTempDC ) GetQ () (value []byte ) {
if p == nil {
return
}
return p .Q
}
func (p *PQInnerDataTempDC ) GetNonce () (value bin .Int128 ) {
if p == nil {
return
}
return p .Nonce
}
func (p *PQInnerDataTempDC ) GetServerNonce () (value bin .Int128 ) {
if p == nil {
return
}
return p .ServerNonce
}
func (p *PQInnerDataTempDC ) GetNewNonce () (value bin .Int256 ) {
if p == nil {
return
}
return p .NewNonce
}
func (p *PQInnerDataTempDC ) GetDC () (value int ) {
if p == nil {
return
}
return p .DC
}
func (p *PQInnerDataTempDC ) GetExpiresIn () (value int ) {
if p == nil {
return
}
return p .ExpiresIn
}
const PQInnerDataClassName = "P_Q_inner_data"
type PQInnerDataClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () PQInnerDataClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
GetPq () (value []byte )
GetP () (value []byte )
GetQ () (value []byte )
GetNonce () (value bin .Int128 )
GetServerNonce () (value bin .Int128 )
GetNewNonce () (value bin .Int256 )
}
func DecodePQInnerData (buf *bin .Buffer ) (PQInnerDataClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case PQInnerDataTypeID :
v := PQInnerData {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode PQInnerDataClass: %w" , err )
}
return &v , nil
case PQInnerDataDCTypeID :
v := PQInnerDataDC {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode PQInnerDataClass: %w" , err )
}
return &v , nil
case PQInnerDataTempDCTypeID :
v := PQInnerDataTempDC {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode PQInnerDataClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode PQInnerDataClass: %w" , bin .NewUnexpectedID (id ))
}
}
type PQInnerDataBox struct {
P_Q_inner_data PQInnerDataClass
}
func (b *PQInnerDataBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode PQInnerDataBox to nil" )
}
v , err := DecodePQInnerData (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .P_Q_inner_data = v
return nil
}
func (b *PQInnerDataBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .P_Q_inner_data == nil {
return fmt .Errorf ("unable to encode PQInnerDataClass as nil" )
}
return b .P_Q_inner_data .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 .