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 StickersSuggestShortNameRequest struct {
Title string
}
const StickersSuggestShortNameRequestTypeID = 0x4dafc503
var (
_ bin .Encoder = &StickersSuggestShortNameRequest {}
_ bin .Decoder = &StickersSuggestShortNameRequest {}
_ bin .BareEncoder = &StickersSuggestShortNameRequest {}
_ bin .BareDecoder = &StickersSuggestShortNameRequest {}
)
func (s *StickersSuggestShortNameRequest ) Zero () bool {
if s == nil {
return true
}
if !(s .Title == "" ) {
return false
}
return true
}
func (s *StickersSuggestShortNameRequest ) String () string {
if s == nil {
return "StickersSuggestShortNameRequest(nil)"
}
type Alias StickersSuggestShortNameRequest
return fmt .Sprintf ("StickersSuggestShortNameRequest%+v" , Alias (*s ))
}
func (s *StickersSuggestShortNameRequest ) FillFrom (from interface {
GetTitle () (value string )
}) {
s .Title = from .GetTitle ()
}
func (*StickersSuggestShortNameRequest ) TypeID () uint32 {
return StickersSuggestShortNameRequestTypeID
}
func (*StickersSuggestShortNameRequest ) TypeName () string {
return "stickers.suggestShortName"
}
func (s *StickersSuggestShortNameRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "stickers.suggestShortName" ,
ID : StickersSuggestShortNameRequestTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Title" ,
SchemaName : "title" ,
},
}
return typ
}
func (s *StickersSuggestShortNameRequest ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode stickers.suggestShortName#4dafc503 as nil" )
}
b .PutID (StickersSuggestShortNameRequestTypeID )
return s .EncodeBare (b )
}
func (s *StickersSuggestShortNameRequest ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode stickers.suggestShortName#4dafc503 as nil" )
}
b .PutString (s .Title )
return nil
}
func (s *StickersSuggestShortNameRequest ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode stickers.suggestShortName#4dafc503 to nil" )
}
if err := b .ConsumeID (StickersSuggestShortNameRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode stickers.suggestShortName#4dafc503: %w" , err )
}
return s .DecodeBare (b )
}
func (s *StickersSuggestShortNameRequest ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode stickers.suggestShortName#4dafc503 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode stickers.suggestShortName#4dafc503: field title: %w" , err )
}
s .Title = value
}
return nil
}
func (s *StickersSuggestShortNameRequest ) GetTitle () (value string ) {
if s == nil {
return
}
return s .Title
}
func (c *Client ) StickersSuggestShortName (ctx context .Context , title string ) (*StickersSuggestedShortName , error ) {
var result StickersSuggestedShortName
request := &StickersSuggestShortNameRequest {
Title : title ,
}
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 .