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 MessagesReorderStickerSetsRequest struct {
Flags bin .Fields
Masks bool
Emojis bool
Order []int64
}
const MessagesReorderStickerSetsRequestTypeID = 0x78337739
var (
_ bin .Encoder = &MessagesReorderStickerSetsRequest {}
_ bin .Decoder = &MessagesReorderStickerSetsRequest {}
_ bin .BareEncoder = &MessagesReorderStickerSetsRequest {}
_ bin .BareDecoder = &MessagesReorderStickerSetsRequest {}
)
func (r *MessagesReorderStickerSetsRequest ) Zero () bool {
if r == nil {
return true
}
if !(r .Flags .Zero ()) {
return false
}
if !(r .Masks == false ) {
return false
}
if !(r .Emojis == false ) {
return false
}
if !(r .Order == nil ) {
return false
}
return true
}
func (r *MessagesReorderStickerSetsRequest ) String () string {
if r == nil {
return "MessagesReorderStickerSetsRequest(nil)"
}
type Alias MessagesReorderStickerSetsRequest
return fmt .Sprintf ("MessagesReorderStickerSetsRequest%+v" , Alias (*r ))
}
func (r *MessagesReorderStickerSetsRequest ) FillFrom (from interface {
GetMasks () (value bool )
GetEmojis () (value bool )
GetOrder () (value []int64 )
}) {
r .Masks = from .GetMasks ()
r .Emojis = from .GetEmojis ()
r .Order = from .GetOrder ()
}
func (*MessagesReorderStickerSetsRequest ) TypeID () uint32 {
return MessagesReorderStickerSetsRequestTypeID
}
func (*MessagesReorderStickerSetsRequest ) TypeName () string {
return "messages.reorderStickerSets"
}
func (r *MessagesReorderStickerSetsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.reorderStickerSets" ,
ID : MessagesReorderStickerSetsRequestTypeID ,
}
if r == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Masks" ,
SchemaName : "masks" ,
Null : !r .Flags .Has (0 ),
},
{
Name : "Emojis" ,
SchemaName : "emojis" ,
Null : !r .Flags .Has (1 ),
},
{
Name : "Order" ,
SchemaName : "order" ,
},
}
return typ
}
func (r *MessagesReorderStickerSetsRequest ) SetFlags () {
if !(r .Masks == false ) {
r .Flags .Set (0 )
}
if !(r .Emojis == false ) {
r .Flags .Set (1 )
}
}
func (r *MessagesReorderStickerSetsRequest ) Encode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode messages.reorderStickerSets#78337739 as nil" )
}
b .PutID (MessagesReorderStickerSetsRequestTypeID )
return r .EncodeBare (b )
}
func (r *MessagesReorderStickerSetsRequest ) EncodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode messages.reorderStickerSets#78337739 as nil" )
}
r .SetFlags ()
if err := r .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.reorderStickerSets#78337739: field flags: %w" , err )
}
b .PutVectorHeader (len (r .Order ))
for _ , v := range r .Order {
b .PutLong (v )
}
return nil
}
func (r *MessagesReorderStickerSetsRequest ) Decode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode messages.reorderStickerSets#78337739 to nil" )
}
if err := b .ConsumeID (MessagesReorderStickerSetsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.reorderStickerSets#78337739: %w" , err )
}
return r .DecodeBare (b )
}
func (r *MessagesReorderStickerSetsRequest ) DecodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode messages.reorderStickerSets#78337739 to nil" )
}
{
if err := r .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode messages.reorderStickerSets#78337739: field flags: %w" , err )
}
}
r .Masks = r .Flags .Has (0 )
r .Emojis = r .Flags .Has (1 )
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode messages.reorderStickerSets#78337739: field order: %w" , err )
}
if headerLen > 0 {
r .Order = make ([]int64 , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode messages.reorderStickerSets#78337739: field order: %w" , err )
}
r .Order = append (r .Order , value )
}
}
return nil
}
func (r *MessagesReorderStickerSetsRequest ) SetMasks (value bool ) {
if value {
r .Flags .Set (0 )
r .Masks = true
} else {
r .Flags .Unset (0 )
r .Masks = false
}
}
func (r *MessagesReorderStickerSetsRequest ) GetMasks () (value bool ) {
if r == nil {
return
}
return r .Flags .Has (0 )
}
func (r *MessagesReorderStickerSetsRequest ) SetEmojis (value bool ) {
if value {
r .Flags .Set (1 )
r .Emojis = true
} else {
r .Flags .Unset (1 )
r .Emojis = false
}
}
func (r *MessagesReorderStickerSetsRequest ) GetEmojis () (value bool ) {
if r == nil {
return
}
return r .Flags .Has (1 )
}
func (r *MessagesReorderStickerSetsRequest ) GetOrder () (value []int64 ) {
if r == nil {
return
}
return r .Order
}
func (c *Client ) MessagesReorderStickerSets (ctx context .Context , request *MessagesReorderStickerSetsRequest ) (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 .