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 StickersSetStickerSetThumbRequest struct {
Flags bin .Fields
Stickerset InputStickerSetClass
Thumb InputDocumentClass
ThumbDocumentID int64
}
const StickersSetStickerSetThumbRequestTypeID = 0xa76a5392
var (
_ bin .Encoder = &StickersSetStickerSetThumbRequest {}
_ bin .Decoder = &StickersSetStickerSetThumbRequest {}
_ bin .BareEncoder = &StickersSetStickerSetThumbRequest {}
_ bin .BareDecoder = &StickersSetStickerSetThumbRequest {}
)
func (s *StickersSetStickerSetThumbRequest ) Zero () bool {
if s == nil {
return true
}
if !(s .Flags .Zero ()) {
return false
}
if !(s .Stickerset == nil ) {
return false
}
if !(s .Thumb == nil ) {
return false
}
if !(s .ThumbDocumentID == 0 ) {
return false
}
return true
}
func (s *StickersSetStickerSetThumbRequest ) String () string {
if s == nil {
return "StickersSetStickerSetThumbRequest(nil)"
}
type Alias StickersSetStickerSetThumbRequest
return fmt .Sprintf ("StickersSetStickerSetThumbRequest%+v" , Alias (*s ))
}
func (s *StickersSetStickerSetThumbRequest ) FillFrom (from interface {
GetStickerset () (value InputStickerSetClass )
GetThumb () (value InputDocumentClass , ok bool )
GetThumbDocumentID () (value int64 , ok bool )
}) {
s .Stickerset = from .GetStickerset ()
if val , ok := from .GetThumb (); ok {
s .Thumb = val
}
if val , ok := from .GetThumbDocumentID (); ok {
s .ThumbDocumentID = val
}
}
func (*StickersSetStickerSetThumbRequest ) TypeID () uint32 {
return StickersSetStickerSetThumbRequestTypeID
}
func (*StickersSetStickerSetThumbRequest ) TypeName () string {
return "stickers.setStickerSetThumb"
}
func (s *StickersSetStickerSetThumbRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "stickers.setStickerSetThumb" ,
ID : StickersSetStickerSetThumbRequestTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Stickerset" ,
SchemaName : "stickerset" ,
},
{
Name : "Thumb" ,
SchemaName : "thumb" ,
Null : !s .Flags .Has (0 ),
},
{
Name : "ThumbDocumentID" ,
SchemaName : "thumb_document_id" ,
Null : !s .Flags .Has (1 ),
},
}
return typ
}
func (s *StickersSetStickerSetThumbRequest ) SetFlags () {
if !(s .Thumb == nil ) {
s .Flags .Set (0 )
}
if !(s .ThumbDocumentID == 0 ) {
s .Flags .Set (1 )
}
}
func (s *StickersSetStickerSetThumbRequest ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode stickers.setStickerSetThumb#a76a5392 as nil" )
}
b .PutID (StickersSetStickerSetThumbRequestTypeID )
return s .EncodeBare (b )
}
func (s *StickersSetStickerSetThumbRequest ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode stickers.setStickerSetThumb#a76a5392 as nil" )
}
s .SetFlags ()
if err := s .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode stickers.setStickerSetThumb#a76a5392: field flags: %w" , err )
}
if s .Stickerset == nil {
return fmt .Errorf ("unable to encode stickers.setStickerSetThumb#a76a5392: field stickerset is nil" )
}
if err := s .Stickerset .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode stickers.setStickerSetThumb#a76a5392: field stickerset: %w" , err )
}
if s .Flags .Has (0 ) {
if s .Thumb == nil {
return fmt .Errorf ("unable to encode stickers.setStickerSetThumb#a76a5392: field thumb is nil" )
}
if err := s .Thumb .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode stickers.setStickerSetThumb#a76a5392: field thumb: %w" , err )
}
}
if s .Flags .Has (1 ) {
b .PutLong (s .ThumbDocumentID )
}
return nil
}
func (s *StickersSetStickerSetThumbRequest ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode stickers.setStickerSetThumb#a76a5392 to nil" )
}
if err := b .ConsumeID (StickersSetStickerSetThumbRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode stickers.setStickerSetThumb#a76a5392: %w" , err )
}
return s .DecodeBare (b )
}
func (s *StickersSetStickerSetThumbRequest ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode stickers.setStickerSetThumb#a76a5392 to nil" )
}
{
if err := s .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode stickers.setStickerSetThumb#a76a5392: field flags: %w" , err )
}
}
{
value , err := DecodeInputStickerSet (b )
if err != nil {
return fmt .Errorf ("unable to decode stickers.setStickerSetThumb#a76a5392: field stickerset: %w" , err )
}
s .Stickerset = value
}
if s .Flags .Has (0 ) {
value , err := DecodeInputDocument (b )
if err != nil {
return fmt .Errorf ("unable to decode stickers.setStickerSetThumb#a76a5392: field thumb: %w" , err )
}
s .Thumb = value
}
if s .Flags .Has (1 ) {
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode stickers.setStickerSetThumb#a76a5392: field thumb_document_id: %w" , err )
}
s .ThumbDocumentID = value
}
return nil
}
func (s *StickersSetStickerSetThumbRequest ) GetStickerset () (value InputStickerSetClass ) {
if s == nil {
return
}
return s .Stickerset
}
func (s *StickersSetStickerSetThumbRequest ) SetThumb (value InputDocumentClass ) {
s .Flags .Set (0 )
s .Thumb = value
}
func (s *StickersSetStickerSetThumbRequest ) GetThumb () (value InputDocumentClass , ok bool ) {
if s == nil {
return
}
if !s .Flags .Has (0 ) {
return value , false
}
return s .Thumb , true
}
func (s *StickersSetStickerSetThumbRequest ) SetThumbDocumentID (value int64 ) {
s .Flags .Set (1 )
s .ThumbDocumentID = value
}
func (s *StickersSetStickerSetThumbRequest ) GetThumbDocumentID () (value int64 , ok bool ) {
if s == nil {
return
}
if !s .Flags .Has (1 ) {
return value , false
}
return s .ThumbDocumentID , true
}
func (s *StickersSetStickerSetThumbRequest ) GetThumbAsNotEmpty () (*InputDocument , bool ) {
if value , ok := s .GetThumb (); ok {
return value .AsNotEmpty ()
}
return nil , false
}
func (c *Client ) StickersSetStickerSetThumb (ctx context .Context , request *StickersSetStickerSetThumbRequest ) (MessagesStickerSetClass , error ) {
var result MessagesStickerSetBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .StickerSet , 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 .