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 MessagesSaveRecentStickerRequest struct {
Flags bin .Fields
Attached bool
ID InputDocumentClass
Unsave bool
}
const MessagesSaveRecentStickerRequestTypeID = 0x392718f8
var (
_ bin .Encoder = &MessagesSaveRecentStickerRequest {}
_ bin .Decoder = &MessagesSaveRecentStickerRequest {}
_ bin .BareEncoder = &MessagesSaveRecentStickerRequest {}
_ bin .BareDecoder = &MessagesSaveRecentStickerRequest {}
)
func (s *MessagesSaveRecentStickerRequest ) Zero () bool {
if s == nil {
return true
}
if !(s .Flags .Zero ()) {
return false
}
if !(s .Attached == false ) {
return false
}
if !(s .ID == nil ) {
return false
}
if !(s .Unsave == false ) {
return false
}
return true
}
func (s *MessagesSaveRecentStickerRequest ) String () string {
if s == nil {
return "MessagesSaveRecentStickerRequest(nil)"
}
type Alias MessagesSaveRecentStickerRequest
return fmt .Sprintf ("MessagesSaveRecentStickerRequest%+v" , Alias (*s ))
}
func (s *MessagesSaveRecentStickerRequest ) FillFrom (from interface {
GetAttached () (value bool )
GetID () (value InputDocumentClass )
GetUnsave () (value bool )
}) {
s .Attached = from .GetAttached ()
s .ID = from .GetID ()
s .Unsave = from .GetUnsave ()
}
func (*MessagesSaveRecentStickerRequest ) TypeID () uint32 {
return MessagesSaveRecentStickerRequestTypeID
}
func (*MessagesSaveRecentStickerRequest ) TypeName () string {
return "messages.saveRecentSticker"
}
func (s *MessagesSaveRecentStickerRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.saveRecentSticker" ,
ID : MessagesSaveRecentStickerRequestTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Attached" ,
SchemaName : "attached" ,
Null : !s .Flags .Has (0 ),
},
{
Name : "ID" ,
SchemaName : "id" ,
},
{
Name : "Unsave" ,
SchemaName : "unsave" ,
},
}
return typ
}
func (s *MessagesSaveRecentStickerRequest ) SetFlags () {
if !(s .Attached == false ) {
s .Flags .Set (0 )
}
}
func (s *MessagesSaveRecentStickerRequest ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.saveRecentSticker#392718f8 as nil" )
}
b .PutID (MessagesSaveRecentStickerRequestTypeID )
return s .EncodeBare (b )
}
func (s *MessagesSaveRecentStickerRequest ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.saveRecentSticker#392718f8 as nil" )
}
s .SetFlags ()
if err := s .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.saveRecentSticker#392718f8: field flags: %w" , err )
}
if s .ID == nil {
return fmt .Errorf ("unable to encode messages.saveRecentSticker#392718f8: field id is nil" )
}
if err := s .ID .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.saveRecentSticker#392718f8: field id: %w" , err )
}
b .PutBool (s .Unsave )
return nil
}
func (s *MessagesSaveRecentStickerRequest ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.saveRecentSticker#392718f8 to nil" )
}
if err := b .ConsumeID (MessagesSaveRecentStickerRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.saveRecentSticker#392718f8: %w" , err )
}
return s .DecodeBare (b )
}
func (s *MessagesSaveRecentStickerRequest ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.saveRecentSticker#392718f8 to nil" )
}
{
if err := s .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode messages.saveRecentSticker#392718f8: field flags: %w" , err )
}
}
s .Attached = s .Flags .Has (0 )
{
value , err := DecodeInputDocument (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.saveRecentSticker#392718f8: field id: %w" , err )
}
s .ID = value
}
{
value , err := b .Bool ()
if err != nil {
return fmt .Errorf ("unable to decode messages.saveRecentSticker#392718f8: field unsave: %w" , err )
}
s .Unsave = value
}
return nil
}
func (s *MessagesSaveRecentStickerRequest ) SetAttached (value bool ) {
if value {
s .Flags .Set (0 )
s .Attached = true
} else {
s .Flags .Unset (0 )
s .Attached = false
}
}
func (s *MessagesSaveRecentStickerRequest ) GetAttached () (value bool ) {
if s == nil {
return
}
return s .Flags .Has (0 )
}
func (s *MessagesSaveRecentStickerRequest ) GetID () (value InputDocumentClass ) {
if s == nil {
return
}
return s .ID
}
func (s *MessagesSaveRecentStickerRequest ) GetUnsave () (value bool ) {
if s == nil {
return
}
return s .Unsave
}
func (s *MessagesSaveRecentStickerRequest ) GetIDAsNotEmpty () (*InputDocument , bool ) {
return s .ID .AsNotEmpty ()
}
func (c *Client ) MessagesSaveRecentSticker (ctx context .Context , request *MessagesSaveRecentStickerRequest ) (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 .