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