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 MessagesGetStickersRequest struct {
Emoticon string
Hash int64
}
const MessagesGetStickersRequestTypeID = 0xd5a5d3a1
var (
_ bin .Encoder = &MessagesGetStickersRequest {}
_ bin .Decoder = &MessagesGetStickersRequest {}
_ bin .BareEncoder = &MessagesGetStickersRequest {}
_ bin .BareDecoder = &MessagesGetStickersRequest {}
)
func (g *MessagesGetStickersRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Emoticon == "" ) {
return false
}
if !(g .Hash == 0 ) {
return false
}
return true
}
func (g *MessagesGetStickersRequest ) String () string {
if g == nil {
return "MessagesGetStickersRequest(nil)"
}
type Alias MessagesGetStickersRequest
return fmt .Sprintf ("MessagesGetStickersRequest%+v" , Alias (*g ))
}
func (g *MessagesGetStickersRequest ) FillFrom (from interface {
GetEmoticon () (value string )
GetHash () (value int64 )
}) {
g .Emoticon = from .GetEmoticon ()
g .Hash = from .GetHash ()
}
func (*MessagesGetStickersRequest ) TypeID () uint32 {
return MessagesGetStickersRequestTypeID
}
func (*MessagesGetStickersRequest ) TypeName () string {
return "messages.getStickers"
}
func (g *MessagesGetStickersRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.getStickers" ,
ID : MessagesGetStickersRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Emoticon" ,
SchemaName : "emoticon" ,
},
{
Name : "Hash" ,
SchemaName : "hash" ,
},
}
return typ
}
func (g *MessagesGetStickersRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode messages.getStickers#d5a5d3a1 as nil" )
}
b .PutID (MessagesGetStickersRequestTypeID )
return g .EncodeBare (b )
}
func (g *MessagesGetStickersRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode messages.getStickers#d5a5d3a1 as nil" )
}
b .PutString (g .Emoticon )
b .PutLong (g .Hash )
return nil
}
func (g *MessagesGetStickersRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode messages.getStickers#d5a5d3a1 to nil" )
}
if err := b .ConsumeID (MessagesGetStickersRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.getStickers#d5a5d3a1: %w" , err )
}
return g .DecodeBare (b )
}
func (g *MessagesGetStickersRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode messages.getStickers#d5a5d3a1 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messages.getStickers#d5a5d3a1: field emoticon: %w" , err )
}
g .Emoticon = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode messages.getStickers#d5a5d3a1: field hash: %w" , err )
}
g .Hash = value
}
return nil
}
func (g *MessagesGetStickersRequest ) GetEmoticon () (value string ) {
if g == nil {
return
}
return g .Emoticon
}
func (g *MessagesGetStickersRequest ) GetHash () (value int64 ) {
if g == nil {
return
}
return g .Hash
}
func (c *Client ) MessagesGetStickers (ctx context .Context , request *MessagesGetStickersRequest ) (MessagesStickersClass , error ) {
var result MessagesStickersBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .Stickers , 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 .