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 HelpGetCountriesListRequest struct {
LangCode string
Hash int
}
const HelpGetCountriesListRequestTypeID = 0x735787a8
var (
_ bin .Encoder = &HelpGetCountriesListRequest {}
_ bin .Decoder = &HelpGetCountriesListRequest {}
_ bin .BareEncoder = &HelpGetCountriesListRequest {}
_ bin .BareDecoder = &HelpGetCountriesListRequest {}
)
func (g *HelpGetCountriesListRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .LangCode == "" ) {
return false
}
if !(g .Hash == 0 ) {
return false
}
return true
}
func (g *HelpGetCountriesListRequest ) String () string {
if g == nil {
return "HelpGetCountriesListRequest(nil)"
}
type Alias HelpGetCountriesListRequest
return fmt .Sprintf ("HelpGetCountriesListRequest%+v" , Alias (*g ))
}
func (g *HelpGetCountriesListRequest ) FillFrom (from interface {
GetLangCode () (value string )
GetHash () (value int )
}) {
g .LangCode = from .GetLangCode ()
g .Hash = from .GetHash ()
}
func (*HelpGetCountriesListRequest ) TypeID () uint32 {
return HelpGetCountriesListRequestTypeID
}
func (*HelpGetCountriesListRequest ) TypeName () string {
return "help.getCountriesList"
}
func (g *HelpGetCountriesListRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "help.getCountriesList" ,
ID : HelpGetCountriesListRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "LangCode" ,
SchemaName : "lang_code" ,
},
{
Name : "Hash" ,
SchemaName : "hash" ,
},
}
return typ
}
func (g *HelpGetCountriesListRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode help.getCountriesList#735787a8 as nil" )
}
b .PutID (HelpGetCountriesListRequestTypeID )
return g .EncodeBare (b )
}
func (g *HelpGetCountriesListRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode help.getCountriesList#735787a8 as nil" )
}
b .PutString (g .LangCode )
b .PutInt (g .Hash )
return nil
}
func (g *HelpGetCountriesListRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode help.getCountriesList#735787a8 to nil" )
}
if err := b .ConsumeID (HelpGetCountriesListRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode help.getCountriesList#735787a8: %w" , err )
}
return g .DecodeBare (b )
}
func (g *HelpGetCountriesListRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode help.getCountriesList#735787a8 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode help.getCountriesList#735787a8: field lang_code: %w" , err )
}
g .LangCode = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode help.getCountriesList#735787a8: field hash: %w" , err )
}
g .Hash = value
}
return nil
}
func (g *HelpGetCountriesListRequest ) GetLangCode () (value string ) {
if g == nil {
return
}
return g .LangCode
}
func (g *HelpGetCountriesListRequest ) GetHash () (value int ) {
if g == nil {
return
}
return g .Hash
}
func (c *Client ) HelpGetCountriesList (ctx context .Context , request *HelpGetCountriesListRequest ) (HelpCountriesListClass , error ) {
var result HelpCountriesListBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .CountriesList , 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 .