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 StickersChangeStickerPositionRequest struct {
Sticker InputDocumentClass
Position int
}
const StickersChangeStickerPositionRequestTypeID = 0xffb6d4ca
var (
_ bin .Encoder = &StickersChangeStickerPositionRequest {}
_ bin .Decoder = &StickersChangeStickerPositionRequest {}
_ bin .BareEncoder = &StickersChangeStickerPositionRequest {}
_ bin .BareDecoder = &StickersChangeStickerPositionRequest {}
)
func (c *StickersChangeStickerPositionRequest ) Zero () bool {
if c == nil {
return true
}
if !(c .Sticker == nil ) {
return false
}
if !(c .Position == 0 ) {
return false
}
return true
}
func (c *StickersChangeStickerPositionRequest ) String () string {
if c == nil {
return "StickersChangeStickerPositionRequest(nil)"
}
type Alias StickersChangeStickerPositionRequest
return fmt .Sprintf ("StickersChangeStickerPositionRequest%+v" , Alias (*c ))
}
func (c *StickersChangeStickerPositionRequest ) FillFrom (from interface {
GetSticker () (value InputDocumentClass )
GetPosition () (value int )
}) {
c .Sticker = from .GetSticker ()
c .Position = from .GetPosition ()
}
func (*StickersChangeStickerPositionRequest ) TypeID () uint32 {
return StickersChangeStickerPositionRequestTypeID
}
func (*StickersChangeStickerPositionRequest ) TypeName () string {
return "stickers.changeStickerPosition"
}
func (c *StickersChangeStickerPositionRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "stickers.changeStickerPosition" ,
ID : StickersChangeStickerPositionRequestTypeID ,
}
if c == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Sticker" ,
SchemaName : "sticker" ,
},
{
Name : "Position" ,
SchemaName : "position" ,
},
}
return typ
}
func (c *StickersChangeStickerPositionRequest ) Encode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode stickers.changeStickerPosition#ffb6d4ca as nil" )
}
b .PutID (StickersChangeStickerPositionRequestTypeID )
return c .EncodeBare (b )
}
func (c *StickersChangeStickerPositionRequest ) EncodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode stickers.changeStickerPosition#ffb6d4ca as nil" )
}
if c .Sticker == nil {
return fmt .Errorf ("unable to encode stickers.changeStickerPosition#ffb6d4ca: field sticker is nil" )
}
if err := c .Sticker .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode stickers.changeStickerPosition#ffb6d4ca: field sticker: %w" , err )
}
b .PutInt (c .Position )
return nil
}
func (c *StickersChangeStickerPositionRequest ) Decode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode stickers.changeStickerPosition#ffb6d4ca to nil" )
}
if err := b .ConsumeID (StickersChangeStickerPositionRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode stickers.changeStickerPosition#ffb6d4ca: %w" , err )
}
return c .DecodeBare (b )
}
func (c *StickersChangeStickerPositionRequest ) DecodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode stickers.changeStickerPosition#ffb6d4ca to nil" )
}
{
value , err := DecodeInputDocument (b )
if err != nil {
return fmt .Errorf ("unable to decode stickers.changeStickerPosition#ffb6d4ca: field sticker: %w" , err )
}
c .Sticker = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode stickers.changeStickerPosition#ffb6d4ca: field position: %w" , err )
}
c .Position = value
}
return nil
}
func (c *StickersChangeStickerPositionRequest ) GetSticker () (value InputDocumentClass ) {
if c == nil {
return
}
return c .Sticker
}
func (c *StickersChangeStickerPositionRequest ) GetPosition () (value int ) {
if c == nil {
return
}
return c .Position
}
func (c *StickersChangeStickerPositionRequest ) GetStickerAsNotEmpty () (*InputDocument , bool ) {
return c .Sticker .AsNotEmpty ()
}
func (c *Client ) StickersChangeStickerPosition (ctx context .Context , request *StickersChangeStickerPositionRequest ) (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 .