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 StickerKeyword struct {
DocumentID int64
Keyword []string
}
const StickerKeywordTypeID = 0xfcfeb29c
var (
_ bin .Encoder = &StickerKeyword {}
_ bin .Decoder = &StickerKeyword {}
_ bin .BareEncoder = &StickerKeyword {}
_ bin .BareDecoder = &StickerKeyword {}
)
func (s *StickerKeyword ) Zero () bool {
if s == nil {
return true
}
if !(s .DocumentID == 0 ) {
return false
}
if !(s .Keyword == nil ) {
return false
}
return true
}
func (s *StickerKeyword ) String () string {
if s == nil {
return "StickerKeyword(nil)"
}
type Alias StickerKeyword
return fmt .Sprintf ("StickerKeyword%+v" , Alias (*s ))
}
func (s *StickerKeyword ) FillFrom (from interface {
GetDocumentID () (value int64 )
GetKeyword () (value []string )
}) {
s .DocumentID = from .GetDocumentID ()
s .Keyword = from .GetKeyword ()
}
func (*StickerKeyword ) TypeID () uint32 {
return StickerKeywordTypeID
}
func (*StickerKeyword ) TypeName () string {
return "stickerKeyword"
}
func (s *StickerKeyword ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "stickerKeyword" ,
ID : StickerKeywordTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "DocumentID" ,
SchemaName : "document_id" ,
},
{
Name : "Keyword" ,
SchemaName : "keyword" ,
},
}
return typ
}
func (s *StickerKeyword ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode stickerKeyword#fcfeb29c as nil" )
}
b .PutID (StickerKeywordTypeID )
return s .EncodeBare (b )
}
func (s *StickerKeyword ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode stickerKeyword#fcfeb29c as nil" )
}
b .PutLong (s .DocumentID )
b .PutVectorHeader (len (s .Keyword ))
for _ , v := range s .Keyword {
b .PutString (v )
}
return nil
}
func (s *StickerKeyword ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode stickerKeyword#fcfeb29c to nil" )
}
if err := b .ConsumeID (StickerKeywordTypeID ); err != nil {
return fmt .Errorf ("unable to decode stickerKeyword#fcfeb29c: %w" , err )
}
return s .DecodeBare (b )
}
func (s *StickerKeyword ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode stickerKeyword#fcfeb29c to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode stickerKeyword#fcfeb29c: field document_id: %w" , err )
}
s .DocumentID = value
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode stickerKeyword#fcfeb29c: field keyword: %w" , err )
}
if headerLen > 0 {
s .Keyword = 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 stickerKeyword#fcfeb29c: field keyword: %w" , err )
}
s .Keyword = append (s .Keyword , value )
}
}
return nil
}
func (s *StickerKeyword ) GetDocumentID () (value int64 ) {
if s == nil {
return
}
return s .DocumentID
}
func (s *StickerKeyword ) GetKeyword () (value []string ) {
if s == nil {
return
}
return s .Keyword
}
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 .