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 StickersAddStickerToSetRequest struct {
Stickerset InputStickerSetClass
Sticker InputStickerSetItem
}
const StickersAddStickerToSetRequestTypeID = 0x8653febe
var (
_ bin .Encoder = &StickersAddStickerToSetRequest {}
_ bin .Decoder = &StickersAddStickerToSetRequest {}
_ bin .BareEncoder = &StickersAddStickerToSetRequest {}
_ bin .BareDecoder = &StickersAddStickerToSetRequest {}
)
func (a *StickersAddStickerToSetRequest ) Zero () bool {
if a == nil {
return true
}
if !(a .Stickerset == nil ) {
return false
}
if !(a .Sticker .Zero ()) {
return false
}
return true
}
func (a *StickersAddStickerToSetRequest ) String () string {
if a == nil {
return "StickersAddStickerToSetRequest(nil)"
}
type Alias StickersAddStickerToSetRequest
return fmt .Sprintf ("StickersAddStickerToSetRequest%+v" , Alias (*a ))
}
func (a *StickersAddStickerToSetRequest ) FillFrom (from interface {
GetStickerset () (value InputStickerSetClass )
GetSticker () (value InputStickerSetItem )
}) {
a .Stickerset = from .GetStickerset ()
a .Sticker = from .GetSticker ()
}
func (*StickersAddStickerToSetRequest ) TypeID () uint32 {
return StickersAddStickerToSetRequestTypeID
}
func (*StickersAddStickerToSetRequest ) TypeName () string {
return "stickers.addStickerToSet"
}
func (a *StickersAddStickerToSetRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "stickers.addStickerToSet" ,
ID : StickersAddStickerToSetRequestTypeID ,
}
if a == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Stickerset" ,
SchemaName : "stickerset" ,
},
{
Name : "Sticker" ,
SchemaName : "sticker" ,
},
}
return typ
}
func (a *StickersAddStickerToSetRequest ) Encode (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't encode stickers.addStickerToSet#8653febe as nil" )
}
b .PutID (StickersAddStickerToSetRequestTypeID )
return a .EncodeBare (b )
}
func (a *StickersAddStickerToSetRequest ) EncodeBare (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't encode stickers.addStickerToSet#8653febe as nil" )
}
if a .Stickerset == nil {
return fmt .Errorf ("unable to encode stickers.addStickerToSet#8653febe: field stickerset is nil" )
}
if err := a .Stickerset .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode stickers.addStickerToSet#8653febe: field stickerset: %w" , err )
}
if err := a .Sticker .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode stickers.addStickerToSet#8653febe: field sticker: %w" , err )
}
return nil
}
func (a *StickersAddStickerToSetRequest ) Decode (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't decode stickers.addStickerToSet#8653febe to nil" )
}
if err := b .ConsumeID (StickersAddStickerToSetRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode stickers.addStickerToSet#8653febe: %w" , err )
}
return a .DecodeBare (b )
}
func (a *StickersAddStickerToSetRequest ) DecodeBare (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't decode stickers.addStickerToSet#8653febe to nil" )
}
{
value , err := DecodeInputStickerSet (b )
if err != nil {
return fmt .Errorf ("unable to decode stickers.addStickerToSet#8653febe: field stickerset: %w" , err )
}
a .Stickerset = value
}
{
if err := a .Sticker .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode stickers.addStickerToSet#8653febe: field sticker: %w" , err )
}
}
return nil
}
func (a *StickersAddStickerToSetRequest ) GetStickerset () (value InputStickerSetClass ) {
if a == nil {
return
}
return a .Stickerset
}
func (a *StickersAddStickerToSetRequest ) GetSticker () (value InputStickerSetItem ) {
if a == nil {
return
}
return a .Sticker
}
func (c *Client ) StickersAddStickerToSet (ctx context .Context , request *StickersAddStickerToSetRequest ) (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 .