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 PendingSuggestion struct {
Suggestion string
Title TextWithEntities
Description TextWithEntities
URL string
}
const PendingSuggestionTypeID = 0xe7e82e12
var (
_ bin .Encoder = &PendingSuggestion {}
_ bin .Decoder = &PendingSuggestion {}
_ bin .BareEncoder = &PendingSuggestion {}
_ bin .BareDecoder = &PendingSuggestion {}
)
func (p *PendingSuggestion ) Zero () bool {
if p == nil {
return true
}
if !(p .Suggestion == "" ) {
return false
}
if !(p .Title .Zero ()) {
return false
}
if !(p .Description .Zero ()) {
return false
}
if !(p .URL == "" ) {
return false
}
return true
}
func (p *PendingSuggestion ) String () string {
if p == nil {
return "PendingSuggestion(nil)"
}
type Alias PendingSuggestion
return fmt .Sprintf ("PendingSuggestion%+v" , Alias (*p ))
}
func (p *PendingSuggestion ) FillFrom (from interface {
GetSuggestion () (value string )
GetTitle () (value TextWithEntities )
GetDescription () (value TextWithEntities )
GetURL () (value string )
}) {
p .Suggestion = from .GetSuggestion ()
p .Title = from .GetTitle ()
p .Description = from .GetDescription ()
p .URL = from .GetURL ()
}
func (*PendingSuggestion ) TypeID () uint32 {
return PendingSuggestionTypeID
}
func (*PendingSuggestion ) TypeName () string {
return "pendingSuggestion"
}
func (p *PendingSuggestion ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "pendingSuggestion" ,
ID : PendingSuggestionTypeID ,
}
if p == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Suggestion" ,
SchemaName : "suggestion" ,
},
{
Name : "Title" ,
SchemaName : "title" ,
},
{
Name : "Description" ,
SchemaName : "description" ,
},
{
Name : "URL" ,
SchemaName : "url" ,
},
}
return typ
}
func (p *PendingSuggestion ) Encode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode pendingSuggestion#e7e82e12 as nil" )
}
b .PutID (PendingSuggestionTypeID )
return p .EncodeBare (b )
}
func (p *PendingSuggestion ) EncodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode pendingSuggestion#e7e82e12 as nil" )
}
b .PutString (p .Suggestion )
if err := p .Title .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode pendingSuggestion#e7e82e12: field title: %w" , err )
}
if err := p .Description .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode pendingSuggestion#e7e82e12: field description: %w" , err )
}
b .PutString (p .URL )
return nil
}
func (p *PendingSuggestion ) Decode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode pendingSuggestion#e7e82e12 to nil" )
}
if err := b .ConsumeID (PendingSuggestionTypeID ); err != nil {
return fmt .Errorf ("unable to decode pendingSuggestion#e7e82e12: %w" , err )
}
return p .DecodeBare (b )
}
func (p *PendingSuggestion ) DecodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode pendingSuggestion#e7e82e12 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode pendingSuggestion#e7e82e12: field suggestion: %w" , err )
}
p .Suggestion = value
}
{
if err := p .Title .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode pendingSuggestion#e7e82e12: field title: %w" , err )
}
}
{
if err := p .Description .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode pendingSuggestion#e7e82e12: field description: %w" , err )
}
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode pendingSuggestion#e7e82e12: field url: %w" , err )
}
p .URL = value
}
return nil
}
func (p *PendingSuggestion ) GetSuggestion () (value string ) {
if p == nil {
return
}
return p .Suggestion
}
func (p *PendingSuggestion ) GetTitle () (value TextWithEntities ) {
if p == nil {
return
}
return p .Title
}
func (p *PendingSuggestion ) GetDescription () (value TextWithEntities ) {
if p == nil {
return
}
return p .Description
}
func (p *PendingSuggestion ) GetURL () (value string ) {
if p == nil {
return
}
return p .URL
}
The pages are generated with Golds v0.8.4 . (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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds .