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 MessagesGetDhConfigRequest struct {
Version int
RandomLength int
}
const MessagesGetDhConfigRequestTypeID = 0x26cf8950
var (
_ bin .Encoder = &MessagesGetDhConfigRequest {}
_ bin .Decoder = &MessagesGetDhConfigRequest {}
_ bin .BareEncoder = &MessagesGetDhConfigRequest {}
_ bin .BareDecoder = &MessagesGetDhConfigRequest {}
)
func (g *MessagesGetDhConfigRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Version == 0 ) {
return false
}
if !(g .RandomLength == 0 ) {
return false
}
return true
}
func (g *MessagesGetDhConfigRequest ) String () string {
if g == nil {
return "MessagesGetDhConfigRequest(nil)"
}
type Alias MessagesGetDhConfigRequest
return fmt .Sprintf ("MessagesGetDhConfigRequest%+v" , Alias (*g ))
}
func (g *MessagesGetDhConfigRequest ) FillFrom (from interface {
GetVersion () (value int )
GetRandomLength () (value int )
}) {
g .Version = from .GetVersion ()
g .RandomLength = from .GetRandomLength ()
}
func (*MessagesGetDhConfigRequest ) TypeID () uint32 {
return MessagesGetDhConfigRequestTypeID
}
func (*MessagesGetDhConfigRequest ) TypeName () string {
return "messages.getDhConfig"
}
func (g *MessagesGetDhConfigRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.getDhConfig" ,
ID : MessagesGetDhConfigRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Version" ,
SchemaName : "version" ,
},
{
Name : "RandomLength" ,
SchemaName : "random_length" ,
},
}
return typ
}
func (g *MessagesGetDhConfigRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode messages.getDhConfig#26cf8950 as nil" )
}
b .PutID (MessagesGetDhConfigRequestTypeID )
return g .EncodeBare (b )
}
func (g *MessagesGetDhConfigRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode messages.getDhConfig#26cf8950 as nil" )
}
b .PutInt (g .Version )
b .PutInt (g .RandomLength )
return nil
}
func (g *MessagesGetDhConfigRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode messages.getDhConfig#26cf8950 to nil" )
}
if err := b .ConsumeID (MessagesGetDhConfigRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.getDhConfig#26cf8950: %w" , err )
}
return g .DecodeBare (b )
}
func (g *MessagesGetDhConfigRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode messages.getDhConfig#26cf8950 to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.getDhConfig#26cf8950: field version: %w" , err )
}
g .Version = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.getDhConfig#26cf8950: field random_length: %w" , err )
}
g .RandomLength = value
}
return nil
}
func (g *MessagesGetDhConfigRequest ) GetVersion () (value int ) {
if g == nil {
return
}
return g .Version
}
func (g *MessagesGetDhConfigRequest ) GetRandomLength () (value int ) {
if g == nil {
return
}
return g .RandomLength
}
func (c *Client ) MessagesGetDhConfig (ctx context .Context , request *MessagesGetDhConfigRequest ) (MessagesDhConfigClass , error ) {
var result MessagesDhConfigBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .DhConfig , nil
}
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 .