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 MessagesGetStickerSetRequest struct {
Stickerset InputStickerSetClass
Hash int
}
const MessagesGetStickerSetRequestTypeID = 0xc8a0ec74
var (
_ bin .Encoder = &MessagesGetStickerSetRequest {}
_ bin .Decoder = &MessagesGetStickerSetRequest {}
_ bin .BareEncoder = &MessagesGetStickerSetRequest {}
_ bin .BareDecoder = &MessagesGetStickerSetRequest {}
)
func (g *MessagesGetStickerSetRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Stickerset == nil ) {
return false
}
if !(g .Hash == 0 ) {
return false
}
return true
}
func (g *MessagesGetStickerSetRequest ) String () string {
if g == nil {
return "MessagesGetStickerSetRequest(nil)"
}
type Alias MessagesGetStickerSetRequest
return fmt .Sprintf ("MessagesGetStickerSetRequest%+v" , Alias (*g ))
}
func (g *MessagesGetStickerSetRequest ) FillFrom (from interface {
GetStickerset () (value InputStickerSetClass )
GetHash () (value int )
}) {
g .Stickerset = from .GetStickerset ()
g .Hash = from .GetHash ()
}
func (*MessagesGetStickerSetRequest ) TypeID () uint32 {
return MessagesGetStickerSetRequestTypeID
}
func (*MessagesGetStickerSetRequest ) TypeName () string {
return "messages.getStickerSet"
}
func (g *MessagesGetStickerSetRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.getStickerSet" ,
ID : MessagesGetStickerSetRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Stickerset" ,
SchemaName : "stickerset" ,
},
{
Name : "Hash" ,
SchemaName : "hash" ,
},
}
return typ
}
func (g *MessagesGetStickerSetRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode messages.getStickerSet#c8a0ec74 as nil" )
}
b .PutID (MessagesGetStickerSetRequestTypeID )
return g .EncodeBare (b )
}
func (g *MessagesGetStickerSetRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode messages.getStickerSet#c8a0ec74 as nil" )
}
if g .Stickerset == nil {
return fmt .Errorf ("unable to encode messages.getStickerSet#c8a0ec74: field stickerset is nil" )
}
if err := g .Stickerset .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.getStickerSet#c8a0ec74: field stickerset: %w" , err )
}
b .PutInt (g .Hash )
return nil
}
func (g *MessagesGetStickerSetRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode messages.getStickerSet#c8a0ec74 to nil" )
}
if err := b .ConsumeID (MessagesGetStickerSetRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.getStickerSet#c8a0ec74: %w" , err )
}
return g .DecodeBare (b )
}
func (g *MessagesGetStickerSetRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode messages.getStickerSet#c8a0ec74 to nil" )
}
{
value , err := DecodeInputStickerSet (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.getStickerSet#c8a0ec74: field stickerset: %w" , err )
}
g .Stickerset = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.getStickerSet#c8a0ec74: field hash: %w" , err )
}
g .Hash = value
}
return nil
}
func (g *MessagesGetStickerSetRequest ) GetStickerset () (value InputStickerSetClass ) {
if g == nil {
return
}
return g .Stickerset
}
func (g *MessagesGetStickerSetRequest ) GetHash () (value int ) {
if g == nil {
return
}
return g .Hash
}
func (c *Client ) MessagesGetStickerSet (ctx context .Context , request *MessagesGetStickerSetRequest ) (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 .