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 MessagesGetAttachedStickersRequest struct {
Media InputStickeredMediaClass
}
const MessagesGetAttachedStickersRequestTypeID = 0xcc5b67cc
var (
_ bin .Encoder = &MessagesGetAttachedStickersRequest {}
_ bin .Decoder = &MessagesGetAttachedStickersRequest {}
_ bin .BareEncoder = &MessagesGetAttachedStickersRequest {}
_ bin .BareDecoder = &MessagesGetAttachedStickersRequest {}
)
func (g *MessagesGetAttachedStickersRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Media == nil ) {
return false
}
return true
}
func (g *MessagesGetAttachedStickersRequest ) String () string {
if g == nil {
return "MessagesGetAttachedStickersRequest(nil)"
}
type Alias MessagesGetAttachedStickersRequest
return fmt .Sprintf ("MessagesGetAttachedStickersRequest%+v" , Alias (*g ))
}
func (g *MessagesGetAttachedStickersRequest ) FillFrom (from interface {
GetMedia () (value InputStickeredMediaClass )
}) {
g .Media = from .GetMedia ()
}
func (*MessagesGetAttachedStickersRequest ) TypeID () uint32 {
return MessagesGetAttachedStickersRequestTypeID
}
func (*MessagesGetAttachedStickersRequest ) TypeName () string {
return "messages.getAttachedStickers"
}
func (g *MessagesGetAttachedStickersRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.getAttachedStickers" ,
ID : MessagesGetAttachedStickersRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Media" ,
SchemaName : "media" ,
},
}
return typ
}
func (g *MessagesGetAttachedStickersRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode messages.getAttachedStickers#cc5b67cc as nil" )
}
b .PutID (MessagesGetAttachedStickersRequestTypeID )
return g .EncodeBare (b )
}
func (g *MessagesGetAttachedStickersRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode messages.getAttachedStickers#cc5b67cc as nil" )
}
if g .Media == nil {
return fmt .Errorf ("unable to encode messages.getAttachedStickers#cc5b67cc: field media is nil" )
}
if err := g .Media .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.getAttachedStickers#cc5b67cc: field media: %w" , err )
}
return nil
}
func (g *MessagesGetAttachedStickersRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode messages.getAttachedStickers#cc5b67cc to nil" )
}
if err := b .ConsumeID (MessagesGetAttachedStickersRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.getAttachedStickers#cc5b67cc: %w" , err )
}
return g .DecodeBare (b )
}
func (g *MessagesGetAttachedStickersRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode messages.getAttachedStickers#cc5b67cc to nil" )
}
{
value , err := DecodeInputStickeredMedia (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.getAttachedStickers#cc5b67cc: field media: %w" , err )
}
g .Media = value
}
return nil
}
func (g *MessagesGetAttachedStickersRequest ) GetMedia () (value InputStickeredMediaClass ) {
if g == nil {
return
}
return g .Media
}
func (c *Client ) MessagesGetAttachedStickers (ctx context .Context , media InputStickeredMediaClass ) ([]StickerSetCoveredClass , error ) {
var result StickerSetCoveredClassVector
request := &MessagesGetAttachedStickersRequest {
Media : media ,
}
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return []StickerSetCoveredClass (result .Elems ), 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 .