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