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 MessagesTranslateResult struct {
Result []TextWithEntities
}
const MessagesTranslateResultTypeID = 0x33db32f8
var (
_ bin .Encoder = &MessagesTranslateResult {}
_ bin .Decoder = &MessagesTranslateResult {}
_ bin .BareEncoder = &MessagesTranslateResult {}
_ bin .BareDecoder = &MessagesTranslateResult {}
)
func (t *MessagesTranslateResult ) Zero () bool {
if t == nil {
return true
}
if !(t .Result == nil ) {
return false
}
return true
}
func (t *MessagesTranslateResult ) String () string {
if t == nil {
return "MessagesTranslateResult(nil)"
}
type Alias MessagesTranslateResult
return fmt .Sprintf ("MessagesTranslateResult%+v" , Alias (*t ))
}
func (t *MessagesTranslateResult ) FillFrom (from interface {
GetResult () (value []TextWithEntities )
}) {
t .Result = from .GetResult ()
}
func (*MessagesTranslateResult ) TypeID () uint32 {
return MessagesTranslateResultTypeID
}
func (*MessagesTranslateResult ) TypeName () string {
return "messages.translateResult"
}
func (t *MessagesTranslateResult ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.translateResult" ,
ID : MessagesTranslateResultTypeID ,
}
if t == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Result" ,
SchemaName : "result" ,
},
}
return typ
}
func (t *MessagesTranslateResult ) Encode (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't encode messages.translateResult#33db32f8 as nil" )
}
b .PutID (MessagesTranslateResultTypeID )
return t .EncodeBare (b )
}
func (t *MessagesTranslateResult ) EncodeBare (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't encode messages.translateResult#33db32f8 as nil" )
}
b .PutVectorHeader (len (t .Result ))
for idx , v := range t .Result {
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.translateResult#33db32f8: field result element with index %d: %w" , idx , err )
}
}
return nil
}
func (t *MessagesTranslateResult ) Decode (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't decode messages.translateResult#33db32f8 to nil" )
}
if err := b .ConsumeID (MessagesTranslateResultTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.translateResult#33db32f8: %w" , err )
}
return t .DecodeBare (b )
}
func (t *MessagesTranslateResult ) DecodeBare (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't decode messages.translateResult#33db32f8 to nil" )
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode messages.translateResult#33db32f8: field result: %w" , err )
}
if headerLen > 0 {
t .Result = make ([]TextWithEntities , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
var value TextWithEntities
if err := value .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode messages.translateResult#33db32f8: field result: %w" , err )
}
t .Result = append (t .Result , value )
}
}
return nil
}
func (t *MessagesTranslateResult ) GetResult () (value []TextWithEntities ) {
if t == nil {
return
}
return t .Result
}
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 .