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 LangpackGetLanguageRequest struct {
LangPack string
LangCode string
}
const LangpackGetLanguageRequestTypeID = 0x6a596502
var (
_ bin .Encoder = &LangpackGetLanguageRequest {}
_ bin .Decoder = &LangpackGetLanguageRequest {}
_ bin .BareEncoder = &LangpackGetLanguageRequest {}
_ bin .BareDecoder = &LangpackGetLanguageRequest {}
)
func (g *LangpackGetLanguageRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .LangPack == "" ) {
return false
}
if !(g .LangCode == "" ) {
return false
}
return true
}
func (g *LangpackGetLanguageRequest ) String () string {
if g == nil {
return "LangpackGetLanguageRequest(nil)"
}
type Alias LangpackGetLanguageRequest
return fmt .Sprintf ("LangpackGetLanguageRequest%+v" , Alias (*g ))
}
func (g *LangpackGetLanguageRequest ) FillFrom (from interface {
GetLangPack () (value string )
GetLangCode () (value string )
}) {
g .LangPack = from .GetLangPack ()
g .LangCode = from .GetLangCode ()
}
func (*LangpackGetLanguageRequest ) TypeID () uint32 {
return LangpackGetLanguageRequestTypeID
}
func (*LangpackGetLanguageRequest ) TypeName () string {
return "langpack.getLanguage"
}
func (g *LangpackGetLanguageRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "langpack.getLanguage" ,
ID : LangpackGetLanguageRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "LangPack" ,
SchemaName : "lang_pack" ,
},
{
Name : "LangCode" ,
SchemaName : "lang_code" ,
},
}
return typ
}
func (g *LangpackGetLanguageRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode langpack.getLanguage#6a596502 as nil" )
}
b .PutID (LangpackGetLanguageRequestTypeID )
return g .EncodeBare (b )
}
func (g *LangpackGetLanguageRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode langpack.getLanguage#6a596502 as nil" )
}
b .PutString (g .LangPack )
b .PutString (g .LangCode )
return nil
}
func (g *LangpackGetLanguageRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode langpack.getLanguage#6a596502 to nil" )
}
if err := b .ConsumeID (LangpackGetLanguageRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode langpack.getLanguage#6a596502: %w" , err )
}
return g .DecodeBare (b )
}
func (g *LangpackGetLanguageRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode langpack.getLanguage#6a596502 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode langpack.getLanguage#6a596502: field lang_pack: %w" , err )
}
g .LangPack = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode langpack.getLanguage#6a596502: field lang_code: %w" , err )
}
g .LangCode = value
}
return nil
}
func (g *LangpackGetLanguageRequest ) GetLangPack () (value string ) {
if g == nil {
return
}
return g .LangPack
}
func (g *LangpackGetLanguageRequest ) GetLangCode () (value string ) {
if g == nil {
return
}
return g .LangCode
}
func (c *Client ) LangpackGetLanguage (ctx context .Context , request *LangpackGetLanguageRequest ) (*LangPackLanguage , error ) {
var result LangPackLanguage
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , 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 .