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 ChannelsSetStickersRequest struct {
Channel InputChannelClass
Stickerset InputStickerSetClass
}
const ChannelsSetStickersRequestTypeID = 0xea8ca4f9
var (
_ bin .Encoder = &ChannelsSetStickersRequest {}
_ bin .Decoder = &ChannelsSetStickersRequest {}
_ bin .BareEncoder = &ChannelsSetStickersRequest {}
_ bin .BareDecoder = &ChannelsSetStickersRequest {}
)
func (s *ChannelsSetStickersRequest ) Zero () bool {
if s == nil {
return true
}
if !(s .Channel == nil ) {
return false
}
if !(s .Stickerset == nil ) {
return false
}
return true
}
func (s *ChannelsSetStickersRequest ) String () string {
if s == nil {
return "ChannelsSetStickersRequest(nil)"
}
type Alias ChannelsSetStickersRequest
return fmt .Sprintf ("ChannelsSetStickersRequest%+v" , Alias (*s ))
}
func (s *ChannelsSetStickersRequest ) FillFrom (from interface {
GetChannel () (value InputChannelClass )
GetStickerset () (value InputStickerSetClass )
}) {
s .Channel = from .GetChannel ()
s .Stickerset = from .GetStickerset ()
}
func (*ChannelsSetStickersRequest ) TypeID () uint32 {
return ChannelsSetStickersRequestTypeID
}
func (*ChannelsSetStickersRequest ) TypeName () string {
return "channels.setStickers"
}
func (s *ChannelsSetStickersRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "channels.setStickers" ,
ID : ChannelsSetStickersRequestTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Channel" ,
SchemaName : "channel" ,
},
{
Name : "Stickerset" ,
SchemaName : "stickerset" ,
},
}
return typ
}
func (s *ChannelsSetStickersRequest ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode channels.setStickers#ea8ca4f9 as nil" )
}
b .PutID (ChannelsSetStickersRequestTypeID )
return s .EncodeBare (b )
}
func (s *ChannelsSetStickersRequest ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode channels.setStickers#ea8ca4f9 as nil" )
}
if s .Channel == nil {
return fmt .Errorf ("unable to encode channels.setStickers#ea8ca4f9: field channel is nil" )
}
if err := s .Channel .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.setStickers#ea8ca4f9: field channel: %w" , err )
}
if s .Stickerset == nil {
return fmt .Errorf ("unable to encode channels.setStickers#ea8ca4f9: field stickerset is nil" )
}
if err := s .Stickerset .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.setStickers#ea8ca4f9: field stickerset: %w" , err )
}
return nil
}
func (s *ChannelsSetStickersRequest ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode channels.setStickers#ea8ca4f9 to nil" )
}
if err := b .ConsumeID (ChannelsSetStickersRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode channels.setStickers#ea8ca4f9: %w" , err )
}
return s .DecodeBare (b )
}
func (s *ChannelsSetStickersRequest ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode channels.setStickers#ea8ca4f9 to nil" )
}
{
value , err := DecodeInputChannel (b )
if err != nil {
return fmt .Errorf ("unable to decode channels.setStickers#ea8ca4f9: field channel: %w" , err )
}
s .Channel = value
}
{
value , err := DecodeInputStickerSet (b )
if err != nil {
return fmt .Errorf ("unable to decode channels.setStickers#ea8ca4f9: field stickerset: %w" , err )
}
s .Stickerset = value
}
return nil
}
func (s *ChannelsSetStickersRequest ) GetChannel () (value InputChannelClass ) {
if s == nil {
return
}
return s .Channel
}
func (s *ChannelsSetStickersRequest ) GetStickerset () (value InputStickerSetClass ) {
if s == nil {
return
}
return s .Stickerset
}
func (s *ChannelsSetStickersRequest ) GetChannelAsNotEmpty () (NotEmptyInputChannel , bool ) {
return s .Channel .AsNotEmpty ()
}
func (c *Client ) ChannelsSetStickers (ctx context .Context , request *ChannelsSetStickersRequest ) (bool , error ) {
var result BoolBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return false , err
}
_ , ok := result .Bool .(*BoolTrue )
return ok , 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 .