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 MessagesGetEmojiKeywordsLanguagesRequest struct {
LangCodes []string
}
const MessagesGetEmojiKeywordsLanguagesRequestTypeID = 0x4e9963b2
var (
_ bin .Encoder = &MessagesGetEmojiKeywordsLanguagesRequest {}
_ bin .Decoder = &MessagesGetEmojiKeywordsLanguagesRequest {}
_ bin .BareEncoder = &MessagesGetEmojiKeywordsLanguagesRequest {}
_ bin .BareDecoder = &MessagesGetEmojiKeywordsLanguagesRequest {}
)
func (g *MessagesGetEmojiKeywordsLanguagesRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .LangCodes == nil ) {
return false
}
return true
}
func (g *MessagesGetEmojiKeywordsLanguagesRequest ) String () string {
if g == nil {
return "MessagesGetEmojiKeywordsLanguagesRequest(nil)"
}
type Alias MessagesGetEmojiKeywordsLanguagesRequest
return fmt .Sprintf ("MessagesGetEmojiKeywordsLanguagesRequest%+v" , Alias (*g ))
}
func (g *MessagesGetEmojiKeywordsLanguagesRequest ) FillFrom (from interface {
GetLangCodes () (value []string )
}) {
g .LangCodes = from .GetLangCodes ()
}
func (*MessagesGetEmojiKeywordsLanguagesRequest ) TypeID () uint32 {
return MessagesGetEmojiKeywordsLanguagesRequestTypeID
}
func (*MessagesGetEmojiKeywordsLanguagesRequest ) TypeName () string {
return "messages.getEmojiKeywordsLanguages"
}
func (g *MessagesGetEmojiKeywordsLanguagesRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.getEmojiKeywordsLanguages" ,
ID : MessagesGetEmojiKeywordsLanguagesRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "LangCodes" ,
SchemaName : "lang_codes" ,
},
}
return typ
}
func (g *MessagesGetEmojiKeywordsLanguagesRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode messages.getEmojiKeywordsLanguages#4e9963b2 as nil" )
}
b .PutID (MessagesGetEmojiKeywordsLanguagesRequestTypeID )
return g .EncodeBare (b )
}
func (g *MessagesGetEmojiKeywordsLanguagesRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode messages.getEmojiKeywordsLanguages#4e9963b2 as nil" )
}
b .PutVectorHeader (len (g .LangCodes ))
for _ , v := range g .LangCodes {
b .PutString (v )
}
return nil
}
func (g *MessagesGetEmojiKeywordsLanguagesRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode messages.getEmojiKeywordsLanguages#4e9963b2 to nil" )
}
if err := b .ConsumeID (MessagesGetEmojiKeywordsLanguagesRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.getEmojiKeywordsLanguages#4e9963b2: %w" , err )
}
return g .DecodeBare (b )
}
func (g *MessagesGetEmojiKeywordsLanguagesRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode messages.getEmojiKeywordsLanguages#4e9963b2 to nil" )
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode messages.getEmojiKeywordsLanguages#4e9963b2: field lang_codes: %w" , err )
}
if headerLen > 0 {
g .LangCodes = make ([]string , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messages.getEmojiKeywordsLanguages#4e9963b2: field lang_codes: %w" , err )
}
g .LangCodes = append (g .LangCodes , value )
}
}
return nil
}
func (g *MessagesGetEmojiKeywordsLanguagesRequest ) GetLangCodes () (value []string ) {
if g == nil {
return
}
return g .LangCodes
}
func (c *Client ) MessagesGetEmojiKeywordsLanguages (ctx context .Context , langcodes []string ) ([]EmojiLanguage , error ) {
var result EmojiLanguageVector
request := &MessagesGetEmojiKeywordsLanguagesRequest {
LangCodes : langcodes ,
}
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return []EmojiLanguage (result .Elems ), 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 .