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 MessagesFaveStickerRequest struct {
ID InputDocumentClass
Unfave bool
}
const MessagesFaveStickerRequestTypeID = 0xb9ffc55b
var (
_ bin .Encoder = &MessagesFaveStickerRequest {}
_ bin .Decoder = &MessagesFaveStickerRequest {}
_ bin .BareEncoder = &MessagesFaveStickerRequest {}
_ bin .BareDecoder = &MessagesFaveStickerRequest {}
)
func (f *MessagesFaveStickerRequest ) Zero () bool {
if f == nil {
return true
}
if !(f .ID == nil ) {
return false
}
if !(f .Unfave == false ) {
return false
}
return true
}
func (f *MessagesFaveStickerRequest ) String () string {
if f == nil {
return "MessagesFaveStickerRequest(nil)"
}
type Alias MessagesFaveStickerRequest
return fmt .Sprintf ("MessagesFaveStickerRequest%+v" , Alias (*f ))
}
func (f *MessagesFaveStickerRequest ) FillFrom (from interface {
GetID () (value InputDocumentClass )
GetUnfave () (value bool )
}) {
f .ID = from .GetID ()
f .Unfave = from .GetUnfave ()
}
func (*MessagesFaveStickerRequest ) TypeID () uint32 {
return MessagesFaveStickerRequestTypeID
}
func (*MessagesFaveStickerRequest ) TypeName () string {
return "messages.faveSticker"
}
func (f *MessagesFaveStickerRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.faveSticker" ,
ID : MessagesFaveStickerRequestTypeID ,
}
if f == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ID" ,
SchemaName : "id" ,
},
{
Name : "Unfave" ,
SchemaName : "unfave" ,
},
}
return typ
}
func (f *MessagesFaveStickerRequest ) Encode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode messages.faveSticker#b9ffc55b as nil" )
}
b .PutID (MessagesFaveStickerRequestTypeID )
return f .EncodeBare (b )
}
func (f *MessagesFaveStickerRequest ) EncodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode messages.faveSticker#b9ffc55b as nil" )
}
if f .ID == nil {
return fmt .Errorf ("unable to encode messages.faveSticker#b9ffc55b: field id is nil" )
}
if err := f .ID .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.faveSticker#b9ffc55b: field id: %w" , err )
}
b .PutBool (f .Unfave )
return nil
}
func (f *MessagesFaveStickerRequest ) Decode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode messages.faveSticker#b9ffc55b to nil" )
}
if err := b .ConsumeID (MessagesFaveStickerRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.faveSticker#b9ffc55b: %w" , err )
}
return f .DecodeBare (b )
}
func (f *MessagesFaveStickerRequest ) DecodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode messages.faveSticker#b9ffc55b to nil" )
}
{
value , err := DecodeInputDocument (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.faveSticker#b9ffc55b: field id: %w" , err )
}
f .ID = value
}
{
value , err := b .Bool ()
if err != nil {
return fmt .Errorf ("unable to decode messages.faveSticker#b9ffc55b: field unfave: %w" , err )
}
f .Unfave = value
}
return nil
}
func (f *MessagesFaveStickerRequest ) GetID () (value InputDocumentClass ) {
if f == nil {
return
}
return f .ID
}
func (f *MessagesFaveStickerRequest ) GetUnfave () (value bool ) {
if f == nil {
return
}
return f .Unfave
}
func (f *MessagesFaveStickerRequest ) GetIDAsNotEmpty () (*InputDocument , bool ) {
return f .ID .AsNotEmpty ()
}
func (c *Client ) MessagesFaveSticker (ctx context .Context , request *MessagesFaveStickerRequest ) (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 .