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 ResPQ struct {
Nonce bin .Int128
ServerNonce bin .Int128
Pq []byte
ServerPublicKeyFingerprints []int64
}
const ResPQTypeID = 0x5162463
var (
_ bin .Encoder = &ResPQ {}
_ bin .Decoder = &ResPQ {}
_ bin .BareEncoder = &ResPQ {}
_ bin .BareDecoder = &ResPQ {}
)
func (r *ResPQ ) Zero () bool {
if r == nil {
return true
}
if !(r .Nonce == bin .Int128 {}) {
return false
}
if !(r .ServerNonce == bin .Int128 {}) {
return false
}
if !(r .Pq == nil ) {
return false
}
if !(r .ServerPublicKeyFingerprints == nil ) {
return false
}
return true
}
func (r *ResPQ ) String () string {
if r == nil {
return "ResPQ(nil)"
}
type Alias ResPQ
return fmt .Sprintf ("ResPQ%+v" , Alias (*r ))
}
func (*ResPQ ) TypeID () uint32 {
return ResPQTypeID
}
func (*ResPQ ) TypeName () string {
return "resPQ"
}
func (r *ResPQ ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "resPQ" ,
ID : ResPQTypeID ,
}
if r == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Nonce" ,
SchemaName : "nonce" ,
},
{
Name : "ServerNonce" ,
SchemaName : "server_nonce" ,
},
{
Name : "Pq" ,
SchemaName : "pq" ,
},
{
Name : "ServerPublicKeyFingerprints" ,
SchemaName : "server_public_key_fingerprints" ,
},
}
return typ
}
func (r *ResPQ ) Encode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode resPQ#5162463 as nil" )
}
b .PutID (ResPQTypeID )
return r .EncodeBare (b )
}
func (r *ResPQ ) EncodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode resPQ#5162463 as nil" )
}
b .PutInt128 (r .Nonce )
b .PutInt128 (r .ServerNonce )
b .PutBytes (r .Pq )
b .PutVectorHeader (len (r .ServerPublicKeyFingerprints ))
for _ , v := range r .ServerPublicKeyFingerprints {
b .PutLong (v )
}
return nil
}
func (r *ResPQ ) Decode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode resPQ#5162463 to nil" )
}
if err := b .ConsumeID (ResPQTypeID ); err != nil {
return fmt .Errorf ("unable to decode resPQ#5162463: %w" , err )
}
return r .DecodeBare (b )
}
func (r *ResPQ ) DecodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode resPQ#5162463 to nil" )
}
{
value , err := b .Int128 ()
if err != nil {
return fmt .Errorf ("unable to decode resPQ#5162463: field nonce: %w" , err )
}
r .Nonce = value
}
{
value , err := b .Int128 ()
if err != nil {
return fmt .Errorf ("unable to decode resPQ#5162463: field server_nonce: %w" , err )
}
r .ServerNonce = value
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode resPQ#5162463: field pq: %w" , err )
}
r .Pq = value
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode resPQ#5162463: field server_public_key_fingerprints: %w" , err )
}
if headerLen > 0 {
r .ServerPublicKeyFingerprints = make ([]int64 , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode resPQ#5162463: field server_public_key_fingerprints: %w" , err )
}
r .ServerPublicKeyFingerprints = append (r .ServerPublicKeyFingerprints , value )
}
}
return nil
}
func (r *ResPQ ) GetNonce () (value bin .Int128 ) {
if r == nil {
return
}
return r .Nonce
}
func (r *ResPQ ) GetServerNonce () (value bin .Int128 ) {
if r == nil {
return
}
return r .ServerNonce
}
func (r *ResPQ ) GetPq () (value []byte ) {
if r == nil {
return
}
return r .Pq
}
func (r *ResPQ ) GetServerPublicKeyFingerprints () (value []int64 ) {
if r == nil {
return
}
return r .ServerPublicKeyFingerprints
}
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 .