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 ReqDHParamsRequest struct {
Nonce bin .Int128
ServerNonce bin .Int128
P []byte
Q []byte
PublicKeyFingerprint int64
EncryptedData []byte
}
const ReqDHParamsRequestTypeID = 0xd712e4be
var (
_ bin .Encoder = &ReqDHParamsRequest {}
_ bin .Decoder = &ReqDHParamsRequest {}
_ bin .BareEncoder = &ReqDHParamsRequest {}
_ bin .BareDecoder = &ReqDHParamsRequest {}
)
func (r *ReqDHParamsRequest ) Zero () bool {
if r == nil {
return true
}
if !(r .Nonce == bin .Int128 {}) {
return false
}
if !(r .ServerNonce == bin .Int128 {}) {
return false
}
if !(r .P == nil ) {
return false
}
if !(r .Q == nil ) {
return false
}
if !(r .PublicKeyFingerprint == 0 ) {
return false
}
if !(r .EncryptedData == nil ) {
return false
}
return true
}
func (r *ReqDHParamsRequest ) String () string {
if r == nil {
return "ReqDHParamsRequest(nil)"
}
type Alias ReqDHParamsRequest
return fmt .Sprintf ("ReqDHParamsRequest%+v" , Alias (*r ))
}
func (*ReqDHParamsRequest ) TypeID () uint32 {
return ReqDHParamsRequestTypeID
}
func (*ReqDHParamsRequest ) TypeName () string {
return "req_DH_params"
}
func (r *ReqDHParamsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "req_DH_params" ,
ID : ReqDHParamsRequestTypeID ,
}
if r == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Nonce" ,
SchemaName : "nonce" ,
},
{
Name : "ServerNonce" ,
SchemaName : "server_nonce" ,
},
{
Name : "P" ,
SchemaName : "p" ,
},
{
Name : "Q" ,
SchemaName : "q" ,
},
{
Name : "PublicKeyFingerprint" ,
SchemaName : "public_key_fingerprint" ,
},
{
Name : "EncryptedData" ,
SchemaName : "encrypted_data" ,
},
}
return typ
}
func (r *ReqDHParamsRequest ) Encode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode req_DH_params#d712e4be as nil" )
}
b .PutID (ReqDHParamsRequestTypeID )
return r .EncodeBare (b )
}
func (r *ReqDHParamsRequest ) EncodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode req_DH_params#d712e4be as nil" )
}
b .PutInt128 (r .Nonce )
b .PutInt128 (r .ServerNonce )
b .PutBytes (r .P )
b .PutBytes (r .Q )
b .PutLong (r .PublicKeyFingerprint )
b .PutBytes (r .EncryptedData )
return nil
}
func (r *ReqDHParamsRequest ) Decode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode req_DH_params#d712e4be to nil" )
}
if err := b .ConsumeID (ReqDHParamsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode req_DH_params#d712e4be: %w" , err )
}
return r .DecodeBare (b )
}
func (r *ReqDHParamsRequest ) DecodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode req_DH_params#d712e4be to nil" )
}
{
value , err := b .Int128 ()
if err != nil {
return fmt .Errorf ("unable to decode req_DH_params#d712e4be: field nonce: %w" , err )
}
r .Nonce = value
}
{
value , err := b .Int128 ()
if err != nil {
return fmt .Errorf ("unable to decode req_DH_params#d712e4be: field server_nonce: %w" , err )
}
r .ServerNonce = value
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode req_DH_params#d712e4be: field p: %w" , err )
}
r .P = value
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode req_DH_params#d712e4be: field q: %w" , err )
}
r .Q = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode req_DH_params#d712e4be: field public_key_fingerprint: %w" , err )
}
r .PublicKeyFingerprint = value
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode req_DH_params#d712e4be: field encrypted_data: %w" , err )
}
r .EncryptedData = value
}
return nil
}
func (r *ReqDHParamsRequest ) GetNonce () (value bin .Int128 ) {
if r == nil {
return
}
return r .Nonce
}
func (r *ReqDHParamsRequest ) GetServerNonce () (value bin .Int128 ) {
if r == nil {
return
}
return r .ServerNonce
}
func (r *ReqDHParamsRequest ) GetP () (value []byte ) {
if r == nil {
return
}
return r .P
}
func (r *ReqDHParamsRequest ) GetQ () (value []byte ) {
if r == nil {
return
}
return r .Q
}
func (r *ReqDHParamsRequest ) GetPublicKeyFingerprint () (value int64 ) {
if r == nil {
return
}
return r .PublicKeyFingerprint
}
func (r *ReqDHParamsRequest ) GetEncryptedData () (value []byte ) {
if r == nil {
return
}
return r .EncryptedData
}
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 .